X-Git-Url: https://pd.if.org/git/?p=pdclib.old;a=blobdiff_plain;f=includes%2Fassert.h;h=ca0022d9d03401e489f480c96c6d887e158c6d81;hp=7874167258675dcb713b9e2f69328db9f2e2b4ad;hb=f7a440b9c7bb0c686dc2368c4ff53b20bf6371f8;hpb=bb22ff7ecd9fe8f4641484df12ad629cd8ee27ac 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