diff options
author | Anuj Phogat <[email protected]> | 2014-06-06 16:56:58 -0700 |
---|---|---|
committer | Carl Worth <[email protected]> | 2014-07-09 12:05:13 -0700 |
commit | 64b7fc2dd16cd4a4966a4ed8e9f239c53715f1d5 (patch) | |
tree | 9879696ba0c258ea12583bf7f9f75ea8a28d8036 | |
parent | 378fa34c7b8ea29672deea7563c552a8e2742809 (diff) |
glsl/glcpp: Do not allow undefining the built-in macros
Fixes piglit tests in spec/glsl-es-3.00/compile:
undef-__FILE__.vert
undef-GL_ES.vert
undef-__LINE__.vert
undef-__VERSION__.vert
Also, fixes Khronos GLES3 CTS tests:
undefine_invalid_object_1_vertex
undefine_invalid_object_1_fragment
undefine_invalid_object_2_vertex
undefine_invalid_object_2_fragment
Signed-off-by: Anuj Phogat <[email protected]>
Reviewed-by: Carl Worth <[email protected]>
-rw-r--r-- | src/glsl/glcpp/glcpp-parse.y | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index ccf8105597b..9d8b5bbb0b6 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -260,6 +260,12 @@ control_line: | HASH_UNDEF { glcpp_parser_resolve_implicit_version(parser); } IDENTIFIER NEWLINE { + if (strcmp("__LINE__", $3) == 0 + || strcmp("__FILE__", $3) == 0 + || strcmp("__VERSION__", $3) == 0) + glcpp_error(& @1, parser, "Built-in (pre-defined)" + " macro names can not be undefined."); + macro_t *macro = hash_table_find (parser->defines, $3); if (macro) { hash_table_remove (parser->defines, $3); |