Store warnings and errors in a parser state infolog.
authorEric Anholt <eric@anholt.net>
Fri, 30 Apr 2010 01:00:33 +0000 (18:00 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 3 May 2010 18:40:26 +0000 (11:40 -0700)
Cleans up compile warning about unused state in _mesa_glsl_warning.  We
would want infolog handling roughly like this anyway.

glsl_parser_extras.cpp
glsl_parser_extras.h

index 4183d13..88767af 100644 (file)
@@ -73,11 +73,15 @@ _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state,
    va_end(ap);
 
    printf("%s\n", buf);
+
+   if (state->info_log)
+      free(state->info_log);
+   state->info_log = strdup(buf);
 }
 
 
 void
-_mesa_glsl_warning(const YYLTYPE *locp, const _mesa_glsl_parse_state *state,
+_mesa_glsl_warning(const YYLTYPE *locp, _mesa_glsl_parse_state *state,
                   const char *fmt, ...)
 {
    char buf[1024];
@@ -92,6 +96,10 @@ _mesa_glsl_warning(const YYLTYPE *locp, const _mesa_glsl_parse_state *state,
    va_end(ap);
 
    printf("%s\n", buf);
+
+   if (!state->info_log) {
+      state->info_log = strdup(buf);
+   }
 }
 
 
index 125c675..b06b3fe 100644 (file)
@@ -65,6 +65,8 @@ struct _mesa_glsl_parse_state {
    const glsl_type **user_structures;
    unsigned num_user_structures;
 
+   char *info_log;
+
    /**
     * \name Enable bits for GLSL extensions
     */
@@ -95,7 +97,7 @@ extern void _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state,
  * \sa _mesa_glsl_error
  */
 extern void _mesa_glsl_warning(const YYLTYPE *locp,
-                              const _mesa_glsl_parse_state *state,
+                              _mesa_glsl_parse_state *state,
                               const char *fmt, ...);
 
 extern void _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state,