From ee7d912e9bee15749519edd9775a4eff14dc6f25 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Thu, 9 Mar 1995 21:33:33 -0500 Subject: [PATCH] (fndef, nested_function): Pass prefix_attributes to start_function. (setspecs): Save prefix_attributes in declspec_stack. (decl rules): Restore prefix_attributes along with current_declspecs. (setattrs): Concatenate prefix_attributes to previous value. From-SVN: r9151 --- gcc/c-parse.in | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/gcc/c-parse.in b/gcc/c-parse.in index b6621f3dc2f..f97751668fc 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -238,7 +238,7 @@ static int if_stmt_line; 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. */ @@ -328,7 +328,7 @@ datadef: 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 @@ -338,7 +338,7 @@ fndef: | 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 @@ -348,7 +348,7 @@ fndef: | 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 @@ -851,10 +851,12 @@ datadecls: 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 ';' @@ -887,31 +889,36 @@ decls: 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 = $0; prefix_attributes = NULL_TREE; } ; setattrs: /* empty */ - { prefix_attributes = $0; } + { prefix_attributes = chainon (prefix_attributes, $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 ';' @@ -1183,7 +1190,8 @@ end ifc 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; @@ -1204,7 +1212,8 @@ nested_function: 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; @@ -1394,6 +1403,7 @@ component_decl: 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 @@ -1404,6 +1414,7 @@ component_decl: | 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 -- 2.30.2