From b99ebc1256ff5400e70c7df8d97a708b45b23620 Mon Sep 17 00:00:00 2001 From: acqn Date: Mon, 27 Nov 2023 20:39:15 +0800 Subject: [PATCH] Fixed diagnostic messages about undeclared identifiers. --- src/cc65/asmstmt.c | 2 +- src/cc65/expr.c | 2 +- src/cc65/symtab.c | 2 +- test/ref/custom-reference-error.cref | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cc65/asmstmt.c b/src/cc65/asmstmt.c index 6cb6f2ef7..166d05434 100644 --- a/src/cc65/asmstmt.c +++ b/src/cc65/asmstmt.c @@ -102,7 +102,7 @@ static SymEntry* AsmGetSym (unsigned Arg, unsigned Type) /* Did we find a symbol with this name? */ if (Sym == 0) { - Error ("Undefined symbol '%s' for argument %u", CurTok.Ident, Arg); + Error ("Undeclared symbol '%s' for argument %u", CurTok.Ident, Arg); AsmErrorSkip (); return 0; } diff --git a/src/cc65/expr.c b/src/cc65/expr.c index f7ad5affc..6d4b04892 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -1322,10 +1322,10 @@ static void Primary (ExprDesc* E) E->Name = (uintptr_t) Sym->Name; } else { /* Undeclared Variable */ + Error ("Undeclared identifier '%s'", Ident); Sym = AddLocalSym (Ident, type_int, SC_AUTO | SC_REF, 0); E->Flags = E_LOC_STACK | E_RTYPE_LVAL; E->Type = type_int; - Error ("Undefined symbol: '%s'", Ident); } } diff --git a/src/cc65/symtab.c b/src/cc65/symtab.c index a7436b6b6..ee8e0bbf8 100644 --- a/src/cc65/symtab.c +++ b/src/cc65/symtab.c @@ -1484,7 +1484,7 @@ void MakeZPSym (const char* Name) if (Entry) { Entry->Flags |= SC_ZEROPAGE; } else { - Error ("Undefined symbol: '%s'", Name); + Error ("Undeclared symbol: '%s'", Name); } } diff --git a/test/ref/custom-reference-error.cref b/test/ref/custom-reference-error.cref index fa584f307..728cc0e15 100644 --- a/test/ref/custom-reference-error.cref +++ b/test/ref/custom-reference-error.cref @@ -1,5 +1,5 @@ custom-reference-error.c:18: Error: Call to undeclared function 'printf' -custom-reference-error.c:19: Error: Undefined symbol: 'n' +custom-reference-error.c:19: Error: Undeclared identifier 'n' custom-reference-error.c:21: Warning: Control reaches end of non-void function [-Wreturn-type] custom-reference-error.c:21: Warning: Parameter 'argc' is never used custom-reference-error.c:21: Warning: Parameter 'argv' is never used