diff options
| author | Shauren <shauren.trinity@gmail.com> | 2025-10-28 14:10:56 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2025-10-28 14:10:56 +0100 |
| commit | 3cbf5fe47f15cad3406d634529a6fb9a622d7fc8 (patch) | |
| tree | d927991c61f36edd280553cac6bbd33b95c351e3 /src | |
| parent | 9646bdddafc8645dfd559646a74f317ad34815b4 (diff) | |
Core/Miscc: Fix compile warning with clang on windows
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/Debugging/Errors.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
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 <cstdlib> #include <thread> #include <cstdarg> #include <cstdio> @@ -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 <Windows.h> #include <intrin.h> #define Crash(message) \ ULONG_PTR execeptionArgs[] = { reinterpret_cast<ULONG_PTR>(strdup(message)), reinterpret_cast<ULONG_PTR>(_ReturnAddress()) }; \ - RaiseException(EXCEPTION_ASSERTION_FAILURE, 0, 2, execeptionArgs); + RaiseException(EXCEPTION_ASSERTION_FAILURE, 0, 2, execeptionArgs); \ + Unreachable() #else -#include <cstring> // 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 |
