aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2003-01-02 20:04:56 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-01-02 20:04:56 +0000
commit4971227d2501045a28d858cb1a807908c18f3a19 (patch)
tree55015d7cc2c4fc651c6535b32fa73144f1ee2f1b
parent5e8a153a549944ab3b061a0cc485540cff9f5d3d (diff)
downloadgcc-4971227d2501045a28d858cb1a807908c18f3a19.zip
gcc-4971227d2501045a28d858cb1a807908c18f3a19.tar.gz
gcc-4971227d2501045a28d858cb1a807908c18f3a19.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/parser.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ext/attrib7.C3
4 files changed, 14 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9d078c6..c23e423 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index f9c690c..dca6853 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 5e48548..bd61d14 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..fa16fdd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attrib7.C
@@ -0,0 +1,3 @@
+// { dg-options "-Wunused-parameter" }
+
+void f (int i __attribute__((__unused__))) {}