mirror of
https://github.com/cc65/cc65.git
synced 2025-02-06 12:31:12 +00:00
Merge pull request #2309 from acqn/Diagnostics
[cc65] Added warning on static functions that are used but not defined
This commit is contained in:
commit
9e3d1e1027
@ -281,11 +281,12 @@ static void Parse (void)
|
||||
if (IsTypeVoid (Decl.Type)) {
|
||||
/* We cannot declare variables of type void */
|
||||
Error ("Illegal type for variable '%s'", Decl.Ident);
|
||||
Sym->Flags &= ~(SC_STORAGE | SC_DEF);
|
||||
Sym->Flags |= SC_DEF;
|
||||
} else if (Size == 0 && SymIsDef (Sym) && !IsEmptiableObjectType (Decl.Type)) {
|
||||
/* Size is unknown. Is it an array? */
|
||||
if (!IsTypeArray (Decl.Type)) {
|
||||
Error ("Variable '%s' has unknown size", Decl.Ident);
|
||||
Sym->Flags |= SC_DEF;
|
||||
}
|
||||
} else {
|
||||
/* Check for enum forward declaration.
|
||||
@ -547,10 +548,16 @@ void Compile (const char* FileName)
|
||||
Entry->Flags |= SC_DEF;
|
||||
} else if (!IsTypeArray (Entry->Type)) {
|
||||
/* Tentative declared variable is still of incomplete type */
|
||||
Error ("Definition of '%s' has type '%s' that is never completed",
|
||||
Error ("Definition of '%s' never has its type '%s' completed",
|
||||
Entry->Name,
|
||||
GetFullTypeName (Entry->Type));
|
||||
}
|
||||
} else if (!SymIsDef (Entry) && (Entry->Flags & SC_FUNC) == SC_FUNC) {
|
||||
/* Check for undefined functions */
|
||||
if ((Entry->Flags & (SC_EXTERN | SC_STATIC)) == SC_STATIC && SymIsRef (Entry)) {
|
||||
Warning ("Static function '%s' used but never defined",
|
||||
Entry->Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user