X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=includes%2Fassert.h;h=cb5c47e4bd2875ba8e1874c96c6e6b7c951d0562;hb=3862b03514c94f37966f61693619e6483ead6045;hp=ca0022d9d03401e489f480c96c6d887e158c6d81;hpb=f7a440b9c7bb0c686dc2368c4ff53b20bf6371f8;p=pdclib.old diff --git a/includes/assert.h b/includes/assert.h index ca0022d..cb5c47e 100644 --- a/includes/assert.h +++ b/includes/assert.h @@ -20,7 +20,10 @@ void _PDCLIB_assert89( char const * const ); #undef assert #ifdef NDEBUG -#define assert( ignore ) ( (void) 0 ) +#define assert( ignore ) do { \ + if(!(expression)) { _PDCLIB_UNREACHABLE; } \ + } while(0) + #elif _PDCLIB_C_MIN(99) #define assert(expression) \ do { if(!(expression)) { \ @@ -29,8 +32,10 @@ void _PDCLIB_assert89( char const * const ); ", file " __FILE__ \ ", line " _PDCLIB_symbol2string( __LINE__ ) \ "." _PDCLIB_endl ); \ + _PDCLIB_UNREACHABLE; \ } \ } while(0) + #else #define assert(expression) \ do { if(!(expression)) { \ @@ -38,6 +43,7 @@ void _PDCLIB_assert89( char const * const ); ", file " __FILE__ \ ", line " _PDCLIB_symbol2string( __LINE__ ) \ "." _PDCLIB_endl ); \ + _PDCLIB_UNREACHABLE; \ } \ } while(0) #endif