Skip to content

Commit

Permalink
Fixed diagnostic messages about undeclared identifiers.
Browse files Browse the repository at this point in the history
  • Loading branch information
acqn committed Nov 27, 2023
1 parent 7574e36 commit b99ebc1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cc65/asmstmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/cc65/expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/cc65/symtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/ref/custom-reference-error.cref
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b99ebc1

Please sign in to comment.