1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

Minor fixes for HandleSymRedefinition().

This commit is contained in:
acqn 2020-08-03 01:15:57 +08:00 committed by Oliver Schmidt
parent 80b0e57543
commit 00c16d34a4

View File

@ -549,7 +549,8 @@ SymEntry FindStructField (const Type* T, const char* Name)
static int HandleSymRedefinition (SymEntry* Entry, const Type* T, unsigned Flags)
/* Check and handle redefinition of existing symbols.
** Return ture if there *is* an error.
** Complete array sizes and function descriptors as well.
** Return true if there *is* an error.
*/
{
/* Get the type info of the existing symbol */
@ -594,8 +595,8 @@ static int HandleSymRedefinition (SymEntry* Entry, const Type* T, unsigned Flags
*/
if (IsTypeFunc (T)) {
/* New type must be identical */
if (TypeCmp (Entry->Type, T) < TC_EQUAL) {
/* New type must be equivalent */
if (TypeCmp (E_Type, T) < TC_EQUAL) {
Error ("Conflicting function types for '%s'", Entry->Name);
Entry = 0;
} else {
@ -614,6 +615,7 @@ static int HandleSymRedefinition (SymEntry* Entry, const Type* T, unsigned Flags
Error ("Redefinition of function '%s' as different kind of symbol", Entry->Name);
Entry = 0;
}
} else if (E_SCType == SC_TYPEDEF) {
if (SCType == SC_TYPEDEF) {
@ -622,9 +624,7 @@ static int HandleSymRedefinition (SymEntry* Entry, const Type* T, unsigned Flags
Error ("Conflicting types for typedef '%s'", Entry->Name);
Entry = 0;
}
} else {
Error ("Redefinition of typedef '%s' as different kind of symbol", Entry->Name);
Entry = 0;
}
@ -639,7 +639,10 @@ static int HandleSymRedefinition (SymEntry* Entry, const Type* T, unsigned Flags
Error ("Conflicting types for '%s'", Entry->Name);
Entry = 0;
} else if (E_SCType == SC_ENUMERATOR) {
/* Current code logic won't reach here, but still... */
/* Enumerators aren't allowed to be redeclared at all, even if
** all occurences are identical. The current code logic won't
** get here, but let's just do it.
*/
Error ("Redeclaration of enumerator constant '%s'", Entry->Name);
Entry = 0;
}