[PATCH 27/27] gdb/testsuite/lib/gdb-dlfcn.h: __WIN32__ => _WIN32

Pedro Alves <[email protected]> Thu, 23 Jul 2026 14:01:18 +0100
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
testsuite/lib/gdb-dlfcn.h guards the Windows branch with __WIN32__,
which is a GCC/MinGW-ism.  __WIN32__ is not defined by MSVC nor by
Clang targeting *-windows-msvc, so when testing with (e.g.)
--target=x86_64-pc-windows-msvc gdb-dlfcn.h takes the <dlfcn.h> branch
and we fail to build the testcase that included it.

Fix this by using _WIN32 instead, which is defined on every (native)
Windows toolchain (and not by Cygwin).

There are no other references to __WIN32__ in the testsuite.

Tested by running the affected testcases on:

 x86_64-pc-linux-gnu
 x86_64-pc-cygwin
 x86_64-w64-mingw32
 x86_64-pc-windows-msvc

Change-Id: Iacb54478519231e81fada2d55fec80a0831ab6d3
---
 gdb/testsuite/lib/gdb-dlfcn.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/gdb-dlfcn.h b/gdb/testsuite/lib/gdb-dlfcn.h
index 02cd6141b2c..66b6816db6a 100644
--- a/gdb/testsuite/lib/gdb-dlfcn.h
+++ b/gdb/testsuite/lib/gdb-dlfcn.h
@@ -22,7 +22,7 @@
 #ifndef GDB_DLFCN_H
 #define GDB_DLFCN_H
 
-#ifdef __WIN32__
+#ifdef _WIN32
 
 #include <windows.h>
 #include <stdio.h>
-- 
2.54.0