1 /* ----------------------------------------------------------------------------
3 * ----------------------------------------------------------------------------
4 * Public Domain C Library - http://pdclib.sourceforge.net
5 * This code is Public Domain. Use, modify, and redistribute at will.
6 * ----------------------------------------------------------------------------
8 * --------------------------------------------------------------------------*/
11 #define _ASSERT_H _ASSERT_H
13 /* ----------------------------------------------------------------------------
15 * --------------------------------------------------------------------------*/
17 /* Helper function doing the print to stderr and call to abort(). */
18 void __assert( char const * const expression, /* the tested expression */
19 char const * const file, /* name of source file */
20 char const * const function, /* name of function */
21 int const line ); /* number of source file line */
23 #endif /* _ASSERT_H - note that the header guard ends here on purpose. The
24 assert macro is redefined upon each inclusion, in
25 dependence of NDEBUG. */
27 /* ----------------------------------------------------------------------------
29 * --------------------------------------------------------------------------*/
33 #define assert( x ) ( (void) 0 )
35 #define assert( x ) ( x ) ? ( (void) 0 ) \
36 : __assert( #x, __FILE__, __func__, __LINE__ )