changed assert() macro so __bad_assertion() can use fputs()
This commit is contained in:
parent
644cfbf61f
commit
ededd15b74
1 changed files with 8 additions and 2 deletions
|
@ -6,12 +6,18 @@
|
||||||
*/
|
*/
|
||||||
/* $Header$ */
|
/* $Header$ */
|
||||||
|
|
||||||
void __bad_assertion(const char *_expr, const char *_file, int _line);
|
void __bad_assertion(const char *_mess);
|
||||||
|
|
||||||
#undef assert
|
#undef assert
|
||||||
|
|
||||||
|
#define __str(x) # x
|
||||||
|
#define __xstr(x) __str(x)
|
||||||
|
|
||||||
#if defined(NDEBUG)
|
#if defined(NDEBUG)
|
||||||
#define assert(ignore) ((void)0)
|
#define assert(ignore) ((void)0)
|
||||||
#else
|
#else
|
||||||
#define assert(expr) ((expr)? (void)0 : __bad_assertion( #expr, __FILE__, __LINE__))
|
#define assert(expr) ((expr)? (void)0 : \
|
||||||
|
__bad_assertion("Assertion \"" #expr \
|
||||||
|
"\" failed, file " __xstr(__FILE__) \
|
||||||
|
", line " __xstr(__LINE__) "\n"))
|
||||||
#endif /* NDEBUG */
|
#endif /* NDEBUG */
|
||||||
|
|
Loading…
Reference in a new issue