mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
detect multiple initializations of globals
This commit is contained in:
parent
8a9cd78072
commit
2d766710b6
1 changed files with 7 additions and 3 deletions
|
@ -409,11 +409,15 @@ var_initializer
|
||||||
def_initialized ($<def>0);
|
def_initialized ($<def>0);
|
||||||
} else {
|
} else {
|
||||||
if ($2->type >= ex_string) {
|
if ($2->type >= ex_string) {
|
||||||
|
if ($<def>0->constant) {
|
||||||
|
error ($2, "%s re-initialized", $<def>0->name);
|
||||||
|
} else {
|
||||||
if ($<def>0->type->type == ev_func) {
|
if ($<def>0->type->type == ev_func) {
|
||||||
PARSE_ERROR;
|
PARSE_ERROR;
|
||||||
} else {
|
} else {
|
||||||
ReuseConstant ($2, $<def>0);
|
ReuseConstant ($2, $<def>0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
error ($2, "non-constant expression used for initializer");
|
error ($2, "non-constant expression used for initializer");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue