+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
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>
$(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 ; \
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.
{ $$ = 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).
--- /dev/null
+// 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