re PR c++/2843 (parser: __attribute__ on parameter declarations)
authorMark Mitchell <mark@codesourcery.com>
Thu, 2 Jan 2003 20:04:56 +0000 (20:04 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 2 Jan 2003 20:04:56 +0000 (20:04 +0000)
PR c++/2843
* parser.c (cp_parser_parameter_declaration): Allow attributes to
appear after the declarator.

PR c++/2843
* g++.dg/ext/attrib7.C: New test.

From-SVN: r60801

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/attrib7.C [new file with mode: 0644]

index 9d078c63b5b2a61b1611ee17c8782617a8041c4f..c23e42391c62d5e0bacdb96e33e5380b1787a498 100644 (file)
@@ -1,5 +1,9 @@
 2003-01-02  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/2843
+       * parser.c (cp_parser_parameter_declaration): Allow attributes to
+       appear after the declarator.
+
        * call.c (build_new_method_call): Fix typo in message format
        string.
 
index f9c690c11c0a7a5189d64c3b98f4c6441c3eb25d..dca6853edc8d9110be32205506cce4f6d0b8d9ac 100644 (file)
@@ -10845,6 +10845,8 @@ cp_parser_parameter_declaration (parser, greater_than_is_operator_p)
                                           /*abstract_p=*/true,
                                           /*ctor_dtor_or_conv_p=*/NULL);
       parser->default_arg_ok_p = saved_default_arg_ok_p;
+      /* After the declarator, allow more attributes.  */
+      attributes = chainon (attributes, cp_parser_attributes_opt (parser));
     }
 
   /* The restriction on definining new types applies only to the type
index 5e485480122d2f0d5042586986a484349c6dd78c..bd61d145a8a3a5af22f45eb1996788fa4d1b9f60 100644 (file)
@@ -1,3 +1,8 @@
+2003-01-02  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/2843
+       * g++.dg/ext/attrib7.C: New test.
+
 2003-01-02  Neil Booth  <neil@daikokuya.co.uk>
 
        * g++.dg/parse/parse6.C: New test.
diff --git a/gcc/testsuite/g++.dg/ext/attrib7.C b/gcc/testsuite/g++.dg/ext/attrib7.C
new file mode 100644 (file)
index 0000000..fa16fdd
--- /dev/null
@@ -0,0 +1,3 @@
+// { dg-options "-Wunused-parameter" }
+
+void f (int i __attribute__((__unused__))) {}