A recent change in osint.adb introduced a dependency on To_C/To_Ada
subprograms which are (too) recent additions to System.OS_Lib, breaking
builds of cross compilers with an older version of GNAT. Even though this is
not guaranteed to work, this dependency is relatively easy to lift, so done.

Tested on x86_64-pc-linux-gnu, committed on trunk

        * osint.adb (OS_Time_To_GNAT_Time): Remove dependency on To_C/To_Ada

Index: osint.adb
===================================================================
--- osint.adb   (revision 276149)
+++ osint.adb   (working copy)
@@ -2183,7 +2183,19 @@
    function OS_Time_To_GNAT_Time (T : OS_Time) return Time_Stamp_Type is
       GNAT_Time : Time_Stamp_Type;
 
-      TI : Long_Integer := To_C (T);
+      type Underlying_OS_Time is
+        range -(2 ** (Standard'Address_Size - Integer'(1))) ..
+              +(2 ** (Standard'Address_Size - Integer'(1)) - 1);
+      --  Underlying_OS_Time is a redeclaration of OS_Time to allow integer
+      --  manipulation. Remove this in favor of To_Ada/To_C once newer
+      --  GNAT releases are available with these functions.
+
+      function To_Int is
+        new Unchecked_Conversion (OS_Time, Underlying_OS_Time);
+      function From_Int is
+        new Unchecked_Conversion (Underlying_OS_Time, OS_Time);
+
+      TI : Underlying_OS_Time := To_Int (T);
       Y  : Year_Type;
       Mo : Month_Type;
       D  : Day_Type;
@@ -2205,7 +2217,7 @@
          TI := TI + 1;
       end if;
 
-      GM_Split (To_Ada (TI), Y, Mo, D, H, Mn, S);
+      GM_Split (From_Int (TI), Y, Mo, D, H, Mn, S);
 
       Make_Time_Stamp
         (Year    => Nat (Y),

Reply via email to