Re: Fix compilation using mingw.org's MinGW

Pedro Alves
2019-04-19T11:33:43Z

On 4/19/19 12:23 PM, Eli Zaretskii wrote:
>> Cc: gdb-patches@sourceware.org
>> From: Pedro Alves <palves@redhat.com>
>> Date: Fri, 19 Apr 2019 11:51:46 +0100
>>
>> building at all either. The subject for the commit that added that NEWS entry
>> sound like that was the intention:
>>
>> commit 742a7df5f4a149f0818aaccfc432c4c0c9a6e26d
>> Author: Eli Zaretskii <eliz@gnu.org>
>> AuthorDate: Sat Mar 2 15:18:32 2019 +0200
>>
>> GDB no longer supports Windows before XP.
>>
>> But surprisingly, I can't find the discussion behind this commit
>> in the archives to see the context and what was decided.
>
> The discussion which led to that change is here:
>
> https://www.sourceware.org/ml/gdb-patches/2019-02/msg00574.html
>

So we're already assuming XP at build time in common code, in
common/netstuff.c.

>>>> So shouldn't we instead be setting _WIN32_WINNT to some
>>>> appropriate number?
>>>
>>> I don't mind, but where?
>>
>> I'd do it in common/common-defs.h, before any #include, where we define
>> other macros that must be defined before any include, like
>> __STDC_LIMIT_MACROS, _FORTIFY_SOURCE, etc.
>>
>>> And also: should we make such changes on the
>>> 8.3 branch at this time?
>>
>> Not sure. Off hand I'd think it's pretty safe, but maybe for 8.3
>> your patch is safer.
>
> I will try doing this in common-defs.h, but for the branch, we could
> set _WIN32_WINNT only in windows-nat.c, as that's the only file that
> currently cares, which should be safer. WDYT?

Sounds good to me.

Thanks,
Pedro Alves