aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Rupp <rupp@adacore.com>2021-04-28 07:46:12 -0700
committerPierre-Marie de Rodat <derodat@adacore.com>2021-07-05 13:09:14 +0000
commitcee731748f23f6cbdcd7baf8102ac4dc87ca5c52 (patch)
tree53318db60f5f96135afd6d104ada832a7c3dda05
parent2644eaa0b91e25d01b5c847131bf7caafc7c4588 (diff)
downloadgcc-cee731748f23f6cbdcd7baf8102ac4dc87ca5c52.zip
gcc-cee731748f23f6cbdcd7baf8102ac4dc87ca5c52.tar.gz
gcc-cee731748f23f6cbdcd7baf8102ac4dc87ca5c52.tar.bz2
[Ada] The Unix Epochalypse of 2038 (Warn about time_t in the compiler)
gcc/ada/ * libgnat/s-os_lib.ads: Add some comments about time_t. * libgnat/s-os_lib.adb (GM_Split/To_GM_Time): Rename formal to P_OS_Time. (GM_Time_Of/To_OS_Time): Likewise.
-rw-r--r--gcc/ada/libgnat/s-os_lib.adb56
-rw-r--r--gcc/ada/libgnat/s-os_lib.ads8
2 files changed, 36 insertions, 28 deletions
diff --git a/gcc/ada/libgnat/s-os_lib.adb b/gcc/ada/libgnat/s-os_lib.adb
index 7591f27..d338450 100644
--- a/gcc/ada/libgnat/s-os_lib.adb
+++ b/gcc/ada/libgnat/s-os_lib.adb
@@ -1347,13 +1347,13 @@ package body System.OS_Lib is
Second : out Second_Type)
is
procedure To_GM_Time
- (P_Time_T : Address;
- P_Year : Address;
- P_Month : Address;
- P_Day : Address;
- P_Hours : Address;
- P_Mins : Address;
- P_Secs : Address);
+ (P_OS_Time : Address;
+ P_Year : Address;
+ P_Month : Address;
+ P_Day : Address;
+ P_Hours : Address;
+ P_Mins : Address;
+ P_Secs : Address);
pragma Import (C, To_GM_Time, "__gnat_to_gm_time");
T : OS_Time := Date;
@@ -1385,13 +1385,13 @@ package body System.OS_Lib is
Locked_Processing : begin
SSL.Lock_Task.all;
To_GM_Time
- (P_Time_T => T'Address,
- P_Year => Y'Address,
- P_Month => Mo'Address,
- P_Day => D'Address,
- P_Hours => H'Address,
- P_Mins => Mn'Address,
- P_Secs => S'Address);
+ (P_OS_Time => T'Address,
+ P_Year => Y'Address,
+ P_Month => Mo'Address,
+ P_Day => D'Address,
+ P_Hours => H'Address,
+ P_Mins => Mn'Address,
+ P_Secs => S'Address);
SSL.Unlock_Task.all;
exception
@@ -1429,26 +1429,26 @@ package body System.OS_Lib is
Second : Second_Type) return OS_Time
is
procedure To_OS_Time
- (P_Time_T : Address;
- P_Year : Integer;
- P_Month : Integer;
- P_Day : Integer;
- P_Hours : Integer;
- P_Mins : Integer;
- P_Secs : Integer);
+ (P_OS_Time : Address;
+ P_Year : Integer;
+ P_Month : Integer;
+ P_Day : Integer;
+ P_Hours : Integer;
+ P_Mins : Integer;
+ P_Secs : Integer);
pragma Import (C, To_OS_Time, "__gnat_to_os_time");
Result : OS_Time;
begin
To_OS_Time
- (P_Time_T => Result'Address,
- P_Year => Year - 1900,
- P_Month => Month - 1,
- P_Day => Day,
- P_Hours => Hour,
- P_Mins => Minute,
- P_Secs => Second);
+ (P_OS_Time => Result'Address,
+ P_Year => Year - 1900,
+ P_Month => Month - 1,
+ P_Day => Day,
+ P_Hours => Hour,
+ P_Mins => Minute,
+ P_Secs => Second);
return Result;
end GM_Time_Of;
diff --git a/gcc/ada/libgnat/s-os_lib.ads b/gcc/ada/libgnat/s-os_lib.ads
index 1d0af9b..8770d94 100644
--- a/gcc/ada/libgnat/s-os_lib.ads
+++ b/gcc/ada/libgnat/s-os_lib.ads
@@ -164,6 +164,14 @@ package System.OS_Lib is
-- component parts to be interpreted in the local time zone, and returns
-- an OS_Time. Returns Invalid_Time if the creation fails.
+ ------------------
+ -- Time_t Stuff --
+ ------------------
+
+ -- Note: Do not use time_t in the compiler and host based tools,
+ -- instead use OS_Time. These 3 declarations are indended for use only
+ -- by consumers of the GNAT.OS_Lib renaming of this package.
+
subtype time_t is Long_Integer;
-- C time_t type of the time representation