X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcommon%2Fcheck.h;h=5f8b31784be2b34393718efd2f2bc1ce5078e420;hb=7bd19b737aacfcf0d81e2bc3a6e537ee72a4eb2f;hp=1049c4bf40ab19f2987c2417507f8d87da333830;hpb=9e47a53bb7b2baac539059a439fa0f977f2535fb;p=cc65 diff --git a/src/common/check.h b/src/common/check.h index 1049c4bf4..5f8b31784 100644 --- a/src/common/check.h +++ b/src/common/check.h @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 1998 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 1998-2001 Ullrich von Bassewitz */ +/* Wacholderweg 14 */ +/* D-70597 Stuttgart */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -56,7 +56,7 @@ extern const char* MsgProgramAborted; /* "Program aborted: " */ extern void (*CheckFailed) (const char* Msg, const char* Cond, - int Code, const char* File, unsigned Line) + const char* File, unsigned Line) attribute ((noreturn)); /* Function pointer that is called from check if the condition code is true. */ @@ -68,29 +68,20 @@ extern void (*CheckFailed) (const char* Msg, const char* Cond, -void Check (const char* Msg, const char* Cond, int Code, - const char* File, unsigned Line); -/* This function is called from all check macros (see below). It checks, - * wether the given Code is true (!= 0). If so, it calls the CheckFailed - * vector with the given strings. If not, it simply returns. - */ - - - -#define FAIL(s) CheckFailed (MsgInternalError, s, 0, __FILE__, __LINE__) +#define FAIL(s) CheckFailed (MsgInternalError, s, __FILE__, __LINE__) /* Fail macro. Is used if something evil happens, calls checkfailed directly. */ -#define ABORT(s) CheckFailed (MsgProgramAborted, s, 0, __FILE__, __LINE__) +#define ABORT(s) CheckFailed (MsgProgramAborted, s, __FILE__, __LINE__) /* Use this one instead of FAIL if there is no internal program error but an * error condition that is caused by the user or operating system (FAIL and * ABORT are essentially the same but the message differs). */ -#define PRECONDITION(c) Check (MsgPrecondition, #c, !(c), __FILE__, __LINE__) - -#define CHECK(c) Check (MsgCheckFailed, #c, !(c), __FILE__, __LINE__) +#define PRECONDITION(c) \ + ((void) ((c)? 0 : (CheckFailed (MsgPrecondition, #c, __FILE__, __LINE__), 0))) -#define ZCHECK(c) Check (MsgCheckFailed, #c, c, __FILE__, __LINE__) +#define CHECK(c) \ + ((void) ((c)? 0 : (CheckFailed (MsgCheckFailed, #c, __FILE__, __LINE__), 0)))