parser.c (cp_parser_declaration): Accept the __extension__ keyword before the declara...
authorMark Mitchell <mark@codesourcery.com>
Thu, 2 Jan 2003 20:30:45 +0000 (20:30 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 2 Jan 2003 20:30:45 +0000 (20:30 +0000)
* parser.c (cp_parser_declaration): Accept the __extension__
keyword before the declaration.

From-SVN: r60802

gcc/cp/ChangeLog
gcc/cp/parser.c

index c23e42391c62d5e0bacdb96e33e5380b1787a498..b8650d5529c04fe50375b15cf88483e817363527 100644 (file)
@@ -1,5 +1,8 @@
 2003-01-02  Mark Mitchell  <mark@codesourcery.com>
 
+       * parser.c (cp_parser_declaration): Accept the __extension__
+       keyword before the declaration.
+
        PR c++/2843
        * parser.c (cp_parser_parameter_declaration): Allow attributes to
        appear after the declarator.
@@ -15,7 +18,7 @@
        (cp_parser_parsing_tentatively): Likewise.
        (cp_parser_nested_name_specifier_opt): Reduce the number of calls
        to the cp_lexer_peek_token.
-        
+
        * parser.c (cp_parser_sizeof_operand): Do not evaluate the
        expression.
 
index dca6853edc8d9110be32205506cce4f6d0b8d9ac..ac920f0296541974c33c3b6354ac2dba6b19bb88 100644 (file)
@@ -6533,7 +6533,12 @@ cp_parser_declaration_seq_opt (parser)
      explicit-instantiation
      explicit-specialization
      linkage-specification
-     namespace-definition    */
+     namespace-definition    
+
+   GNU extension:
+
+   declaration:
+      __extension__ declaration */
 
 static void
 cp_parser_declaration (parser)
@@ -6541,6 +6546,18 @@ cp_parser_declaration (parser)
 {
   cp_token token1;
   cp_token token2;
+  int saved_pedantic;
+
+  /* Check for the `__extension__' keyword.  */
+  if (cp_parser_extension_opt (parser, &saved_pedantic))
+    {
+      /* Parse the qualified declaration.  */
+      cp_parser_declaration (parser);
+      /* Restore the PEDANTIC flag.  */
+      pedantic = saved_pedantic;
+
+      return;
+    }
 
   /* Try to figure out what kind of declaration is present.  */
   token1 = *cp_lexer_peek_token (parser->lexer);