On 30/07/14 03:42, Kenneth Graunke wrote:
On Tuesday, July 29, 2014 05:02:39 PM Brian Paul wrote:
ERROR is a #define in the MSVC WinGDI.h header file.
Add the _TOKEN suffix as we do for a few other lexer tokens.
Brian, sorry I missed your review and ended up duplicating it byte per
byte! Obviously it looks fine to me.
How about ERROR_TOK? That's what we use in the main compiler.
Kenneth, I also think it is worth to have some unique prefix/suffix on
all tokens, to prevent this sort of collisions and make the code more
consistent. But I believe that if/what prefix/suffix to use is
something that glsl maintainers need to discuss and figure out among
themselves. In the meanwhile, we just need to fix the build somehow.
And _TOKEN is at least consistent with some of other existing tokens FWIW.
Jose
Either way,
Reviewed-by: Kenneth Graunke <kenn...@whitecape.org>
---
src/glsl/glcpp/glcpp-lex.l | 2 +-
src/glsl/glcpp/glcpp-parse.y | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index 4b9ab23..c126850 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -350,7 +350,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
<HASH>error.* {
BEGIN INITIAL;
- RETURN_STRING_TOKEN (ERROR);
+ RETURN_STRING_TOKEN (ERROR_TOKEN);
}
/* After we see a "#define" we enter the <DEFINE> start state
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index bc873cd..4ee4110 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -171,11 +171,11 @@ add_builtin_define(glcpp_parser_t *parser, const char
*name, int value);
/* We use HASH_TOKEN, DEFINE_TOKEN and VERSION_TOKEN (as opposed to
* HASH, DEFINE, and VERSION) to avoid conflicts with other symbols,
* (such as the <HASH> and <DEFINE> start conditions in the lexer). */
-%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH_TOKEN DEFINE_TOKEN
FUNC_IDENTIFIER OBJ_IDENTIFIER ELIF ELSE ENDIF ERROR IF IFDEF IFNDEF LINE
PRAGMA UNDEF VERSION_TOKEN GARBAGE IDENTIFIER IF_EXPANDED INTEGER
INTEGER_STRING LINE_EXPANDED NEWLINE OTHER PLACEHOLDER SPACE PLUS_PLUS
MINUS_MINUS
+%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH_TOKEN DEFINE_TOKEN
FUNC_IDENTIFIER OBJ_IDENTIFIER ELIF ELSE ENDIF ERROR_TOKEN IF IFDEF IFNDEF LINE
PRAGMA UNDEF VERSION_TOKEN GARBAGE IDENTIFIER IF_EXPANDED INTEGER
INTEGER_STRING LINE_EXPANDED NEWLINE OTHER PLACEHOLDER SPACE PLUS_PLUS
MINUS_MINUS
%token PASTE
%type <ival> INTEGER operator SPACE integer_constant
%type <expression_value> expression
-%type <str> IDENTIFIER FUNC_IDENTIFIER OBJ_IDENTIFIER INTEGER_STRING OTHER
ERROR PRAGMA
+%type <str> IDENTIFIER FUNC_IDENTIFIER OBJ_IDENTIFIER INTEGER_STRING OTHER
ERROR_TOKEN PRAGMA
%type <string_list> identifier_list
%type <token> preprocessing_token conditional_token
%type <token_list> pp_tokens replacement_list text_line conditional_tokens
@@ -421,7 +421,7 @@ control_line_success:
;
control_line_error:
- HASH_TOKEN ERROR NEWLINE {
+ HASH_TOKEN ERROR_TOKEN NEWLINE {
glcpp_error(& @1, parser, "#%s", $2);
}
| HASH_TOKEN GARBAGE pp_tokens NEWLINE {
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=NMr9uy2iTjWVixC0wOcYCWEIYhfo80qKwRgdodpoDzA%3D%0A&m=unZdw6Fem4fe10DP3h0mE612BC%2BXp0BkVTLSl62H0LA%3D%0A&s=12ec183a15bb542d696763fb9395b5fc1d4deda69b5a4e2e6dd92dbc6304defc
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev