fix UC_ASSERT writing to wrong fd, and unterminated if
log more in UC_NOTREACHED
This commit is contained in:
+14
-7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user