mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-19 07:20:50 +00:00
Delay calling find_type for enums.
As find_type encodes the type too, calling find_type before the enumerators have been created causes the type encoding to lose the enumerators.
This commit is contained in:
parent
7a504f8983
commit
46d2959908
3 changed files with 12 additions and 2 deletions
|
@ -49,6 +49,7 @@ struct symbol_s *build_struct (int su, struct symbol_s *tag,
|
||||||
struct symtab_s *symtab, struct type_s *type);
|
struct symtab_s *symtab, struct type_s *type);
|
||||||
struct symbol_s *find_enum (struct symbol_s *tag);
|
struct symbol_s *find_enum (struct symbol_s *tag);
|
||||||
struct symtab_s *start_enum (struct symbol_s *enm);
|
struct symtab_s *start_enum (struct symbol_s *enm);
|
||||||
|
struct symbol_s *finish_enum (struct symbol_s *sym);
|
||||||
void add_enum (struct symbol_s *enm, struct symbol_s *name,
|
void add_enum (struct symbol_s *enm, struct symbol_s *name,
|
||||||
struct expr_s *val);
|
struct expr_s *val);
|
||||||
int enum_as_bool (struct type_s *enm, struct expr_s **zero,
|
int enum_as_bool (struct type_s *enm, struct expr_s **zero,
|
||||||
|
|
|
@ -552,7 +552,10 @@ optional_enum_list
|
||||||
;
|
;
|
||||||
|
|
||||||
enum_list
|
enum_list
|
||||||
: '{' enum_init enumerator_list optional_comma '}' { $$ = $3; }
|
: '{' enum_init enumerator_list optional_comma '}'
|
||||||
|
{
|
||||||
|
$$ = finish_enum ($3);
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
enum_init
|
enum_init
|
||||||
|
|
|
@ -153,10 +153,16 @@ start_enum (symbol_t *sym)
|
||||||
sym = find_enum (0);
|
sym = find_enum (0);
|
||||||
}
|
}
|
||||||
sym->type->t.symtab = new_symtab (current_symtab, stab_local);
|
sym->type->t.symtab = new_symtab (current_symtab, stab_local);
|
||||||
sym->type = find_type (sym->type);
|
|
||||||
return sym->type->t.symtab;
|
return sym->type->t.symtab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
symbol_t *
|
||||||
|
finish_enum (symbol_t *sym)
|
||||||
|
{
|
||||||
|
sym->type = find_type (sym->type);
|
||||||
|
return sym;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
add_enum (symbol_t *enm, symbol_t *name, expr_t *val)
|
add_enum (symbol_t *enm, symbol_t *name, expr_t *val)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue