diff options
author | Jakub Jelinek <jakub@redhat.com> | 2002-04-23 22:59:05 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2002-04-23 22:59:05 +0200 |
commit | 29cece2e5d5d62e657442a92094324cfba6466eb (patch) | |
tree | ee6ed88377a7ea38a81e1b662785e9f4346dcd9c | |
parent | 7e67bb8588a51269784cdee84dc985b33eae90a9 (diff) | |
download | gcc-29cece2e5d5d62e657442a92094324cfba6466eb.zip gcc-29cece2e5d5d62e657442a92094324cfba6466eb.tar.gz gcc-29cece2e5d5d62e657442a92094324cfba6466eb.tar.bz2 |
parse.y (check_class_key): Allow KEY to be union/enum/struct/class node with attributes.
* parse.y (check_class_key): Allow KEY to be union/enum/struct/class
node with attributes.
* g++.dg/parse/attr1.C: New test.
From-SVN: r52678
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/parse.y | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/attr1.C | 50 |
4 files changed, 61 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 25d1f4c..0274561 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2002-04-23 Jakub Jelinek <jakub@redhat.com> + + * parse.y (check_class_key): Allow KEY to be union/enum/struct/class + node with attributes. + 2002-2-23 David O'Brien <obrien@FreeBSD.org> * g++spec.c (MATH_LIBRARY_PROFILE, LIBSTDCXX_PROFILE): Add. diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index ae1c2a4..491c83e 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -214,6 +214,8 @@ check_class_key (key, aggr) tree key; tree aggr; { + if (TREE_CODE (key) == TREE_LIST) + key = TREE_VALUE (key); if ((key == union_type_node) != (TREE_CODE (aggr) == UNION_TYPE)) pedwarn ("`%s' tag used in naming `%#T'", key == union_type_node ? "union" diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c1641dd..07de93d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-04-23 Jakub Jelinek <jakub@redhat.com> + + * g++.dg/parse/attr1.C: New test. + 2002-04-23 Roger Sayle <roger@eyesopen.com> * gcc.c-torture/execute/string-opt-17.c: New test case. diff --git a/gcc/testsuite/g++.dg/parse/attr1.C b/gcc/testsuite/g++.dg/parse/attr1.C new file mode 100644 index 0000000..10d6f57 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/attr1.C @@ -0,0 +1,50 @@ +// Test whether attributes are accepted both immediately after +// struct/union keyword and after the closing brace. +// { dg-do compile } + +struct foo +{ + union __attribute__ ((packed)) + { + int a; + long b; + }; + union __attribute__ ((packed)) __attribute__ ((unused)) + { + int c; + long d; + }; +}; + +union __attribute__ ((packed)) bar +{ + int c; + long d; +}; + +struct __attribute__ ((packed)) baz +{ + int e; + long f; +}; + +struct foo2 +{ + union + { + int a; + long b; + } __attribute__ ((packed)); +}; + +union bar2 +{ + int c; + long d; +} __attribute__ ((packed)); + +struct baz2 +{ + int e; + long f; +} __attribute__ ((packed)); |