mirror of
https://github.com/zeldaret/tww.git
synced 2026-07-01 11:28:53 -04:00
Make JUT_ASSERT macro more accurate
(COND) == 0 and !(COND) both only match sometimes, but (void)((COND) || ...) seems to work all the time.
This commit is contained in:
@@ -4,11 +4,7 @@
|
||||
#include "dolphin/types.h"
|
||||
#include "dolphin/os/OS.h"
|
||||
|
||||
#define JUT_ASSERT(LINE, COND) \
|
||||
if ((COND) == 0) { \
|
||||
JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND); \
|
||||
OSPanic(__FILE__, LINE, "Halt"); \
|
||||
}
|
||||
#define JUT_ASSERT(LINE, COND) (void)((COND) || (JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND), OSPanic(__FILE__, LINE, "Halt"), 0));
|
||||
|
||||
// Favored by JAI (JAudio)
|
||||
#define JUT_ASSERT_MSG(LINE, COND, MSG) \
|
||||
@@ -20,14 +16,6 @@
|
||||
} \
|
||||
}
|
||||
|
||||
// Some asserts on floats have the wrong codegen with JUT_ASSERT's (COND) == 0 check.
|
||||
// Using !(COND) instead fixes them.
|
||||
#define JUT_ASSERT_FLOAT(LINE, COND) \
|
||||
if (!(COND)) { \
|
||||
JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND); \
|
||||
OSPanic(__FILE__, LINE, "Halt"); \
|
||||
}
|
||||
|
||||
#define JUT_PANIC(LINE) \
|
||||
JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, "0"); \
|
||||
OSPanic(__FILE__, LINE, "Halt");
|
||||
|
||||
Reference in New Issue
Block a user