From: Doug Rupp Date: Wed, 28 Apr 2021 15:48:52 +0000 (-0700) Subject: [Ada] The Unix Epochalyse of 2038 - OS_Time comparison X-Git-Tag: basepoints/gcc-13~6288 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=63b43535dc775883436ac5c8445522e34e373efc;p=thirdparty%2Fgcc.git [Ada] The Unix Epochalyse of 2038 - OS_Time comparison gcc/ada/ * libgnat/s-os_lib.ads: Import OS_Time comparison ops as intrinsic. * libgnat/s-os_lib.adb: Remove OS_TIme comparison ops implementation. --- diff --git a/gcc/ada/libgnat/s-os_lib.adb b/gcc/ada/libgnat/s-os_lib.adb index d338450dce63..19f4cf7cdcf6 100644 --- a/gcc/ada/libgnat/s-os_lib.adb +++ b/gcc/ada/libgnat/s-os_lib.adb @@ -133,42 +133,6 @@ package body System.OS_Lib is -- Converts a C String to an Ada String. We could do this making use of -- Interfaces.C.Strings but we prefer not to import that entire package - --------- - -- "<" -- - --------- - - function "<" (X, Y : OS_Time) return Boolean is - begin - return Long_Long_Integer (X) < Long_Long_Integer (Y); - end "<"; - - ---------- - -- "<=" -- - ---------- - - function "<=" (X, Y : OS_Time) return Boolean is - begin - return Long_Long_Integer (X) <= Long_Long_Integer (Y); - end "<="; - - --------- - -- ">" -- - --------- - - function ">" (X, Y : OS_Time) return Boolean is - begin - return Long_Long_Integer (X) > Long_Long_Integer (Y); - end ">"; - - ---------- - -- ">=" -- - ---------- - - function ">=" (X, Y : OS_Time) return Boolean is - begin - return Long_Long_Integer (X) >= Long_Long_Integer (Y); - end ">="; - ----------------- -- Args_Length -- ----------------- diff --git a/gcc/ada/libgnat/s-os_lib.ads b/gcc/ada/libgnat/s-os_lib.ads index 8770d94e4da3..d4911d9efc8d 100644 --- a/gcc/ada/libgnat/s-os_lib.ads +++ b/gcc/ada/libgnat/s-os_lib.ads @@ -1111,18 +1111,13 @@ private -- time stamps, but may have a different representation than C's time_t. -- This type needs to match the declaration of OS_Time in adaint.h. - -- Add pragma Inline statements for comparison operations on OS_Time. It - -- would actually be nice to use pragma Import (Intrinsic) here, but this - -- was not properly supported till GNAT 3.15a, so that would cause - -- bootstrap path problems. To be changed later ??? - Invalid_Time : constant OS_Time := -1; -- This value should match the return value from __gnat_file_time_* - pragma Inline ("<"); - pragma Inline (">"); - pragma Inline ("<="); - pragma Inline (">="); + pragma Import (Intrinsic, "<"); + pragma Import (Intrinsic, ">"); + pragma Import (Intrinsic, "<="); + pragma Import (Intrinsic, ">="); pragma Inline (To_C); pragma Inline (To_Ada);