Fix GDB compilation on MinGW (PR gdb/24292)
authorEli Zaretskii <eliz@gnu.org>
Sat, 2 Mar 2019 13:13:54 +0000 (15:13 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 2 Mar 2019 13:13:54 +0000 (15:13 +0200)
gdb/ChangeLog:

2019-03-02  Eli Zaretskii  <eliz@gnu.org>

PR gdb/24292
* common/netstuff.c:
* gdbserver/gdbreplay.c
* gdbserver/remote-utils.c:
* ser-tcp.c:
* unittests/parse-connection-spec-selftests.c [USE_WIN32API]:
Include ws2tcpip.h instead of wsiapi.h and winsock2.h.  Redefine
_WIN32_WINNT to 0x0501 if defined to a smaller value, as
'getaddrinfo' and 'freeaddrinfo' were not available before
Windows XP, and mingw.org's MinGW headers by default define
_WIN32_WINNT to 0x500.

gdb/ChangeLog
gdb/common/netstuff.c
gdb/gdbserver/gdbreplay.c
gdb/gdbserver/remote-utils.c
gdb/ser-tcp.c
gdb/unittests/parse-connection-spec-selftests.c

index da1890a32d582288701d53713d069063ae298e5e..0698c3a1371342111d5f90e91c01c7fb8a9e4baa 100644 (file)
@@ -1,3 +1,17 @@
+2019-03-02  Eli Zaretskii  <eliz@gnu.org>
+
+       PR gdb/24292
+       * common/netstuff.c:
+       * gdbserver/gdbreplay.c
+       * gdbserver/remote-utils.c:
+       * ser-tcp.c:
+       * unittests/parse-connection-spec-selftests.c [USE_WIN32API]:
+       Include ws2tcpip.h instead of wsiapi.h and winsock2.h.  Redefine
+       _WIN32_WINNT to 0x0501 if defined to a smaller value, as
+       'getaddrinfo' and 'freeaddrinfo' were not available before
+       Windows XP, and mingw.org's MinGW headers by default define
+       _WIN32_WINNT to 0x500.
+
 2019-03-01  Gary Benson <gbenson@redhat.com>
 
        * coffread.c (coff_start_symtab): Remove unnecessary xstrdup.
index c1cc8d9d6974cce506dd612d2a15afb1d791ab75..27fdc739ffd5a5e91b72acbd3f6caecf461e7c74 100644 (file)
 #include <algorithm>
 
 #ifdef USE_WIN32API
-#include <winsock2.h>
-#include <wspiapi.h>
+#if _WIN32_WINNT < 0x0501
+# undef _WIN32_WINNT
+# define _WIN32_WINNT 0x0501
+#endif
+#include <ws2tcpip.h>
 #else
 #include <netinet/in.h>
 #include <arpa/inet.h>
index bda8095839c6ffd7968dc8338adea94061d2a630..63303eebc40b17b90d0547099c87af53628843a5 100644 (file)
 #endif
 
 #if USE_WIN32API
-#include <winsock2.h>
-#include <wspiapi.h>
+#if _WIN32_WINNT < 0x0501
+# undef _WIN32_WINNT
+# define _WIN32_WINNT 0x0501
+#endif
+#include <ws2tcpip.h>
 #endif
 
 #include "common/netstuff.h"
index ad0228db99c93fb3c0c80a77d7e06b55c535a2c5..4e6f9c62de8bb52db4d771f69cc780fb9112baeb 100644 (file)
 #include <sys/stat.h>
 
 #if USE_WIN32API
-#include <winsock2.h>
-#include <wspiapi.h>
+#if _WIN32_WINNT < 0x0501
+# undef _WIN32_WINNT
+# define _WIN32_WINNT 0x0501
+#endif
+#include <ws2tcpip.h>
 #endif
 
 #if __QNX__
index f484e59f196600a5bbff8c62ef781d17a13a4986..039b0432231142b6cc18138607858384727bd43b 100644 (file)
 #include "common/gdb_sys_time.h"
 
 #ifdef USE_WIN32API
-#include <winsock2.h>
-#include <wspiapi.h>
+#if _WIN32_WINNT < 0x0501
+# undef _WIN32_WINNT
+# define _WIN32_WINNT 0x0501
+#endif
+#include <ws2tcpip.h>
 #ifndef ETIMEDOUT
 #define ETIMEDOUT WSAETIMEDOUT
 #endif
index ac7cd41e21229f1c3136b4bd509e4fcafd7d79f0..969c51e4e88da5abbe593cfbaca891c72b9ef91b 100644 (file)
 #include "common/netstuff.h"
 #include "diagnostics.h"
 #ifdef USE_WIN32API
-#include <winsock2.h>
-#include <wspiapi.h>
+#if _WIN32_WINNT < 0x0501
+# undef _WIN32_WINNT
+# define _WIN32_WINNT 0x0501
+#endif
+#include <ws2tcpip.h>
 #else
 #include <netinet/in.h>
 #include <arpa/inet.h>