On Mon, Mar 8, 2021 at 12:07 PM Eric Botcazou <botca...@adacore.com> wrote: > > > I wonder why we include <windows.h> from this file at all, > > and why it is not included from {t,}system.h instead which > > is where system header specific fixups should be made > > (and this one could be avoided because system headers > > are included _before_ poisoning anything). > > <windows.h> is the Mother of All Things on the platform so you don't want to > include it liberally (although it can be tamed e.g. with WIN32_LEAN_AND_MEAN). > Therefore including it from tsystem.h might be worse than the actual disease. > > Mikael, can you work around the problem by adding > > #ifdef __CYGWIN__ > #include "mingw32.h" > #endif > > at the appropriate spot in raise-gcc.c instead?
This one worked. Is that what you had in mind? * raise-gcc.c: On Cygwin include mingw32.h to prevent windows.h from including x86intrin.h or emmintrin.h. --- gcc/ada/raise-gcc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/ada/raise-gcc.c b/gcc/ada/raise-gcc.c index 1446bfaaeb7..b096eba1b75 100644 --- a/gcc/ada/raise-gcc.c +++ b/gcc/ada/raise-gcc.c @@ -79,6 +79,12 @@ typedef char bool; (SJLJ or DWARF). We need a consistently named interface to import from a-except, so wrappers are defined here. */ +#ifdef __CYGWIN__ +/* Prevent compile error due to unwind-generic.h including <windows.h>, + see comment above #include <windows.h> in mingw32.h. */ +#include "mingw32.h" +#endif + #ifndef IN_RTS /* For gnat1/gnatbind compilation: cannot use unwind.h, as it is for the target. So mimic configure...
From 44a276e7900a506ee4b6f85d25ae5d96a11bd91e Mon Sep 17 00:00:00 2001 From: Mikael Pettersson <mikpeli...@gmail.com> Date: Mon, 8 Mar 2021 22:31:16 +0100 Subject: [PATCH] PR bootstrap/94918 * raise-gcc.c: On Cygwin include mingw32.h to prevent windows.h from including x86intrin.h or emmintrin.h. --- gcc/ada/raise-gcc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/ada/raise-gcc.c b/gcc/ada/raise-gcc.c index 1446bfaaeb7..b096eba1b75 100644 --- a/gcc/ada/raise-gcc.c +++ b/gcc/ada/raise-gcc.c @@ -79,6 +79,12 @@ typedef char bool; (SJLJ or DWARF). We need a consistently named interface to import from a-except, so wrappers are defined here. */ +#ifdef __CYGWIN__ +/* Prevent compile error due to unwind-generic.h including <windows.h>, + see comment above #include <windows.h> in mingw32.h. */ +#include "mingw32.h" +#endif + #ifndef IN_RTS /* For gnat1/gnatbind compilation: cannot use unwind.h, as it is for the target. So mimic configure... -- 2.26.2