Common/Assert: Include the condition and function in the message

This commit is contained in:
Pokechu22 2021-11-10 13:39:36 -08:00
parent 36d605715d
commit 1c0ca09e6f

View file

@ -13,31 +13,32 @@
{ \
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(); \
} \
} while (0)
#define DEBUG_ASSERT_MSG(_t_, _a_, _msg_, ...) \
#define DEBUG_ASSERT_MSG(_t_, _a_, _fmt_, ...) \
do \
{ \
if constexpr (Common::Log::MAX_LOGLEVEL >= Common::Log::LogLevel::LDEBUG) \
{ \
if (!(_a_)) \
{ \
ERROR_LOG(_t_, _msg_, ##__VA_ARGS__); \
if (!PanicYesNo(_msg_, ##__VA_ARGS__)) \
Crash(); \
} \
} \
ASSERT_MSG(_t_, _a_, _fmt_, ##__VA_ARGS__); \
} while (0)
#define ASSERT(_a_) \
do \
{ \
ASSERT_MSG(MASTER_LOG, _a_, \
_trans("An error occurred.\n\n Line: %d\n File: %s\n\nIgnore and continue?"), \
__LINE__, __FILE__); \
if (!(_a_)) \
{ \
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)
#define DEBUG_ASSERT(_a_) \