static tree current_declspecs;
static tree prefix_attributes = NULL_TREE;
-/* Stack of saved values of current_declspecs. */
+/* Stack of saved values of current_declspecs and prefix_attributes. */
static tree declspec_stack;
/* 1 if we explained undeclared var errors. */
\f
fndef:
typed_declspecs setspecs declarator
- { if (! start_function ($1, $3, 0))
+ { if (! start_function ($1, $3, prefix_attributes, 0))
YYERROR1;
reinit_parse_for_function (); }
xdecls
| typed_declspecs setspecs declarator error
{ }
| declmods setspecs notype_declarator
- { if (! start_function ($1, $3, 0))
+ { if (! start_function ($1, $3, prefix_attributes, 0))
YYERROR1;
reinit_parse_for_function (); }
xdecls
| declmods setspecs notype_declarator error
{ }
| setspecs notype_declarator
- { if (! start_function (NULL_TREE, $2, 0))
+ { if (! start_function (NULL_TREE, $2, prefix_attributes, 0))
YYERROR1;
reinit_parse_for_function (); }
xdecls
datadecl:
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 setspecs notype_initdecls ';'
- { current_declspecs = TREE_VALUE (declspec_stack);
+ { current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
declspec_stack = TREE_CHAIN (declspec_stack);
resume_momentary ($2); }
| typed_declspecs ';'
setspecs: /* empty */
{ $$ = suspend_momentary ();
pending_xref_error ();
- declspec_stack = tree_cons (NULL_TREE, current_declspecs,
+ declspec_stack = tree_cons (prefix_attributes,
+ current_declspecs,
declspec_stack);
current_declspecs = $<ttype>0;
prefix_attributes = NULL_TREE; }
;
setattrs: /* empty */
- { prefix_attributes = $<ttype>0; }
+ { prefix_attributes = chainon (prefix_attributes, $<ttype>0); }
;
decl:
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 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 nested_function
{ current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
declspec_stack = TREE_CHAIN (declspec_stack);
resume_momentary ($2); }
| declmods setspecs notype_nested_function
{ current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
declspec_stack = TREE_CHAIN (declspec_stack);
resume_momentary ($2); }
| typed_declspecs ';'
nested_function:
declarator
{ push_c_function_context ();
- if (! start_function (current_declspecs, $1, 1))
+ if (! start_function (current_declspecs, $1,
+ prefix_attributes, 1))
{
pop_c_function_context ();
YYERROR1;
notype_nested_function:
notype_declarator
{ push_c_function_context ();
- if (! start_function (current_declspecs, $1, 1))
+ if (! start_function (current_declspecs, $1,
+ prefix_attributes, 1))
{
pop_c_function_context ();
YYERROR1;
typed_typespecs setspecs components
{ $$ = $3;
current_declspecs = TREE_VALUE (declspec_stack);
+ prefix_attributes = TREE_PURPOSE (declspec_stack);
declspec_stack = TREE_CHAIN (declspec_stack);
resume_momentary ($2); }
| typed_typespecs
| nonempty_type_quals setspecs components
{ $$ = $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