On Sun, Jan 10, 2021 at 2:05 PM Mikael Pettersson via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > On Sun, Jan 10, 2021 at 11:57 AM Arnaud Charlet <char...@adacore.com> wrote: > > > > > This fixes a compilation error preventing bootstrap with Ada on > > > x86_64-pc-cygwin. See PR bootstrap/94918 for details. > > > > > > Compared to the initial patch sent in May 2020, this v2 patch places > > > the fix in Ada's raise-gcc.c instead of the shared unwind-generic.h, > > > which should hopefully simplify getting it applied. > > > > Not sure why. Applying it there looks incomplete and kludgy, don't you > > agree? > > Ok, then here's v3 which places the fix in unwind-generic.h. The fix > matches what Ada's mingw32.h does. > > Tested by bootstrapping this and the preliminary workaround for > PR98590 on x86_64-pc-cygwin. > > Ok for master and branches?
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). The include was added by Tristan, well - probably just merged by him. Eric? > libgcc/ > > 2021-01-10 Mikael Pettersson <mikpeli...@gmail.com> > > PR bootstrap/94918 > * unwind-generic.h (__SEH__): Prevent windows.h from including > x86intrin.h or emmintrin.h on Cygwin64. > > --- gcc-11-20210103/libgcc/unwind-generic.h.~1~ 2021-01-03 > 23:32:20.000000000 +0100 > +++ gcc-11-20210103/libgcc/unwind-generic.h 2021-01-09 > 14:51:16.262378715 +0100 > @@ -30,6 +30,12 @@ > > #if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__) > /* Only for _GCC_specific_handler. */ > +#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 > +#define _EMMINTRIN_H_INCLUDED > +#endif > #include <windows.h> > #endif