Common/Assert: Include the condition and function in the message
This commit is contained in:
parent
36d605715d
commit
1c0ca09e6f
|
@ -13,31 +13,32 @@
|
||||||
{ \
|
{ \
|
||||||
if (!(_a_)) \
|
if (!(_a_)) \
|
||||||
{ \
|
{ \
|
||||||
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) \
|
if (!PanicYesNo("An error occurred.\n\n" _fmt_ "\n\n" \
|
||||||
|
" Condition: %s\n File: %s\n Line: %d\n Function: %s\n\n" \
|
||||||
|
"Ignore and continue?", \
|
||||||
|
##__VA_ARGS__, #_a_, __FILE__, __LINE__, __func__)) \
|
||||||
Crash(); \
|
Crash(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define DEBUG_ASSERT_MSG(_t_, _a_, _msg_, ...) \
|
#define DEBUG_ASSERT_MSG(_t_, _a_, _fmt_, ...) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
if constexpr (Common::Log::MAX_LOGLEVEL >= Common::Log::LogLevel::LDEBUG) \
|
if constexpr (Common::Log::MAX_LOGLEVEL >= Common::Log::LogLevel::LDEBUG) \
|
||||||
{ \
|
ASSERT_MSG(_t_, _a_, _fmt_, ##__VA_ARGS__); \
|
||||||
if (!(_a_)) \
|
|
||||||
{ \
|
|
||||||
ERROR_LOG(_t_, _msg_, ##__VA_ARGS__); \
|
|
||||||
if (!PanicYesNo(_msg_, ##__VA_ARGS__)) \
|
|
||||||
Crash(); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ASSERT(_a_) \
|
#define ASSERT(_a_) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
ASSERT_MSG(MASTER_LOG, _a_, \
|
if (!(_a_)) \
|
||||||
_trans("An error occurred.\n\n Line: %d\n File: %s\n\nIgnore and continue?"), \
|
{ \
|
||||||
__LINE__, __FILE__); \
|
if (!PanicYesNo("An error occurred.\n\n" \
|
||||||
|
" Condition: %s\n File: %s\n Line: %d\n Function: %s\n\n" \
|
||||||
|
"Ignore and continue?", \
|
||||||
|
#_a_, __FILE__, __LINE__, __func__)) \
|
||||||
|
Crash(); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define DEBUG_ASSERT(_a_) \
|
#define DEBUG_ASSERT(_a_) \
|
||||||
|
|
Loading…
Reference in New Issue