mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-20 17:31:08 +00:00
Detect redefinitions of structs and unions
While the redefinition was being detected, it was misreported as the tag being wrong, and on the wrong line, too.
This commit is contained in:
parent
f2102187b9
commit
be4c3a82a2
1 changed files with 12 additions and 5 deletions
|
@ -584,8 +584,13 @@ struct_specifier
|
|||
{
|
||||
symbol_t *sym;
|
||||
sym = find_struct ($1, $2, 0);
|
||||
if (!sym->table)
|
||||
if (!sym->table) {
|
||||
symtab_addsymbol (current_symtab, sym);
|
||||
} else {
|
||||
error (0, "%s %s redefined", $1 == 's' ? "struct" : "union",
|
||||
$2->name);
|
||||
$1 = 0;
|
||||
}
|
||||
current_symtab = new_symtab (current_symtab, stab_local);
|
||||
}
|
||||
struct_defs '}'
|
||||
|
@ -594,10 +599,12 @@ struct_specifier
|
|||
symtab_t *symtab = current_symtab;
|
||||
current_symtab = symtab->parent;
|
||||
|
||||
sym = build_struct ($1, $2, symtab, 0);
|
||||
$$ = make_spec (sym->type, 0, 0, 0);
|
||||
if (!sym->table)
|
||||
symtab_addsymbol (current_symtab, sym);
|
||||
if ($1) {
|
||||
sym = build_struct ($1, $2, symtab, 0);
|
||||
$$ = make_spec (sym->type, 0, 0, 0);
|
||||
if (!sym->table)
|
||||
symtab_addsymbol (current_symtab, sym);
|
||||
}
|
||||
}
|
||||
| STRUCT tag
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue