mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 21:20:33 +00:00
[qfcc] Support anonymous structs in ivars
Missed this earlier.
This commit is contained in:
parent
0bb4279a9f
commit
896c14f33a
2 changed files with 20 additions and 1 deletions
|
@ -1873,6 +1873,24 @@ ivar_decls
|
|||
|
||||
ivar_decl
|
||||
: type ivars
|
||||
| type
|
||||
{
|
||||
if (is_anonymous_struct ($1)) {
|
||||
// anonymous struct/union
|
||||
// type->name always begins with "tag "
|
||||
$1.sym = new_symbol (va (".anonymous.%s", $1.type->name + 4));
|
||||
$1.sym->type = $1.type;
|
||||
$1.sym->sy_type = sy_var;
|
||||
$1.sym->visibility = vis_anonymous;
|
||||
symtab_addsymbol (current_symtab, $1.sym);
|
||||
if (!$1.sym->table) {
|
||||
error (0, "duplicate field `%s'", $1.sym->name);
|
||||
}
|
||||
} else {
|
||||
// bare type
|
||||
warning (0, "declaration does not declare anything");
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
ivars
|
||||
|
|
|
@ -182,7 +182,8 @@ symtab_flat_copy (symtab_t *symtab, symtab_t *parent)
|
|||
newtab = new_symtab (parent, stab_local);
|
||||
do {
|
||||
for (symbol = symtab->symbols; symbol; symbol = symbol->next) {
|
||||
if (Hash_Find (newtab->tab, symbol->name))
|
||||
if (symbol->visibility == vis_anonymous
|
||||
|| Hash_Find (newtab->tab, symbol->name))
|
||||
continue;
|
||||
newsym = copy_symbol (symbol);
|
||||
symtab_addsymbol (newtab, newsym);
|
||||
|
|
Loading…
Reference in a new issue