[Mesa-dev] [PATCH 2/2] glcpp: Make undefined macros illegal in #if and #elif for GLES3

Carl Worth cworth at cworth.org
Mon Nov 26 15:12:37 PST 2012


Simply emitting a nicely-formatted error message if any undefined macro is
encoutnered in a parser context expecting an expression.
---
 src/glsl/glcpp/glcpp-parse.y |    2 ++
 1 file changed, 2 insertions(+)

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



More information about the mesa-dev mailing list