diff options
author | Kargatum <dowlandtop@yandex.com> | 2021-04-18 19:36:54 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-18 14:36:54 +0200 |
commit | 8263faa288fcfb7f3c97e7c3dea83f7c545b1d2a (patch) | |
tree | b43be0709656c926fb39f4ec76d353bd67958c83 /src/common/Debugging/Errors.h | |
parent | ac6a968242f526ede1089714e492ee100842ebfd (diff) |
feat(Core/Debugging): Allow to show a message when aborting (#5228)
Diffstat (limited to 'src/common/Debugging/Errors.h')
-rw-r--r-- | src/common/Debugging/Errors.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/Debugging/Errors.h b/src/common/Debugging/Errors.h index 1a01c51ae0..6e40202f4e 100644 --- a/src/common/Debugging/Errors.h +++ b/src/common/Debugging/Errors.h @@ -21,6 +21,8 @@ namespace acore DECLSPEC_NORETURN void Abort(char const* file, int line, char const* function) ATTR_NORETURN; + DECLSPEC_NORETURN void Abort(char const* file, int line, char const* function, char const* message, ...) ATTR_NORETURN; + void Warning(char const* file, int line, char const* function, char const* message); DECLSPEC_NORETURN void AbortHandler(int sigval) ATTR_NORETURN; @@ -47,6 +49,7 @@ std::string GetDebugInfo(); #define WPError(cond, msg) ASSERT_BEGIN do { if (!(cond)) acore::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END #define WPWarning(cond, msg) ASSERT_BEGIN do { if (!(cond)) acore::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END #define WPAbort() ASSERT_BEGIN do { acore::Abort(__FILE__, __LINE__, __FUNCTION__); } while(0) ASSERT_END +#define WPAbort_MSG(msg, ...) ASSERT_BEGIN do { acore::Abort(__FILE__, __LINE__, __FUNCTION__, (msg), ##__VA_ARGS__); } while(0) ASSERT_END #ifdef PERFORMANCE_PROFILING #define ASSERT(cond, ...) ((void)0) @@ -57,6 +60,7 @@ std::string GetDebugInfo(); #endif #define ABORT WPAbort +#define ABORT_MSG WPAbort_MSG template <typename T> inline T* ASSERT_NOTNULL_IMPL(T* pointer, char const* expr) |