aboutsummaryrefslogtreecommitdiff
path: root/gcc/objc/objc-parse.y
diff options
context:
space:
mode:
authorAlastair J. Houghton <ajh8@doc.ic.ac.uk>1999-10-15 08:42:02 +0000
committerJeff Law <law@gcc.gnu.org>1999-10-15 02:42:02 -0600
commitffc3b0f915b0f510a92a0604d0ddae4b6e7dd34e (patch)
tree8bc53910e67e019a077ccea4058a4d9f91b9d391 /gcc/objc/objc-parse.y
parente57ad0c81569d506af52ff39efd2fcd9719ef53a (diff)
downloadgcc-ffc3b0f915b0f510a92a0604d0ddae4b6e7dd34e.zip
gcc-ffc3b0f915b0f510a92a0604d0ddae4b6e7dd34e.tar.gz
gcc-ffc3b0f915b0f510a92a0604d0ddae4b6e7dd34e.tar.bz2
c-parse.in (component_decl): Support anonymous struct/union.
* 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. Co-Authored-By: Mumit Khan <khan@xraylith.wisc.edu> From-SVN: r30016
Diffstat (limited to 'gcc/objc/objc-parse.y')
-rw-r--r--gcc/objc/objc-parse.y23
1 files changed, 16 insertions, 7 deletions
diff --git a/gcc/objc/objc-parse.y b/gcc/objc/objc-parse.y
index f22926f..24d39f0 100644
--- a/gcc/objc/objc-parse.y
+++ b/gcc/objc/objc-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 73
+%expect 74
%{
#include "config.h"
@@ -1537,12 +1537,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);