From: Ian Romanick Date: Fri, 13 Aug 2010 16:23:54 +0000 (-0700) Subject: glsl2: Avoid token name collisions with names used by Windows header files X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5c77efc0b28dceaa2420b900822f475422a378d1;p=mesa.git glsl2: Avoid token name collisions with names used by Windows header files --- diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index a96078e481a..3128cdd3a78 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -128,9 +128,9 @@ HASH ^{SPC}#{SPC} attribute return ATTRIBUTE; const return CONST_TOK; -bool return BOOL; -float return FLOAT; -int return INT; +bool return BOOL_TOK; +float return FLOAT_TOK; +int return INT_TOK; break return BREAK; continue return CONTINUE; @@ -164,9 +164,9 @@ mat4x2 TOKEN_OR_IDENTIFIER(120, MAT4X2); mat4x3 TOKEN_OR_IDENTIFIER(120, MAT4X3); mat4x4 TOKEN_OR_IDENTIFIER(120, MAT4X4); -in return IN; -out return OUT; -inout return INOUT; +in return IN_TOK; +out return OUT_TOK; +inout return INOUT_TOK; uniform return UNIFORM; varying return VARYING; centroid TOKEN_OR_IDENTIFIER(120, CENTROID); @@ -184,7 +184,7 @@ sampler1DShadow return SAMPLER1DSHADOW; sampler2DShadow return SAMPLER2DSHADOW; struct return STRUCT; -void return VOID; +void return VOID_TOK; layout { if ((yyextra->language_version >= 140) @@ -269,7 +269,7 @@ enum RESERVED_WORD(999, ENUM); typedef RESERVED_WORD(999, TYPEDEF); template RESERVED_WORD(999, TEMPLATE); this RESERVED_WORD(999, THIS); -packed RESERVED_WORD(999, PACKED); +packed RESERVED_WORD(999, PACKED_TOK); goto RESERVED_WORD(999, GOTO); switch RESERVED_WORD(130, SWITCH); default RESERVED_WORD(130, DEFAULT); @@ -281,13 +281,13 @@ static RESERVED_WORD(999, STATIC); extern RESERVED_WORD(999, EXTERN); external RESERVED_WORD(999, EXTERNAL); interface RESERVED_WORD(999, INTERFACE); -long RESERVED_WORD(999, LONG); -short RESERVED_WORD(999, SHORT); -double RESERVED_WORD(999, DOUBLE); +long RESERVED_WORD(999, LONG_TOK); +short RESERVED_WORD(999, SHORT_TOK); +double RESERVED_WORD(999, DOUBLE_TOK); half RESERVED_WORD(999, HALF); -fixed RESERVED_WORD(999, FIXED); +fixed RESERVED_WORD(999, FIXED_TOK); unsigned RESERVED_WORD(999, UNSIGNED); -input RESERVED_WORD(999, INPUT); +input RESERVED_WORD(999, INPUT_TOK); output RESERVED_WORD(999, OUTPUT); hvec2 RESERVED_WORD(999, HVEC2); hvec3 RESERVED_WORD(999, HVEC3); diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 30c43d24749..1ee6da1d23a 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -77,10 +77,10 @@ } for_rest_statement; } -%token ATTRIBUTE CONST_TOK BOOL FLOAT INT UINT +%token ATTRIBUTE CONST_TOK BOOL_TOK FLOAT_TOK INT_TOK UINT_TOK %token BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT %token BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 UVEC2 UVEC3 UVEC4 VEC2 VEC3 VEC4 -%token CENTROID IN OUT INOUT UNIFORM VARYING +%token CENTROID IN_TOK OUT_TOK INOUT_TOK UNIFORM VARYING %token NOPERSPECTIVE FLAT SMOOTH %token MAT2X2 MAT2X3 MAT2X4 %token MAT3X2 MAT3X3 MAT3X4 @@ -90,7 +90,7 @@ %token SAMPLER2DARRAYSHADOW ISAMPLER1D ISAMPLER2D ISAMPLER3D ISAMPLERCUBE %token ISAMPLER1DARRAY ISAMPLER2DARRAY USAMPLER1D USAMPLER2D USAMPLER3D %token USAMPLERCUBE USAMPLER1DARRAY USAMPLER2DARRAY -%token STRUCT VOID WHILE +%token STRUCT VOID_TOK WHILE %token IDENTIFIER %token FLOATCONSTANT %token INTCONSTANT UINTCONSTANT BOOLCONSTANT @@ -108,9 +108,9 @@ /* Reserved words that are not actually used in the grammar. */ -%token ASM CLASS UNION ENUM TYPEDEF TEMPLATE THIS PACKED GOTO +%token ASM CLASS UNION ENUM TYPEDEF TEMPLATE THIS PACKED_TOK GOTO %token INLINE_TOK NOINLINE VOLATILE PUBLIC_TOK STATIC EXTERN EXTERNAL -%token LONG SHORT DOUBLE HALF FIXED UNSIGNED INPUT OUPTUT +%token LONG_TOK SHORT_TOK DOUBLE_TOK HALF FIXED_TOK UNSIGNED INPUT_TOK OUPTUT %token HVEC2 HVEC3 HVEC4 DVEC2 DVEC3 DVEC4 FVEC2 FVEC3 FVEC4 %token SAMPLER2DRECT SAMPLER3DRECT SAMPLER2DRECTSHADOW %token SIZEOF CAST NAMESPACE USING @@ -370,7 +370,7 @@ function_call_generic: ; function_call_header_no_parameters: - function_call_header VOID + function_call_header VOID_TOK | function_call_header ; @@ -783,9 +783,9 @@ parameter_declaration: parameter_qualifier: /* empty */ { $$.i = 0; } - | IN { $$.i = 0; $$.q.in = 1; } - | OUT { $$.i = 0; $$.q.out = 1; } - | INOUT { $$.i = 0; $$.q.in = 1; $$.q.out = 1; } + | IN_TOK { $$.i = 0; $$.q.in = 1; } + | OUT_TOK { $$.i = 0; $$.q.out = 1; } + | INOUT_TOK { $$.i = 0; $$.q.in = 1; $$.q.out = 1; } ; parameter_type_specifier: @@ -1030,10 +1030,10 @@ storage_qualifier: | ATTRIBUTE { $$.i = 0; $$.q.attribute = 1; } | opt_layout_qualifier VARYING { $$.i = $1.i; $$.q.varying = 1; } | CENTROID VARYING { $$.i = 0; $$.q.centroid = 1; $$.q.varying = 1; } - | opt_layout_qualifier IN { $$.i = 0; $$.q.in = 1; } - | OUT { $$.i = 0; $$.q.out = 1; } - | CENTROID IN { $$.i = 0; $$.q.centroid = 1; $$.q.in = 1; } - | CENTROID OUT { $$.i = 0; $$.q.centroid = 1; $$.q.out = 1; } + | opt_layout_qualifier IN_TOK { $$.i = 0; $$.q.in = 1; } + | OUT_TOK { $$.i = 0; $$.q.out = 1; } + | CENTROID IN_TOK { $$.i = 0; $$.q.centroid = 1; $$.q.in = 1; } + | CENTROID OUT_TOK { $$.i = 0; $$.q.centroid = 1; $$.q.out = 1; } | UNIFORM { $$.i = 0; $$.q.uniform = 1; } ; @@ -1084,11 +1084,11 @@ type_specifier_nonarray: ; basic_type_specifier_nonarray: - VOID { $$ = ast_void; } - | FLOAT { $$ = ast_float; } - | INT { $$ = ast_int; } - | UINT { $$ = ast_uint; } - | BOOL { $$ = ast_bool; } + VOID_TOK { $$ = ast_void; } + | FLOAT_TOK { $$ = ast_float; } + | INT_TOK { $$ = ast_int; } + | UINT_TOK { $$ = ast_uint; } + | BOOL_TOK { $$ = ast_bool; } | VEC2 { $$ = ast_vec2; } | VEC3 { $$ = ast_vec3; } | VEC4 { $$ = ast_vec4; }