From 105f54b2330d0227059c08d2e03454efa934c5db Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Tue, 5 Sep 2023 10:22:35 -0700 Subject: [PATCH] fix build & test conformance issues on mingw32/gcc and mingw64/clang (#1034) CLI/Reduce.cpp: Never worked under MinGW as-is. Add check for MinGW as they're defined. VM/src/lmem.cpp: MinGW layout follows more closely MSVC. Checks before were only correct for 32-bit gcc / clang in non-Windows. NOTES: __MINGW32__ is defined on both 32-bit and 64-bit, __MINGW64__ is 64-bit only. 32-bit MinGW compilers (both Clang & GCC) have a floating point test error on math.noise, specifically math.lua:258. All other test cases / unit tests pass modulo stack size issues (so requires optimized build). --------- Co-authored-by: jdp_ <42700985+jdpatdiscord@users.noreply.github.com> --- CLI/Reduce.cpp | 2 +- VM/src/lmem.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CLI/Reduce.cpp b/CLI/Reduce.cpp index 38133e04..721bb51c 100644 --- a/CLI/Reduce.cpp +++ b/CLI/Reduce.cpp @@ -15,7 +15,7 @@ #define VERBOSE 0 // 1 - print out commandline invocations. 2 - print out stdout -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__MINGW32__) const auto popen = &_popen; const auto pclose = &_pclose; diff --git a/VM/src/lmem.cpp b/VM/src/lmem.cpp index 3cbdafff..25ca999d 100644 --- a/VM/src/lmem.cpp +++ b/VM/src/lmem.cpp @@ -98,6 +98,8 @@ */ #if defined(__APPLE__) #define ABISWITCH(x64, ms32, gcc32) (sizeof(void*) == 8 ? x64 : gcc32) +#elif defined(__i386__) && defined(__MINGW32__) && !defined(__MINGW64__) +#define ABISWITCH(x64, ms32, gcc32) (ms32) #elif defined(__i386__) && !defined(_MSC_VER) #define ABISWITCH(x64, ms32, gcc32) (gcc32) #else