From: Eli Zaretskii Date: Sat, 2 Mar 2019 13:13:54 +0000 (+0200) Subject: Fix GDB compilation on MinGW (PR gdb/24292) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=41fa577fbc326402be49b3f03bc828e52dba8b88;p=binutils-gdb.git Fix GDB compilation on MinGW (PR gdb/24292) gdb/ChangeLog: 2019-03-02 Eli Zaretskii 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index da1890a32d5..0698c3a1371 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2019-03-02 Eli Zaretskii + + 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 * coffread.c (coff_start_symtab): Remove unnecessary xstrdup. diff --git a/gdb/common/netstuff.c b/gdb/common/netstuff.c index c1cc8d9d697..27fdc739ffd 100644 --- a/gdb/common/netstuff.c +++ b/gdb/common/netstuff.c @@ -21,8 +21,11 @@ #include #ifdef USE_WIN32API -#include -#include +#if _WIN32_WINNT < 0x0501 +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +#endif +#include #else #include #include diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c index bda8095839c..63303eebc40 100644 --- a/gdb/gdbserver/gdbreplay.c +++ b/gdb/gdbserver/gdbreplay.c @@ -45,8 +45,11 @@ #endif #if USE_WIN32API -#include -#include +#if _WIN32_WINNT < 0x0501 +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +#endif +#include #endif #include "common/netstuff.h" diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index ad0228db99c..4e6f9c62de8 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -63,8 +63,11 @@ #include #if USE_WIN32API -#include -#include +#if _WIN32_WINNT < 0x0501 +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +#endif +#include #endif #if __QNX__ diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c index f484e59f196..039b0432231 100644 --- a/gdb/ser-tcp.c +++ b/gdb/ser-tcp.c @@ -39,8 +39,11 @@ #include "common/gdb_sys_time.h" #ifdef USE_WIN32API -#include -#include +#if _WIN32_WINNT < 0x0501 +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +#endif +#include #ifndef ETIMEDOUT #define ETIMEDOUT WSAETIMEDOUT #endif diff --git a/gdb/unittests/parse-connection-spec-selftests.c b/gdb/unittests/parse-connection-spec-selftests.c index ac7cd41e212..969c51e4e88 100644 --- a/gdb/unittests/parse-connection-spec-selftests.c +++ b/gdb/unittests/parse-connection-spec-selftests.c @@ -22,8 +22,11 @@ #include "common/netstuff.h" #include "diagnostics.h" #ifdef USE_WIN32API -#include -#include +#if _WIN32_WINNT < 0x0501 +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +#endif +#include #else #include #include