fix UC_ASSERT writing to wrong fd, and unterminated if
log more in UC_NOTREACHED
This commit is contained in:
+11
-4
@@ -84,19 +84,26 @@ const typeof( ((const type *)0)->member ) *__mptr = (ptr); \
|
|||||||
/**
|
/**
|
||||||
* assert() that is not affected by NDEBUG define
|
* assert() that is not affected by NDEBUG define
|
||||||
*/
|
*/
|
||||||
#define UC_ASSERT(expr) do {\
|
#define UC_ASSERT(expr)\
|
||||||
if (!(expr) ) {\
|
do {\
|
||||||
|
if (!(expr) ) {\
|
||||||
fprintf(stderr,\
|
fprintf(stderr,\
|
||||||
"UC_ASSERT failed '%s' %s:%d\n", UC_STRINGIFY(expr), __FILE__, __LINE__);\
|
"UC_ASSERT failed '%s' %s:%d\n", UC_STRINGIFY(expr), __FILE__, __LINE__);\
|
||||||
uc_backtrace_fd(3);\
|
uc_backtrace_fd(2);\
|
||||||
abort();\
|
abort();\
|
||||||
|
}\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macro for asserting code that should not be reached,
|
* Macro for asserting code that should not be reached,
|
||||||
* terminates the program if executed
|
* 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
|
* Round up X / y
|
||||||
|
|||||||
Reference in New Issue
Block a user