mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-08 04:08:32 +09:00
[Feat]: more refined MOBILEGL_ASSERT() macro
This commit is contained in:
+9
-1
@@ -43,12 +43,20 @@
|
||||
#define MOBILEGL_LOG_FILE_PATH ""
|
||||
#endif
|
||||
|
||||
#if _MSC_VER
|
||||
#define TRAP assert(false)
|
||||
#elif __clang__
|
||||
#define TRAP __builtin_debugtrap()
|
||||
#else
|
||||
#define TRAP raise(SIGTRAP)
|
||||
#endif
|
||||
|
||||
// =============================== Utils ================================ //
|
||||
#define MOBILEGL_ASSERT(condition, ...) \
|
||||
do { \
|
||||
if (!(condition)) { \
|
||||
MGLOG_F("Assertion failed" __VA_OPT__(": ") __VA_ARGS__); \
|
||||
MGLOG_F(" at %s:%d (%s)", __FILE__, __LINE__, __func__); \
|
||||
assert(false); \
|
||||
TRAP; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
Reference in New Issue
Block a user