From 25a0f9cfaeca20baeaaa0c76911821949aadcb40 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 26 Sep 2019 14:10:46 +0000 Subject: [PATCH] * osint.adb (OS_Time_To_GNAT_Time): Remove dependency on To_C/To_Ada From-SVN: r276151 --- gcc/ada/ChangeLog | 4 ++++ gcc/ada/osint.adb | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 08244e89afb..a5f3843ca00 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2019-09-26 Arnaud Charlet + + * osint.adb (OS_Time_To_GNAT_Time): Remove dependency on To_C/To_Ada + 2019-09-23 Rainer Orth * libgnarl/s-osinte__solaris.ads (sysconf): Declare. diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb index 973f463eca6..ac891877535 100644 --- a/gcc/ada/osint.adb +++ b/gcc/ada/osint.adb @@ -2183,7 +2183,19 @@ package body Osint is 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 @@ package body Osint is 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), -- 2.30.2