[Mingw-users] Yet another compilation problem with building gcc 7.3.0

Back to archive index

Keith Marshall keith****@users*****
Sat Jun 30 22:45:52 JST 2018


On 29/06/18 03:52, David Gressett wrote:
> I found that my successful gcc 7.1.0 build has tconfig.h, but my
> failed 7.3.0 build has config.h.

I suspect that config.h vs. tconfig.h may be a red herring; the issue is
(again) in gcc/ada/mingw32.h, where in gcc-7.1.0, I see:

| /* We need functionality available only starting with Windows XP */
| #ifndef _WIN32_WINNT
| #define _WIN32_WINNT 0x0501
| #endif
|
| #ifndef __CYGWIN__
| #include <tchar.h>
| #endif
| #if defined (__CYGWIN__) && !defined (__CYGWIN32__) && !defined (IN_RTS)
| /* Note: windows.h on cygwin-64 includes x86intrin.h which uses malloc.
|    That fails to compile, if malloc is poisoned, i.e. if !IN_RTS.  */
| #define _X86INTRIN_H_INCLUDED
| #endif
| #include <windows.h>
|
| #ifndef _O_U8TEXT
| #define _O_U8TEXT _O_TEXT
| #endif
| #ifndef _O_U16TEXT
| #define _O_U16TEXT _O_TEXT
| #endif
| #ifndef _O_WTEXT
| #define _O_WTEXT _O_TEXT
| #endif

That block of "fall-back" defines is conspicuously absent from the
gcc-7.3.0 version of gcc/ada/mingw32.h.  I don't know why the GCC folks
removed it, but I can speculate: perhaps it's because, once again, it is
misplaced code.  (The reason why I sarcastically quoted "fall-back" is
because it is no such thing!  We've already established that mingw32.h
needs to be the first header included, to satisfy prerequisite feature
test specifications, and pursuant to that requirement, they never gave
<fcntl.h> a chance to define any of the three constants in question,
before making those so-called fall-backs unconditionally active.  I
guess someone recognized that, but instead of fixing it properly, they
just threw the baby out with the bath water).

The proper fix here would be to "#include <fcntl.h>" immediately after
the "#include <windows.h>", and then leave the conditional fall-back
defines in place thereafter.  Alternatively, if they don't want to
accept the polluting effect of including <fcntl.h> here, they could
provide a local "ada-fcntl.h", which they include *instead* of
<fcntl.h>, have it include the real <fcntl.h>, and then offer the
fall-back defines, (or just place copies of the fall-back defines, after
"#include <fcntl.h>", in *every* translation unit which may require them.

BTW, in gcc-7.3.0, they still have:

| /* We need functionality available only starting with Windows XP */
| #ifndef _WIN32_WINNT
| #define _WIN32_WINNT 0x0501
| #endif

so it is still apparent that their intent is to support WinXP legacy;
the removal of those three fall-back defines is a violation of that
intent, since supporting the symbols in question now requires at least
Vista (unconfirmed), or maybe even Win7 (confirmed okay); the necessary
support is *definitely not* available in WinXP (confirmed).

It may also be worth noting that, without 09-ada-unicode-misuse.patch,
the original placement of "#include <_mingw.h>" in gcc/ada/mingw32.h
would have prevented their definition of _WIN32_WINNT from taking
effect; it would have already been assigned a default (likely equivalent
to _WIN32_WINNT_WIN2K), which would have prevented them from realizing
their WinXP intent anyway.

-- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
Url : https://lists.osdn.me/mailman/archives/mingw-users/attachments/20180630/8a3b1c4c/attachment.pgp 



More information about the MinGW-Users mailing list
Back to archive index