diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-10-15 08:42:02 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-10-15 08:42:02 +0000 |
commit | ddde614ac68b8e5416c797bac23ff7f76fb556a7 (patch) | |
tree | 8bc53910e67e019a077ccea4058a4d9f91b9d391 /gcc/c-parse.y | |
parent | a59b3fe5d36a71aae6fa31d14a90b05550229620 (diff) | |
download | gcc-ddde614ac68b8e5416c797bac23ff7f76fb556a7.tar.gz |
* c-parse.in (component_decl): Support anonymous struct/union.
(%expect): Update.
* c-parse.y: Regenerate.
* c-parse.c: Likewise.
* objc/objc-parse.y: Likewise.
* objc/objc-parse.c: Likewise.
* c-decl.c (finish_struct): Don't sort the fields.
(field_decl_cmp): Delete unused function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30016 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-parse.y')
-rw-r--r-- | gcc/c-parse.y | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/gcc/c-parse.y b/gcc/c-parse.y index 7d4e2c69213..f9092d7aed6 100644 --- a/gcc/c-parse.y +++ b/gcc/c-parse.y @@ -28,7 +28,7 @@ Boston, MA 02111-1307, USA. */ /* To whomever it may concern: I have heard that such a thing was once written by AT&T, but I have never seen it. */ -%expect 52 +%expect 53 %{ #include "config.h" @@ -1407,12 +1407,21 @@ component_decl: prefix_attributes = TREE_PURPOSE (declspec_stack); declspec_stack = TREE_CHAIN (declspec_stack); resume_momentary ($2); } - | typed_typespecs - { if (pedantic) - pedwarn ("ANSI C forbids member declarations with no members"); - shadow_tag($1); - $$ = NULL_TREE; } - | nonempty_type_quals setspecs components + | typed_typespecs setspecs save_filename save_lineno maybe_attribute + { + /* Support for unnamed structs or unions as members of + structs or unions (which is [a] useful and [b] supports + MS P-SDK). */ + if (pedantic) + pedwarn ("ANSI C doesn't support unnamed structs/unions"); + + $$ = grokfield($3, $4, NULL, current_declspecs, NULL_TREE); + current_declspecs = TREE_VALUE (declspec_stack); + prefix_attributes = TREE_PURPOSE (declspec_stack); + declspec_stack = TREE_CHAIN (declspec_stack); + resume_momentary ($2); + } + | nonempty_type_quals setspecs components { $$ = $3; current_declspecs = TREE_VALUE (declspec_stack); prefix_attributes = TREE_PURPOSE (declspec_stack); |