]> pd.if.org Git - pdclib/blob - includes/assert.h
Comment cleanups.
[pdclib] / includes / assert.h
1 /* Diagnostics <assert.h>
2
3    This file is part of the Public Domain C Library (PDCLib).
4    Permission is granted to use, modify, and / or redistribute at will.
5 */
6
7 #include <_PDCLIB_aux.h>
8 #include <_PDCLIB_config.h>
9
10 #ifndef _PDCLIB_ASSERT_H
11 #define _PDCLIB_ASSERT_H _PDCLIB_ASSERT_H
12 #if _PDCLIB_C_VERSION == 99
13 void _PDCLIB_assert( char const * const, char const * const, char const * const );
14 #else
15 void _PDCLIB_assert( char const * const );
16 #endif
17 #endif
18
19 /* If NDEBUG is set, assert() is a null operation. */
20 #undef assert
21
22 #ifdef NDEBUG
23 #define assert( ignore ) ( (void) 0 )
24 #else
25 #if _PDCLIB_C_VERSION == 99
26 #define assert( expression ) ( ( expression ) ? (void) 0 \
27         : _PDCLIB_assert( "Assertion failed: " #expression \
28                           ", function ", __func__, \
29                           ", file " __FILE__ \
30                           ", line " _PDCLIB_symbol2string( __LINE__ ) \
31                           "." _PDCLIB_endl ) )
32 #else
33 #define assert( expression ) ( ( expression ) ? (void) 0 \
34         : _PDCLIB_assert( "Assertion failed: " #expression \
35                           ", file " __FILE__ \
36                           ", line " _PDCLIB_symbol2string( __LINE__ ) \
37                           "." _PDCLIB_endl ) )
38 #endif
39 #endif
40