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