We set __USE_MINGW_ACCESS for windows hosts to use MinGWs wrapper
for the access function. The wrapper ensures that access behaves
in the expected way (e.g. for special files, such as nul).
However, we now compile most sources with the C++ compiler and
the __USE_MINGW_ACCESS in CFLAGS is not used there. This causes
GCCs build against newer msvcrt versions with incompatible
access implementations to fail. This patch adds the flag to the
CXXFLAGS for all bootstrap stages. Bootstrapped on
x86_64-mingw64-seh.

config/ChangeLog:

2019-03-02  Johannes Pfau  <johannesp...@gmail.com>

        * mh-mingw: Also set __USE_MINGW_ACCESS flag for C++ code.

---
 config/mh-mingw | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/config/mh-mingw b/config/mh-mingw
index bc1d27477d0..a795096f038 100644
--- a/config/mh-mingw
+++ b/config/mh-mingw
@@ -2,6 +2,11 @@
 # Vista (see PR33281 for details).
 BOOT_CFLAGS += -D__USE_MINGW_ACCESS -Wno-pedantic-ms-format
 CFLAGS += -D__USE_MINGW_ACCESS
+STAGE1_CXXFLAGS += -D__USE_MINGW_ACCESS
+STAGE2_CXXFLAGS += -D__USE_MINGW_ACCESS
+STAGE3_CXXFLAGS += -D__USE_MINGW_ACCESS
+STAGE4_CXXFLAGS += -D__USE_MINGW_ACCESS
+
 # Increase stack limit to a figure based on the Linux default, with 4MB added
 # as GCC turns out to need that much more to pass all the limits-* tests.
 LDFLAGS += -Wl,--stack,12582912
-- 
2.19.2

Reply via email to