mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Fix self-referenced enum declarations
eg: typedef enum foo { bar = 1, baz = bar, } foo;
This commit is contained in:
parent
ed283a9e7f
commit
ee228504aa
2 changed files with 3 additions and 0 deletions
|
@ -553,6 +553,7 @@ optional_enum_list
|
|||
enum_list
|
||||
: '{' enum_init enumerator_list optional_comma '}'
|
||||
{
|
||||
current_symtab = current_symtab->parent;
|
||||
$$ = finish_enum ($3);
|
||||
}
|
||||
;
|
||||
|
@ -562,6 +563,7 @@ enum_init
|
|||
{
|
||||
$$ = find_enum ($<symbol>-1);
|
||||
start_enum ($$);
|
||||
current_symtab = $$->type->t.symtab;
|
||||
}
|
||||
;
|
||||
|
||||
|
|
|
@ -201,6 +201,7 @@ add_enum (symbol_t *enm, symbol_t *name, expr_t *val)
|
|||
if (enum_tab->symbols)
|
||||
value = ((symbol_t *)(enum_tab->symtail))->s.value->v.integer_val + 1;
|
||||
if (val) {
|
||||
convert_name (val);
|
||||
if (!is_constant (val))
|
||||
error (val, "non-constant initializer");
|
||||
else if (!is_integer_val (val))
|
||||
|
|
Loading…
Reference in a new issue