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