From: cuz Date: Thu, 9 Oct 2003 18:56:38 +0000 (+0000) Subject: Fixed a bug - enum tags were inserted into the wrong table X-Git-Tag: V2.12.0~1289 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=89d4ba55538a71466b93db374d4ce4d8cdb5b57a;p=cc65 Fixed a bug - enum tags were inserted into the wrong table git-svn-id: svn://svn.cc65.org/cc65/trunk@2484 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/symtab.c b/src/cc65/symtab.c index 2c50775d7..1a8f67ebe 100644 --- a/src/cc65/symtab.c +++ b/src/cc65/symtab.c @@ -584,8 +584,11 @@ SymEntry* AddStructSym (const char* Name, unsigned Size, SymTable* Tab) SymEntry* AddConstSym (const char* Name, const type* Type, unsigned Flags, long Val) /* Add an constant symbol to the symbol table and return it */ { + /* Enums must be inserted in the global symbol table */ + SymTable* Tab = ((Flags & SC_ENUM) == SC_ENUM)? SymTab0 : SymTab; + /* Do we have an entry with this name already? */ - SymEntry* Entry = FindSymInTable (SymTab, Name, HashStr (Name)); + SymEntry* Entry = FindSymInTable (Tab, Name, HashStr (Name)); if (Entry) { if ((Entry->Flags & SC_CONST) != SC_CONST) { Error ("Symbol `%s' is already different kind", Name); @@ -605,7 +608,7 @@ SymEntry* AddConstSym (const char* Name, const type* Type, unsigned Flags, long Entry->V.ConstVal = Val; /* Add the entry to the symbol table */ - AddSymEntry (SymTab, Entry); + AddSymEntry (Tab, Entry); /* Return the entry */ return Entry; @@ -727,7 +730,7 @@ SymEntry* AddGlobalSym (const char* Name, const type* Type, unsigned Flags) return Entry; } else { /* Check if we have a size in the existing definition */ - if (ESize == UNSPECIFIED) { + if (ESize == UNSPECIFIED) { /* Existing, size not given, use size from new def */ Encode (EType + 1, Size); }