mirror of
https://github.com/cc65/cc65.git
synced 2024-12-23 19:29:37 +00:00
Added warning on static functions that are used but not defined.
This commit is contained in:
parent
05aae60816
commit
a5746227dc
@ -273,11 +273,12 @@ static void Parse (void)
|
|||||||
if (IsTypeVoid (Decl.Type)) {
|
if (IsTypeVoid (Decl.Type)) {
|
||||||
/* We cannot declare variables of type void */
|
/* We cannot declare variables of type void */
|
||||||
Error ("Illegal type for variable '%s'", Decl.Ident);
|
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)) {
|
} else if (Size == 0 && SymIsDef (Sym) && !IsEmptiableObjectType (Decl.Type)) {
|
||||||
/* Size is unknown. Is it an array? */
|
/* Size is unknown. Is it an array? */
|
||||||
if (!IsTypeArray (Decl.Type)) {
|
if (!IsTypeArray (Decl.Type)) {
|
||||||
Error ("Variable '%s' has unknown size", Decl.Ident);
|
Error ("Variable '%s' has unknown size", Decl.Ident);
|
||||||
|
Sym->Flags |= SC_DEF;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Check for enum forward declaration.
|
/* Check for enum forward declaration.
|
||||||
@ -539,10 +540,16 @@ void Compile (const char* FileName)
|
|||||||
Entry->Flags |= SC_DEF;
|
Entry->Flags |= SC_DEF;
|
||||||
} else if (!IsTypeArray (Entry->Type)) {
|
} else if (!IsTypeArray (Entry->Type)) {
|
||||||
/* Tentative declared variable is still of incomplete 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,
|
Entry->Name,
|
||||||
GetFullTypeName (Entry->Type));
|
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…
Reference in New Issue
Block a user