mirror of
https://github.com/cc65/cc65.git
synced 2025-08-09 13:25:06 +00:00
Added warning diagnostics for conflicts between extern/public and static declarations.
This commit is contained in:
@@ -813,11 +813,25 @@ SymEntry* AddGlobalSym (const char* Name, const Type* T, unsigned Flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If a static declaration follows a non-static declaration, then
|
||||||
|
** warn about the conflict. (It will compile a public declaration.)
|
||||||
|
*/
|
||||||
|
if ((Flags & SC_EXTERN) == 0 && (Entry->Flags & SC_EXTERN) != 0) {
|
||||||
|
Warning ("static declaration follows non-static declaration of `%s'.", Name);
|
||||||
|
}
|
||||||
|
|
||||||
/* An extern declaration must not change the current linkage. */
|
/* An extern declaration must not change the current linkage. */
|
||||||
if (IsFunc || (Flags & (SC_EXTERN | SC_DEF)) == SC_EXTERN) {
|
if (IsFunc || (Flags & (SC_EXTERN | SC_DEF)) == SC_EXTERN) {
|
||||||
Flags &= ~SC_EXTERN;
|
Flags &= ~SC_EXTERN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If a public declaration follows a static declaration, then
|
||||||
|
** warn about the conflict. (It will compile a public declaration.)
|
||||||
|
*/
|
||||||
|
if ((Flags & SC_EXTERN) != 0 && (Entry->Flags & SC_EXTERN) == 0) {
|
||||||
|
Warning ("public declaration follows static declaration of `%s'.", Name);
|
||||||
|
}
|
||||||
|
|
||||||
/* Add the new flags */
|
/* Add the new flags */
|
||||||
Entry->Flags |= Flags;
|
Entry->Flags |= Flags;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user