1
0
mirror of https://github.com/cc65/cc65.git synced 2025-02-03 22:32:24 +00:00

Error handling cleanup/changes.

git-svn-id: svn://svn.cc65.org/cc65/trunk@369 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2000-10-15 19:52:01 +00:00
parent 5cf9e0af18
commit 221ef5a9c2
14 changed files with 115 additions and 213 deletions

View File

@ -3372,7 +3372,7 @@ void g_lt (unsigned flags, unsigned long val)
/* Give a warning in some special cases */
if ((flags & CF_UNSIGNED) && val == 0) {
Warning (WARN_COND_NEVER_TRUE);
Warning ("Condition is never true");
}
/* Look at the type */
@ -3587,7 +3587,7 @@ void g_ge (unsigned flags, unsigned long val)
/* Give a warning in some special cases */
if ((flags & CF_UNSIGNED) && val == 0) {
Warning (WARN_COND_ALWAYS_TRUE);
Warning ("Condition is always true");
}
/* Look at the type */

View File

@ -907,7 +907,7 @@ void CheckEmptyDecl (const DeclSpec* D)
*/
{
if ((D->Flags & DS_EXTRA_TYPE) == 0) {
Warning (WARN_USELESS_DECL);
Warning ("Useless declaration");
}
}

View File

