From 3cbf5fe47f15cad3406d634529a6fb9a622d7fc8 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 28 Oct 2025 14:10:56 +0100 Subject: Core/Miscc: Fix compile warning with clang on windows --- src/common/Debugging/Errors.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/common/Debugging') diff --git a/src/common/Debugging/Errors.cpp b/src/common/Debugging/Errors.cpp index 51000b51707..c333aa24ec0 100644 --- a/src/common/Debugging/Errors.cpp +++ b/src/common/Debugging/Errors.cpp @@ -17,7 +17,6 @@ #include "Errors.h" #include "StringFormat.h" -#include #include #include #include @@ -34,20 +33,26 @@ terminates the application. */ +#if TRINITY_COMPILER == TRINITY_COMPILER_MICROSOFT +#define Unreachable() (__assume(false)) +#else +#define Unreachable() (__builtin_unreachable()) +#endif + #if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS #include #include #define Crash(message) \ ULONG_PTR execeptionArgs[] = { reinterpret_cast(strdup(message)), reinterpret_cast(_ReturnAddress()) }; \ - RaiseException(EXCEPTION_ASSERTION_FAILURE, 0, 2, execeptionArgs); + RaiseException(EXCEPTION_ASSERTION_FAILURE, 0, 2, execeptionArgs); \ + Unreachable() #else -#include // should be easily accessible in gdb extern "C" { TC_COMMON_API char const* TrinityAssertionFailedMessage = nullptr; } #define Crash(message) \ TrinityAssertionFailedMessage = strdup(message); \ *((volatile int*)nullptr) = 0; \ - exit(1); + Unreachable() #endif namespace -- cgit v1.2.3