diff mbox series

[Ada] Fix PR ada/115133

Message ID 1966714.PYKUYFuaPT@fomalhaut
State New
Headers show
Series [Ada] Fix PR ada/115133 | expand

Commit Message

Eric Botcazou May 17, 2024, 10:26 p.m. UTC
The recent changes made to the runtime library broke its build on Solaris 
because it uses Solaris threads instead of POSIX threads on this platform.

Tested by Rainer, applied on the mainline.


2024-05-17  Eric Botcazou  <ebotcazou@adacore.com>
            Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR ada/115133
	* libgnarl/s-osinte__solaris.ads (mutex_t): Fix typo.
	* libgnarl/s-taprop__solaris.adb (Record_Lock): Add conversion.
	(Check_Sleep): Likewise.
	(Record_Wakeup): Likewise.
	(Check_Unlock): Likewise.
	* libgnarl/s-tasini.adb (Initialize_RTS_Lock): Add pragma Import
	on the overlaid variable.
	(Finalize_RTS_Lock): Likewise.
	(Acquire_RTS_Lock): Likewise.
	(Release_RTS_Lock): Likewise.
	* libgnarl/s-taspri__solaris.ads (To_RTS_Lock_Ptr): New instance
	of Ada.Unchecked_Conversion.
	* libgnat/s-oslock__solaris.ads: Add with clause for
	Ada.Unchecked_Conversion.
	(array_type_9): Add missing name qualification.
	(record_type_3): Likewise.
	(mutex_t): Fix formatting.
diff mbox series

Patch

diff --git a/gcc/ada/libgnarl/s-osinte__solaris.ads b/gcc/ada/libgnarl/s-osinte__solaris.ads
index 12ad52bb48e..3703697ef44 100644
--- a/gcc/ada/libgnarl/s-osinte__solaris.ads
+++ b/gcc/ada/libgnarl/s-osinte__solaris.ads
@@ -298,7 +298,7 @@  package System.OS_Interface is
 
    function To_thread_t is new Ada.Unchecked_Conversion (Integer, thread_t);
 
-   subtype mutex_t is System.OS_Lock.mutex_t;
+   subtype mutex_t is System.OS_Locks.mutex_t;
 
    type cond_t is limited private;
 
diff --git a/gcc/ada/libgnarl/s-taprop__solaris.adb b/gcc/ada/libgnarl/s-taprop__solaris.adb
index 88b77b09820..82e51b8d25c 100644
--- a/gcc/ada/libgnarl/s-taprop__solaris.adb
+++ b/gcc/ada/libgnarl/s-taprop__solaris.adb
@@ -1399,7 +1399,7 @@  package body System.Task_Primitives.Operations is
       P := Self_ID.Common.LL.Locks;
 
       if P /= null then
-         L.Next := P;
+         L.Next := To_RTS_Lock_Ptr (P);
       end if;
 
       Self_ID.Common.LL.Locking := null;
@@ -1440,7 +1440,7 @@  package body System.Task_Primitives.Operations is
 
       Self_ID.Common.LL.L.Owner := null;
       P := Self_ID.Common.LL.Locks;
-      Self_ID.Common.LL.Locks := Self_ID.Common.LL.Locks.Next;
+      Self_ID.Common.LL.Locks := To_Lock_Ptr (Self_ID.Common.LL.Locks.Next);
       P.Next := null;
       return True;
    end Check_Sleep;
@@ -1468,7 +1468,7 @@  package body System.Task_Primitives.Operations is
       P := Self_ID.Common.LL.Locks;
 
       if P /= null then
-         L.Next := P;
+         L.Next := To_RTS_Lock_Ptr (P);
       end if;
 
       Self_ID.Common.LL.Locking := null;
@@ -1549,7 +1549,7 @@  package body System.Task_Primitives.Operations is
 
       L.Owner := null;
       P := Self_ID.Common.LL.Locks;
