This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: c++/2843: parser: __attribute__ on parameter declarations
- From: Mark Mitchell <mark at codesourcery dot com>
- To: John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>, "neil at gcc dot gnu dot org" <neil at gcc dot gnu dot org>, "dave dot anglin at nrc dot ca" <dave dot anglin at nrc dot ca>, "gcc-bugs at gcc dot gnu dot org" <gcc-bugs at gcc dot gnu dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 02 Jan 2003 12:27:35 -0800
- Subject: Re: c++/2843: parser: __attribute__ on parameter declarations
Mark, I would also appreciate somebody looking at the following report
which appears to be related to the above problem:
<http://gcc.gnu.org/ml/gcc-patches/2002-12/msg01494.html>.
I checked in this patch to fix the problem.
Tested on i686-pc-linux-gnu, applied on the mainline.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2003-01-02 Mark Mitchell <mark@codesourcery.com>
* parser.c (cp_parser_declaration): Accept the __extension__
keyword before the declaration.
Index: parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.14
diff -c -p -r1.14 parser.c
*** parser.c 2 Jan 2003 19:45:12 -0000 1.14
--- parser.c 2 Jan 2003 20:28:54 -0000
*************** cp_parser_declaration_seq_opt (parser)
*** 6533,6539 ****
explicit-instantiation
explicit-specialization
linkage-specification
! namespace-definition */
static void
cp_parser_declaration (parser)
--- 6533,6544 ----
explicit-instantiation
explicit-specialization
linkage-specification
! namespace-definition
!
! GNU extension:
!
! declaration:
! __extension__ declaration */
static void
cp_parser_declaration (parser)
*************** cp_parser_declaration (parser)
*** 6541,6546 ****
--- 6546,6563 ----
{
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);