Fix compilation using mingw.org's MinGW

Pedro Alves palves@redhat.com
Tue Apr 30 17:04:00 GMT 2019


On 4/30/19 4:25 PM, Eli Zaretskii wrote:
>> From: LRN <lrn1986@gmail.com>
>> Date: Tue, 30 Apr 2019 16:05:55 +0300
>>
>>>  - IIRC, Cygwin uses the same w32api headers as mingw.org.  I don't know
>>>    whether Cygwin sets _WIN32_WINNT to a higher number already; we
>>>    haven't heard any complaints, so I guess it does.
>>>
>>
>> Cygwin uses mingw-w64.
> 
> Maybe I'm missing something, but I don't think this is relevant.
> _WIN32_WINNT is not a MinGW invention, it's an official symbol in
> Windows headers, so all Windows compilers need to support it in the
> same way and with the same semantics.  The only difference is the
> default value.
> 
> Am I missing something?
> 

The issue is where is that default set?

On my Fedora mingw-w64 cross, it is not set by default by the
compiler:

 $ x86_64-w64-mingw32-gcc -x c /dev/null -dM -E | grep _WIN32_WINNT
 $ (empty)

It seems to be set instead in the headers, in include/sdkddkver.h.

I guess that if Cygwin indeed uses mingw-w64 headers nowadays, it won't
need the fix as long as the headers default to a higher version than
gdb requires.  Pedantically, I think we should tweak
the "#ifdef __MINGW32__" to consider Cygwin too, since the Cygwin ports
also pulls in w32api headers, but if it doesn't matter in practice, and
it's not convenient to test, then we can simply forget about it until
a time when someone notices something odd.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list