Mesa (gles3): glcpp: Make undefined macros illegal in #if and #elif for GLES3

Carl Worth cworth at kemper.freedesktop.org
Tue Nov 27 21:26:23 UTC 2012


Module: Mesa
Branch: gles3
Commit: d91b972bae12b32290049c9f1dc6591841e00a5a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d91b972bae12b32290049c9f1dc6591841e00a5a

Author: Carl Worth <cworth at cworth.org>
Date:   Mon Nov 26 15:00:05 2012 -0800

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 at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/glsl/glcpp/glcpp-parse.y |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 258eb6e..bdf7e17 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -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 {




More information about the mesa-commit mailing list