summaryrefslogtreecommitdiff
path: root/gcc/c-parse.in
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1995-05-21 12:39:16 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1995-05-21 12:39:16 +0000
commit3d200b2cc699b7e9516fe348e85498742f8278ad (patch)
tree38efb5c3c07ebbbb9b34e2b011e1e05ea14401ff /gcc/c-parse.in
parent34fc0dd7c19cdf0bac107f92b6f2002b751e96bd (diff)
downloadgcc-3d200b2cc699b7e9516fe348e85498742f8278ad.tar.gz
(datadef, fndef, ivar_decl, mydecls): Restore declspec_stack since
setspecs is used. (parmlist_or_identifiers): Use setspecs before parsing parms and restore after parsing parms. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@9760 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-parse.in')
-rw-r--r--gcc/c-parse.in82
1 files changed, 62 insertions, 20 deletions
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index 76c9670fdb0..70063f695c2 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -310,11 +310,22 @@ datadef:
{ if (pedantic)
error ("ANSI C forbids data definition with no type or storage class");
else if (!flag_traditional)
- warning ("data definition has no type or storage class"); }
+ warning ("data definition has no type or storage class");
+
+ current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary ($1); }
| declmods setspecs notype_initdecls ';'
- {}
+ { current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary ($2); }
| typed_declspecs setspecs initdecls ';'
- {}
+ { current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary ($2); }
| declmods ';'
{ pedwarn ("empty declaration"); }
| typed_declspecs ';'
@@ -334,9 +345,16 @@ fndef:
xdecls
{ store_parm_decls (); }
compstmt_or_error
- { finish_function (0); }
+ { finish_function (0);
+ current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary ($2); }
| typed_declspecs setspecs declarator error
- { }
+ { current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary ($2); }
| declmods setspecs notype_declarator
{ if (! start_function ($1, $3, prefix_attributes, 0))
YYERROR1;
@@ -344,9 +362,16 @@ fndef:
xdecls
{ store_parm_decls (); }
compstmt_or_error
- { finish_function (0); }
+ { finish_function (0);
+ current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary ($2); }
| declmods setspecs notype_declarator error
- { }
+ { current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary ($2); }
| setspecs notype_declarator
{ if (! start_function (NULL_TREE, $2, prefix_attributes, 0))
YYERROR1;
@@ -354,9 +379,16 @@ fndef:
xdecls
{ store_parm_decls (); }
compstmt_or_error
- { finish_function (0); }
+ { finish_function (0);
+ current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary ($1); }
| setspecs notype_declarator error
- { }
+ { current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary ($1); }
;
identifier:
@@ -2145,13 +2177,18 @@ parm:
where either a parmlist or an identifier list is ok.
Its value is a list of ..._TYPE nodes or a list of identifiers. */
parmlist_or_identifiers:
+ setspecs
{ pushlevel (0);
clear_parm_order ();
declare_parm_level (1); }
parmlist_or_identifiers_1
- { $$ = $2;
+ { $$ = $3;
parmlist_tags_warning ();
- poplevel (0, 0, 0); }
+ poplevel (0, 0, 0);
+ current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary ($1); }
;
parmlist_or_identifiers_1:
@@ -2410,15 +2447,17 @@ ivar_decls:
ivar_decl:
typed_typespecs setspecs ivars
- {
- $$ = $3;
- resume_momentary ($2);
- }
+ { $$ = $3;
+ 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 ivars
- {
- $$ = $3;
- resume_momentary ($2);
- }
+ { $$ = $3;
+ current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary ($2); }
| error
{ $$ = NULL_TREE; }
;
@@ -2595,7 +2634,10 @@ mydecls:
mydecl:
typed_declspecs setspecs myparms ';'
- { resume_momentary ($2); }
+ { current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
+ declspec_stack = TREE_CHAIN (declspec_stack);
+ resume_momentary ($2); }
| typed_declspecs ';'
{ shadow_tag ($1); }
| declmods ';'