1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-11 11:30:13 +00:00

Set enum tag definition flags.

This commit is contained in:
acqn 2020-08-08 06:45:45 +08:00 committed by Oliver Schmidt
parent 1dd899c7c9
commit 0f1a5e0520

View File

@ -697,18 +697,17 @@ SymEntry* AddEnumSym (const char* Name, const Type* Type, SymTable* Tab)
/* Existing symbol is not an enum */ /* Existing symbol is not an enum */
Error ("Symbol '%s' is already different kind", Name); Error ("Symbol '%s' is already different kind", Name);
Entry = 0; Entry = 0;
} else { } else if (Type != 0) {
/* Define the struct size if the underlying type is given. */ /* Define the struct size if the underlying type is given. */
if (Type != 0) { if (Entry->V.E.Type != 0) {
if (Type !=0 && Entry->V.E.Type != 0) { /* Both are definitions. */
/* Both are definitions. */ Error ("Multiple definition for 'enum %s'", Name);
Error ("Multiple definition for enum '%s'", Name); Entry = 0;
Entry = 0; } else {
} else { Entry->V.E.SymTab = Tab;
Entry->Type = 0; Entry->V.E.Type = Type;
Entry->V.E.SymTab = Tab; Entry->Flags &= ~SC_DECL;
Entry->V.E.Type = Type; Entry->Flags |= SC_DEF;
}
} }
} }
@ -724,7 +723,6 @@ SymEntry* AddEnumSym (const char* Name, const Type* Type, SymTable* Tab)
Entry = NewSymEntry (Name, SC_ENUM); Entry = NewSymEntry (Name, SC_ENUM);
/* Set the enum type data */ /* Set the enum type data */
Entry->Type = 0;
Entry->V.E.SymTab = Tab; Entry->V.E.SymTab = Tab;
Entry->V.E.Type = Type; Entry->V.E.Type = Type;