diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1995-03-30 08:58:33 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1995-03-30 08:58:33 -0500 |
commit | 5d7a33dca49325ab3e4c83b1fd0cf9dfc152aa20 (patch) | |
tree | 2f83115fc5e114aca45b60969bf559a26a661f0d /gcc | |
parent | d17e26f744a2d0157597e4de625a15746db63cc5 (diff) | |
download | gcc-5d7a33dca49325ab3e4c83b1fd0cf9dfc152aa20.zip gcc-5d7a33dca49325ab3e4c83b1fd0cf9dfc152aa20.tar.gz gcc-5d7a33dca49325ab3e4c83b1fd0cf9dfc152aa20.tar.bz2 |
Now have 27 shift/reduce conflicts.
(attribute_list): Just make chain of all attributes.
(attrib): Consistently put name as PURPOSE, args, if any, as VALUE.
(structsp): Allow attributes on any struct or union.
From-SVN: r9260
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-parse.in | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/gcc/c-parse.in b/gcc/c-parse.in index 2a9fd01..a2a23da 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -30,7 +30,7 @@ ifobjc %expect 35 end ifobjc ifc -%expect 23 +%expect 27 /* These are the 23 conflicts you should get in parse.output; the state numbers may vary if minor changes in the grammar are made. @@ -1090,24 +1090,22 @@ attribute: attribute_list: attrib - { $$ = build_tree_list (NULL_TREE, $1); } + { $$ = $1; } | attribute_list ',' attrib - { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); } + { $$ = chainon ($1, $3); } ; attrib: /* empty */ { $$ = NULL_TREE; } | any_word - { $$ = $1; } + { $$ = build_tree_list ($1, NULL_TREE); } | any_word '(' IDENTIFIER ')' - { $$ = tree_cons ($1, NULL_TREE, - build_tree_list (NULL_TREE, $3)); } + { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); } | any_word '(' IDENTIFIER ',' nonnull_exprlist ')' - { $$ = tree_cons ($1, NULL_TREE, - tree_cons (NULL_TREE, $3, $5)); } + { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); } | any_word '(' nonnull_exprlist ')' - { $$ = tree_cons ($1, NULL_TREE, $3); } + { $$ = build_tree_list ($1, $3); } ; /* This still leaves out most reserved keywords, @@ -1311,19 +1309,24 @@ structsp: { $$ = start_struct (RECORD_TYPE, $2); /* Start scope of tag before parsing components. */ } - component_decl_list '}' + component_decl_list '}' maybe_attribute { $$ = finish_struct ($<ttype>4, $5); + decl_attributes ($$, $7, NULL_TREE); /* Really define the structure. */ } - | STRUCT '{' component_decl_list '}' + | STRUCT '{' component_decl_list '}' maybe_attribute { $$ = finish_struct (start_struct (RECORD_TYPE, NULL_TREE), - $3); } + $3); + decl_attributes ($$, $5, NULL_TREE); + } | STRUCT identifier { $$ = xref_tag (RECORD_TYPE, $2); } | UNION identifier '{' { $$ = start_struct (UNION_TYPE, $2); } - component_decl_list '}' - { $$ = finish_struct ($<ttype>4, $5); } + component_decl_list '}' maybe_attribute + { $$ = finish_struct ($<ttype>4, $5); + decl_attributes ($$, $5, NULL_TREE); + } | UNION '{' component_decl_list '}' { $$ = finish_struct (start_struct (UNION_TYPE, NULL_TREE), $3); } |