Re: Fix compilation using mingw.org's MinGW

Pedro Alves
2019-04-19T10:51:52Z

On 4/18/19 7:56 PM, Eli Zaretskii wrote:
>> From: Pedro Alves <palves@redhat.com>
>> Date: Thu, 18 Apr 2019 18:22:14 +0100
>>
>> * Removed targets
>>
>> GDB no longer supports native debugging on versions of MS-Windows
>> before Windows XP.
>
> I was talking about compile time, not run time.

Not sure it makes any practical difference. From the text above, you could
claim that we wanted to support hosting GDB on older versions of Windows,
but not support native debugging, say, so you could still remote debug
from such older Windows boxes. But was that the intention? I'd say
keep it simple -- if we don't support native debugging, then we don't support
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.

>
> In any case, if we don't support systems older than XP, then why do we
> load those functions dynamically at run time and call them via a
> function pointer?

Because that code is older than the decision to stop supporting older
Windows versions, surely? :

ChangeLog-2010: * windows-nat.c (GetConsoleFontSize, GetCurrentConsoleFont):
ChangeLog-2010: (bad_GetCurrentConsoleFont, bad_GetConsoleFontSize): New functions.
ChangeLog-2010: GetCurrentConsoleFont.
ChangeLog-2015: (GetCurrentConsoleFont_ftype, GetModuleInformation_ftype)

>
>> 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.

Thanks,
Pedro Alves