mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-01 09:02:08 +00:00
[qfcc] Accept "struct foo; struct foo { ... };"
That is, do not treat structure definition after declaration to be a redefinition.
This commit is contained in:
parent
d91289ea1b
commit
e33d83fc9e
1 changed files with 12 additions and 3 deletions
|
@ -610,9 +610,18 @@ struct_specifier
|
||||||
if (!sym->table) {
|
if (!sym->table) {
|
||||||
symtab_addsymbol (current_symtab, sym);
|
symtab_addsymbol (current_symtab, sym);
|
||||||
} else {
|
} else {
|
||||||
error (0, "%s %s redefined", $1 == 's' ? "struct" : "union",
|
if (!sym->type) {
|
||||||
$2->name);
|
internal_error (0, "broken structure symbol?");
|
||||||
$1 = 0;
|
}
|
||||||
|
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);
|
current_symtab = new_symtab (current_symtab, stab_local);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue