Commit 962a2496 by Richard Kenner

(datadef, fndef, ivar_decl, mydecls): Restore declspec_stack since setspecs is used.

(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.

From-SVN: r9760
parent 4f6cd2e6
...@@ -310,11 +310,22 @@ datadef: ...@@ -310,11 +310,22 @@ datadef:
{ if (pedantic) { if (pedantic)
error ("ANSI C forbids data definition with no type or storage class"); error ("ANSI C forbids data definition with no type or storage class");
else if (!flag_traditional) 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 ';' | 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 ';' | 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 ';' | declmods ';'
{ pedwarn ("empty declaration"); } { pedwarn ("empty declaration"); }
| typed_declspecs ';' | typed_declspecs ';'
...@@ -334,9 +345,16 @@ fndef: ...@@ -334,9 +345,16 @@ fndef:
xdecls xdecls
{ store_parm_decls (); } { store_parm_decls (); }
compstmt_or_error 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 | 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 | declmods setspecs notype_declarator
{ if (! start_function ($1, $3, prefix_attributes, 0)) { if (! start_function ($1, $3, prefix_attributes, 0))
YYERROR1; YYERROR1;
...@@ -344,9 +362,16 @@ fndef: ...@@ -344,9 +362,16 @@ fndef:
xdecls xdecls
{ store_parm_decls (); } { store_parm_decls (); }
compstmt_or_error 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 | 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 | setspecs notype_declarator
{ if (! start_function (NULL_TREE, $2, prefix_attributes, 0)) { if (! start_function (NULL_TREE, $2, prefix_attributes, 0))
YYERROR1; YYERROR1;
...@@ -354,9 +379,16 @@ fndef: ...@@ -354,9 +379,16 @@ fndef:
xdecls xdecls
{ store_parm_decls (); } { store_parm_decls (); }
compstmt_or_error 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 | 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: identifier:
...@@ -2145,13 +2177,18 @@ parm: ...@@ -2145,13 +2177,18 @@ parm:
where either a parmlist or an identifier list is ok. where either a parmlist or an identifier list is ok.
Its value is a list of ..._TYPE nodes or a list of identifiers. */ Its value is a list of ..._TYPE nodes or a list of identifiers. */
parmlist_or_identifiers: parmlist_or_identifiers:
setspecs
{ pushlevel (0); { pushlevel (0);
clear_parm_order (); clear_parm_order ();
declare_parm_level (1); } declare_parm_level (1); }
parmlist_or_identifiers_1 parmlist_or_identifiers_1
{ $$ = $2; { $$ = $3;
parmlist_tags_warning (); 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: parmlist_or_identifiers_1:
...@@ -2410,15 +2447,17 @@ ivar_decls: ...@@ -2410,15 +2447,17 @@ ivar_decls:
ivar_decl: ivar_decl:
typed_typespecs setspecs ivars typed_typespecs setspecs ivars
{ { $$ = $3;
$$ = $3; current_declspecs = TREE_VALUE (declspec_stack);
resume_momentary ($2); prefix_attributes = TREE_PURPOSE (declspec_stack);
} declspec_stack = TREE_CHAIN (declspec_stack);
resume_momentary ($2); }
| nonempty_type_quals setspecs ivars | nonempty_type_quals setspecs ivars
{ { $$ = $3;
$$ = $3; current_declspecs = TREE_VALUE (declspec_stack);
resume_momentary ($2); prefix_attributes = TREE_PURPOSE (declspec_stack);
} declspec_stack = TREE_CHAIN (declspec_stack);
resume_momentary ($2); }
| error | error
{ $$ = NULL_TREE; } { $$ = NULL_TREE; }
; ;
...@@ -2595,7 +2634,10 @@ mydecls: ...@@ -2595,7 +2634,10 @@ mydecls:
mydecl: mydecl:
typed_declspecs setspecs myparms ';' 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 ';' | typed_declspecs ';'
{ shadow_tag ($1); } { shadow_tag ($1); }
| declmods ';' | declmods ';'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment