diff options
Diffstat (limited to 'libc/include/assert.h')
-rw-r--r-- | libc/include/assert.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libc/include/assert.h b/libc/include/assert.h new file mode 100644 index 0000000..c58c57f --- /dev/null +++ b/libc/include/assert.h @@ -0,0 +1,23 @@ +#ifdef __ASSERT_H +#define __ASSERT_H +#include <features.h> + +/* If NDEBUG is defined, do nothing. + If not, and EXPRESSION is zero, print an error message and abort. */ + +#ifdef NDEBUG + +#define assert(expr) ((void) 0) + +#else /* Not NDEBUG. */ + +extern void __assert __P((const char *, const char *, int)); + +#define assert(expr) \ + ((void) ((expr) || \ + (__assert (__STRING(expr), \ + __FILE__, __LINE__), 0))) + +#endif /* NDEBUG. */ + +#endif /* __ASSERT_H */ |