mirror of
https://github.com/cc65/cc65.git
synced 2024-12-23 04:30:10 +00:00
Improved diagnostics on multiple definition of struct/union types.
This commit is contained in:
parent
87f8893886
commit
d8a722b638
@ -1220,11 +1220,6 @@ NextMember: if (CurTok.Tok != TOK_COMMA) {
|
||||
Flags |= SC_FICTITIOUS;
|
||||
}
|
||||
|
||||
/* Empty union is not supported now */
|
||||
if (UnionSize == 0) {
|
||||
Error ("Empty union type '%s' is not supported", Name);
|
||||
}
|
||||
|
||||
/* Make a real entry from the forward decl and return it */
|
||||
return AddStructSym (Name, SC_UNION | SC_DEF | Flags, UnionSize, FieldTab, DSFlags);
|
||||
}
|
||||
@ -1471,11 +1466,6 @@ NextMember: if (CurTok.Tok != TOK_COMMA) {
|
||||
Flags |= SC_FICTITIOUS;
|
||||
}
|
||||
|
||||
/* Empty struct is not supported now */
|
||||
if (StructSize == 0) {
|
||||
Error ("Empty struct type '%s' is not supported", Name);
|
||||
}
|
||||
|
||||
/* Make a real entry from the forward decl and return it */
|
||||
return AddStructSym (Name, SC_STRUCT | SC_DEF | Flags, StructSize, FieldTab, DSFlags);
|
||||
}
|
||||
|
@ -919,14 +919,8 @@ SymEntry* AddStructSym (const char* Name, unsigned Flags, unsigned Size, SymTabl
|
||||
/* SCType must be struct or union */
|
||||
PRECONDITION (SCType == SC_STRUCT || SCType == SC_UNION);
|
||||
|
||||
if ((Flags & SC_FICTITIOUS) == 0) {
|
||||
/* Do we have an entry with this name already? */
|
||||
TagEntry = FindSymInTable (CurTagTab, Name, HashStr (Name));
|
||||
} else {
|
||||
/* Add a fictitious symbol in the fail-safe table */
|
||||
TagEntry = 0;
|
||||
CurTagTab = FailSafeTab;
|
||||
}
|
||||
/* Do we have an entry with this name already? */
|
||||
TagEntry = FindSymInTable (CurTagTab, Name, HashStr (Name));
|
||||
|
||||
if (TagEntry) {
|
||||
|
||||
@ -954,6 +948,15 @@ SymEntry* AddStructSym (const char* Name, unsigned Flags, unsigned Size, SymTabl
|
||||
if (DSFlags != 0) {
|
||||
*DSFlags |= DS_NEW_TYPE_DEF;
|
||||
}
|
||||
|
||||
if ((Flags & SC_FICTITIOUS) == SC_FICTITIOUS) {
|
||||
/* Add a fictitious symbol in the fail-safe table */
|
||||
TagEntry = 0;
|
||||
} else if (Size == 0) {
|
||||
/* Empty struct is not supported now */
|
||||
Error ("Empty %s type '%s' is not supported", SCType == SC_STRUCT ? "struct" : "union", Name);
|
||||
TagEntry = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user