public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2019] [Ada] The Unix Epochalyse of 2038 - OS_Time
@ 2021-07-05 13:14 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-07-05 13:14 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a0bdd4b03b87a01a5984aa5c7ad94f66b2a7bc9e
commit r12-2019-ga0bdd4b03b87a01a5984aa5c7ad94f66b2a7bc9e
Author: Doug Rupp <rupp@adacore.com>
Date: Sun Apr 25 21:52:09 2021 -0700
[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.
Diff:
---
gcc/ada/adaint.h | 4 ----
gcc/ada/libgnat/s-os_lib.adb | 8 ++++----
gcc/ada/libgnat/s-os_lib.ads | 3 +--
gcc/ada/osint.adb | 3 +--
4 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 6ef61e77e60..b03294f2b18 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 5c02b2d5239..7591f27903d 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 42ac488c2bf..1d0af9b73a8 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 d47eaa5d649..3e5db3612d6 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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-05 13:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05 13:14 [gcc r12-2019] [Ada] The Unix Epochalyse of 2038 - OS_Time Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).