This fixes three compilation errors preventing bootstrap of gcc-10/11
with Ada on x86_64-pc-cygwin.  See PR bootstrap/94918 for details.

Tested by bootstrapping on x86_64-pc-cygwin, and since it touches code
shared with mingw, also by building a cross to x86_64-w64-mingw32.

Ok for master and gcc-10 branch?

(I don't have commit rights, so I will need assistance with that.)

(The patch is also attached, since gmail _will_ corrupt this text.)

gcc/ada/

2020-05-02  Mikael Pettersson  <mikpeli...@gmail.com>

        PR bootstrap/94918

        * mingw32.h: Prevent windows.h from including emmintrin.h on Cygwin64.
        * libgnat/g-sercom__mingw.adb (Open): Insert missing type conversion.

libgcc/

2020-05-02  Mikael Pettersson  <mikpeli...@gmail.com>

        PR bootstrap/94918

        * unwind-generic.h (__SEH__): Prevent windows.h from including
        x86intrin.h and emmintrin.h.

--- gcc-10.1.0-RC-20200430/gcc/ada/libgnat/g-sercom__mingw.adb.~1~
 2020-04-30 22:51:33.000000000 +0200
+++ gcc-10.1.0-RC-20200430/gcc/ada/libgnat/g-sercom__mingw.adb
2020-05-02 16:36:49.565719571 +0200
@@ -103,6 +103,7 @@ package body GNAT.Serial_Communications
    is
       C_Name  : constant String := String (Name) & ASCII.NUL;
       Success : BOOL;
+      HFile   : HANDLE;
       pragma Unreferenced (Success);

    begin
@@ -110,7 +111,7 @@ package body GNAT.Serial_Communications
          Success := CloseHandle (HANDLE (Port.H));
       end if;

-      Port.H := CreateFileA
+      HFile := CreateFileA
         (lpFileName            => C_Name (C_Name'First)'Address,
          dwDesiredAccess       => GENERIC_READ or GENERIC_WRITE,
          dwShareMode           => 0,
@@ -118,6 +119,7 @@ package body GNAT.Serial_Communications
          dwCreationDisposition => OPEN_EXISTING,
          dwFlagsAndAttributes  => 0,
          hTemplateFile         => 0);
+      Port.H := Serial_Port_Descriptor (HFile);

       pragma Assert (INVALID_HANDLE_VALUE = -1);

--- gcc-10.1.0-RC-20200430/gcc/ada/mingw32.h.~1~        2020-04-30
22:51:33.000000000 +0200
+++ gcc-10.1.0-RC-20200430/gcc/ada/mingw32.h    2020-05-02
16:36:44.485724702 +0200
@@ -56,6 +56,7 @@
 /* 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>

--- gcc-10.1.0-RC-20200430/libgcc/unwind-generic.h.~1~  2020-04-30
22:51:36.000000000 +0200
+++ gcc-10.1.0-RC-20200430/libgcc/unwind-generic.h      2020-05-02
16:36:44.485724702 +0200
@@ -30,6 +30,8 @@

 #if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
 /* Only for _GCC_specific_handler.  */
+#define _X86INTRIN_H_INCLUDED
+#define _EMMINTRIN_H_INCLUDED
 #include <windows.h>
 #endif
gcc/ada/

2020-05-02  Mikael Pettersson  <mikpeli...@gmail.com>

        PR bootstrap/94918

        * mingw32.h: Prevent windows.h from including emmintrin.h on Cygwin64.
        * libgnat/g-sercom__mingw.adb (Open): Insert missing type conversion.

libgcc/

2020-05-02  Mikael Pettersson  <mikpeli...@gmail.com>

        PR bootstrap/94918

        * unwind-generic.h (__SEH__): Prevent windows.h from including
        x86intrin.h and emmintrin.h.

--- gcc-10.1.0-RC-20200430/gcc/ada/libgnat/g-sercom__mingw.adb.~1~      
2020-04-30 22:51:33.000000000 +0200
+++ gcc-10.1.0-RC-20200430/gcc/ada/libgnat/g-sercom__mingw.adb  2020-05-02 
16:36:49.565719571 +0200
@@ -103,6 +103,7 @@ package body GNAT.Serial_Communications
    is
       C_Name  : constant String := String (Name) & ASCII.NUL;
       Success : BOOL;
+      HFile   : HANDLE;
       pragma Unreferenced (Success);
 
    begin
@@ -110,7 +111,7 @@ package body GNAT.Serial_Communications
          Success := CloseHandle (HANDLE (Port.H));
       end if;
 
-      Port.H := CreateFileA
+      HFile := CreateFileA
         (lpFileName            => C_Name (C_Name'First)'Address,
          dwDesiredAccess       => GENERIC_READ or GENERIC_WRITE,
          dwShareMode           => 0,
@@ -118,6 +119,7 @@ package body GNAT.Serial_Communications
          dwCreationDisposition => OPEN_EXISTING,
          dwFlagsAndAttributes  => 0,
          hTemplateFile         => 0);
+      Port.H := Serial_Port_Descriptor (HFile);
 
       pragma Assert (INVALID_HANDLE_VALUE = -1);
 
--- gcc-10.1.0-RC-20200430/gcc/ada/mingw32.h.~1~        2020-04-30 
22:51:33.000000000 +0200
+++ gcc-10.1.0-RC-20200430/gcc/ada/mingw32.h    2020-05-02 16:36:44.485724702 
+0200
@@ -56,6 +56,7 @@
 /* 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>
 
--- gcc-10.1.0-RC-20200430/libgcc/unwind-generic.h.~1~  2020-04-30 
22:51:36.000000000 +0200
+++ gcc-10.1.0-RC-20200430/libgcc/unwind-generic.h      2020-05-02 
16:36:44.485724702 +0200
@@ -30,6 +30,8 @@
 
 #if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
 /* Only for _GCC_specific_handler.  */
+#define _X86INTRIN_H_INCLUDED
+#define _EMMINTRIN_H_INCLUDED
 #include <windows.h>
 #endif
 

Reply via email to