public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mikael Pettersson <mikpelinux@gmail.com>
To: Eric Botcazou <botcazou@adacore.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
	Arnaud Charlet <charlet@adacore.com>,
	 GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH v2] fix Ada bootstrap on Cygwin64 (PR bootstrap/94918)
Date: Mon, 8 Mar 2021 22:43:19 +0100	[thread overview]
Message-ID: <CAM43=SMDAQNuZc22GBKFoeP+PUz89aFrUNG2hu8mCtgKF=6eng@mail.gmail.com> (raw)
In-Reply-To: <4113159.e1GE0xNht7@fomalhaut>

[-- Attachment #1: Type: text/plain, Size: 1631 bytes --]

On Mon, Mar 8, 2021 at 12:07 PM Eric Botcazou <botcazou@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...

[-- Attachment #2: 0001-PR-bootstrap-94918.patch --]
[-- Type: text/x-patch, Size: 1005 bytes --]

From 44a276e7900a506ee4b6f85d25ae5d96a11bd91e Mon Sep 17 00:00:00 2001
From: Mikael Pettersson <mikpelinux@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


  reply	other threads:[~2021-03-08 21:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-10 10:44 Mikael Pettersson
2021-01-10 10:57 ` Arnaud Charlet
2021-01-10 13:04   ` Mikael Pettersson
2021-03-07 17:16     ` Mikael Pettersson
2021-03-07 18:20       ` Arnaud Charlet
2021-03-08 10:21     ` Richard Biener
2021-03-08 11:07       ` Eric Botcazou
2021-03-08 21:43         ` Mikael Pettersson [this message]
2021-03-08 22:21           ` Eric Botcazou
2021-03-09 16:00             ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM43=SMDAQNuZc22GBKFoeP+PUz89aFrUNG2hu8mCtgKF=6eng@mail.gmail.com' \
    --to=mikpelinux@gmail.com \
    --cc=botcazou@adacore.com \
    --cc=charlet@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).