mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-24 00:10:05 +08:00
parser.c (cp_parser_enumerator_list): Do not warn about trailing commas in C++0x mode.
* parser.c (cp_parser_enumerator_list): Do not warn about trailing commas in C++0x mode. From-SVN: r180967
This commit is contained in:
parent
a5c037e263
commit
669cc68c37
@ -1,3 +1,8 @@
|
||||
2011-10-09 Magnus Fromreide <magfr@lysator.liu.se>
|
||||
|
||||
* parser.c (cp_parser_enumerator_list): Do not warn about
|
||||
trailing commas in C++0x mode.
|
||||
|
||||
2011-11-04 Olivier Goffart <olivier@woboq.com>
|
||||
Jason Merrill <jason@redhat.com>
|
||||
|
||||
|
@ -14058,6 +14058,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
|
||||
|
||||
enum-specifier:
|
||||
enum-head { enumerator-list [opt] }
|
||||
enum-head { enumerator-list , } [C++0x]
|
||||
|
||||
enum-head:
|
||||
enum-key identifier [opt] enum-base [opt]
|
||||
@ -14077,6 +14078,8 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
|
||||
GNU Extensions:
|
||||
enum-key attributes[opt] identifier [opt] enum-base [opt]
|
||||
{ enumerator-list [opt] }attributes[opt]
|
||||
enum-key attributes[opt] identifier [opt] enum-base [opt]
|
||||
{ enumerator-list, }attributes[opt] [C++0x]
|
||||
|
||||
Returns an ENUM_TYPE representing the enumeration, or NULL_TREE
|
||||
if the token stream isn't an enum-specifier after all. */
|
||||
@ -14416,8 +14419,9 @@ cp_parser_enumerator_list (cp_parser* parser, tree type)
|
||||
/* If the next token is a `}', there is a trailing comma. */
|
||||
if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE))
|
||||
{
|
||||
if (!in_system_header)
|
||||
pedwarn (input_location, OPT_pedantic, "comma at end of enumerator list");
|
||||
if (cxx_dialect < cxx0x && !in_system_header)
|
||||
pedwarn (input_location, OPT_pedantic,
|
||||
"comma at end of enumerator list");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,10 @@
|
||||
2011-10-09 Magnus Fromreide <magfr@lysator.liu.se>
|
||||
|
||||
* g++.dg/cpp0x/enum21a.C: Test that enum x { y, } does
|
||||
generate a pedwarn in c++98-mode.
|
||||
* g++.dg/cpp0x/enum21b.C: Test that enum x { y, }
|
||||
don't generate a pedwarn in c++0x-mode.
|
||||
|
||||
2011-11-04 Olivier Goffart <olivier@woboq.com>
|
||||
|
||||
PR c++/50965
|
||||
|
4
gcc/testsuite/g++.dg/cpp0x/enum21a.C
Normal file
4
gcc/testsuite/g++.dg/cpp0x/enum21a.C
Normal file
@ -0,0 +1,4 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-pedantic -std=c++98" }
|
||||
|
||||
enum x { y, }; // { dg-warning "comma at end of enumerator list" }
|
4
gcc/testsuite/g++.dg/cpp0x/enum21b.C
Normal file
4
gcc/testsuite/g++.dg/cpp0x/enum21b.C
Normal file
@ -0,0 +1,4 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-pedantic -std=c++0x" }
|
||||
|
||||
enum x { y, };
|
Loading…
Reference in New Issue
Block a user