[qfcc] Make initialization of external vars an error

This commit is contained in:
Bill Currie 2020-03-03 17:32:48 +09:00
parent 051a572bcc
commit b186332da0
2 changed files with 5 additions and 2 deletions

View file

@ -575,7 +575,7 @@ initialize_def (symbol_t *sym, expr_t *init, defspace_t *space,
internal_error (0, "half defined var");
if (storage == sc_extern) {
if (init)
warning (0, "initializing external variable");
error (0, "initializing external variable");
return;
}
if (init && check->s.def->initialized) {
@ -611,7 +611,7 @@ initialize_def (symbol_t *sym, expr_t *init, defspace_t *space,
init_field_def (sym->s.def, init, storage);
if (storage == sc_extern) {
if (init)
warning (0, "initializing external variable");
error (0, "initializing external variable");
return;
}
if (!init)

View file

@ -1021,6 +1021,9 @@ overloaded_identifier
non_code_func
: '=' '#' expr
{
if ($<spec>-1.storage == sc_extern) {
error (0, "initializing external variable");
}
build_builtin_function ($<symbol>0, $3, 0);
}
| '=' expr