/* * assert.h * sec 4.2 ansi draft */ /* Allow this file to be included multiple times with different settings of NDEBUG. */ #undef assert #ifndef _COMPILER_H #include #endif __EXTERN void __eprintf __PROTO((const char *, const char *, const long, const char *)); __EXTERN void abort __PROTO((void)); #ifndef __FAILED #define __FAILED "assertion `%s' failed at line '%ld' of file %s\n" #endif #ifdef NDEBUG #define assert(cond) #else #ifdef __STDC__ #define assert(cond) \ if(!(cond)) { __eprintf(__FAILED, #cond, (long)__LINE__, __FILE__); abort(); } #else #ifndef __LINE__ #define __LINE__ 0 #endif #ifndef __FILE__ #define __FILE__ "unknown" #endif #define assert(cond) \ if(!(cond)) { __eprintf(__FAILED, "cond", (long)__LINE__, __FILE__); abort(); } #endif /* __STDC__ */ #endif /* NDEBUG */