diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2010-06-18 20:08:15 -0700 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2010-06-21 12:41:05 -0700 |
commit | 65875743542fd1388b18a1a3c1c2bec4a6a3007e (patch) | |
tree | 6e5987fc0a4006dd48392defeb4d1d82baf05201 /glcpp | |
parent | c9529c4d7727e0ff9da71f0941746e4d213dd689 (diff) |
glcpp: Ignore junk tokens at end of #ifdef/#ifndef (with warning)
Both nVidia's compiler and GCC accept this.
Fixes CorrectPreprocess11.frag.
Diffstat (limited to 'glcpp')
-rw-r--r-- | glcpp/glcpp-parse.y | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/glcpp/glcpp-parse.y b/glcpp/glcpp-parse.y index c70370a6c3..035a5c83f0 100644 --- a/glcpp/glcpp-parse.y +++ b/glcpp/glcpp-parse.y @@ -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; |