@ -51,30 +51,8 @@
static char* WarnMsg [WARN_COUNT-1] = {
"Unreachable code",
"Condition is never true",
"Condition is always true",
"Converting pointer to integer without a cast",
"Converting integer to pointer without a cast",
"Function call without a prototype",
"Unknown #pragma",
"No case labels",
"Function must be extern",
"Parameter `%s' is never used",
"`%s' is defined but never used",
"Constant is long",
"`/*' found inside a comment",
"Useless declaration",
};
/* Error messages sorted by ErrTypes */
static char* ErrMsg [ERR_COUNT-1] = {
"Invalid character (%u)",
"Unexpected newline",
"End-of-file reached in comment starting at line %u",
"Syntax error",
"`\"' expected",
"`:' expected",
@ -92,23 +70,11 @@ static char* ErrMsg [ERR_COUNT-1] = {
"Incompatible pointer types",
"Too many arguments in function call",
"Too few arguments in function call",
"Macro argument count mismatch",
"Duplicate macro parameter: %s",
"Macro redefinition is not identical",
"Variable identifier expected",
"Integer expression expected",
"Constant expression expected",
"No active loop",
"`\"' or `<' expected",
"Missing terminator or name too long",
"Include file `%s' not found",
"Cannot open include file `%s': %s",
"Invalid #error directive",
"#error: %s",
"Unexpected `#endif'",
"Unexpected `#else'",
"`#endif' expected",
"Compiler directive expected",
"Redefinition of `%s'",
"Conflicting types for `%s'",
"String literal expected",
@ -118,7 +84,6 @@ static char* ErrMsg [ERR_COUNT-1] = {
"Unexpected `continue'",
"Undefined symbol: `%s'",
"Undefined label: `%s'",
"Include nesting too deep",
"Too many local variables",
"Too many initializers",
"Cannot initialize incomplete type",
@ -134,7 +99,6 @@ static char* ErrMsg [ERR_COUNT-1] = {
"Illegal function call",
"Illegal indirection",
"Illegal address",
"Illegal macro call",
"Illegal hex digit",
"Illegal character constant",
"Illegal modifier",
@ -162,20 +126,6 @@ static char* ErrMsg [ERR_COUNT-1] = {
static char* FatMsg [FAT_COUNT-1] = {
"Too many errors",
"Cannot open output file: %s",
"Cannot write to output file (disk full?)",
"Cannot open input file: %s",
"Out of memory",
"Stack overflow",
"Stack empty",
"Out of string space",
"Too many case labels",
};
/* Count of errors/warnings */
unsigned ErrorCount = 0;
unsigned WarningCount = 0;
@ -188,44 +138,59 @@ unsigned WarningCount = 0;
void Warning (unsigned WarnNum, ...)
/* Print warning message. */
static void IntWarning (const char* Filename, unsigned Line, const char* Msg, va_list ap)
/* Print warning message - internal function. */
{
va_list ap;
if (!NoWarn) {
fprintf (stderr, "%s(%u): Warning #%u: ",
GetCurrentFile(), curpos, WarnNum);
va_start (ap, WarnNum);
vfprintf (stderr, WarnMsg [WarnNum-1], ap);
va_end (ap);
fprintf (stderr, "%s(%u): Warning: ", Filename, Line);
vfprintf (stderr, Msg, ap);
fprintf (stderr, "\n");
if (Verbose) {
fprintf (stderr, "Line: %s\n", line);
}
++WarningCount;
}
++ WarningCount;
}
void PPWarning (unsigned WarnNum, ...)
void Warning (const char* Format, ...)
/* Print warning message. */
{
va_list ap;
va_start (ap, Format);
IntWarning (GetCurrentFile(), curpos, Format, ap);
va_end (ap);
}
void PPWarning (const char* Format, ...)
/* Print warning message. For use within the preprocessor. */
{
va_list ap;
va_start (ap, Format);
IntWarning (GetCurrentFile(), GetCurrentLine(), Format, ap);
va_end (ap);
}
if (!NoWarn) {
fprintf (stderr, "%s(%u): Warning #%u: ",
GetCurrentFile(), GetCurrentLine(), WarnNum);
va_start (ap, WarnNum);
vfprintf (stderr, WarnMsg [WarnNum-1], ap);
va_end (ap);
fprintf (stderr, "\n");
static void IntError (const char* Filename, unsigned Line, const char* Msg, va_list ap)
/* Print an error message - internal function*/
{
fprintf (stderr, "%s(%u): Error: ", Filename, Line);
vfprintf (stderr, Msg, ap);
fprintf (stderr, "\n");
if (Verbose) {
fprintf (stderr, "Line: %s\n", line);
}
++ErrorCount;
if (ErrorCount > 10) {
Fatal ("Too many errors");
}
++WarningCount;
}
@ -234,57 +199,44 @@ void Error (unsigned ErrNum, ...)
/* Print an error message */
{
va_list ap;
fprintf (stderr, "%s(%u): Error #%u: ",
GetCurrentFile(), curpos, ErrNum);
va_start (ap, ErrNum);
vfprintf (stderr, ErrMsg [ErrNum-1], ap);
IntError (GetCurrentFile(), curpos, ErrMsg [ErrNum-1], ap);
va_end (ap);
fprintf (stderr, "\n");
if (Verbose) {
fprintf (stderr, "Line: %s\n", line);
}
++ErrorCount;
if (ErrorCount > 10) {
Fatal (FAT_TOO_MANY_ERRORS);
}
}
void PPError (unsigned ErrNum, ...)
void MError (const char* Format, ...)
/* Print an error message */
{
va_list ap;
va_start (ap, Format);
IntError (GetCurrentFile(), curpos, Format, ap);
va_end (ap);
}
void PPError (const char* Format, ...)
/* Print an error message. For use within the preprocessor. */
{
va_list ap;
fprintf (stderr, "%s(%u): Error #%u: ",
GetCurrentFile(), GetCurrentLine(), ErrNum);
va_start (ap, ErrNum);
vfprintf (stderr, ErrMsg [ErrNum-1], ap);
va_start (ap, Format);
IntError (GetCurrentFile(), GetCurrentLine(), Format, ap);
va_end (ap);
fprintf (stderr, "\n");
++ErrorCount;
if (ErrorCount > 10) {
Fatal (FAT_TOO_MANY_ERRORS);
}
}
void Fatal (unsigned FatNum, ...)
void Fatal (const char* Format, ...)
/* Print a message about a fatal error and die */
{
va_list ap;
fprintf (stderr, "%s(%u): Fatal #%u: ",
GetCurrentFile(), curpos, FatNum);
fprintf (stderr, "%s(%u): Fatal: ", GetCurrentFile(), curpos);
va_start (ap, FatNum);
vfprintf (stderr, FatMsg [FatNum-1], ap);
va_start (ap, Format);
vfprintf (stderr, Format, ap);
va_end (ap);
fprintf (stderr, "\n");

View File

@ -49,32 +49,9 @@
/* Warning numbers */
enum Warnings {
WARN_NONE, /* No warning */
WARN_UNREACHABLE_CODE,
WARN_COND_NEVER_TRUE,
WARN_COND_ALWAYS_TRUE,
WARN_PTR_TO_INT_CONV,
WARN_INT_TO_PTR_CONV,
WARN_FUNC_WITHOUT_PROTO,
WARN_UNKNOWN_PRAGMA,
WARN_NO_CASE_LABELS,
WARN_FUNC_MUST_BE_EXTERN,
WARN_UNUSED_PARM,
WARN_UNUSED_ITEM,
WARN_CONSTANT_IS_LONG,
WARN_NESTED_COMMENT,
WARN_USELESS_DECL,
WARN_COUNT /* Warning count */
};
/* Error numbers */
enum Errors {
enum Errors {
ERR_NONE, /* No error */
ERR_INVALID_CHAR,
ERR_UNEXPECTED_NEWLINE,
ERR_EOF_IN_COMMENT,
ERR_SYNTAX,
ERR_QUOTE_EXPECTED,
ERR_COLON_EXPECTED,
@ -92,23 +69,11 @@ enum Errors {
ERR_INCOMPATIBLE_POINTERS,
ERR_TOO_MANY_FUNC_ARGS,
ERR_TOO_FEW_FUNC_ARGS,
ERR_MACRO_ARGCOUNT,
ERR_DUPLICATE_MACRO_ARG,
ERR_MACRO_REDEF,
ERR_VAR_IDENT_EXPECTED,
ERR_INT_EXPR_EXPECTED,
ERR_CONST_EXPR_EXPECTED,
ERR_NO_ACTIVE_LOOP,
ERR_INCLUDE_LTERM_EXPECTED,
ERR_INCLUDE_RTERM_EXPECTED,
ERR_INCLUDE_NOT_FOUND,
ERR_INCLUDE_OPEN_FAILURE,
ERR_INVALID_USER_ERROR,
ERR_USER_ERROR,
ERR_UNEXPECTED_CPP_ENDIF,
ERR_UNEXPECTED_CPP_ELSE,
ERR_CPP_ENDIF_EXPECTED,
ERR_CPP_DIRECTIVE_EXPECTED,
ERR_MULTIPLE_DEFINITION,
ERR_CONFLICTING_TYPES,
ERR_STRLIT_EXPECTED,
@ -118,7 +83,6 @@ enum Errors {
ERR_UNEXPECTED_CONTINUE,
ERR_UNDEFINED_SYMBOL,
ERR_UNDEFINED_LABEL,
ERR_INCLUDE_NESTING,
ERR_TOO_MANY_LOCALS,
ERR_TOO_MANY_INITIALIZERS,
ERR_INIT_INCOMPLETE_TYPE,
@ -134,7 +98,6 @@ enum Errors {
ERR_ILLEGAL_FUNC_CALL,
ERR_ILLEGAL_INDIRECT,
ERR_ILLEGAL_ADDRESS,
ERR_ILLEGAL_MACRO_CALL,
ERR_ILLEGAL_HEX_DIGIT,
ERR_ILLEGAL_CHARCONST,
ERR_ILLEGAL_MODIFIER,
@ -161,23 +124,6 @@ enum Errors {
ERR_COUNT /* Error count */
};
/* Fatal errors */
enum Fatals {
FAT_NONE,
FAT_TOO_MANY_ERRORS,
FAT_CANNOT_OPEN_OUTPUT,
FAT_CANNOT_WRITE_OUTPUT,
FAT_CANNOT_OPEN_INPUT,
FAT_OUT_OF_MEMORY,
FAT_STACK_OVERFLOW,
FAT_STACK_EMPTY,
FAT_OUT_OF_STRSPACE,
FAT_TOO_MANY_CASE_LABELS,
FAT_COUNT /* Fatal error count */
};
/* Count of errors/warnings */
extern unsigned ErrorCount;
extern unsigned WarningCount;
@ -190,22 +136,25 @@ extern unsigned WarningCount;
void Warning (unsigned WarnNum, ...);
void Warning (const char* Format, ...) attribute ((format (printf, 1, 2)));
/* Print warning message. */
void PPWarning (unsigned WarnNum, ...);
void PPWarning (const char* Format, ...) attribute ((format (printf, 1, 2)));
/* Print warning message. For use within the preprocessor. */
void Error (unsigned ErrNum, ...);
/* Print an error message */
void PPError (unsigned ErrNum, ...);
void MError (const char* Format, ...) attribute ((format (printf, 1, 2)));
/* Print an error message */
void PPError (const char* Format, ...) attribute ((format (printf, 1, 2)));
/* Print an error message. For use within the preprocessor. */
void Fatal (unsigned FatNum, ...);
void Fatal (const char* Format, ...) attribute ((noreturn, format (printf, 1, 2)));
/* Print a message about a fatal error and die */
void Internal (char* Format, ...) attribute ((noreturn));
void Internal (char* Format, ...) attribute ((noreturn, format (printf, 1, 2)));
/* Print a message about an internal compiler error and die. */
void ErrorReport (void);

View File

@ -213,9 +213,9 @@ unsigned assignadjust (type* lhst, struct expent* rhs)
} else if (IsClassInt (lhst)) {
if (IsClassPtr (rhst)) {
/* Pointer -> int conversion */
Warning (WARN_PTR_TO_INT_CONV);
Warning ("Converting pointer to integer without a cast");
} else if (!IsClassInt (rhst)) {
Error (ERR_INCOMPATIBLE_TYPES);
Error (ERR_INCOMPATIBLE_TYPES);
} else {
/* Adjust the int types. To avoid manipulation of TOS mark lhs
* as const.
@ -253,7 +253,7 @@ unsigned assignadjust (type* lhst, struct expent* rhs)
} else if (IsClassInt (rhst)) {
/* Int to pointer assignment is valid only for constant zero */
if ((rhs->e_flags & E_MCONST) == 0 || rhs->e_const != 0) {
Warning (WARN_INT_TO_PTR_CONV);
Warning ("Converting integer to pointer without a cast");
}
} else if (IsTypeFuncPtr (lhst) && IsTypeFunc(rhst)) {
/* Assignment of function to function pointer is allowed, provided
@ -815,7 +815,7 @@ static int primary (struct expent* lval)
* function signature for a function having an empty param list
* and returning int.
*/
Warning (WARN_FUNC_WITHOUT_PROTO);
Warning ("Function call without a prototype");
Sym = AddGlobalSym (Ident, GetImplicitFuncType(), SC_EXTERN | SC_REF | SC_FUNC);
lval->e_tptr = Sym->Type;
lval->e_flags = E_MGLOBAL | E_MCONST | E_TGLAB;
@ -3008,7 +3008,7 @@ void test (unsigned label, int cond)
/* Constant rvalue */
if (cond == 0 && lval.e_const == 0) {
g_jump (label);
Warning (WARN_UNREACHABLE_CODE);
Warning ("Unreachable code");
} else if (cond && lval.e_const) {
g_jump (label);
}

View File

@ -198,7 +198,7 @@ void OpenMainFile (const char* Name)
FILE* F = fopen (Name, "r");
if (F == 0) {
/* Cannot open */
Fatal (FAT_CANNOT_OPEN_INPUT, strerror (errno));
Fatal ("Cannot open input file `%s': %s", Name, strerror (errno));
}
/* Allocate a new AFile structure for the file */
@ -216,14 +216,14 @@ void OpenIncludeFile (const char* Name, unsigned DirSpec)
/* Check for the maximum include nesting */
if (CollCount (&AFiles) > MAX_INC_NESTING) {
PPError (ERR_INCLUDE_NESTING);
PPError ("Include nesting too deep");
return;
}
/* Search for the file */
N = FindInclude (Name, DirSpec);
if (N == 0) {
PPError (ERR_INCLUDE_NOT_FOUND, Name);
PPError ("Include file `%s' not found", Name);
return;
}
@ -242,7 +242,7 @@ void OpenIncludeFile (const char* Name, unsigned DirSpec)
F = fopen (IF->Name, "r");
if (F == 0) {
/* Error opening the file */
PPError (ERR_INCLUDE_OPEN_FAILURE, IF->Name, strerror (errno));
PPError ("Cannot open include file `%s': %s", IF->Name, strerror (errno));
return;
}

View File

@ -140,7 +140,7 @@ void AddLiteralChar (char C)
/* Add one character to the literal pool */
{
if (LiteralOffs >= LITPOOL_SIZE) {
Fatal (FAT_OUT_OF_STRSPACE);
Fatal ("Out of literal space");
}
LiteralPool[LiteralOffs++] = C;
}

View File

@ -152,7 +152,7 @@ static void ParseOneDecl (const DeclSpec* Spec)
if (IsTypeFunc (Decl.Type)) {
/* Function prototypes are always external */
if ((SC & SC_EXTERN) == 0) {
Warning (WARN_FUNC_MUST_BE_EXTERN);
Warning ("Function must be extern");
}
SC |= SC_FUNC | SC_EXTERN;

View File

@ -174,7 +174,7 @@ static void SetSys (const char* Sys)
default:
AbEnd ("Unknown target system type");
}
}
/* Initialize the translation tables for the target system */
TgtTranslateInit ();
@ -191,7 +191,7 @@ static void DoCreateDep (const char* OutputName)
/* Open the file */
FILE* F = fopen (DepName, "w");
if (F == 0) {
Fatal (FAT_CANNOT_OPEN_OUTPUT, strerror (errno));
Fatal ("Cannot open dependency file `%s': %s", DepName, strerror (errno));
}
/* Write the dependencies to the file */
@ -200,7 +200,7 @@ static void DoCreateDep (const char* OutputName)
/* Close the file, check for errors */
if (fclose (F) != 0) {
remove (DepName);
Fatal (FAT_CANNOT_WRITE_OUTPUT);
Fatal ("Cannot write to dependeny file (disk full?)");
}
/* Free the name */
@ -615,7 +615,7 @@ int main (int argc, char* argv[])
/* Open the file */
F = fopen (OutputFile, "w");
if (F == 0) {
Fatal (FAT_CANNOT_OPEN_OUTPUT, strerror (errno));
Fatal ("Cannot open output file `%s': %s", OutputFile, strerror (errno));
}
/* Write the output to the file */
@ -624,7 +624,7 @@ int main (int argc, char* argv[])
/* Close the file, check for errors */
if (fclose (F) != 0) {
remove (OutputFile);
Fatal (FAT_CANNOT_WRITE_OUTPUT);
Fatal ("Cannot write to output file (disk full?)");
}
/* Create dependencies if requested */

View File

@ -151,7 +151,7 @@ static void SegNamePragma (void (*Func) (const char*))
Func (Name);
} else {
/* Segment name is invalid */
Error (ERR_ILLEGAL_SEG_NAME, Name);
@ -201,7 +201,7 @@ void DoPragma (void)
* for unknown pragmas, however, we're allowed to warn - and we will
* do so. Otherwise one typo may give you hours of bug hunting...
*/
Warning (WARN_UNKNOWN_PRAGMA);
Warning ("Unknown #pragma `%s'", CurTok.Ident);
return;
}

View File

@ -98,12 +98,13 @@ static void Comment (void)
while (CurC != '*' || NextC != '/') {
if (CurC == '\0') {
if (NextLine () == 0) {
PPError (ERR_EOF_IN_COMMENT, StartingLine);
PPError ("End-of-file reached in comment starting at line %u",
StartingLine);
return;
}
} else {
if (CurC == '/' && NextC == '*') {
PPWarning (WARN_NESTED_COMMENT);
PPWarning ("`/*' found inside a comment");
}
NextChar ();
}
@ -170,7 +171,7 @@ static int MacName (char* Ident)
/* Get macro symbol name. If error, print message and clear line. */
{
if (IsSym (Ident) == 0) {
PPError (ERR_IDENT_EXPECTED);
PPError ("Identifier expected");
ClearLine ();
return 0;
} else {
@ -242,7 +243,7 @@ static int MacroCall (Macro* M)
/* Expect an argument list */
SkipBlank ();
if (CurC != '(') {
PPError (ERR_ILLEGAL_MACRO_CALL);
PPError ("Illegal macro call");
return 0;
}
@ -315,7 +316,7 @@ static int MacroCall (Macro* M)
/* Compare formal argument count with actual */
if (M->ArgCount != ArgCount) {
PPError (ERR_MACRO_ARGCOUNT);
PPError ("Macro argument count mismatch");
/* Be sure to make enough empty arguments available */
while (ArgCount < M->ArgCount) {
M->ActualArgs [ArgCount++] = "";
@ -395,7 +396,7 @@ static void addmac (void)
/* Check for a right paren and eat it if we find one */
if (CurC != ')') {
PPError (ERR_RPAREN_EXPECTED);
PPError ("`)' expected");
ClearLine ();
return;
}
@ -421,7 +422,7 @@ static void addmac (void)
*/
if (Existing) {
if (MacroCmp (M, Existing) != 0) {
PPError (ERR_MACRO_REDEF);
PPError ("Macro redefinition is not identical");
}
}
}
@ -465,7 +466,7 @@ static int Pass1 (const char* From, char* To)
SkipBlank();
}
if (!IsIdent (CurC)) {
PPError (ERR_IDENT_EXPECTED);
PPError ("Identifier expected");
*mptr++ = '0';
} else {
SymName (Ident);
@ -473,7 +474,7 @@ static int Pass1 (const char* From, char* To)
if (HaveParen) {
SkipBlank();
if (CurC != ')') {
PPError (ERR_RPAREN_EXPECTED);
PPError ("`)' expected");
} else {
NextChar ();
}
@ -701,7 +702,7 @@ static void doinclude (void)
break;
default:
PPError (ERR_INCLUDE_LTERM_EXPECTED);
PPError ("`\"' or `<' expected");
goto Done;
}
NextChar ();
@ -719,7 +720,7 @@ static void doinclude (void)
/* Check if we got a terminator */
if (CurC != RTerm) {
/* No terminator found */
PPError (ERR_INCLUDE_RTERM_EXPECTED);
PPError ("Missing terminator or file name too long");
goto Done;
}
@ -740,9 +741,9 @@ static void doerror (void)
{
SkipBlank ();
if (CurC == '\0') {
PPError (ERR_INVALID_USER_ERROR);
PPError ("Invalid #error directive");
} else {
PPError (ERR_USER_ERROR, lptr);
PPError ("#error: %s", lptr);
}
/* clear rest of line */
@ -818,7 +819,7 @@ void Preprocess (void)
continue;
}
if (!IsSym (Directive)) {
PPError (ERR_CPP_DIRECTIVE_EXPECTED);
PPError ("Preprocessor directive expected");
ClearLine ();
} else {
switch (searchtok (Directive, pre_toks)) {
@ -836,7 +837,7 @@ void Preprocess (void)
}
s_ifdef[i_ifdef] ^= 2;
} else {
PPError (ERR_UNEXPECTED_CPP_ELSE);
PPError ("Unexpected `#else'");
}
break;
@ -844,7 +845,7 @@ void Preprocess (void)
if (i_ifdef >= 0) {
Skip = s_ifdef[i_ifdef--] & 1;
} else {
PPError (ERR_UNEXPECTED_CPP_ENDIF);
PPError ("Unexpected `#endif'");
}
break;
@ -875,7 +876,7 @@ void Preprocess (void)
case PP_LINE:
/* Not allowed in strict ANSI mode */
if (ANSI) {
PPError (ERR_CPP_DIRECTIVE_EXPECTED);
PPError ("Preprocessor directive expected");
ClearLine ();
}
break;
@ -896,7 +897,7 @@ void Preprocess (void)
break;
default:
PPError (ERR_CPP_DIRECTIVE_EXPECTED);
PPError ("Preprocessor directive expected");
ClearLine ();
}
}
@ -904,7 +905,7 @@ void Preprocess (void)
}
if (NextLine () == 0) {
if (i_ifdef >= 0) {
PPError (ERR_CPP_ENDIF_EXPECTED);
PPError ("`#endif' expected");
}
return;
}

View File

@ -192,7 +192,7 @@ int IsSym (char *s)
static void unknown (char C)
/* Error message for unknown character */
{
Error (ERR_INVALID_CHAR, C);
MError ("Invalid input character with code %02X", C & 0xFF);
NextChar (); /* Skip */
}
@ -350,7 +350,7 @@ static void StringConst (void)
while (CurC != '\"') {
if (CurC == '\0') {
Error (ERR_UNEXPECTED_NEWLINE);
MError ("Unexpected newline");
break;
}
AddLiteralChar (ParseChar ());
@ -458,7 +458,7 @@ void NextToken (void)
* warning.
*/
if (k <= 0xFFFF && (types & IT_UINT) == 0 && !HaveSuffix) {
Warning (WARN_CONSTANT_IS_LONG);
Warning ("Constant is long");
}
}
if (k > 0xFFFF) {
@ -754,7 +754,7 @@ void NextToken (void)
} while (CurC == ' ');
if (!IsSym (token) || strcmp (token, "pragma") != 0) {
/* OOPS - should not happen */
Error (ERR_CPP_DIRECTIVE_EXPECTED);
MError ("Preprocessor directive expected");
}
nxttok = TOK_PRAGMA;
break;

View File

@ -13,7 +13,7 @@
/* common */
#include "xmalloc.h"
/* cc65 */
#include "asmcode.h"
#include "asmlabel.h"
@ -395,7 +395,7 @@ static void cascadeswitch (struct expent* eval)
/* Check if we have any labels */
if (lcount == 0) {
Warning (WARN_NO_CASE_LABELS);
Warning ("No case labels");
}
/* Eat the closing curly brace */
@ -451,7 +451,7 @@ static void tableswitch (struct expent* eval)
while (curtok != TOK_RCURLY) {
if (curtok == TOK_CASE || curtok == TOK_DEFAULT) {
if (lcount >= CASE_MAX) {
Fatal (FAT_TOO_MANY_CASE_LABELS);
Fatal ("Too many case labels");
}
label = GetLabel ();
do {
@ -481,7 +481,7 @@ static void tableswitch (struct expent* eval)
/* Check if we have any labels */
if (lcount == 0) {
Warning (WARN_NO_CASE_LABELS);
Warning ("No case labels");
}
/* Eat the closing curly brace */

View File

@ -165,9 +165,9 @@ static void CheckSymTable (SymTable* Tab)
if (((Flags & SC_AUTO) || (Flags & SC_STATIC)) && (Flags & SC_EXTERN) == 0) {
if ((Flags & SC_DEF) && !(Flags & SC_REF)) {
if (Flags & SC_PARAM) {
Warning (WARN_UNUSED_PARM, Entry->Name);
Warning ("Parameter `%s' is never used", Entry->Name);
} else {
Warning (WARN_UNUSED_ITEM, Entry->Name);
Warning ("`%s' is defined but never used", Entry->Name);
}
}
}
@ -179,7 +179,7 @@ static void CheckSymTable (SymTable* Tab)
Error (ERR_UNDEFINED_LABEL, Entry->Name);
} else if ((Flags & SC_REF) == 0) {
/* Defined but not used */
Warning (WARN_UNUSED_ITEM, Entry->Name);
Warning ("`%s' is defined but never used", Entry->Name);
}
}