Allow zero size arrays to match sized arrays of the same type.

This allows externally declared arrays to not specify a size.
This commit is contained in:
Bill Currie 2011-02-15 12:08:03 +09:00
parent b2d4aee61e
commit b3da6ef3d4

View file

@ -199,8 +199,13 @@ make_symbol (const char *name, type_t *type, defspace_t *space,
sym = new_symbol_type (name, type);
}
if (sym->type != type) {
error (0, "%s redefined", name);
sym = new_symbol_type (name, type);
if (is_array (sym->type) && is_array (type)
&& !sym->type->t.array.size) {
sym->type = type;
} else {
error (0, "%s redefined", name);
sym = new_symbol_type (name, type);
}
}
if (sym->s.def && sym->s.def->external && storage != st_extern) {
relocs = sym->s.def->relocs;