Disallow passing NULL for state to _mesa_glsl_error
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 23 Mar 2010 20:21:19 +0000 (13:21 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 23 Mar 2010 20:21:19 +0000 (13:21 -0700)
The two places that were still passing NULL had a state pointer to
pass.  Not passing it in these places prevented termination of
compilation of erroneous programs.

ast_to_hir.cpp
glsl_parser_extras.cpp

index b4a3d05..563cb92 100644 (file)
@@ -650,7 +650,7 @@ ast_expression::hir(exec_list *instructions,
       if (var != NULL) {
         type = result->type;
       } else {
-        _mesa_glsl_error(& loc, NULL, "`%s' undeclared",
+        _mesa_glsl_error(& loc, state, "`%s' undeclared",
                          this->primary_expression.identifier);
 
         error_emitted = true;
@@ -704,7 +704,7 @@ ast_expression::hir(exec_list *instructions,
    }
 
    if (is_error_type(type) && !error_emitted)
-      _mesa_glsl_error(& loc, NULL, "type mismatch");
+      _mesa_glsl_error(& loc, state, "type mismatch");
 
    return result;
 }
index 3a2038a..b774d8b 100644 (file)
@@ -44,8 +44,7 @@ _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state,
    int len;
    va_list ap;
 
-   if (state)
-      state->error = true;
+   state->error = true;
 
    len = snprintf(buf, sizeof(buf), "%u:%u(%u): error: ",
                  locp->source, locp->first_line, locp->first_column);