parse.y (reserved_declspecs): Don't handle attributes.
authorJason Merrill <jason@gcc.gnu.org>
Mon, 11 Feb 2002 15:52:20 +0000 (10:52 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 11 Feb 2002 15:52:20 +0000 (10:52 -0500)
        * parse.y (reserved_declspecs): Don't handle attributes.
        (reserved_typespecquals): Handle them here.
        * Make-lang.in (parse.c): Adjust expected conflicts.

From-SVN: r49678

gcc/cp/ChangeLog
gcc/cp/Make-lang.in
gcc/cp/parse.y
gcc/testsuite/g++.dg/ext/attrib4.C [new file with mode: 0644]

index 25bf9d92070b4f4ea14dfb0b47d1bf615e828e44..f6c2a542951619b1966582c1852c2449298b7ca1 100644 (file)
@@ -1,3 +1,9 @@
+2002-02-11  Jason Merrill  <jason@redhat.com>
+
+       * parse.y (reserved_declspecs): Don't handle attributes.
+       (reserved_typespecquals): Handle them here.
+       * Make-lang.in (parse.c): Adjust expected conflicts.
+
 2002-02-08  Jakub Jelinek  <jakub@redhat.com>
 
        * parse.y (primary, primary_no_id): Use compstmt_or_stmtexpr
@@ -1603,8 +1609,8 @@ Fri Sep 21 08:16:19 2001  J"orn Rennecke <amylaar@redhat.com>
 
 2001-09-15  Gabriel Dos Reis  <gdr@merlin.codesourcery.com>
 
-               * Make-lang.in (cp/error.o): Depend on real.h
-               * error.c: #include "real.h"
+       * Make-lang.in (cp/error.o): Depend on real.h
+       * error.c: #include "real.h"
 
 2001-09-15  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
index 976559a8d298ee2d74132e6238c30dbe18c678ab..f8d023a1cb7c05d9322a1d81798709aa12ed0767 100644 (file)
@@ -120,7 +120,7 @@ $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
 
 $(srcdir)/cp/parse.h: $(srcdir)/cp/parse.c
 $(srcdir)/cp/parse.c: $(srcdir)/cp/parse.y
-       @echo "Expect 31 shift/reduce conflicts and 58 reduce/reduce conflicts."
+       @echo "Expect 33 shift/reduce conflicts and 58 reduce/reduce conflicts."
        cd $(srcdir)/cp && \
        if $(BISON) $(BISONFLAGS) -d -o p$$$$.c parse.y; then \
          grep '^#define[       ]*YYEMPTY' p$$$$.c >> p$$$$.h ; \
index 7faeabaf87cc1a9c6e464ac82b23206e0ec0ac13..54a6823a616dd0da635719bbce9566e75b71999f 100644 (file)
@@ -1895,10 +1895,6 @@ reserved_declspecs:
                    warning ("`%s' is not at beginning of declaration",
                             IDENTIFIER_POINTER ($2));
                  $$ = tree_cons (NULL_TREE, $2, $$); }
-       | reserved_declspecs attributes
-               { $$ = tree_cons ($2, NULL_TREE, $1); }
-       | attributes
-               { $$ = tree_cons ($1, NULL_TREE, NULL_TREE); }
        ;
 
 /* List of just storage classes and type modifiers.
@@ -1966,6 +1962,10 @@ reserved_typespecquals:
                { $$ = build_tree_list (NULL_TREE, $1.t); }
        | reserved_typespecquals typespecqual_reserved
                { $$ = tree_cons (NULL_TREE, $2.t, $1); }
+       | reserved_typespecquals attributes
+               { $$ = tree_cons ($2, NULL_TREE, $1); }
+       | attributes %prec EMPTY
+               { $$ = tree_cons ($1, NULL_TREE, NULL_TREE); }
        ;
 
 /* A typespec (but not a type qualifier).
diff --git a/gcc/testsuite/g++.dg/ext/attrib4.C b/gcc/testsuite/g++.dg/ext/attrib4.C
new file mode 100644 (file)
index 0000000..68cc741
--- /dev/null
@@ -0,0 +1,31 @@
+// Test for syntax support of various attribute permutations.
+
+int
+__attribute__((noreturn))
+__attribute__((unused))
+one(void); // OK 
+
+__attribute__((noreturn))
+__attribute__((unused))
+int
+two(void); // OK
+
+int
+__attribute__((unused))
+three (void)
+__attribute__((noreturn)); // OK
+
+__attribute__((unused))
+int
+four (void)
+__attribute__((noreturn)); // OK
+
+int
+five(void)
+__attribute__((noreturn))
+__attribute__((unused));  // OK
+
+__attribute__((noreturn))
+int
+__attribute__((unused)) // parse error before '__attribute__' in C++
+six (void);              // OK in C