diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-13 10:19:03 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-13 10:19:03 +0000 |
commit | e8fc0d3480bf8f266db2caa965af50776e270ec9 (patch) | |
tree | 1628ba21d162d8c904b22105327717febc42c784 /gcc/c-parser.c | |
parent | 2725970784399fb8efb1c946472340c2de074f45 (diff) | |
download | gcc-e8fc0d3480bf8f266db2caa965af50776e270ec9.tar.gz |
2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c/15236
* diagnostic.c (pedwarn_at): New.
* toplev.h (pedwarn_at): Declare.
* c-tree.h (build_enumerator): Update declaration.
* c-decl.c (finish_enum): Update comment.
(build_enumerator): Take a location parameter. Give a pedwarn but do
not perform any conversion.
* c-parser.c (c_parser_enum_specifier): Set correct location for
enumerator.
testsuite/
* gcc.dg/pr15236.c: New.
* gcc.dg/torture/pr25183.c: Update.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139050 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r-- | gcc/c-parser.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c index 02fc7853fce..6617145a6cb 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -1630,6 +1630,7 @@ c_parser_enum_specifier (c_parser *parser) bool seen_comma; c_token *token; location_t comma_loc; + location_t value_loc; if (c_parser_next_token_is_not (parser, CPP_NAME)) { c_parser_error (parser, "expected identifier"); @@ -1641,15 +1642,19 @@ c_parser_enum_specifier (c_parser *parser) enum_id = token->value; /* Set the location in case we create a decl now. */ c_parser_set_source_position_from_token (token); + value_loc = token->location; c_parser_consume_token (parser); if (c_parser_next_token_is (parser, CPP_EQ)) { c_parser_consume_token (parser); + value_loc = c_parser_peek_token (parser)->location; + /* This may call cb_line_change and alter the input_location. */ enum_value = c_parser_expr_no_commas (parser, NULL).value; } else enum_value = NULL_TREE; - enum_decl = build_enumerator (&the_enum, enum_id, enum_value); + enum_decl = build_enumerator (&the_enum, enum_id, enum_value, + value_loc); TREE_CHAIN (enum_decl) = values; values = enum_decl; seen_comma = false; |