-      Self_ID.Common.LL.Locks := Self_ID.Common.LL.Locks.Next;
+      Self_ID.Common.LL.Locks := To_Lock_Ptr (Self_ID.Common.LL.Locks.Next);
       P.Next := null;
       return True;
    end Check_Unlock;
diff --git a/gcc/ada/libgnarl/s-tasini.adb b/gcc/ada/libgnarl/s-tasini.adb
index 794183f5356..d42d2881df4 100644
--- a/gcc/ada/libgnarl/s-tasini.adb
+++ b/gcc/ada/libgnarl/s-tasini.adb
@@ -246,6 +246,7 @@  package body System.Tasking.Initialization is
    procedure Initialize_RTS_Lock (Addr : Address) is
       Lock : aliased SOL.RTS_Lock;
       for Lock'Address use Addr;
+      pragma Import (Ada, Lock);
 
    begin
       Initialize_Lock (Lock'Unchecked_Access, PO_Level);
@@ -258,6 +259,7 @@  package body System.Tasking.Initialization is
    procedure Finalize_RTS_Lock (Addr : Address) is
       Lock : aliased SOL.RTS_Lock;
       for Lock'Address use Addr;
+      pragma Import (Ada, Lock);
 
    begin
       Finalize_Lock (Lock'Unchecked_Access);
@@ -270,6 +272,7 @@  package body System.Tasking.Initialization is
    procedure Acquire_RTS_Lock (Addr : Address) is
       Lock : aliased SOL.RTS_Lock;
       for Lock'Address use Addr;
+      pragma Import (Ada, Lock);
 
    begin
       Write_Lock (Lock'Unchecked_Access);
@@ -282,6 +285,7 @@  package body System.Tasking.Initialization is
    procedure Release_RTS_Lock (Addr : Address) is
       Lock : aliased SOL.RTS_Lock;
       for Lock'Address use Addr;
+      pragma Import (Ada, Lock);
 
    begin
       Unlock (Lock'Unchecked_Access);
diff --git a/gcc/ada/libgnarl/s-taspri__solaris.ads b/gcc/ada/libgnarl/s-taspri__solaris.ads
index ca40229993b..16fc4196b00 100644
--- a/gcc/ada/libgnarl/s-taspri__solaris.ads
+++ b/gcc/ada/libgnarl/s-taspri__solaris.ads
@@ -47,6 +47,8 @@  package System.Task_Primitives is
 
    function To_Lock_Ptr is
      new Ada.Unchecked_Conversion (OS_Locks.RTS_Lock_Ptr, Lock_Ptr);
+   function To_RTS_Lock_Ptr is
+     new Ada.Unchecked_Conversion (Lock_Ptr, OS_Locks.RTS_Lock_Ptr);
 
    type Suspension_Object is limited private;
    --  Should be used for the implementation of Ada.Synchronous_Task_Control
diff --git a/gcc/ada/libgnat/s-oslock__solaris.ads b/gcc/ada/libgnat/s-oslock__solaris.ads
index 8cf7c694904..cc5a83df02e 100644
--- a/gcc/ada/libgnat/s-oslock__solaris.ads
+++ b/gcc/ada/libgnat/s-oslock__solaris.ads
@@ -31,6 +31,7 @@ 
 
 --  This is a Solaris (native) version of this package
 
+with Ada.Unchecked_Conversion;
 with Interfaces.C;
 
 package System.OS_Locks is
@@ -65,10 +66,10 @@  package System.OS_Locks is
 
 private
 
-   type array_type_9 is array (0 .. 3) of unsigned_char;
+   type array_type_9 is array (0 .. 3) of Interfaces.C.unsigned_char;
    type record_type_3 is record
       flag  : array_type_9;
-      Xtype : unsigned_long;
+      Xtype : Interfaces.C.unsigned_long;
    end record;
    pragma Convention (C, record_type_3);
 
@@ -79,6 +80,6 @@  private
       lock  : upad64_t;
       data  : upad64_t;
    end record;
-  pragma Convention (C, mutex_t);
+   pragma Convention (C, mutex_t);
 
 end System.OS_Locks;