3 /* 7.2 Diagnostics <assert.h>
5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
9 #ifndef _PDCLIB_ASSERT_H
10 #define _PDCLIB_ASSERT_H _PDCLIB_ASSERT_H
11 #include <_PDCLIB_aux.h>
12 #include <_PDCLIB_config.h>
13 _PDCLIB_BEGIN_EXTERN_C
15 /* Functions _NOT_ tagged noreturn as this hampers debugging */
16 void _PDCLIB_assert99( char const * const, char const * const, char const * const );
17 void _PDCLIB_assert89( char const * const );
19 /* If NDEBUG is set, assert() is a null operation. */
23 #define assert( ignore ) ( (void) 0 )
24 #elif _PDCLIB_C_MIN(99)
25 #define assert(expression) \
26 do { if(!(expression)) { \
27 _PDCLIB_assert99("Assertion failed: " _PDCLIB_symbol2string(expression)\
28 ", function ", __func__, \
30 ", line " _PDCLIB_symbol2string( __LINE__ ) \
35 #define assert(expression) \
36 do { if(!(expression)) { \
37 _PDCLIB_assert89("Assertion failed: " _PDCLIB_symbol2string(expression)\
39 ", line " _PDCLIB_symbol2string( __LINE__ ) \