From 5ee8618510eacaca1f779612103bf709f59e9450 Mon Sep 17 00:00:00 2001 From: cuz Date: Tue, 1 Aug 2000 15:17:43 +0000 Subject: [PATCH] Use the CHECK macros from the common dir git-svn-id: svn://svn.cc65.org/cc65/trunk@251 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65/error.c | 9 --------- src/ca65/error.h | 16 ---------------- src/ca65/expr.c | 1 + src/ca65/instr.c | 5 ++++- src/ca65/istack.c | 7 +++++-- src/ca65/listing.c | 1 + src/ca65/macpack.c | 4 ++++ src/ca65/macro.c | 11 +++++++---- src/ca65/nexttok.c | 4 ++++ src/ca65/objcode.c | 5 +++-- src/ca65/pseudo.c | 1 + src/ca65/scanner.c | 3 ++- src/ca65/symtab.c | 7 ++++--- src/ca65/toklist.c | 5 +++-- src/ca65/ulabel.c | 9 ++++++--- src/cl65/error.c | 22 ++++------------------ src/cl65/error.h | 24 ------------------------ src/ld65/config.c | 9 ++++++--- src/ld65/dbgsyms.c | 9 ++++++--- src/ld65/error.c | 24 ++++-------------------- src/ld65/error.h | 34 +++++----------------------------- src/ld65/exports.c | 11 +++++++---- src/ld65/expr.c | 1 + src/ld65/o65.c | 1 + src/ld65/segments.c | 3 ++- src/od65/error.c | 16 ---------------- src/od65/error.h | 24 ------------------------ 27 files changed, 81 insertions(+), 185 deletions(-) diff --git a/src/ca65/error.c b/src/ca65/error.c index 86fd96b29..93ffa121a 100644 --- a/src/ca65/error.c +++ b/src/ca65/error.c @@ -51,15 +51,6 @@ /* Warning level */ unsigned WarnLevel = 1; -/* Messages for internal compiler errors */ -const char _MsgCheckFailed [] = - "Check failed: `%s' (= %d), file `%s', line %u\n"; -const char _MsgPrecondition [] = - "Precondition violated: `%s' (= %d), file `%s', line %u\n"; -const char _MsgFail [] = - "%s, file `%s', line %u\n"; - - /* Statistics */ unsigned ErrorCount = 0; unsigned WarningCount = 0; diff --git a/src/ca65/error.h b/src/ca65/error.h index c7bd9d86c..f3ebceb7b 100644 --- a/src/ca65/error.h +++ b/src/ca65/error.h @@ -153,11 +153,6 @@ enum Fatals { /* Warning levels */ extern unsigned WarnLevel; -/* Messages for internal compiler errors */ -extern const char _MsgCheckFailed []; -extern const char _MsgPrecondition []; -extern const char _MsgFail []; - /* Statistics */ extern unsigned ErrorCount; extern unsigned WarningCount; @@ -191,17 +186,6 @@ void Fatal (unsigned FatNum, ...); void Internal (const char* Format, ...); /* Print a message about an internal compiler error and die. */ -#define CHECK(c) \ - if (!(c)) \ - Internal (_MsgCheckFailed, #c, c, __FILE__, __LINE__) - -#define PRECONDITION(c) \ - if (!(c)) \ - Internal (_MsgPrecondition, #c, c, __FILE__, __LINE__) - -#define FAIL(s) \ - Internal (_MsgFail, s, __FILE__, __LINE__) - /* End of error.h */ diff --git a/src/ca65/expr.c b/src/ca65/expr.c index 535bea07d..5cd4610c4 100644 --- a/src/ca65/expr.c +++ b/src/ca65/expr.c @@ -34,6 +34,7 @@ /* common */ +#include "check.h" #include "exprdefs.h" #include "xmalloc.h" diff --git a/src/ca65/instr.c b/src/ca65/instr.c index 6f8b3fea7..553296471 100644 --- a/src/ca65/instr.c +++ b/src/ca65/instr.c @@ -37,8 +37,11 @@ #include #include -#include "../common/bitops.h" +/* common */ +#include "bitops.h" +#include "check.h" +/* ca65 */ #include "ea.h" #include "error.h" #include "expr.h" diff --git a/src/ca65/istack.c b/src/ca65/istack.c index 18b4031c2..3b7ffb648 100644 --- a/src/ca65/istack.c +++ b/src/ca65/istack.c @@ -33,8 +33,11 @@ -#include "../common/xmalloc.h" - +/* common */ +#include "check.h" +#include "xmalloc.h" + +/* ca65 */ #include "error.h" #include "istack.h" diff --git a/src/ca65/listing.c b/src/ca65/listing.c index 3f3fb3d79..94edfd2c9 100644 --- a/src/ca65/listing.c +++ b/src/ca65/listing.c @@ -38,6 +38,7 @@ #include /* common */ +#include "check.h" #include "fname.h" #include "segdefs.h" #include "version.h" diff --git a/src/ca65/macpack.c b/src/ca65/macpack.c index 8f50eedba..317cf390c 100644 --- a/src/ca65/macpack.c +++ b/src/ca65/macpack.c @@ -33,6 +33,10 @@ +/* common */ +#include "check.h" + +/* ca65 */ #include "error.h" #include "scanner.h" #include "macpack.h" diff --git a/src/ca65/macro.c b/src/ca65/macro.c index d85fbcc90..be71e3761 100644 --- a/src/ca65/macro.c +++ b/src/ca65/macro.c @@ -36,9 +36,12 @@ #include #include -#include "../common/hashstr.h" -#include "../common/xmalloc.h" - +/* common */ +#include "check.h" +#include "hashstr.h" +#include "xmalloc.h" + +/* ca65 */ #include "condasm.h" #include "error.h" #include "istack.h" @@ -657,7 +660,7 @@ static void StartExpDefine (Macro* M) /* A define style macro must be called with as many actual parameters * as there are formal ones. Get the parameter count. - */ + */ unsigned Count = M->ParamCount; /* Skip the current token */ diff --git a/src/ca65/nexttok.c b/src/ca65/nexttok.c index 9504e2928..f460cdc91 100644 --- a/src/ca65/nexttok.c +++ b/src/ca65/nexttok.c @@ -35,6 +35,10 @@ #include +/* common */ +#include "check.h" + +/* ca65 */ #include "error.h" #include "expr.h" #include "scanner.h" diff --git a/src/ca65/objcode.c b/src/ca65/objcode.c index a6bf604d9..5ad68f41e 100644 --- a/src/ca65/objcode.c +++ b/src/ca65/objcode.c @@ -38,9 +38,10 @@ #include /* common */ +#include "check.h" #include "segdefs.h" #include "xmalloc.h" - + /* cc65 */ #include "error.h" #include "fragment.h" @@ -162,7 +163,7 @@ static Segment* NewSegment (const char* Name, unsigned SegType) return S; } - + void UseCodeSeg (void) /* Use the code segment */ diff --git a/src/ca65/pseudo.c b/src/ca65/pseudo.c index 057eead6c..8604ca75f 100644 --- a/src/ca65/pseudo.c +++ b/src/ca65/pseudo.c @@ -41,6 +41,7 @@ /* common */ #include "bitops.h" +#include "check.h" /* ca65 */ #include "condasm.h" diff --git a/src/ca65/scanner.c b/src/ca65/scanner.c index 4647d4c01..fbebe0277 100644 --- a/src/ca65/scanner.c +++ b/src/ca65/scanner.c @@ -41,9 +41,10 @@ #include /* common */ +#include "check.h" #include "fname.h" #include "xmalloc.h" - + /* ca65 */ #include "condasm.h" #include "error.h" diff --git a/src/ca65/symtab.c b/src/ca65/symtab.c index d7997fa7b..027f715dd 100644 --- a/src/ca65/symtab.c +++ b/src/ca65/symtab.c @@ -36,10 +36,11 @@ #include /* common */ -#include "symdefs.h" +#include "check.h" #include "hashstr.h" +#include "symdefs.h" #include "xmalloc.h" - + /* ca65 */ #include "global.h" #include "error.h" @@ -998,7 +999,7 @@ void WriteImports (void) } S = S->List; } - + /* Done writing imports */ ObjEndImports (); } diff --git a/src/ca65/toklist.c b/src/ca65/toklist.c index 82137f720..ff1cfa267 100644 --- a/src/ca65/toklist.c +++ b/src/ca65/toklist.c @@ -34,10 +34,11 @@ #include - + /* common */ +#include "check.h" #include "xmalloc.h" - + /* ca65 */ #include "error.h" #include "istack.h" diff --git a/src/ca65/ulabel.c b/src/ca65/ulabel.c index 1618afb73..4faee3d21 100644 --- a/src/ca65/ulabel.c +++ b/src/ca65/ulabel.c @@ -33,9 +33,12 @@ -#include "../common/filepos.h" -#include "../common/xmalloc.h" - +/* common */ +#include "check.h" +#include "filepos.h" +#include "xmalloc.h" + +/* ca65 */ #include "error.h" #include "expr.h" #include "scanner.h" diff --git a/src/cl65/error.c b/src/cl65/error.c index 54cdc2b22..0372d50a0 100644 --- a/src/cl65/error.c +++ b/src/cl65/error.c @@ -37,29 +37,15 @@ #include #include -#include "../common/cmdline.h" - +/* common */ +#include "cmdline.h" + +/* cl65 */ #include "global.h" #include "error.h" -/*****************************************************************************/ -/* Data */ -/*****************************************************************************/ - - - -/* Messages for internal compiler errors */ -const char _MsgCheckFailed [] = - "Check failed: `%s' (= %d), file `%s', line %u\n"; -const char _MsgPrecondition [] = - "Precondition violated: `%s' (= %d), file `%s', line %u\n"; -const char _MsgFail [] = - "%s, file `%s', line %u\n"; - - - /*****************************************************************************/ /* Code */ /*****************************************************************************/ diff --git a/src/cl65/error.h b/src/cl65/error.h index e029eb5c3..755e91476 100644 --- a/src/cl65/error.h +++ b/src/cl65/error.h @@ -38,19 +38,6 @@ -/*****************************************************************************/ -/* Data */ -/*****************************************************************************/ - - - -/* Messages for internal compiler errors */ -extern const char _MsgCheckFailed []; -extern const char _MsgPrecondition []; -extern const char _MsgFail []; - - - /*****************************************************************************/ /* Code */ /*****************************************************************************/ @@ -66,17 +53,6 @@ void Error (const char* Format, ...); void Internal (const char* Format, ...); /* Print an internal error message and die */ -#define CHECK(c) \ - if (!(c)) \ - Internal (_MsgCheckFailed, #c, c, __FILE__, __LINE__) - -#define PRECONDITION(c) \ - if (!(c)) \ - Internal (_MsgPrecondition, #c, c, __FILE__, __LINE__) - -#define FAIL(s) \ - Internal (_MsgFail, s, __FILE__, __LINE__) - /* End of error.h */ diff --git a/src/ld65/config.c b/src/ld65/config.c index 3d9869899..d3f637654 100644 --- a/src/ld65/config.c +++ b/src/ld65/config.c @@ -38,9 +38,12 @@ #include #include -#include "../common/bitops.h" -#include "../common/xmalloc.h" - +/* common */ +#include "check.h" +#include "bitops.h" +#include "xmalloc.h" + +/* ld65 */ #include "error.h" #include "global.h" #include "bin.h" diff --git a/src/ld65/dbgsyms.c b/src/ld65/dbgsyms.c index 5df33aaf4..911dedab9 100644 --- a/src/ld65/dbgsyms.c +++ b/src/ld65/dbgsyms.c @@ -35,9 +35,12 @@ #include -#include "../common/symdefs.h" -#include "../common/xmalloc.h" - +/* common */ +#include "check.h" +#include "symdefs.h" +#include "xmalloc.h" + +/* ld65 */ #include "global.h" #include "error.h" #include "fileio.h" diff --git a/src/ld65/error.c b/src/ld65/error.c index 53b06d16b..fa049488b 100644 --- a/src/ld65/error.c +++ b/src/ld65/error.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 1998 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 1998-2000 Ullrich von Bassewitz */ +/* Wacholderweg 14 */ +/* D-70597 Stuttgart */ +/* EMail: uz@musoftware.de */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -41,22 +41,6 @@ -/*****************************************************************************/ -/* Data */ -/*****************************************************************************/ - - - -/* Messages for internal compiler errors */ -const char _MsgCheckFailed [] = - "Check failed: `%s' (= %d), file `%s', line %u\n"; -const char _MsgPrecondition [] = - "Precondition violated: `%s' (= %d), file `%s', line %u\n"; -const char _MsgFail [] = - "%s, file `%s', line %u\n"; - - - /*****************************************************************************/ /* Code */ /*****************************************************************************/ diff --git a/src/ld65/error.h b/src/ld65/error.h index 263a4881e..a29a08229 100644 --- a/src/ld65/error.h +++ b/src/ld65/error.h @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 1998 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 1998-2000 Ullrich von Bassewitz */ +/* Wacholderweg 14 */ +/* D-70597 Stuttgart */ +/* EMail: uz@musoftware.de */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -43,19 +43,6 @@ -/*****************************************************************************/ -/* Data */ -/*****************************************************************************/ - - - -/* Messages for internal compiler errors */ -extern const char _MsgCheckFailed []; -extern const char _MsgPrecondition []; -extern const char _MsgFail []; - - - /*****************************************************************************/ /* Code */ /*****************************************************************************/ @@ -71,18 +58,7 @@ void Error (const char* Format, ...) attribute((format(printf,1,2))); void Internal (const char* Format, ...) attribute((format(printf,1,2))); /* Print an internal error message and die */ -#define CHECK(c) \ - if (!(c)) \ - Internal (_MsgCheckFailed, #c, c, __FILE__, __LINE__) - -#define PRECONDITION(c) \ - if (!(c)) \ - Internal (_MsgPrecondition, #c, c, __FILE__, __LINE__) - -#define FAIL(s) \ - Internal (_MsgFail, s, __FILE__, __LINE__) - - + /* End of error.h */ diff --git a/src/ld65/exports.c b/src/ld65/exports.c index 7141067a3..93681465b 100644 --- a/src/ld65/exports.c +++ b/src/ld65/exports.c @@ -37,10 +37,13 @@ #include #include -#include "../common/symdefs.h" -#include "../common/hashstr.h" -#include "../common/xmalloc.h" - +/* common */ +#include "check.h" +#include "hashstr.h" +#include "symdefs.h" +#include "xmalloc.h" + +/* ld65 */ #include "global.h" #include "error.h" #include "fileio.h" diff --git a/src/ld65/expr.c b/src/ld65/expr.c index 51471bb30..3e1f01041 100644 --- a/src/ld65/expr.c +++ b/src/ld65/expr.c @@ -34,6 +34,7 @@ /* common */ +#include "check.h" #include "exprdefs.h" #include "xmalloc.h" diff --git a/src/ld65/o65.c b/src/ld65/o65.c index a630cc035..c1441037b 100644 --- a/src/ld65/o65.c +++ b/src/ld65/o65.c @@ -39,6 +39,7 @@ #include /* common */ +#include "check.h" #include "version.h" #include "xmalloc.h" diff --git a/src/ld65/segments.c b/src/ld65/segments.c index 66b6f1ea0..17976e52d 100644 --- a/src/ld65/segments.c +++ b/src/ld65/segments.c @@ -37,12 +37,13 @@ #include /* common */ +#include "check.h" #include "exprdefs.h" #include "hashstr.h" #include "segdefs.h" #include "symdefs.h" #include "xmalloc.h" - + /* ld65 */ #include "error.h" #include "expr.h" diff --git a/src/od65/error.c b/src/od65/error.c index 8b3da8a46..3d934e5c1 100644 --- a/src/od65/error.c +++ b/src/od65/error.c @@ -41,22 +41,6 @@ -/*****************************************************************************/ -/* Data */ -/*****************************************************************************/ - - - -/* Messages for internal compiler errors */ -const char _MsgCheckFailed [] = - "Check failed: `%s' (= %d), file `%s', line %u\n"; -const char _MsgPrecondition [] = - "Precondition violated: `%s' (= %d), file `%s', line %u\n"; -const char _MsgFail [] = - "%s, file `%s', line %u\n"; - - - /*****************************************************************************/ /* Code */ /*****************************************************************************/ diff --git a/src/od65/error.h b/src/od65/error.h index d434cd4c7..f4dbf3fd4 100644 --- a/src/od65/error.h +++ b/src/od65/error.h @@ -43,19 +43,6 @@ -/*****************************************************************************/ -/* Data */ -/*****************************************************************************/ - - - -/* Messages for internal compiler errors */ -extern const char _MsgCheckFailed []; -extern const char _MsgPrecondition []; -extern const char _MsgFail []; - - - /*****************************************************************************/ /* Code */ /*****************************************************************************/ @@ -71,17 +58,6 @@ void Error (const char* Format, ...) attribute((format(printf,1,2))); void Internal (const char* Format, ...) attribute((format(printf,1,2))); /* Print an internal error message and die */ -#define CHECK(c) \ - if (!(c)) \ - Internal (_MsgCheckFailed, #c, c, __FILE__, __LINE__) - -#define PRECONDITION(c) \ - if (!(c)) \ - Internal (_MsgPrecondition, #c, c, __FILE__, __LINE__) - -#define FAIL(s) \ - Internal (_MsgFail, s, __FILE__, __LINE__) - /* End of error.h */ -- 2.39.5