Re: Fix compilation using mingw.org's MinGW

Pedro Alves
2019-04-30T17:26:25Z

On 4/30/19 6:17 PM, Eli Zaretskii wrote:
>> Cc: gdb-patches@sourceware.org
>> From: Pedro Alves <palves@redhat.com>
>> Date: Tue, 30 Apr 2019 18:03:57 +0100
>>
>> The issue is where is that default set?
>
> On some internal header file (it differs between various flavors of
> MinGW).

Right, which is what I said.

> But no matter where it is set, it must be defined after _any_
> standard header is included, so in practice I think it's defined at
> the place where the patch tests for it.

I think you mean "before". But I did not say that this was the wrong
place (since I was the one that suggested the place). Only that
pedantically the new code could/should be tweaked like this:

- #ifdef __MINGW32__
+ #if defined (__MINGW32__) || defined (__CYGWIN__)
# ifdef _WIN32_WINNT
# if _WIN32_WINNT < 0x0501
# undef _WIN32_WINNT
# define _WIN32_WINNT 0x0501
# endif
# else
# define _WIN32_WINNT 0x0501
# endif
#endif /* __MINGW32__ */

>
> In any case, the only platform which really needs this is mingw.org's
> MinGW, where I actually tested this assumption. The other two,
> MinGW64 and Cygwin, don't support older platforms (they actually don't
> support XP anymore, only Vista and onward), so their default values
> are higher than 0x0501 anyway.
>

Right, like I said.

Thanks,
Pedro Alves