aboutsummaryrefslogtreecommitdiff
path: root/src/common/Debugging/Errors.h
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2020-03-09 20:06:13 +0100
committerShauren <shauren.trinity@gmail.com>2021-12-22 22:54:18 +0100
commit1fa4403b8c16ec0aa0a31831df2a77a86ef6642d (patch)
treee53d7227a59271a9f296076c9c2ca40b56111f28 /src/common/Debugging/Errors.h
parent2b656aa96707c5cc09358f594dae8c9d5968fe9a (diff)
Core/Common: Allow to show a message when aborting
Add a new ABORT_MSG macro that allows to show a formatted message before stopping the executable (cherry picked from commit 0ddee8a4a03fb5c7ee8d18144ca21cd2baad6f01)
Diffstat (limited to 'src/common/Debugging/Errors.h')
-rw-r--r--src/common/Debugging/Errors.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/Debugging/Errors.h b/src/common/Debugging/Errors.h
index befb269a120..6fd0faa0d87 100644
--- a/src/common/Debugging/Errors.h
+++ b/src/common/Debugging/Errors.h
@@ -31,6 +31,7 @@ namespace Trinity
DECLSPEC_NORETURN TC_COMMON_API void Error(char const* file, int line, char const* function, char const* message) ATTR_NORETURN;
DECLSPEC_NORETURN TC_COMMON_API void Abort(char const* file, int line, char const* function) ATTR_NORETURN;
+ DECLSPEC_NORETURN TC_COMMON_API void Abort(char const* file, int line, char const* function, char const* message, ...) ATTR_NORETURN;
TC_COMMON_API void Warning(char const* file, int line, char const* function, char const* message);
@@ -58,6 +59,7 @@ TC_COMMON_API std::string GetDebugInfo();
#define WPError(cond, msg) ASSERT_BEGIN do { if (!(cond)) Trinity::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END
#define WPWarning(cond, msg) ASSERT_BEGIN do { if (!(cond)) Trinity::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END
#define WPAbort() ASSERT_BEGIN do { Trinity::Abort(__FILE__, __LINE__, __FUNCTION__); } while(0) ASSERT_END
+#define WPAbort_MSG(msg, ...) ASSERT_BEGIN do { Trinity::Abort(__FILE__, __LINE__, __FUNCTION__, (msg), ##__VA_ARGS__); } while(0) ASSERT_END
#ifdef PERFORMANCE_PROFILING
#define ASSERT(cond, ...) ((void)0)
@@ -68,6 +70,7 @@ TC_COMMON_API 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)