1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +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 */
Error ("Symbol '%s' is already different kind", Name);
Entry = 0;
} else {
} else if (Type != 0) {
/* Define the struct size if the underlying type is given. */
if (Type != 0) {
if (Type !=0 && Entry->V.E.Type != 0) {
/* Both are definitions. */
Error ("Multiple definition for enum '%s'", Name);
Entry = 0;
} else {
Entry->Type = 0;
Entry->V.E.SymTab = Tab;
Entry->V.E.Type = Type;
}
if (Entry->V.E.Type != 0) {
/* Both are definitions. */
Error ("Multiple definition for 'enum %s'", Name);
Entry = 0;
} else {
Entry->V.E.SymTab = Tab;
Entry->V.E.Type = Type;
Entry->Flags &= ~SC_DECL;
Entry->Flags |= SC_DEF;
}
}
@ -724,7 +723,6 @@ SymEntry* AddEnumSym (const char* Name, const Type* Type, SymTable* Tab)
Entry = NewSymEntry (Name, SC_ENUM);
/* Set the enum type data */
Entry->Type = 0;
Entry->V.E.SymTab = Tab;
Entry->V.E.Type = Type;