From 4971227d2501045a28d858cb1a807908c18f3a19 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Thu, 2 Jan 2003 20:04:56 +0000 Subject: [PATCH] re PR c++/2843 (parser: __attribute__ on parameter declarations) 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 | 4 ++++ gcc/cp/parser.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ext/attrib7.C | 3 +++ 4 files changed, 14 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ext/attrib7.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9d078c63b5b..c23e42391c6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2003-01-02 Mark Mitchell + 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. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index f9c690c11c0..dca6853edc8 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5e485480122..bd61d145a8a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-01-02 Mark Mitchell + + PR c++/2843 + * g++.dg/ext/attrib7.C: New test. + 2003-01-02 Neil Booth * 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 index 00000000000..fa16fdd98cd --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib7.C @@ -0,0 +1,3 @@ +// { dg-options "-Wunused-parameter" } + +void f (int i __attribute__((__unused__))) {}