[Mesa-dev] [PATCH] glcpp: Disallow "defined" as a macro name.

Kenneth Graunke kenneth at whitecape.org
Thu Feb 18 01:19:50 UTC 2016


Both GCC and Clang disallow this, and glslang has recently started
disallowing it as well.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94188
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/compiler/glsl/glcpp/glcpp-parse.y | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y b/src/compiler/glsl/glcpp/glcpp-parse.y
index 43a1aa9..70951a0 100644
--- a/src/compiler/glsl/glcpp/glcpp-parse.y
+++ b/src/compiler/glsl/glcpp/glcpp-parse.y
@@ -2096,6 +2096,9 @@ _check_for_reserved_macro_name (glcpp_parser_t *parser, YYLTYPE *loc,
 	if (strncmp(identifier, "GL_", 3) == 0) {
 		glcpp_error (loc, parser, "Macro names starting with \"GL_\" are reserved.\n");
 	}
+	if (strcmp(identifier, "defined") == 0) {
+		glcpp_error (loc, parser, "\"defined\" cannot be used as a macro name");
+	}
 }
 
 static int
-- 
2.7.1



More information about the mesa-dev mailing list