glcpp: Make undefined macros illegal in #if and #elif for GLES3
authorCarl Worth <cworth@cworth.org>
Mon, 26 Nov 2012 23:00:05 +0000 (15:00 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 11 Jan 2013 18:57:25 +0000 (10:57 -0800)
Simply emitting a nicely-formatted error message if any undefined macro is
encountered in a parser context expecting an expression.

With this commit, the following piglit test now passes:

spec/glsl-es-3.00/compiler/undefined-macro.vert

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/glcpp/glcpp-parse.y

index 76dcd42290cd63be995fbf30a81d19bb44cfe008..8fba923a2cb77c5f92bcf37e01882ee84b0033da 100644 (file)
@@ -363,6 +363,8 @@ integer_constant:
 expression:
        integer_constant
 |      IDENTIFIER {
+               if (parser->is_gles)
+                       glcpp_error(& @1, parser, "undefined macro %s in expression (illegal in GLES)", $1);
                $$ = 0;
        }
 |      expression OR expression {