From 8434d30768d56cb45bc5373f74550fb8b27957e8 Mon Sep 17 00:00:00 2001 From: SachinVin Date: Sat, 18 Mar 2023 20:25:39 +0530 Subject: [PATCH] common\common_funcs.h: use __builtin_trap for `Crash()` --- src/common/common_funcs.h | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index c29a33b09..385af24c5 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -35,16 +35,16 @@ #define CITRA_NO_INLINE __attribute__((noinline)) #endif -#ifndef _MSC_VER - -#if CITRA_ARCH(x86_64) -#define Crash() __asm__ __volatile__("int $3") +#ifdef _MSC_VER +extern "C" { +__declspec(dllimport) void __stdcall DebugBreak(void); +} +#define Crash() DebugBreak() #else -#define Crash() exit(1) +#define Crash() __builtin_trap() #endif -#else // _MSC_VER - +#ifdef _MSC_VER #if (_MSC_VER < 1900) // Function Cross-Compatibility #define snprintf _snprintf @@ -53,12 +53,7 @@ // Locale Cross-Compatibility #define locale_t _locale_t -extern "C" { -__declspec(dllimport) void __stdcall DebugBreak(void); -} -#define Crash() DebugBreak() - -#endif // _MSC_VER ndef +#endif // _MSC_VER // Generic function to get last error message. // Call directly after the command or use the error num.