glcpp: Make undefined macros illegal in #if and #elif for GLES3

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>
This commit is contained in:
Carl Worth
2012-11-26 15:00:05 -08:00
committed by Ian Romanick
parent 77e1bc9f1d
commit 93e719ba4d

View 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 {