Fix storage class for for-loop declarations

Getting "i redeclared" when i was declared in a for loop in two
different functions was a tad unexpected.
This commit is contained in:
Bill Currie 2020-02-19 10:50:15 +09:00
parent 67e183c8b6
commit 7a315b4a89

View file

@ -153,7 +153,7 @@ int yylex (void);
%token PROTECTED PROTOCOL PUBLIC SELECTOR REFERENCE SELF THIS
%type <spec> optional_specifiers specifiers local_specifiers
%type <spec> storage_class save_storage
%type <spec> storage_class save_storage set_spec_storage
%type <spec> type_specifier type_specifier_or_storage_class
%type <spec> type
@ -349,6 +349,14 @@ save_storage
}
;
set_spec_storage
: /* emtpy */
{
$$ = $<spec>0;
$$.storage = current_storage;
}
;
function_body
: optional_state_expr
{
@ -1229,7 +1237,7 @@ switch_block
opt_init
: cexpr
| type init_var_decl_list { $$ = $2; }
| type set_spec_storage init_var_decl_list { $$ = $3; }
| /* empty */
{
$$ = 0;