diff --git a/src/cc65/compile.c b/src/cc65/compile.c index 0dc75273d..94e389292 100644 --- a/src/cc65/compile.c +++ b/src/cc65/compile.c @@ -273,11 +273,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. @@ -539,10 +540,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); + } } }