X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=includes%2Fassert.h;h=ca0022d9d03401e489f480c96c6d887e158c6d81;hp=7874167258675dcb713b9e2f69328db9f2e2b4ad;hb=1cc4363093c919f79eafac209bb5c41548d3f88f;hpb=5155ca96295a12b4857fc0e6a9629cc43a9a85fa diff --git a/includes/assert.h b/includes/assert.h index 7874167..ca0022d 100644 --- a/includes/assert.h +++ b/includes/assert.h @@ -12,6 +12,7 @@ #include <_PDCLIB_config.h> _PDCLIB_BEGIN_EXTERN_C +/* Functions _NOT_ tagged noreturn as this hampers debugging */ void _PDCLIB_assert99( char const * const, char const * const, char const * const ); void _PDCLIB_assert89( char const * const ); @@ -20,23 +21,24 @@ void _PDCLIB_assert89( char const * const ); #ifdef NDEBUG #define assert( ignore ) ( (void) 0 ) -#elif _PDCLIB_C_VERSION >= 99 +#elif _PDCLIB_C_MIN(99) #define assert(expression) \ - do { if(!(expression)) \ - _PDCLIB_assert99("Assertion failed: " #expression \ + do { if(!(expression)) { \ + _PDCLIB_assert99("Assertion failed: " _PDCLIB_symbol2string(expression)\ ", function ", __func__, \ ", file " __FILE__ \ ", line " _PDCLIB_symbol2string( __LINE__ ) \ "." _PDCLIB_endl ); \ + } \ } while(0) #else #define assert(expression) \ - do { \ - if(!(expression)) \ - _PDCLIB_assert89( "Assertion failed: " #expression \ - ", file " __FILE__ \ - ", line " _PDCLIB_symbol2string( __LINE__ ) \ - "." _PDCLIB_endl ); \ + do { if(!(expression)) { \ + _PDCLIB_assert89("Assertion failed: " _PDCLIB_symbol2string(expression)\ + ", file " __FILE__ \ + ", line " _PDCLIB_symbol2string( __LINE__ ) \ + "." _PDCLIB_endl ); \ + } \ } while(0) #endif