diff mbox series

[Valgrind-developers,v2] mingw: Fix arch detection ifdefs for non-x86 mingw platforms

Message ID 20200427183151.14368-1-martin@martin.st
State New
Headers show
Series [Valgrind-developers,v2] mingw: Fix arch detection ifdefs for non-x86 mingw platforms | expand

Commit Message

Martin Storsjo April 27, 2020, 6:31 p.m. UTC
Don't assume that __MINGW32__ implies x86; Windows runs on ARM/ARM64
as well, and there are mingw toolchains that target those architectures.

This mirrors how the MSVC parts of the same expressions are written,
as (defined(_WIN32) && defined(_M_IX86)) and
(defined(_WIN64) && defined(_M_X64)) - not relying on _WIN32/_WIN64
or __MINGW32__/__MINGW64__ alone to indicate architecture.

Change the __MINGW64__ and _WIN64 ifdefs into plain __MINGW32__
and _WIN32 as well, for clarity - these defines mostly imply
platform.
---
 include/valgrind.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

-- 
2.17.1



_______________________________________________
Valgrind-developers mailing list
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Comments

Bart Van Assche April 27, 2020, 6:55 p.m. UTC | #1
On 2020-04-27 11:31, Martin Storsjö wrote:
> Don't assume that __MINGW32__ implies x86; Windows runs on ARM/ARM64
> as well, and there are mingw toolchains that target those architectures.

This patch has been applied on the master branch. Thanks for the patch!

Bart.
Martin Storsjo April 27, 2020, 6:56 p.m. UTC | #2
On Mon, 27 Apr 2020, Bart Van Assche wrote:

> On 2020-04-27 11:31, Martin Storsjö wrote:

>> Don't assume that __MINGW32__ implies x86; Windows runs on ARM/ARM64

>> as well, and there are mingw toolchains that target those architectures.

>

> This patch has been applied on the master branch. Thanks for the patch!


Thank you!

// Martin
_______________________________________________
Valgrind-developers mailing list
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers
diff mbox series

Patch

diff --git a/include/valgrind.h b/include/valgrind.h
index c8b24a38e..00e985dca 100644
--- a/include/valgrind.h
+++ b/include/valgrind.h
@@ -131,12 +131,13 @@ 
 #  define PLAT_x86_darwin 1
 #elif defined(__APPLE__) && defined(__x86_64__)
 #  define PLAT_amd64_darwin 1
-#elif (defined(__MINGW32__) && !defined(__MINGW64__)) \
+#elif (defined(__MINGW32__) && defined(__i386__)) \
       || defined(__CYGWIN32__) \
       || (defined(_WIN32) && defined(_M_IX86))
 #  define PLAT_x86_win32 1
-#elif defined(__MINGW64__) \
-      || (defined(_WIN64) && defined(_M_X64))
+#elif (defined(__MINGW32__) && defined(__x86_64__)) \
+      || (defined(_WIN32) && defined(_M_X64))
+/* __MINGW32__ and _WIN32 are defined in 64 bit mode as well. */
 #  define PLAT_amd64_win64 1
 #elif defined(__linux__) && defined(__i386__)
 #  define PLAT_x86_linux 1