Add MINGW32 compiler flag. (see #2094)

This commit is contained in:
HoseynHeydari 2022-04-14 17:56:19 +04:30
parent e3aaa40fe7
commit d8b5016fc9
5 changed files with 9 additions and 5 deletions

View File

@ -40,6 +40,10 @@
#define CATCH_COMPILER_MSC #define CATCH_COMPILER_MSC
#endif #endif
#if defined(__MINGW32__)
#define CATCH_COMPILER_MINGW32
#endif
#ifdef __cplusplus #ifdef __cplusplus
# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) # if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
@ -139,7 +143,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Not all Windows environments support SEH properly // Not all Windows environments support SEH properly
#if defined(__MINGW32__) #if defined(CATCH_COMPILER_MINGW32)
# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH # define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH
#endif #endif

View File

@ -108,7 +108,7 @@
return IsDebuggerPresent() != 0; return IsDebuggerPresent() != 0;
} }
} }
#elif defined(__MINGW32__) #elif defined(CATCH_COMPILER_MINGW32)
extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent(); extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
namespace Catch { namespace Catch {
bool isDebuggerActive() { bool isDebuggerActive() {

View File

@ -49,7 +49,7 @@ namespace Catch {
#endif #endif
#elif defined(CATCH_COMPILER_MSC) #elif defined(CATCH_COMPILER_MSC)
#define CATCH_TRAP() __debugbreak() #define CATCH_TRAP() __debugbreak()
#elif defined(__MINGW32__) #elif defined(CATCH_COMPILER_MINGW32)
extern "C" __declspec(dllimport) void __stdcall DebugBreak(); extern "C" __declspec(dllimport) void __stdcall DebugBreak();
#define CATCH_TRAP() DebugBreak() #define CATCH_TRAP() DebugBreak()
#endif #endif

View File

@ -24,7 +24,7 @@
#elif defined(linux) || defined(__linux) || defined(__linux__) #elif defined(linux) || defined(__linux) || defined(__linux__)
# define CATCH_PLATFORM_LINUX # define CATCH_PLATFORM_LINUX
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(CATCH_COMPILER_MSC) || defined(__MINGW32__) #elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(CATCH_COMPILER_MSC) || defined(CATCH_COMPILER_MINGW32)
# define CATCH_PLATFORM_WINDOWS # define CATCH_PLATFORM_WINDOWS
#endif #endif

View File

@ -29,7 +29,7 @@ namespace Catch {
std::time(&rawtime); std::time(&rawtime);
std::tm timeInfo = {}; std::tm timeInfo = {};
#if defined (CATCH_COMPILER_MSC) || defined (__MINGW32__) #if defined (CATCH_COMPILER_MSC) || defined (CATCH_COMPILER_MINGW32)
gmtime_s(&timeInfo, &rawtime); gmtime_s(&timeInfo, &rawtime);
#else #else
gmtime_r(&rawtime, &timeInfo); gmtime_r(&rawtime, &timeInfo);