detect multiple initializations of globals

This commit is contained in:
Bill Currie 2003-01-29 22:29:37 +00:00
parent 8a9cd78072
commit 2d766710b6

View file

@ -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");
} }