mirror of
https://github.com/cc65/cc65.git
synced 2025-01-11 11:30:13 +00:00
Improved diagnostics on conflicting type declarations.
This commit is contained in:
parent
96df4e8b5e
commit
29c9cb3e00
@ -702,6 +702,7 @@ static int HandleSymRedefinition (SymEntry* Entry, const Type* T, unsigned Flags
|
|||||||
if (SCType == SC_TYPEDEF) {
|
if (SCType == SC_TYPEDEF) {
|
||||||
if (IsDistinctRedef (E_Type, T, TC_IDENTICAL, TCF_MASK_QUAL)) {
|
if (IsDistinctRedef (E_Type, T, TC_IDENTICAL, TCF_MASK_QUAL)) {
|
||||||
Error ("Conflicting types for typedef '%s'", Entry->Name);
|
Error ("Conflicting types for typedef '%s'", Entry->Name);
|
||||||
|
Note ("'%s' vs '%s'", GetFullTypeName (T), GetFullTypeName (E_Type));
|
||||||
Entry = 0;
|
Entry = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -728,7 +729,7 @@ static int HandleSymRedefinition (SymEntry* Entry, const Type* T, unsigned Flags
|
|||||||
/* New type must be compatible with the composite prototype */
|
/* New type must be compatible with the composite prototype */
|
||||||
if (IsDistinctRedef (E_Type, T, TC_EQUAL, TCF_MASK_QUAL)) {
|
if (IsDistinctRedef (E_Type, T, TC_EQUAL, TCF_MASK_QUAL)) {
|
||||||
Error ("Conflicting function types for '%s'", Entry->Name);
|
Error ("Conflicting function types for '%s'", Entry->Name);
|
||||||
TypeCompatibilityDiagnostic (T, E_Type, 0, "'%s' vs '%s'");
|
Note ("'%s' vs '%s'", GetFullTypeName (T), GetFullTypeName (E_Type));
|
||||||
Entry = 0;
|
Entry = 0;
|
||||||
} else {
|
} else {
|
||||||
/* Refine the existing composite prototype with this new
|
/* Refine the existing composite prototype with this new
|
||||||
@ -760,6 +761,7 @@ static int HandleSymRedefinition (SymEntry* Entry, const Type* T, unsigned Flags
|
|||||||
IsDistinctRedef (E_Type + 1, T + 1, TC_IDENTICAL, TCF_MASK_QUAL)) {
|
IsDistinctRedef (E_Type + 1, T + 1, TC_IDENTICAL, TCF_MASK_QUAL)) {
|
||||||
/* Conflicting element types */
|
/* Conflicting element types */
|
||||||
Error ("Conflicting array types for '%s[]'", Entry->Name);
|
Error ("Conflicting array types for '%s[]'", Entry->Name);
|
||||||
|
Note ("'%s' vs '%s'", GetFullTypeName (T), GetFullTypeName (E_Type));
|
||||||
Entry = 0;
|
Entry = 0;
|
||||||
} else {
|
} else {
|
||||||
/* Check if we have a size in the existing definition */
|
/* Check if we have a size in the existing definition */
|
||||||
@ -777,6 +779,7 @@ static int HandleSymRedefinition (SymEntry* Entry, const Type* T, unsigned Flags
|
|||||||
Entry = 0;
|
Entry = 0;
|
||||||
} else if (IsDistinctRedef (E_Type, T, TC_EQUAL, TCF_MASK_QUAL)) {
|
} else if (IsDistinctRedef (E_Type, T, TC_EQUAL, TCF_MASK_QUAL)) {
|
||||||
Error ("Conflicting types for '%s'", Entry->Name);
|
Error ("Conflicting types for '%s'", Entry->Name);
|
||||||
|
Note ("'%s' vs '%s'", GetFullTypeName (T), GetFullTypeName (E_Type));
|
||||||
Entry = 0;
|
Entry = 0;
|
||||||
} else if (E_SCType == SC_ENUMERATOR) {
|
} else if (E_SCType == SC_ENUMERATOR) {
|
||||||
/* Enumerators aren't allowed to be redeclared at all, even if
|
/* Enumerators aren't allowed to be redeclared at all, even if
|
||||||
|
Loading…
x
Reference in New Issue
Block a user