[patch] stray semi-colons in libstdc++ testsuite

Dirk Mueller mueller@kde.org
Mon Dec 10 14:06:00 GMT 2007


On Sunday 09 December 2007, Jonathan Wakely wrote:

> Although GCC accepts it without warning in all modes, 

-pedantic rejects it

> it's not legal 
> to have a semi-colon after a namespace declaration in C++03.

so it should be added to -Wc++-0x-compat ? any other places where stray 
semicolons are now rejected?

something like this (untested)?


--- cp/parser.c (revision 130658)
+++ cp/parser.c (working copy)
@@ -11567,6 +11567,15 @@ cp_parser_namespace_definition (cp_parse
   pop_namespace ();
   /* Look for the final `}'.  */
   cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'");
+
+  if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
+    {
+      cp_lexer_consume_token (parser->lexer);
+      if (pedantic && !in_system_header)
+        pedwarn ("extra %<;%>");
+      else
+        warning (OPT_Wc__0x_compat, "extra %<;%>");
+    }
 }


Dirk



More information about the Libstdc++ mailing list