0
0
Fork 0
mirror of https://git.code.sf.net/p/quake/quakeforge synced 2025-04-07 18:01:30 +00:00

[qfcc] Fix some glsl parsing issues

Segfault when debug printing expr values, missing spec_merge for
type_qualifier and superfluous ; after for loop init expression.
This commit is contained in:
Bill Currie 2024-09-01 17:02:42 +09:00
parent f335540e99
commit f0eccc398e
2 changed files with 6 additions and 2 deletions
tools/qfcc/source

View file

@ -115,6 +115,7 @@ set_line_file (int line, const char *file, int flags)
.column = 1,
.last_line = line,
.last_column = 1,
.file = ReuseString (file),
};
if (file) {
add_source_file (file);

View file

@ -203,7 +203,7 @@ int yylex (YYSTYPE *yylval, YYLTYPE *yylloc);
%type <param> parameter_declarator parameter_type_specifier
%printer { fprintf (yyo, "%s", $$->name); } <symbol>
%printer { fprintf (yyo, "%s", $$->type == ex_value ? get_value_string ($$->value) : "<expr>"); } <expr>
%printer { fprintf (yyo, "%s", ($$ && $$->type == ex_value) ? get_value_string ($$->value) : "<expr>"); } <expr>
%printer { fprintf (yyo, "%p", $<pointer>$); } <*>
%printer { fprintf (yyo, "<>"); } <>
@ -744,6 +744,9 @@ precise_qualifer
type_qualifier
: single_type_qualifier
| type_qualifier single_type_qualifier
{
$<spec>$ = spec_merge ($1, $2);
}
;
single_type_qualifier
@ -1069,7 +1072,7 @@ iteration_statement
}
| FOR break_label continue_label
// '(' for_init_statement for_rest_statement ')'
'(' for_init_statement ';' conditionopt ';' expressionopt ')'
'(' for_init_statement conditionopt ';' expressionopt ')'
statement_no_new_scope
{
if ($for_init_statement) {