diff options
author | marha <marha@users.sourceforge.net> | 2014-03-09 21:32:55 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-03-09 21:32:55 +0100 |
commit | 3dd4b6420f686b0147d5b8136268cc63196e253b (patch) | |
tree | 2c81c3f7503dbcfb5b64fd95b40bb1c2204598ef /mesalib/src/glsl | |
parent | 321c01267ae1c446f1bd22b642567fcafa016c02 (diff) | |
download | vcxsrv-3dd4b6420f686b0147d5b8136268cc63196e253b.tar.gz vcxsrv-3dd4b6420f686b0147d5b8136268cc63196e253b.tar.bz2 vcxsrv-3dd4b6420f686b0147d5b8136268cc63196e253b.zip |
fontconfig mesa xserver git update 9 Mar 2014
xserver commit 1c61d38528a573caadee2468ee59ea558c822e09
fontconfig commit f8ccf379eb1092592ae0b65deb563c5491f69de9
mesa commit 897f40f25d21af678b1b67c1a68c4a6722d19983
Diffstat (limited to 'mesalib/src/glsl')
-rw-r--r-- | mesalib/src/glsl/ast.h | 36 | ||||
-rw-r--r-- | mesalib/src/glsl/glcpp/glcpp-lex.l | 5 | ||||
-rw-r--r-- | mesalib/src/glsl/glsl_lexer.ll | 3 | ||||
-rw-r--r-- | mesalib/src/glsl/glsl_parser.yy | 215 | ||||
-rw-r--r-- | mesalib/src/glsl/glsl_parser_extras.cpp | 6 | ||||
-rw-r--r-- | mesalib/src/glsl/link_uniforms.cpp | 3 |
6 files changed, 152 insertions, 116 deletions
diff --git a/mesalib/src/glsl/ast.h b/mesalib/src/glsl/ast.h index 1efb30679..ae70b003c 100644 --- a/mesalib/src/glsl/ast.h +++ b/mesalib/src/glsl/ast.h @@ -75,10 +75,10 @@ public: struct YYLTYPE locp; locp.source = this->location.source; - locp.first_line = this->location.line; - locp.first_column = this->location.column; - locp.last_line = locp.first_line; - locp.last_column = locp.first_column; + locp.first_line = this->location.first_line; + locp.first_column = this->location.first_column; + locp.last_line = this->location.last_line; + locp.last_column = this->location.last_column; return locp; } @@ -91,17 +91,35 @@ public: void set_location(const struct YYLTYPE &locp) { this->location.source = locp.source; - this->location.line = locp.first_line; - this->location.column = locp.first_column; + this->location.first_line = locp.first_line; + this->location.first_column = locp.first_column; + this->location.last_line = locp.last_line; + this->location.last_column = locp.last_column; + } + + /** + * Set the source location range of an AST node using two location nodes + * + * \sa ast_node::set_location + */ + void set_location_range(const struct YYLTYPE &begin, const struct YYLTYPE &end) + { + this->location.source = begin.source; + this->location.first_line = begin.first_line; + this->location.last_line = end.last_line; + this->location.first_column = begin.first_column; + this->location.last_column = end.last_column; } /** * Source location of the AST node. */ struct { - unsigned source; /**< GLSL source number. */ - unsigned line; /**< Line number within the source string. */ - unsigned column; /**< Column in the line. */ + unsigned source; /**< GLSL source number. */ + unsigned first_line; /**< First line number within the source string. */ + unsigned first_column; /**< First column in the first line. */ + unsigned last_line; /**< Last line number within the source string. */ + unsigned last_column; /**< Last column in the last line. */ } location; exec_node link; diff --git a/mesalib/src/glsl/glcpp/glcpp-lex.l b/mesalib/src/glsl/glcpp/glcpp-lex.l index ea3b862e4..188e45466 100644 --- a/mesalib/src/glsl/glcpp/glcpp-lex.l +++ b/mesalib/src/glsl/glcpp/glcpp-lex.l @@ -47,8 +47,9 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); if (parser->has_new_source_number) \ yylloc->source = parser->new_source_number; \ yylloc->first_column = yycolumn + 1; \ - yylloc->first_line = yylineno; \ + yylloc->first_line = yylloc->last_line = yylineno; \ yycolumn += yyleng; \ + yylloc->last_column = yycolumn + 1; \ parser->has_new_line_number = 0; \ parser->has_new_source_number = 0; \ } while(0); @@ -337,7 +338,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? return OTHER; } -{HSPACE}+ { +{HSPACE} { if (yyextra->space_tokens) { return SPACE; } diff --git a/mesalib/src/glsl/glsl_lexer.ll b/mesalib/src/glsl/glsl_lexer.ll index 9fd9b80d3..760235127 100644 --- a/mesalib/src/glsl/glsl_lexer.ll +++ b/mesalib/src/glsl/glsl_lexer.ll @@ -38,8 +38,9 @@ static int classify_identifier(struct _mesa_glsl_parse_state *, const char *); do { \ yylloc->source = 0; \ yylloc->first_column = yycolumn + 1; \ - yylloc->first_line = yylineno + 1; \ + yylloc->first_line = yylloc->last_line = yylineno + 1; \ yycolumn += yyleng; \ + yylloc->last_column = yycolumn + 1; \ } while(0); #define YY_USER_INIT yylineno = 0; yycolumn = 0; diff --git a/mesalib/src/glsl/glsl_parser.yy b/mesalib/src/glsl/glsl_parser.yy index 1df572254..faaf4388c 100644 --- a/mesalib/src/glsl/glsl_parser.yy +++ b/mesalib/src/glsl/glsl_parser.yy @@ -388,35 +388,35 @@ primary_expression: { void *ctx = state; $$ = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL); - $$->set_location(yylloc); + $$->set_location(@1); $$->primary_expression.identifier = $1; } | INTCONSTANT { void *ctx = state; $$ = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL); - $$->set_location(yylloc); + $$->set_location(@1); $$->primary_expression.int_constant = $1; } | UINTCONSTANT { void *ctx = state; $$ = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL); - $$->set_location(yylloc); + $$->set_location(@1); $$->primary_expression.uint_constant = $1; } | FLOATCONSTANT { void *ctx = state; $$ = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL); - $$->set_location(yylloc); + $$->set_location(@1); $$->primary_expression.float_constant = $1; } | BOOLCONSTANT { void *ctx = state; $$ = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL); - $$->set_location(yylloc); + $$->set_location(@1); $$->primary_expression.bool_constant = $1; } | '(' expression ')' @@ -431,7 +431,7 @@ postfix_expression: { void *ctx = state; $$ = new(ctx) ast_expression(ast_array_index, $1, $3, NULL); - $$->set_location(yylloc); + $$->set_location_range(@1, @4); } | function_call { @@ -441,20 +441,20 @@ postfix_expression: { void *ctx = state; $$ = new(ctx) ast_expression(ast_field_selection, $1, NULL, NULL); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); $$->primary_expression.identifier = $3; } | postfix_expression INC_OP { void *ctx = state; $$ = new(ctx) ast_expression(ast_post_inc, $1, NULL, NULL); - $$->set_location(yylloc); + $$->set_location_range(@1, @2); } | postfix_expression DEC_OP { void *ctx = state; $$ = new(ctx) ast_expression(ast_post_dec, $1, NULL, NULL); - $$->set_location(yylloc); + $$->set_location_range(@1, @2); } ; @@ -472,7 +472,7 @@ function_call_or_method: { void *ctx = state; $$ = new(ctx) ast_expression(ast_field_selection, $1, $3, NULL); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } ; @@ -490,13 +490,13 @@ function_call_header_with_parameters: function_call_header assignment_expression { $$ = $1; - $$->set_location(yylloc); + $$->set_location(@1); $$->expressions.push_tail(& $2->link); } | function_call_header_with_parameters ',' assignment_expression { $$ = $1; - $$->set_location(yylloc); + $$->set_location(@1); $$->expressions.push_tail(& $3->link); } ; @@ -513,21 +513,23 @@ function_identifier: { void *ctx = state; $$ = new(ctx) ast_function_expression($1); - $$->set_location(yylloc); + $$->set_location(@1); } | variable_identifier { void *ctx = state; ast_expression *callee = new(ctx) ast_expression($1); + callee->set_location(@1); $$ = new(ctx) ast_function_expression(callee); - $$->set_location(yylloc); + $$->set_location(@1); } | FIELD_SELECTION { void *ctx = state; ast_expression *callee = new(ctx) ast_expression($1); + callee->set_location(@1); $$ = new(ctx) ast_function_expression(callee); - $$->set_location(yylloc); + $$->set_location(@1); } ; @@ -545,13 +547,13 @@ method_call_header_with_parameters: method_call_header assignment_expression { $$ = $1; - $$->set_location(yylloc); + $$->set_location(@1); $$->expressions.push_tail(& $2->link); } | method_call_header_with_parameters ',' assignment_expression { $$ = $1; - $$->set_location(yylloc); + $$->set_location(@1); $$->expressions.push_tail(& $3->link); } ; @@ -564,8 +566,9 @@ method_call_header: { void *ctx = state; ast_expression *callee = new(ctx) ast_expression($1); + callee->set_location(@1); $$ = new(ctx) ast_function_expression(callee); - $$->set_location(yylloc); + $$->set_location(@1); } ; @@ -576,19 +579,19 @@ unary_expression: { void *ctx = state; $$ = new(ctx) ast_expression(ast_pre_inc, $2, NULL, NULL); - $$->set_location(yylloc); + $$->set_location(@1); } | DEC_OP unary_expression { void *ctx = state; $$ = new(ctx) ast_expression(ast_pre_dec, $2, NULL, NULL); - $$->set_location(yylloc); + $$->set_location(@1); } | unary_operator unary_expression { void *ctx = state; $$ = new(ctx) ast_expression($1, $2, NULL, NULL); - $$->set_location(yylloc); + $$->set_location_range(@1, @2); } ; @@ -606,19 +609,19 @@ multiplicative_expression: { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_mul, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } | multiplicative_expression '/' unary_expression { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_div, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } | multiplicative_expression '%' unary_expression { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_mod, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } ; @@ -628,13 +631,13 @@ additive_expression: { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_add, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } | additive_expression '-' multiplicative_expression { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_sub, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } ; @@ -644,13 +647,13 @@ shift_expression: { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_lshift, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } | shift_expression RIGHT_OP additive_expression { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_rshift, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } ; @@ -660,25 +663,25 @@ relational_expression: { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_less, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } | relational_expression '>' shift_expression { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_greater, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } | relational_expression LE_OP shift_expression { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_lequal, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } | relational_expression GE_OP shift_expression { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_gequal, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } ; @@ -688,13 +691,13 @@ equality_expression: { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_equal, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } | equality_expression NE_OP relational_expression { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_nequal, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } ; @@ -704,7 +707,7 @@ and_expression: { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_bit_and, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } ; @@ -714,7 +717,7 @@ exclusive_or_expression: { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_bit_xor, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } ; @@ -724,7 +727,7 @@ inclusive_or_expression: { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_bit_or, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } ; @@ -734,7 +737,7 @@ logical_and_expression: { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_logic_and, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } ; @@ -744,7 +747,7 @@ logical_xor_expression: { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_logic_xor, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } ; @@ -754,7 +757,7 @@ logical_or_expression: { void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_logic_or, $1, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } ; @@ -764,7 +767,7 @@ conditional_expression: { void *ctx = state; $$ = new(ctx) ast_expression(ast_conditional, $1, $3, $5); - $$->set_location(yylloc); + $$->set_location_range(@1, @5); } ; @@ -774,7 +777,7 @@ assignment_expression: { void *ctx = state; $$ = new(ctx) ast_expression($2, $1, $3, NULL); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } ; @@ -802,7 +805,7 @@ expression: void *ctx = state; if ($1->oper != ast_sequence) { $$ = new(ctx) ast_expression(ast_sequence, NULL, NULL, NULL); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); $$->expressions.push_tail(& $1->link); } else { $$ = $1; @@ -864,7 +867,7 @@ function_header: { void *ctx = state; $$ = new(ctx) ast_function(); - $$->set_location(yylloc); + $$->set_location(@2); $$->return_type = $1; $$->identifier = $2; @@ -878,9 +881,9 @@ parameter_declarator: { void *ctx = state; $$ = new(ctx) ast_parameter_declarator(); - $$->set_location(yylloc); + $$->set_location_range(@1, @2); $$->type = new(ctx) ast_fully_specified_type(); - $$->type->set_location(yylloc); + $$->type->set_location(@1); $$->type->specifier = $1; $$->identifier = $2; } @@ -888,9 +891,9 @@ parameter_declarator: { void *ctx = state; $$ = new(ctx) ast_parameter_declarator(); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); $$->type = new(ctx) ast_fully_specified_type(); - $$->type->set_location(yylloc); + $$->type->set_location(@1); $$->type->specifier = $1; $$->identifier = $2; $$->array_specifier = $3; @@ -907,8 +910,9 @@ parameter_declaration: { void *ctx = state; $$ = new(ctx) ast_parameter_declarator(); - $$->set_location(yylloc); + $$->set_location(@2); $$->type = new(ctx) ast_fully_specified_type(); + $$->type->set_location_range(@1, @2); $$->type->qualifier = $1; $$->type->specifier = $2; } @@ -980,7 +984,7 @@ init_declarator_list: { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, NULL, NULL); - decl->set_location(yylloc); + decl->set_location(@3); $$ = $1; $$->declarations.push_tail(&decl->link); @@ -990,7 +994,7 @@ init_declarator_list: { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, $4, NULL); - decl->set_location(yylloc); + decl->set_location_range(@3, @4); $$ = $1; $$->declarations.push_tail(&decl->link); @@ -1000,7 +1004,7 @@ init_declarator_list: { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, $4, $6); - decl->set_location(yylloc); + decl->set_location_range(@3, @4); $$ = $1; $$->declarations.push_tail(&decl->link); @@ -1010,7 +1014,7 @@ init_declarator_list: { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, NULL, $5); - decl->set_location(yylloc); + decl->set_location(@3); $$ = $1; $$->declarations.push_tail(&decl->link); @@ -1025,51 +1029,56 @@ single_declaration: void *ctx = state; /* Empty declaration list is valid. */ $$ = new(ctx) ast_declarator_list($1); - $$->set_location(yylloc); + $$->set_location(@1); } | fully_specified_type any_identifier { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, NULL, NULL); + decl->set_location(@2); $$ = new(ctx) ast_declarator_list($1); - $$->set_location(yylloc); + $$->set_location_range(@1, @2); $$->declarations.push_tail(&decl->link); } | fully_specified_type any_identifier array_specifier { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, $3, NULL); + decl->set_location_range(@2, @3); $$ = new(ctx) ast_declarator_list($1); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); $$->declarations.push_tail(&decl->link); } | fully_specified_type any_identifier array_specifier '=' initializer { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, $3, $5); + decl->set_location_range(@2, @3); $$ = new(ctx) ast_declarator_list($1); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); $$->declarations.push_tail(&decl->link); } | fully_specified_type any_identifier '=' initializer { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, NULL, $4); + decl->set_location(@2); $$ = new(ctx) ast_declarator_list($1); - $$->set_location(yylloc); + $$->set_location_range(@1, @2); $$->declarations.push_tail(&decl->link); } | INVARIANT variable_identifier // Vertex only. { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, NULL, NULL); + decl->set_location(@2); $$ = new(ctx) ast_declarator_list(NULL); - $$->set_location(yylloc); + $$->set_location_range(@1, @2); $$->invariant = true; $$->declarations.push_tail(&decl->link); @@ -1081,14 +1090,14 @@ fully_specified_type: { void *ctx = state; $$ = new(ctx) ast_fully_specified_type(); - $$->set_location(yylloc); + $$->set_location(@1); $$->specifier = $1; } | type_qualifier type_specifier { void *ctx = state; $$ = new(ctx) ast_fully_specified_type(); - $$->set_location(yylloc); + $$->set_location_range(@1, @2); $$->qualifier = $1; $$->specifier = $2; } @@ -1696,12 +1705,14 @@ array_specifier: '[' ']' { void *ctx = state; - $$ = new(ctx) ast_array_specifier(yylloc); + $$ = new(ctx) ast_array_specifier(@1); + $$->set_location_range(@1, @2); } | '[' constant_expression ']' { void *ctx = state; - $$ = new(ctx) ast_array_specifier(yylloc, $2); + $$ = new(ctx) ast_array_specifier(@1, $2); + $$->set_location_range(@1, @3); } | array_specifier '[' ']' { @@ -1745,19 +1756,19 @@ type_specifier_nonarray: { void *ctx = state; $$ = new(ctx) ast_type_specifier($1); - $$->set_location(yylloc); + $$->set_location(@1); } | struct_specifier { void *ctx = state; $$ = new(ctx) ast_type_specifier($1); - $$->set_location(yylloc); + $$->set_location(@1); } | TYPE_IDENTIFIER { void *ctx = state; $$ = new(ctx) ast_type_specifier($1); - $$->set_location(yylloc); + $$->set_location(@1); } ; @@ -1888,7 +1899,7 @@ struct_specifier: { void *ctx = state; $$ = new(ctx) ast_struct_specifier($2, $4); - $$->set_location(yylloc); + $$->set_location_range(@2, @5); state->symbols->add_type($2, glsl_type::void_type); state->symbols->add_type_ast($2, new(ctx) ast_type_specifier($$)); } @@ -1896,7 +1907,7 @@ struct_specifier: { void *ctx = state; $$ = new(ctx) ast_struct_specifier(NULL, $3); - $$->set_location(yylloc); + $$->set_location_range(@2, @4); } ; @@ -1918,7 +1929,7 @@ struct_declaration: { void *ctx = state; ast_fully_specified_type *const type = $1; - type->set_location(yylloc); + type->set_location(@1); if (type->qualifier.flags.i != 0) _mesa_glsl_error(&@1, state, @@ -1926,7 +1937,7 @@ struct_declaration: "structure members"); $$ = new(ctx) ast_declarator_list(type); - $$->set_location(yylloc); + $$->set_location(@2); $$->declarations.push_degenerate_list_at_head(& $2->link); } @@ -1950,13 +1961,13 @@ struct_declarator: { void *ctx = state; $$ = new(ctx) ast_declaration($1, NULL, NULL); - $$->set_location(yylloc); + $$->set_location(@1); } | any_identifier array_specifier { void *ctx = state; $$ = new(ctx) ast_declaration($1, $2, NULL); - $$->set_location(yylloc); + $$->set_location_range(@1, @2); } ; @@ -1977,7 +1988,7 @@ initializer_list: { void *ctx = state; $$ = new(ctx) ast_aggregate_initializer(); - $$->set_location(yylloc); + $$->set_location(@1); $$->expressions.push_tail(& $1->link); } | initializer_list ',' initializer @@ -2011,7 +2022,7 @@ compound_statement: { void *ctx = state; $$ = new(ctx) ast_compound_statement(true, NULL); - $$->set_location(yylloc); + $$->set_location_range(@1, @2); } | '{' { @@ -2021,7 +2032,7 @@ compound_statement: { void *ctx = state; $$ = new(ctx) ast_compound_statement(true, $3); - $$->set_location(yylloc); + $$->set_location_range(@1, @4); state->symbols->pop_scope(); } ; @@ -2036,13 +2047,13 @@ compound_statement_no_new_scope: { void *ctx = state; $$ = new(ctx) ast_compound_statement(false, NULL); - $$->set_location(yylloc); + $$->set_location_range(@1, @2); } | '{' statement_list '}' { void *ctx = state; $$ = new(ctx) ast_compound_statement(false, $2); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } ; @@ -2073,13 +2084,13 @@ expression_statement: { void *ctx = state; $$ = new(ctx) ast_expression_statement(NULL); - $$->set_location(yylloc); + $$->set_location(@1); } | expression ';' { void *ctx = state; $$ = new(ctx) ast_expression_statement($1); - $$->set_location(yylloc); + $$->set_location(@1); } ; @@ -2088,7 +2099,7 @@ selection_statement: { $$ = new(state) ast_selection_statement($3, $5.then_statement, $5.else_statement); - $$->set_location(yylloc); + $$->set_location_range(@1, @5); } ; @@ -2115,8 +2126,8 @@ condition: void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, NULL, $4); ast_declarator_list *declarator = new(ctx) ast_declarator_list($1); - decl->set_location(yylloc); - declarator->set_location(yylloc); + decl->set_location_range(@2, @4); + declarator->set_location(@1); declarator->declarations.push_tail(&decl->link); $$ = declarator; @@ -2131,7 +2142,7 @@ switch_statement: SWITCH '(' expression ')' switch_body { $$ = new(state) ast_switch_statement($3, $5); - $$->set_location(yylloc); + $$->set_location_range(@1, @5); } ; @@ -2139,12 +2150,12 @@ switch_body: '{' '}' { $$ = new(state) ast_switch_body(NULL); - $$->set_location(yylloc); + $$->set_location_range(@1, @2); } | '{' case_statement_list '}' { $$ = new(state) ast_switch_body($2); - $$->set_location(yylloc); + $$->set_location_range(@1, @3); } ; @@ -2152,12 +2163,12 @@ case_label: CASE expression ':' { $$ = new(state) ast_case_label($2); - $$->set_location(yylloc); + $$->set_location(@2); } | DEFAULT ':' { $$ = new(state) ast_case_label(NULL); - $$->set_location(yylloc); + $$->set_location(@2); } ; @@ -2168,7 +2179,7 @@ case_label_list: labels->labels.push_tail(& $1->link); $$ = labels; - $$->set_location(yylloc); + $$->set_location(@1); } | case_label_list case_label { @@ -2181,7 +2192,7 @@ case_statement: case_label_list statement { ast_case_statement *stmts = new(state) ast_case_statement($1); - stmts->set_location(yylloc); + stmts->set_location(@2); stmts->stmts.push_tail(& $2->link); $$ = stmts; @@ -2197,7 +2208,7 @@ case_statement_list: case_statement { ast_case_statement_list *cases= new(state) ast_case_statement_list(); - cases->set_location(yylloc); + cases->set_location(@1); cases->cases.push_tail(& $1->link); $$ = cases; @@ -2215,21 +2226,21 @@ iteration_statement: void *ctx = state; $$ = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, NULL, $3, NULL, $5); - $$->set_location(yylloc); + $$->set_location_range(@1, @4); } | DO statement WHILE '(' expression ')' ';' { void *ctx = state; $$ = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, NULL, $5, NULL, $2); - $$->set_location(yylloc); + $$->set_location_range(@1, @6); } | FOR '(' for_init_statement for_rest_statement ')' statement_no_new_scope { void *ctx = state; $$ = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, $3, $4.cond, $4.rest, $6); - $$->set_location(yylloc); + $$->set_location_range(@1, @6); } ; @@ -2265,31 +2276,31 @@ jump_statement: { void *ctx = state; $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); - $$->set_location(yylloc); + $$->set_location(@1); } | BREAK ';' { void *ctx = state; $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); - $$->set_location(yylloc); + $$->set_location(@1); } | RETURN ';' { void *ctx = state; $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); - $$->set_location(yylloc); + $$->set_location(@1); } | RETURN expression ';' { void *ctx = state; $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, $2); - $$->set_location(yylloc); + $$->set_location_range(@1, @2); } | DISCARD ';' // Fragment shader only. { void *ctx = state; $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); - $$->set_location(yylloc); + $$->set_location(@1); } ; @@ -2305,7 +2316,7 @@ function_definition: { void *ctx = state; $$ = new(ctx) ast_function_definition(); - $$->set_location(yylloc); + $$->set_location_range(@1, @2); $$->prototype = $1; $$->body = $2; @@ -2454,11 +2465,13 @@ instance_name_opt: { $$ = new(state) ast_interface_block(*state->default_uniform_qualifier, $1, NULL); + $$->set_location(@1); } | NEW_IDENTIFIER array_specifier { $$ = new(state) ast_interface_block(*state->default_uniform_qualifier, $1, $2); + $$->set_location_range(@1, @2); } ; @@ -2480,7 +2493,7 @@ member_declaration: { void *ctx = state; ast_fully_specified_type *type = $1; - type->set_location(yylloc); + type->set_location(@1); if (type->qualifier.flags.q.attribute) { _mesa_glsl_error(& @1, state, @@ -2493,7 +2506,7 @@ member_declaration: } $$ = new(ctx) ast_declarator_list(type); - $$->set_location(yylloc); + $$->set_location(@2); $$->declarations.push_degenerate_list_at_head(& $2->link); } diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index d7f5202fe..61ae62150 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -807,8 +807,10 @@ ast_node::print(void) const ast_node::ast_node(void) { this->location.source = 0; - this->location.line = 0; - this->location.column = 0; + this->location.first_line = 0; + this->location.first_column = 0; + this->location.last_line = 0; + this->location.last_column = 0; } diff --git a/mesalib/src/glsl/link_uniforms.cpp b/mesalib/src/glsl/link_uniforms.cpp index 1cf376d5d..1c451e7f5 100644 --- a/mesalib/src/glsl/link_uniforms.cpp +++ b/mesalib/src/glsl/link_uniforms.cpp @@ -775,9 +775,10 @@ link_set_image_access_qualifiers(struct gl_shader_program *prog) if (var && var->data.mode == ir_var_uniform && var->type->contains_image()) { - unsigned id; + unsigned id = 0; bool found = prog->UniformHash->get(id, var->name); assert(found); + (void) found; const gl_uniform_storage *storage = &prog->UniformStorage[id]; const unsigned index = storage->image[i].index; const GLenum access = (var->data.image.read_only ? GL_READ_ONLY : |