[qfcc] Accept "struct foo; struct foo { ... };"

That is, do not treat structure definition after declaration to be a
redefinition.
This commit is contained in:
Bill Currie 2020-03-02 20:16:29 +09:00
parent d91289ea1b
commit e33d83fc9e

View file

@ -610,9 +610,18 @@ struct_specifier
if (!sym->table) {
symtab_addsymbol (current_symtab, sym);
} else {
error (0, "%s %s redefined", $1 == 's' ? "struct" : "union",
$2->name);
$1 = 0;
if (!sym->type) {
internal_error (0, "broken structure symbol?");
}
if (sym->type->meta == ty_enum
|| (sym->type->meta == ty_struct && sym->type->t.symtab)) {
error (0, "%s %s redefined",
$1 == 's' ? "struct" : "union", $2->name);
$1 = 0;
} else if (sym->type->meta != ty_struct) {
internal_error (0, "%s is not a struct or union",
$2->name);
}
}
current_symtab = new_symtab (current_symtab, stab_local);
}