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:26:54 +0000 (15:26 +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.

(cherry picked from commit 41fa577fbc326402be49b3f03bc828e52dba8b88)

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 0cf5e56..eb8eb15 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-02-27  Kevin Buettner  <kevinb@redhat.com>
     
        * NEWS: Note minimum Python version.
index c1cc8d9..27fdc73 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 26a5553..fed9102 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 ad0228d..4e6f9c6 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 f484e59..039b043 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 ac7cd41..969c51e 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>