glcpp: Disallow undefining GL_* builtin macros.
authorChris Forbes <chrisf@ijw.co.nz>
Sat, 29 Nov 2014 20:54:59 +0000 (09:54 +1300)
committerChris Forbes <chrisf@ijw.co.nz>
Sat, 6 Dec 2014 22:47:45 +0000 (11:47 +1300)
Fixes the piglit test: spec/glsl-es-3.00/compiler/undef-GL_ES.vert

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/glcpp/glcpp-parse.y

index f1119eb805ad4b5f95f6973e6efcb31a25bd150d..287792439b5eb235e211d4057be559e122818db3 100644 (file)
@@ -290,7 +290,8 @@ control_line_success:
                macro_t *macro;
                if (strcmp("__LINE__", $4) == 0
                    || strcmp("__FILE__", $4) == 0
-                   || strcmp("__VERSION__", $4) == 0)
+                   || strcmp("__VERSION__", $4) == 0
+                   || strncmp("GL_", $4, 3) == 0)
                        glcpp_error(& @1, parser, "Built-in (pre-defined)"
                                    " macro names can not be undefined.");