diff --git a/src/common/Debugging/Errors.h b/src/common/Debugging/Errors.h index 81d06a0d44..865dc8cffc 100644 --- a/src/common/Debugging/Errors.h +++ b/src/common/Debugging/Errors.h @@ -52,25 +52,17 @@ namespace Trinity } } // namespace Trinity -#if TRINITY_COMPILER_IS_MICROSOFT -#define ASSERT_BEGIN __pragma(warning(push)) __pragma(warning(disable: 4127)) -#define ASSERT_END __pragma(warning(pop)) -#else -#define ASSERT_BEGIN -#define ASSERT_END -#endif - -#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS && !defined(EXCEPTION_ASSERTION_FAILURE) #define EXCEPTION_ASSERTION_FAILURE 0xC0000420L #endif -#define WPAssert(cond, ...) ASSERT_BEGIN do { if (!(cond)) [[unlikely]] Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, #cond, GetDebugInfo(), ##__VA_ARGS__); } while(0) ASSERT_END -#define WPAssert_NODEBUGINFO(cond, ...) ASSERT_BEGIN do { if (!(cond)) [[unlikely]] Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, #cond, ::GetDebugInfo(), ##__VA_ARGS__); } while(0) ASSERT_END -#define WPFatal(cond, ...) ASSERT_BEGIN do { if (!(cond)) [[unlikely]] Trinity::Fatal(__FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); } while(0) ASSERT_END -#define WPError(cond, msg) ASSERT_BEGIN do { if (!(cond)) [[unlikely]] Trinity::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END -#define WPWarning(cond, msg) ASSERT_BEGIN do { if (!(cond)) [[unlikely]] 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 +#define WPAssert(cond, ...) do { if (!(cond)) [[unlikely]] Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, #cond, GetDebugInfo(), ##__VA_ARGS__); } while(0) +#define WPAssert_NODEBUGINFO(cond, ...) do { if (!(cond)) [[unlikely]] Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, #cond, ::GetDebugInfo(), ##__VA_ARGS__); } while(0) +#define WPFatal(cond, ...) do { if (!(cond)) [[unlikely]] Trinity::Fatal(__FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); } while(0) +#define WPError(cond, msg) do { if (!(cond)) [[unlikely]] Trinity::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) +#define WPWarning(cond, msg) do { if (!(cond)) [[unlikely]] Trinity::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) +#define WPAbort() do { Trinity::Abort(__FILE__, __LINE__, __FUNCTION__); } while(0) +#define WPAbort_MSG(msg, ...) do { Trinity::Abort(__FILE__, __LINE__, __FUNCTION__, (msg), ##__VA_ARGS__); } while(0) #ifdef PERFORMANCE_PROFILING #define ASSERT(cond, ...) ((void)0) diff --git a/src/common/Logging/Log.h b/src/common/Logging/Log.h index 59224aac50..46a15b9d97 100644 --- a/src/common/Logging/Log.h +++ b/src/common/Logging/Log.h @@ -155,24 +155,16 @@ class TC_COMMON_API Log #define sLog Log::instance() -#define TC_LOG_MESSAGE_BODY_CORE(filterType__, level__, message__, ...) \ +#ifdef PERFORMANCE_PROFILING +#define TC_LOG_MESSAGE_BODY(filterType__, level__, message__, ...) ((void)0) +#else +#define TC_LOG_MESSAGE_BODY(filterType__, level__, message__, ...) \ do { \ Log* logInstance = sLog; \ if (Logger const* loggerInstance = logInstance->GetEnabledLogger(Log::make_string_view((filterType__)), (level__))) \ logInstance->OutMessageTo(loggerInstance, Log::make_string_view((filterType__)), (level__), \ Log::make_format_string_view((message__)), ## __VA_ARGS__); \ } while (0) - -#ifdef PERFORMANCE_PROFILING -#define TC_LOG_MESSAGE_BODY(filterType__, level__, message__, ...) ((void)0) -#elif !TRINITY_COMPILER_IS_MICROSOFT -#define TC_LOG_MESSAGE_BODY(filterType__, level__, message__, ...) TC_LOG_MESSAGE_BODY_CORE(filterType__, level__, message__, ## __VA_ARGS__) -#else -#define TC_LOG_MESSAGE_BODY(filterType__, level__, message__, ...) \ - __pragma(warning(push)) \ - __pragma(warning(disable:4127)) \ - TC_LOG_MESSAGE_BODY_CORE(filterType__, level__, message__, ## __VA_ARGS__) \ - __pragma(warning(pop)) #endif #define TC_LOG_TRACE(filterType__, message__, ...) \