diff --git a/include/ucore/utils.h b/include/ucore/utils.h index 7253f04..5f8b0af 100644 --- a/include/ucore/utils.h +++ b/include/ucore/utils.h @@ -84,19 +84,26 @@ const typeof( ((const type *)0)->member ) *__mptr = (ptr); \ /** * assert() that is not affected by NDEBUG define */ -#define UC_ASSERT(expr) do {\ -if (!(expr) ) {\ - fprintf(stderr,\ - "UC_ASSERT failed '%s' %s:%d\n", UC_STRINGIFY(expr), __FILE__, __LINE__);\ - uc_backtrace_fd(3);\ - abort();\ +#define UC_ASSERT(expr)\ + do {\ + if (!(expr) ) {\ + fprintf(stderr,\ + "UC_ASSERT failed '%s' %s:%d\n", UC_STRINGIFY(expr), __FILE__, __LINE__);\ + uc_backtrace_fd(2);\ + abort();\ + }\ } while (0) /** * Macro for asserting code that should not be reached, * terminates the program if executed */ -#define UC_NOT_REACED() abort() +#define UC_NOT_REACED()\ +do {\ + fprintf(stderr, "UC_NOT_REACED at %s:%d\n", __FILE__, __LINE__);\ + uc_backtrace_fd(2);\ + abort();\ +while (0) /** * Round up X / y