aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Rupp <rupp@adacore.com>2021-04-25 21:52:09 -0700
committerPierre-Marie de Rodat <derodat@adacore.com>2021-07-05 13:09:12 +0000
commita0bdd4b03b87a01a5984aa5c7ad94f66b2a7bc9e (patch)
tree65506f7ae0df06decc27986f88f53539a2aa4534
parente7b17be97330d2e42dd7e8e84a5b16a167241931 (diff)
downloadgcc-a0bdd4b03b87a01a5984aa5c7ad94f66b2a7bc9e.zip
gcc-a0bdd4b03b87a01a5984aa5c7ad94f66b2a7bc9e.tar.gz
gcc-a0bdd4b03b87a01a5984aa5c7ad94f66b2a7bc9e.tar.bz2
[Ada] The Unix Epochalyse of 2038 - OS_Time
gcc/ada/ * adaint.h (OS_Time): typedef as long long. * osint.adb (Underlying_OS_Time): Declare as 64-bit signed type. * libgnat/s-os_lib.adb ("<"): Compare OS_Time as Long_Long_Integer. ("<="): Likewise. (">"): Likewise. (">="): Likewise. * libgnat/s-os_lib.ads (OS_Time): Declare as 64-bit signed type.
-rw-r--r--gcc/ada/adaint.h4
-rw-r--r--gcc/ada/libgnat/s-os_lib.adb8
-rw-r--r--gcc/ada/libgnat/s-os_lib.ads3
-rw-r--r--gcc/ada/osint.adb3
4 files changed, 6 insertions, 12 deletions
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 6ef61e7..b03294f 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -101,11 +101,7 @@ extern "C" {
#endif
/* Type corresponding to GNAT.OS_Lib.OS_Time */
-#if defined (_WIN64)
typedef long long OS_Time;
-#else
-typedef long OS_Time;
-#endif
#define __int64 long long
GNAT_STRUCT_STAT;
diff --git a/gcc/ada/libgnat/s-os_lib.adb b/gcc/ada/libgnat/s-os_lib.adb
index 5c02b2d..7591f27 100644
--- a/gcc/ada/libgnat/s-os_lib.adb
+++ b/gcc/ada/libgnat/s-os_lib.adb
@@ -139,7 +139,7 @@ package body System.OS_Lib is
function "<" (X, Y : OS_Time) return Boolean is
begin
- return Long_Integer (X) < Long_Integer (Y);
+ return Long_Long_Integer (X) < Long_Long_Integer (Y);
end "<";
----------
@@ -148,7 +148,7 @@ package body System.OS_Lib is
function "<=" (X, Y : OS_Time) return Boolean is
begin
- return Long_Integer (X) <= Long_Integer (Y);
+ return Long_Long_Integer (X) <= Long_Long_Integer (Y);
end "<=";
---------
@@ -157,7 +157,7 @@ package body System.OS_Lib is
function ">" (X, Y : OS_Time) return Boolean is
begin
- return Long_Integer (X) > Long_Integer (Y);
+ return Long_Long_Integer (X) > Long_Long_Integer (Y);
end ">";
----------
@@ -166,7 +166,7 @@ package body System.OS_Lib is
function ">=" (X, Y : OS_Time) return Boolean is
begin
- return Long_Integer (X) >= Long_Integer (Y);
+ return Long_Long_Integer (X) >= Long_Long_Integer (Y);
end ">=";
-----------------
diff --git a/gcc/ada/libgnat/s-os_lib.ads b/gcc/ada/libgnat/s-os_lib.ads
index 42ac488..1d0af9b 100644
--- a/gcc/ada/libgnat/s-os_lib.ads
+++ b/gcc/ada/libgnat/s-os_lib.ads
@@ -1098,8 +1098,7 @@ private
pragma Import (C, Current_Process_Id, "__gnat_current_process_id");
type OS_Time is
- range -(2 ** (Standard'Address_Size - Integer'(1))) ..
- +(2 ** (Standard'Address_Size - Integer'(1)) - 1);
+ range -(2 ** 63) .. +(2 ** 63 - 1);
-- Type used for timestamps in the compiler. This type is used to hold
-- 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.
diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb
index d47eaa5..3e5db36 100644
--- a/gcc/ada/osint.adb
+++ b/gcc/ada/osint.adb
@@ -2191,8 +2191,7 @@ package body Osint is
GNAT_Time : Time_Stamp_Type;
type Underlying_OS_Time is
- range -(2 ** (Standard'Address_Size - Integer'(1))) ..
- +(2 ** (Standard'Address_Size - Integer'(1)) - 1);
+ range -(2 ** 63) .. +(2 ** 63 - 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.