mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
glcpp: Ignore junk tokens at end of #ifdef/#ifndef (with warning)
Both nVidia's compiler and GCC accept this. Fixes CorrectPreprocess11.frag.
This commit is contained in:
parent
c9529c4d77
commit
6587574354
1 changed files with 8 additions and 2 deletions
|
|
@ -232,12 +232,12 @@ control_line:
|
|||
_token_list_append_list (expanded, $2);
|
||||
glcpp_parser_lex_from (parser, expanded);
|
||||
}
|
||||
| HASH_IFDEF IDENTIFIER NEWLINE {
|
||||
| HASH_IFDEF IDENTIFIER junk NEWLINE {
|
||||
macro_t *macro = hash_table_find (parser->defines, $2);
|
||||
talloc_free ($2);
|
||||
_glcpp_parser_skip_stack_push_if (parser, & @1, macro != NULL);
|
||||
}
|
||||
| HASH_IFNDEF IDENTIFIER NEWLINE {
|
||||
| HASH_IFNDEF IDENTIFIER junk NEWLINE {
|
||||
macro_t *macro = hash_table_find (parser->defines, $2);
|
||||
talloc_free ($2);
|
||||
_glcpp_parser_skip_stack_push_if (parser, & @1, macro == NULL);
|
||||
|
|
@ -377,6 +377,12 @@ replacement_list:
|
|||
| pp_tokens
|
||||
;
|
||||
|
||||
junk:
|
||||
/* empty */
|
||||
| pp_tokens {
|
||||
glcpp_warning(&@1, parser, "extra tokens at end of directive");
|
||||
}
|
||||
|
||||
pp_tokens:
|
||||
preprocessing_token {
|
||||
parser->space_tokens = 1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue