diff options
author | Doug Rupp <rupp@adacore.com> | 2021-06-05 12:58:35 -0700 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-07-09 12:35:30 +0000 |
commit | 175c2f98ea85004f23acc4b40f0e4264420116fc (patch) | |
tree | aba2b54fd16afaf2916260e53c5b9b1d34693075 /gcc/ada/libgnarl | |
parent | fbc72d0b4ac841fdf7d3ea15851f3be39361a86c (diff) | |
download | gcc-175c2f98ea85004f23acc4b40f0e4264420116fc.zip gcc-175c2f98ea85004f23acc4b40f0e4264420116fc.tar.gz gcc-175c2f98ea85004f23acc4b40f0e4264420116fc.tar.bz2 |
[Ada] Declare time_t uniformly based on a system parameter
gcc/ada/
* Makefile.rtl: Add translations for s-parame__posix2008.ads
* libgnarl/s-linux.ads: Import System.Parameters.
(time_t): Declare using System.Parameters.time_t_bits.
* libgnarl/s-linux__alpha.ads: Likewise.
* libgnarl/s-linux__android.ads: Likewise.
* libgnarl/s-linux__hppa.ads: Likewise.
* libgnarl/s-linux__mips.ads: Likewise.
* libgnarl/s-linux__riscv.ads: Likewise.
* libgnarl/s-linux__sparc.ads: Likewise.
* libgnarl/s-linux__x32.ads: Likewise.
* libgnarl/s-qnx.ads: Likewise.
* libgnarl/s-osinte__aix.ads: Likewise.
* libgnarl/s-osinte__android.ads: Likewise.
* libgnarl/s-osinte__darwin.ads: Likewise.
* libgnarl/s-osinte__dragonfly.ads: Likewise.
* libgnarl/s-osinte__freebsd.ads: Likewise.
* libgnarl/s-osinte__gnu.ads: Likewise.
* libgnarl/s-osinte__hpux-dce.ads: Likewise.
* libgnarl/s-osinte__hpux.ads: Likewise.
* libgnarl/s-osinte__kfreebsd-gnu.ads: Likewise.
* libgnarl/s-osinte__lynxos178e.ads: Likewise.
* libgnarl/s-osinte__qnx.ads: Likewise.
* libgnarl/s-osinte__rtems.ads: Likewise.
* libgnarl/s-osinte__solaris.ads: Likewise.
* libgnarl/s-osinte__vxworks.ads: Likewise.
* libgnat/g-sothco.ads: Likewise.
* libgnat/s-osprim__darwin.adb: Likewise.
* libgnat/s-osprim__posix.adb: Likewise.
* libgnat/s-osprim__posix2008.adb: Likewise.
* libgnat/s-osprim__rtems.adb: Likewise.
* libgnat/s-osprim__x32.adb: Likewise.
* libgnarl/s-osinte__linux.ads: use type System.Linux.time_t.
* libgnat/s-os_lib.ads (time_t): Declare as subtype of
Long_Long_Integer.
* libgnat/s-parame.ads (time_t_bits): New constant.
* libgnat/s-parame__ae653.ads (time_t_bits): Likewise.
* libgnat/s-parame__hpux.ads (time_t_bits): Likewise.
* libgnat/s-parame__vxworks.ads (time_t_bits): Likewise.
* libgnat/s-parame__posix2008.ads: New file for 64 bit time_t.
Diffstat (limited to 'gcc/ada/libgnarl')
24 files changed, 84 insertions, 23 deletions
diff --git a/gcc/ada/libgnarl/s-linux.ads b/gcc/ada/libgnarl/s-linux.ads index 16a28ac..2251f2d 100644 --- a/gcc/ada/libgnarl/s-linux.ads +++ b/gcc/ada/libgnarl/s-linux.ads @@ -36,6 +36,7 @@ -- Preelaborate. This package is designed to be a bottom-level (leaf) package with Interfaces.C; +with System.Parameters; package System.Linux is pragma Preelaborate; @@ -46,7 +47,8 @@ package System.Linux is subtype long is Interfaces.C.long; subtype suseconds_t is Interfaces.C.long; - subtype time_t is Interfaces.C.long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; subtype clockid_t is Interfaces.C.int; type timespec is record diff --git a/gcc/ada/libgnarl/s-linux__alpha.ads b/gcc/ada/libgnarl/s-linux__alpha.ads index cd9a62e..06b12f2 100644 --- a/gcc/ada/libgnarl/s-linux__alpha.ads +++ b/gcc/ada/libgnarl/s-linux__alpha.ads @@ -36,6 +36,7 @@ -- Preelaborate. This package is designed to be a bottom-level (leaf) package. with Interfaces.C; +with System.Parameters; package System.Linux is pragma Preelaborate; @@ -46,7 +47,8 @@ package System.Linux is subtype long is Interfaces.C.long; subtype suseconds_t is Interfaces.C.long; - subtype time_t is Interfaces.C.long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; subtype clockid_t is Interfaces.C.int; type timespec is record diff --git a/gcc/ada/libgnarl/s-linux__android.ads b/gcc/ada/libgnarl/s-linux__android.ads index 5b23b73..d2b689e 100644 --- a/gcc/ada/libgnarl/s-linux__android.ads +++ b/gcc/ada/libgnarl/s-linux__android.ads @@ -36,6 +36,7 @@ -- Preelaborate. This package is designed to be a bottom-level (leaf) package with Interfaces.C; +with System.Parameters; package System.Linux is pragma Preelaborate; @@ -46,7 +47,8 @@ package System.Linux is subtype long is Interfaces.C.long; subtype suseconds_t is Interfaces.C.long; - subtype time_t is Interfaces.C.long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; subtype clockid_t is Interfaces.C.int; type timespec is record diff --git a/gcc/ada/libgnarl/s-linux__hppa.ads b/gcc/ada/libgnarl/s-linux__hppa.ads index 73815d2..03869df 100644 --- a/gcc/ada/libgnarl/s-linux__hppa.ads +++ b/gcc/ada/libgnarl/s-linux__hppa.ads @@ -36,6 +36,7 @@ -- Preelaborate. This package is designed to be a bottom-level (leaf) package. with Interfaces.C; +with System.Parameters; package System.Linux is pragma Preelaborate; @@ -46,7 +47,8 @@ package System.Linux is subtype long is Interfaces.C.long; subtype suseconds_t is Interfaces.C.long; - subtype time_t is Interfaces.C.long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; subtype clockid_t is Interfaces.C.int; type timespec is record diff --git a/gcc/ada/libgnarl/s-linux__mips.ads b/gcc/ada/libgnarl/s-linux__mips.ads index f63640c..3660ee9 100644 --- a/gcc/ada/libgnarl/s-linux__mips.ads +++ b/gcc/ada/libgnarl/s-linux__mips.ads @@ -35,6 +35,7 @@ -- Preelaborate. This package is designed to be a bottom-level (leaf) package with Interfaces.C; +with System.Parameters; package System.Linux is pragma Preelaborate; @@ -46,7 +47,8 @@ package System.Linux is subtype int is Interfaces.C.int; subtype long is Interfaces.C.long; subtype suseconds_t is Interfaces.C.long; - subtype time_t is Interfaces.C.long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; subtype clockid_t is Interfaces.C.int; type timespec is record diff --git a/gcc/ada/libgnarl/s-linux__riscv.ads b/gcc/ada/libgnarl/s-linux__riscv.ads index d8d0f63..e3f7cc3 100644 --- a/gcc/ada/libgnarl/s-linux__riscv.ads +++ b/gcc/ada/libgnarl/s-linux__riscv.ads @@ -35,6 +35,7 @@ -- Preelaborate. This package is designed to be a bottom-level (leaf) package with Interfaces.C; +with System.Parameters; package System.Linux is pragma Preelaborate; @@ -46,7 +47,8 @@ package System.Linux is subtype int is Interfaces.C.int; subtype long is Interfaces.C.long; subtype suseconds_t is Interfaces.C.long; - subtype time_t is Interfaces.C.long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; subtype clockid_t is Interfaces.C.int; type timespec is record diff --git a/gcc/ada/libgnarl/s-linux__sparc.ads b/gcc/ada/libgnarl/s-linux__sparc.ads index 47850fe..102e9ff 100644 --- a/gcc/ada/libgnarl/s-linux__sparc.ads +++ b/gcc/ada/libgnarl/s-linux__sparc.ads @@ -36,6 +36,7 @@ -- Preelaborate. This package is designed to be a bottom-level (leaf) package with Interfaces.C; +with System.Parameters; package System.Linux is pragma Preelaborate; @@ -46,7 +47,8 @@ package System.Linux is subtype long is Interfaces.C.long; subtype suseconds_t is Interfaces.C.long; - subtype time_t is Interfaces.C.long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; subtype clockid_t is Interfaces.C.int; type timespec is record diff --git a/gcc/ada/libgnarl/s-linux__x32.ads b/gcc/ada/libgnarl/s-linux__x32.ads index 29b1c0c..3281235 100644 --- a/gcc/ada/libgnarl/s-linux__x32.ads +++ b/gcc/ada/libgnarl/s-linux__x32.ads @@ -38,6 +38,8 @@ with Interfaces.C; +with System.Parameters; + package System.Linux is pragma Preelaborate; @@ -46,12 +48,15 @@ package System.Linux is ---------- subtype suseconds_t is Long_Long_Integer; - subtype time_t is Long_Long_Integer; + -- Note that suseconds_t is 64 bits. + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; subtype clockid_t is Interfaces.C.int; type timespec is record tv_sec : time_t; tv_nsec : Long_Long_Integer; + -- Note that tv_nsec is 64 bits. end record; pragma Convention (C, timespec); diff --git a/gcc/ada/libgnarl/s-osinte__aix.ads b/gcc/ada/libgnarl/s-osinte__aix.ads index 065876c..bab03d0 100644 --- a/gcc/ada/libgnarl/s-osinte__aix.ads +++ b/gcc/ada/libgnarl/s-osinte__aix.ads @@ -43,6 +43,8 @@ with Ada.Unchecked_Conversion; with Interfaces.C; with Interfaces.C.Extensions; +with System.Parameters; + package System.OS_Interface is pragma Preelaborate; @@ -540,7 +542,8 @@ private type pid_t is new int; - type time_t is new long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/libgnarl/s-osinte__android.ads b/gcc/ada/libgnarl/s-osinte__android.ads index 56bd134..27f7d9d 100644 --- a/gcc/ada/libgnarl/s-osinte__android.ads +++ b/gcc/ada/libgnarl/s-osinte__android.ads @@ -42,6 +42,7 @@ with Ada.Unchecked_Conversion; with Interfaces.C; with System.Linux; with System.OS_Constants; +with System.Parameters; package System.OS_Interface is pragma Preelaborate; @@ -593,7 +594,8 @@ private type pid_t is new int; - type time_t is new long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/libgnarl/s-osinte__darwin.ads b/gcc/ada/libgnarl/s-osinte__darwin.ads index a58f520..ac41d528 100644 --- a/gcc/ada/libgnarl/s-osinte__darwin.ads +++ b/gcc/ada/libgnarl/s-osinte__darwin.ads @@ -40,6 +40,7 @@ with Interfaces.C; with System.OS_Constants; +with System.Parameters; package System.OS_Interface is pragma Preelaborate; @@ -514,7 +515,8 @@ private type pid_t is new int32_t; - type time_t is new long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/libgnarl/s-osinte__dragonfly.ads b/gcc/ada/libgnarl/s-osinte__dragonfly.ads index 5ac4792..515e1b3 100644 --- a/gcc/ada/libgnarl/s-osinte__dragonfly.ads +++ b/gcc/ada/libgnarl/s-osinte__dragonfly.ads @@ -43,6 +43,8 @@ with Ada.Unchecked_Conversion; with Interfaces.C; +with System.Parameters; + package System.OS_Interface is pragma Preelaborate; @@ -633,7 +635,8 @@ private type pid_t is new int; - type time_t is new long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; type timespec is record ts_sec : time_t; diff --git a/gcc/ada/libgnarl/s-osinte__freebsd.ads b/gcc/ada/libgnarl/s-osinte__freebsd.ads index cbe8a6e..0dae1fb 100644 --- a/gcc/ada/libgnarl/s-osinte__freebsd.ads +++ b/gcc/ada/libgnarl/s-osinte__freebsd.ads @@ -43,6 +43,8 @@ with Ada.Unchecked_Conversion; with Interfaces.C; +with System.Parameters; + package System.OS_Interface is pragma Preelaborate; @@ -630,7 +632,8 @@ private type pid_t is new int; Self_PID : constant pid_t := 0; - type time_t is new long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; type timespec is record ts_sec : time_t; diff --git a/gcc/ada/libgnarl/s-osinte__gnu.ads b/gcc/ada/libgnarl/s-osinte__gnu.ads index 99ee175..98eef86 100644 --- a/gcc/ada/libgnarl/s-osinte__gnu.ads +++ b/gcc/ada/libgnarl/s-osinte__gnu.ads @@ -39,6 +39,7 @@ -- Preelaborate. This package is designed to be a bottom-level (leaf) package with Interfaces.C; +with System.Parameters; with Unchecked_Conversion; package System.OS_Interface is @@ -652,7 +653,8 @@ private type pid_t is new int; - type time_t is new long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/libgnarl/s-osinte__hpux-dce.ads b/gcc/ada/libgnarl/s-osinte__hpux-dce.ads index 8e04e63..ce8c5ab 100644 --- a/gcc/ada/libgnarl/s-osinte__hpux-dce.ads +++ b/gcc/ada/libgnarl/s-osinte__hpux-dce.ads @@ -42,6 +42,8 @@ with Ada.Unchecked_Conversion; with Interfaces.C; +with System.Parameters; + package System.OS_Interface is pragma Preelaborate; @@ -444,7 +446,8 @@ private type pid_t is new int; - type time_t is new long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/libgnarl/s-osinte__hpux.ads b/gcc/ada/libgnarl/s-osinte__hpux.ads index c92fbda..c94b84c 100644 --- a/gcc/ada/libgnarl/s-osinte__hpux.ads +++ b/gcc/ada/libgnarl/s-osinte__hpux.ads @@ -42,6 +42,8 @@ with Ada.Unchecked_Conversion; with Interfaces.C; +with System.Parameters; + package System.OS_Interface is pragma Preelaborate; @@ -514,7 +516,8 @@ private type pid_t is new int; - type time_t is new long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads b/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads index 90e0116..de91ee8 100644 --- a/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads +++ b/gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads @@ -39,6 +39,7 @@ -- Preelaborate. This package is designed to be a bottom-level (leaf) package with Interfaces.C; +with System.Parameters; with Unchecked_Conversion; package System.OS_Interface is @@ -598,7 +599,8 @@ private type pid_t is new int; - type time_t is new long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads index ca0bf1b..cda0f8e 100644 --- a/gcc/ada/libgnarl/s-osinte__linux.ads +++ b/gcc/ada/libgnarl/s-osinte__linux.ads @@ -51,6 +51,8 @@ package System.OS_Interface is pragma Linker_Options ("-lpthread"); + use type System.Linux.time_t; + subtype int is Interfaces.C.int; subtype char is Interfaces.C.char; subtype short is Interfaces.C.short; diff --git a/gcc/ada/libgnarl/s-osinte__lynxos178e.ads b/gcc/ada/libgnarl/s-osinte__lynxos178e.ads index f2a866b..4f38a53 100644 --- a/gcc/ada/libgnarl/s-osinte__lynxos178e.ads +++ b/gcc/ada/libgnarl/s-osinte__lynxos178e.ads @@ -43,6 +43,7 @@ with Ada.Unchecked_Conversion; with Interfaces.C; with System.Multiprocessors; +with System.Parameters; package System.OS_Interface is pragma Preelaborate; @@ -539,7 +540,8 @@ private type pid_t is new long; - type time_t is new int64; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; type suseconds_t is new int; diff --git a/gcc/ada/libgnarl/s-osinte__qnx.ads b/gcc/ada/libgnarl/s-osinte__qnx.ads index af326c4..28abfbe 100644 --- a/gcc/ada/libgnarl/s-osinte__qnx.ads +++ b/gcc/ada/libgnarl/s-osinte__qnx.ads @@ -40,6 +40,7 @@ with Ada.Unchecked_Conversion; with Interfaces.C; with System.OS_Constants; +with System.Parameters; package System.OS_Interface is pragma Preelaborate; @@ -566,7 +567,8 @@ private type pid_t is new int; - type time_t is new long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/libgnarl/s-osinte__rtems.ads b/gcc/ada/libgnarl/s-osinte__rtems.ads index 6aae823..ffbfc3a 100644 --- a/gcc/ada/libgnarl/s-osinte__rtems.ads +++ b/gcc/ada/libgnarl/s-osinte__rtems.ads @@ -52,6 +52,7 @@ with Interfaces.C; with System.OS_Constants; +with System.Parameters; package System.OS_Interface is pragma Preelaborate; @@ -617,7 +618,8 @@ private type pid_t is new int; - type time_t is new Long_Long_Integer; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/libgnarl/s-osinte__solaris.ads b/gcc/ada/libgnarl/s-osinte__solaris.ads index b2f4af4..29e1026 100644 --- a/gcc/ada/libgnarl/s-osinte__solaris.ads +++ b/gcc/ada/libgnarl/s-osinte__solaris.ads @@ -42,6 +42,8 @@ with Interfaces.C; with Ada.Unchecked_Conversion; +with System.Parameters; + package System.OS_Interface is pragma Preelaborate; @@ -523,7 +525,8 @@ private type pid_t is new long; - type time_t is new long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; type timespec is record tv_sec : time_t; diff --git a/gcc/ada/libgnarl/s-osinte__vxworks.ads b/gcc/ada/libgnarl/s-osinte__vxworks.ads index 5e30698..8b9c5bf 100644 --- a/gcc/ada/libgnarl/s-osinte__vxworks.ads +++ b/gcc/ada/libgnarl/s-osinte__vxworks.ads @@ -42,6 +42,7 @@ with Interfaces.C; with System.VxWorks; with System.VxWorks.Ext; with System.Multiprocessors; +with System.Parameters; package System.OS_Interface is pragma Preelaborate; @@ -239,7 +240,11 @@ package System.OS_Interface is -- Time -- ---------- - type time_t is new unsigned_long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; + -- Time_t here used to be unsigned to match the VxWorks header + -- declaration. The header declaration has changed in newer release + -- and is now signed for applications. type timespec is record ts_sec : time_t; diff --git a/gcc/ada/libgnarl/s-qnx.ads b/gcc/ada/libgnarl/s-qnx.ads index 7f33d70..811c41c 100644 --- a/gcc/ada/libgnarl/s-qnx.ads +++ b/gcc/ada/libgnarl/s-qnx.ads @@ -37,6 +37,8 @@ with Interfaces.C; +with System.Parameters; + package System.QNX is pragma Preelaborate; @@ -46,7 +48,8 @@ package System.QNX is subtype long is Interfaces.C.long; subtype suseconds_t is Interfaces.C.long; - subtype time_t is Interfaces.C.long; + type time_t is range -2 ** (System.Parameters.time_t_bits - 1) + .. 2 ** (System.Parameters.time_t_bits - 1) - 1; subtype clockid_t is Interfaces.C.int; type timespec is record |