mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 21:20:33 +00:00
[qfcc] Make initialization of external vars an error
This commit is contained in:
parent
051a572bcc
commit
b186332da0
2 changed files with 5 additions and 2 deletions
|
@ -575,7 +575,7 @@ initialize_def (symbol_t *sym, expr_t *init, defspace_t *space,
|
||||||
internal_error (0, "half defined var");
|
internal_error (0, "half defined var");
|
||||||
if (storage == sc_extern) {
|
if (storage == sc_extern) {
|
||||||
if (init)
|
if (init)
|
||||||
warning (0, "initializing external variable");
|
error (0, "initializing external variable");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (init && check->s.def->initialized) {
|
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);
|
init_field_def (sym->s.def, init, storage);
|
||||||
if (storage == sc_extern) {
|
if (storage == sc_extern) {
|
||||||
if (init)
|
if (init)
|
||||||
warning (0, "initializing external variable");
|
error (0, "initializing external variable");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!init)
|
if (!init)
|
||||||
|
|
|
@ -1021,6 +1021,9 @@ overloaded_identifier
|
||||||
non_code_func
|
non_code_func
|
||||||
: '=' '#' expr
|
: '=' '#' expr
|
||||||
{
|
{
|
||||||
|
if ($<spec>-1.storage == sc_extern) {
|
||||||
|
error (0, "initializing external variable");
|
||||||
|
}
|
||||||
build_builtin_function ($<symbol>0, $3, 0);
|
build_builtin_function ($<symbol>0, $3, 0);
|
||||||
}
|
}
|
||||||
| '=' expr
|
| '=' expr
|
||||||
|
|
Loading…
Reference in a new issue