glcpp: Raise error if defining any macro containing two consecutive underscores
The specification reserves any macro name containing two consecutive underscores, (anywhere within the name). Previously, we only raised this error for macro names that started with two underscores. Fix the implementation to check for two underscores anywhere, and also update the corresponding 086-reserved-macro-names test. This also fixes the following two piglit tests: spec/glsl-1.30/preprocessor/reserved/double-underscore-02.frag spec/glsl-1.30/preprocessor/reserved/double-underscore-03.frag Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Carl Worth <cworth@cworth.org>
This commit is contained in:
parent
28842c2331
commit
c4aaf7943c
3 changed files with 7 additions and 3 deletions
|
|
@ -1663,8 +1663,8 @@ _check_for_reserved_macro_name (glcpp_parser_t *parser, YYLTYPE *loc,
|
|||
/* According to the GLSL specification, macro names starting with "__"
|
||||
* or "GL_" are reserved for future use. So, don't allow them.
|
||||
*/
|
||||
if (strncmp(identifier, "__", 2) == 0) {
|
||||
glcpp_error (loc, parser, "Macro names starting with \"__\" are reserved.\n");
|
||||
if (strstr(identifier, "__")) {
|
||||
glcpp_error (loc, parser, "Macro names containing \"__\" are reserved.\n");
|
||||
}
|
||||
if (strncmp(identifier, "GL_", 3) == 0) {
|
||||
glcpp_error (loc, parser, "Macro names starting with \"GL_\" are reserved.\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue