MinGW build of GDB 8.2.90 (was: GDB 8.2.90 available for testing)

Eli Zaretskii
2019-02-28T18:31:10Z

> From: Joel Brobecker <brobecker@adacore.com>
> Date: Wed, 27 Feb 2019 09:51:12 +0400 (+04)
>
> I have just finished creating the gdb-8.2.90 pre-release.
> It is available for download at the following location:
>
> ftp://sourceware.org/pub/gdb/snapshots/branch/gdb-8.2.90.tar.xz

Thanks, I've built this with mingw.org's MinGW and bumped into a few
problems.

First, the recent changes to support IPv6 caused compilation errors in
several files. The problem is with several fragments such as this
one:

#ifdef USE_WIN32API
#include <winsock2.h>
#include <wspiapi.h>
#else
...

mingw.org's MinGW doesn't have wspiapi.h. Moreover, the Microsoft
documentation indicates that to get prototypes of getaddrinfo,
freeaddrinfo, etc. one needs to include ws2tcpip.h (and not include
winsock2.h separately), see, for example,

https://docs.microsoft.com/en-us/windows/desktop/api/ws2tcpip/nf-ws2tcpip-getaddrinfo

Sergio, can you tell why you used wspiapi.h instead?

Is it okay to push changes such as the one below, master and branch
(after filing a Bugzilla report)?

--- ./gdb/common/netstuff.c~0 2019-02-27 06:51:50.000000000 +0200
+++ ./gdb/common/netstuff.c 2019-02-28 08:56:07.511568800 +0200
@@ -21,8 +21,11 @@
#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>

Note that one other side effect of the IPv6 support additions is that
on MS-Windows GDB will no longer run on versions older than XP, I
guess this is something that should be mentioned in NEWS?

The other two problems were minor warning, one in tui.c about an
unused variable 'cap' (it is not used on Windows) and another in
xml-syscall.c:

CXX xml-syscall.o
xml-syscall.c: In function 'bool xml_list_syscalls_by_group(gdbarch*, const char*, std::vector<int>*)':
xml-syscall.c:475:14: warning: types may not be defined in a for-range-declaration
for (const struct syscall_desc *sysdesc : groupdesc->syscalls)
^~~~~~

I solved the latter by removing "struct" from the declaration. This
is with GCC 6.3.0; is that a GCC bug? is removing "struct" the right
solution?

Thanks.