public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2210] [Ada] Declare time_t uniformly based on a system parameter
@ 2021-07-09 12:39 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-07-09 12:39 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:175c2f98ea85004f23acc4b40f0e4264420116fc
commit r12-2210-g175c2f98ea85004f23acc4b40f0e4264420116fc
Author: Doug Rupp <rupp@adacore.com>
Date: Sat Jun 5 12:58:35 2021 -0700
[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.
Diff:
---
gcc/ada/Makefile.rtl | 3 +
gcc/ada/libgnarl/s-linux.ads | 4 +-
gcc/ada/libgnarl/s-linux__alpha.ads | 4 +-
gcc/ada/libgnarl/s-linux__android.ads | 4 +-
gcc/ada/libgnarl/s-linux__hppa.ads | 4 +-
gcc/ada/libgnarl/s-linux__mips.ads | 4 +-
gcc/ada/libgnarl/s-linux__riscv.ads | 4 +-
gcc/ada/libgnarl/s-linux__sparc.ads | 4 +-
gcc/ada/libgnarl/s-linux__x32.ads | 7 +-
gcc/ada/libgnarl/s-osinte__aix.ads | 5 +-
gcc/ada/libgnarl/s-osinte__android.ads | 4 +-
gcc/ada/libgnarl/s-osinte__darwin.ads | 4 +-
gcc/ada/libgnarl/s-osinte__dragonfly.ads | 5 +-
gcc/ada/libgnarl/s-osinte__freebsd.ads | 5 +-
gcc/ada/libgnarl/s-osinte__gnu.ads | 4 +-
gcc/ada/libgnarl/s-osinte__hpux-dce.ads | 5 +-
gcc/ada/libgnarl/s-osinte__hpux.ads | 5 +-
gcc/ada/libgnarl/s-osinte__kfreebsd-gnu.ads | 4 +-
gcc/ada/libgnarl/s-osinte__linux.ads | 2 +
gcc/ada/libgnarl/s-osinte__lynxos178e.ads | 4 +-
gcc/ada/libgnarl/s-osinte__qnx.ads | 4 +-
gcc/ada/libgnarl/s-osinte__rtems.ads | 4 +-
gcc/ada/libgnarl/s-osinte__solaris.ads | 5 +-
gcc/ada/libgnarl/s-osinte__vxworks.ads | 7 +-
gcc/ada/libgnarl/s-qnx.ads | 5 +-
gcc/ada/libgnat/g-sothco.ads | 7 +-
gcc/ada/libgnat/s-os_lib.ads | 10 +-
gcc/ada/libgnat/s-osprim__darwin.adb | 4 +-
gcc/ada/libgnat/s-osprim__posix.adb | 4 +-
gcc/ada/libgnat/s-osprim__posix2008.adb | 4 +-
gcc/ada/libgnat/s-osprim__rtems.adb | 4 +-
gcc/ada/libgnat/s-osprim__x32.adb | 3 +-
gcc/ada/libgnat/s-parame.ads | 7 +
gcc/ada/libgnat/s-parame__ae653.ads | 7 +
gcc/ada/libgnat/s-parame__hpux.ads | 7 +
gcc/ada/libgnat/s-parame__posix2008.ads | 193 ++++++++++++++++++++++++++++
gcc/ada/libgnat/s-parame__vxworks.ads | 15 +++
37 files changed, 342 insertions(+), 33 deletions(-)
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 5475d0d875b..fb851a6bd92 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -2162,6 +2162,7 @@ ifeq ($(strip $(filter-out lynxos178%,$(target_os))),)
ifeq ($(strip $(filter-out lynxos178e,$(target_os))),)
LIBGNAT_TARGET_PAIRS += \
+ s-parame.ads<libgnat/s-parame__posix2008.ads \
s-osinte.ads<libgnarl/s-osinte__lynxos178e.ads \
s-osprim.adb<libgnat/s-osprim__posix2008.adb \
s-tracon.adb<hie/s-tracon__ppc-eabi.adb
@@ -2181,6 +2182,7 @@ ifeq ($(strip $(filter-out rtems%,$(target_os))),)
s-osinte.ads<libgnarl/s-osinte__rtems.ads \
s-osprim.adb<libgnat/s-osprim__rtems.adb \
s-parame.adb<libgnat/s-parame__rtems.adb \
+ s-parame.ads<libgnat/s-parame__posix2008.ads \
s-taprop.adb<libgnarl/s-taprop__posix.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
@@ -2760,6 +2762,7 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),)
s-osinte.ads<libgnarl/s-osinte__linux.ads \
s-osinte.adb<libgnarl/s-osinte__x32.adb \
s-osprim.adb<libgnat/s-osprim__x32.adb \
+ s-parame.ads<libgnat/s-parame__posix2008.ads \
s-taprop.adb<libgnarl/s-taprop__linux.adb \
s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
diff --git a/gcc/ada/libgnarl/s-linux.ads b/gcc/ada/libgnarl/s-linux.ads
index 16a28acd7aa..2251f2d529a 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 cd9a62e0a98..06b12f2a79e 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 5b23b73c448..d2b689ec972 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 73815d2b0bf..03869df69c0 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 f63640c5e6c..3660ee958f3 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 d8d0f63626b..e3f7cc39c79 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 47850febc0e..102e9fffc2b 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 29b1c0c3ec4..3281235f91c 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 065876c8388..bab03d05aad 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 56bd134449b..27f7d9d736f 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 a58f5205765..ac41d528094 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 5ac4792dee6..515e1b3d279 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 cbe8a6e4b2e..0dae1fbc68d 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 99ee1754e4b..98eef86869e 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 8e04e638d1f..ce8c5abe572 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 c92fbda1ada..c94b84c1752 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 90e0116e579..de91ee8b6a8 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 ca0bf1b5070..cda0f8ef103 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 f2a866b72af..4f38a53d3d4 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 af326c4a9a1..28abfbe051a 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 6aae823c866..ffbfc3aa6fb 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 b2f4af4243c..29e1026f0de 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 5e3069871ee..8b9c5bf7b48 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 7f33d7007b4..811c41cbe07 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
diff --git a/gcc/ada/libgnat/g-sothco.ads b/gcc/ada/libgnat/g-sothco.ads
index f6e61b208d1..b48657ba2af 100644
--- a/gcc/ada/libgnat/g-sothco.ads
+++ b/gcc/ada/libgnat/g-sothco.ads
@@ -34,6 +34,7 @@
with Ada.Unchecked_Conversion;
with Interfaces.C.Strings;
+with System.Parameters;
package GNAT.Sockets.Thin_Common is
@@ -44,9 +45,9 @@ package GNAT.Sockets.Thin_Common is
Failure : constant C.int := -1;
type time_t is
- range -2 ** (8 * SOSC.SIZEOF_tv_sec - 1)
- .. 2 ** (8 * SOSC.SIZEOF_tv_sec - 1) - 1;
- for time_t'Size use 8 * SOSC.SIZEOF_tv_sec;
+ range -2 ** (System.Parameters.time_t_bits - 1)
+ .. 2 ** (System.Parameters.time_t_bits - 1) - 1;
+ for time_t'Size use System.Parameters.time_t_bits;
pragma Convention (C, time_t);
type suseconds_t is
diff --git a/gcc/ada/libgnat/s-os_lib.ads b/gcc/ada/libgnat/s-os_lib.ads
index d4911d9efc8..4c279d563b5 100644
--- a/gcc/ada/libgnat/s-os_lib.ads
+++ b/gcc/ada/libgnat/s-os_lib.ads
@@ -172,8 +172,14 @@ package System.OS_Lib is
-- 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
+ subtype time_t is Long_Long_Integer;
+ -- C time_t can be either long or long long, but this is a subtype
+ -- not used in the compiler or tools, but only for user
+ -- applications, so we choose the Ada equivalent of the latter
+ -- because eventually that will be the type used out of necessity.
+ -- This may effect some user code on 32 bit targets that have not yet
+ -- migrated to the Posix 2008 standard, particularly pre version 5
+ -- 32 bit Linux.
function To_C (Time : OS_Time) return time_t;
-- Convert OS_Time to C time_t type
diff --git a/gcc/ada/libgnat/s-osprim__darwin.adb b/gcc/ada/libgnat/s-osprim__darwin.adb
index adbd7ed1db2..00d0ccb8f6c 100644
--- a/gcc/ada/libgnat/s-osprim__darwin.adb
+++ b/gcc/ada/libgnat/s-osprim__darwin.adb
@@ -31,6 +31,7 @@
-- This version is for darwin
+with System.Parameters;
package body System.OS_Primitives is
-- ??? These definitions are duplicated from System.OS_Interface
@@ -45,7 +46,8 @@ package body System.OS_Primitives is
pragma Convention (C, struct_timezone);
type struct_timezone_ptr is access all struct_timezone;
- type time_t is new Long_Integer;
+ type time_t is range -2 ** (System.Parameters.time_t_bits - 1)
+ .. 2 ** (System.Parameters.time_t_bits - 1) - 1;
type struct_timeval is record
tv_sec : time_t;
diff --git a/gcc/ada/libgnat/s-osprim__posix.adb b/gcc/ada/libgnat/s-osprim__posix.adb
index d3083dd3331..96bf70e82df 100644
--- a/gcc/ada/libgnat/s-osprim__posix.adb
+++ b/gcc/ada/libgnat/s-osprim__posix.adb
@@ -30,6 +30,7 @@
------------------------------------------------------------------------------
-- This version is for POSIX-like operating systems
+with System.Parameters;
package body System.OS_Primitives is
@@ -38,7 +39,8 @@ package body System.OS_Primitives is
-- these declarations in System.OS_Interface and move these ones in
-- the spec.
- type time_t is new 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/libgnat/s-osprim__posix2008.adb b/gcc/ada/libgnat/s-osprim__posix2008.adb
index 4804f0b35af..44f14c4fccf 100644
--- a/gcc/ada/libgnat/s-osprim__posix2008.adb
+++ b/gcc/ada/libgnat/s-osprim__posix2008.adb
@@ -33,6 +33,7 @@
with System.CRTL;
with System.OS_Constants;
+with System.Parameters;
package body System.OS_Primitives is
subtype int is System.CRTL.int;
@@ -41,7 +42,8 @@ package body System.OS_Primitives is
-- we don't want to depend on any package. Consider removing these
-- declarations in System.OS_Interface and move these ones to the spec.
- type time_t is new System.CRTL.int64;
+ 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/libgnat/s-osprim__rtems.adb b/gcc/ada/libgnat/s-osprim__rtems.adb
index f7a7e1f5302..23669e1f5ec 100644
--- a/gcc/ada/libgnat/s-osprim__rtems.adb
+++ b/gcc/ada/libgnat/s-osprim__rtems.adb
@@ -31,6 +31,7 @@
-- This version is for POSIX-like operating systems
+with System.Parameters;
package body System.OS_Primitives is
-- ??? These definitions are duplicated from System.OS_Interface
@@ -38,7 +39,8 @@ package body System.OS_Primitives is
-- these declarations in System.OS_Interface and move these ones in
-- the spec.
- 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/libgnat/s-osprim__x32.adb b/gcc/ada/libgnat/s-osprim__x32.adb
index 846ca119196..d3c922c8f38 100644
--- a/gcc/ada/libgnat/s-osprim__x32.adb
+++ b/gcc/ada/libgnat/s-osprim__x32.adb
@@ -38,7 +38,8 @@ package body System.OS_Primitives is
-- these declarations in System.OS_Interface and move these ones in
-- the spec.
- 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/libgnat/s-parame.ads b/gcc/ada/libgnat/s-parame.ads
index d767f8d70e2..178bd7cf2a9 100644
--- a/gcc/ada/libgnat/s-parame.ads
+++ b/gcc/ada/libgnat/s-parame.ads
@@ -100,6 +100,13 @@ package System.Parameters is
-- Indicates if secondary stacks can grow and shrink at run-time. If False,
-- the size of a secondary stack is fixed at the point of its creation.
+ ------------------------------------
+ -- Characteristics of time_t type --
+ ------------------------------------
+
+ time_t_bits : constant := Long_Integer'Size;
+ -- Number of bits in type time_t.
+
----------------------------------------------
-- Characteristics of types in Interfaces.C --
----------------------------------------------
diff --git a/gcc/ada/libgnat/s-parame__ae653.ads b/gcc/ada/libgnat/s-parame__ae653.ads
index c42c97c8a48..76824351c91 100644
--- a/gcc/ada/libgnat/s-parame__ae653.ads
+++ b/gcc/ada/libgnat/s-parame__ae653.ads
@@ -100,6 +100,13 @@ package System.Parameters is
-- Indicates if secondary stacks can grow and shrink at run-time. If False,
-- the size of a secondary stack is fixed at the point of its creation.
+ ------------------------------------
+ -- Characteristics of time_t type --
+ ------------------------------------
+
+ time_t_bits : constant := Long_Integer'Size;
+ -- Number of bits in type time_t.
+
----------------------------------------------
-- Characteristics of types in Interfaces.C --
----------------------------------------------
diff --git a/gcc/ada/libgnat/s-parame__hpux.ads b/gcc/ada/libgnat/s-parame__hpux.ads
index 961c9ce9728..053cd764a8a 100644
--- a/gcc/ada/libgnat/s-parame__hpux.ads
+++ b/gcc/ada/libgnat/s-parame__hpux.ads
@@ -98,6 +98,13 @@ package System.Parameters is
-- Indicates if secondary stacks can grow and shrink at run-time. If False,
-- the size of a secondary stack is fixed at the point of its creation.
+ ------------------------------------
+ -- Characteristics of time_t type --
+ ------------------------------------
+
+ time_t_bits : constant := Long_Integer'Size;
+ -- Number of bits in type time_t.
+
----------------------------------------------
-- Characteristics of Types in Interfaces.C --
----------------------------------------------
diff --git a/gcc/ada/libgnat/s-parame__posix2008.ads b/gcc/ada/libgnat/s-parame__posix2008.ads
new file mode 100644
index 00000000000..af299eceac9
--- /dev/null
+++ b/gcc/ada/libgnat/s-parame__posix2008.ads
@@ -0,0 +1,193 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . P A R A M E T E R S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2021, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This is the Posix 2008 version for 64 bit time_t.
+
+-- This package defines some system dependent parameters for GNAT. These
+-- are values that are referenced by the runtime library and are therefore
+-- relevant to the target machine.
+
+-- The parameters whose value is defined in the spec are not generally
+-- expected to be changed. If they are changed, it will be necessary to
+-- recompile the run-time library.
+
+-- The parameters which are defined by functions can be changed by modifying
+-- the body of System.Parameters in file s-parame.adb. A change to this body
+-- requires only rebinding and relinking of the application.
+
+-- Note: do not introduce any pragma Inline statements into this unit, since
+-- otherwise the relinking and rebinding capability would be deactivated.
+
+pragma Compiler_Unit_Warning;
+
+package System.Parameters is
+ pragma Pure;
+
+ ---------------------------------------
+ -- Task And Stack Allocation Control --
+ ---------------------------------------
+
+ type Size_Type is range
+ -(2 ** (Integer'(Standard'Address_Size) - 1)) ..
+ +(2 ** (Integer'(Standard'Address_Size) - 1)) - 1;
+ -- Type used to provide task stack sizes to the runtime. Sized to permit
+ -- stack sizes of up to half the total addressable memory space. This may
+ -- seem excessively large (even for 32-bit systems), however there are many
+ -- instances of users requiring large stack sizes (for example string
+ -- processing).
+
+ Unspecified_Size : constant Size_Type := Size_Type'First;
+ -- Value used to indicate that no size type is set
+
+ function Default_Stack_Size return Size_Type;
+ -- Default task stack size used if none is specified
+
+ function Minimum_Stack_Size return Size_Type;
+ -- Minimum task stack size permitted
+
+ function Adjust_Storage_Size (Size : Size_Type) return Size_Type;
+ -- Given the storage size stored in the TCB, return the Storage_Size
+ -- value required by the RM for the Storage_Size attribute. The
+ -- required adjustment is as follows:
+ --
+ -- when Size = Unspecified_Size, return Default_Stack_Size
+ -- when Size < Minimum_Stack_Size, return Minimum_Stack_Size
+ -- otherwise return given Size
+
+ Default_Env_Stack_Size : constant Size_Type := 8_192_000;
+ -- Assumed size of the environment task, if no other information is
+ -- available. This value is used when stack checking is enabled and
+ -- no GNAT_STACK_LIMIT environment variable is set.
+
+ Stack_Grows_Down : constant Boolean := True;
+ -- This constant indicates whether the stack grows up (False) or
+ -- down (True) in memory as functions are called. It is used for
+ -- proper implementation of the stack overflow check.
+
+ Runtime_Default_Sec_Stack_Size : constant Size_Type := 10 * 1024;
+ -- The run-time chosen default size for secondary stacks that may be
+ -- overridden by the user with the use of binder -D switch.
+
+ Sec_Stack_Dynamic : constant Boolean := True;
+ -- Indicates if secondary stacks can grow and shrink at run-time. If False,
+ -- the size of a secondary stack is fixed at the point of its creation.
+
+ ------------------------------------
+ -- Characteristics of time_t type --
+ ------------------------------------
+
+ time_t_bits : constant := Long_Long_Integer'Size;
+ -- Number of bits in type time_t. Use for targets that are Posix 2008
+ -- compliant (fixes the year 2038 time_t overflow).
+
+ ----------------------------------------------
+ -- Characteristics of types in Interfaces.C --
+ ----------------------------------------------
+
+ long_bits : constant := Long_Integer'Size;
+ -- Number of bits in type long and unsigned_long. The normal convention
+ -- is that this is the same as type Long_Integer, but this may not be true
+ -- of all targets.
+
+ ptr_bits : constant := Standard'Address_Size;
+ subtype C_Address is System.Address;
+ -- Number of bits in Interfaces.C pointers, normally a standard address
+
+ C_Malloc_Linkname : constant String := "__gnat_malloc";
+ -- Name of runtime function used to allocate such a pointer
+
+ ----------------------------------------------
+ -- Behavior of Pragma Finalize_Storage_Only --
+ ----------------------------------------------
+
+ -- Garbage_Collected is a Boolean constant whose value indicates the
+ -- effect of the pragma Finalize_Storage_Entry on a controlled type.
+
+ -- Garbage_Collected = False
+
+ -- The system releases all storage on program termination only,
+ -- but not other garbage collection occurs, so finalization calls
+ -- are omitted only for outer level objects can be omitted if
+ -- pragma Finalize_Storage_Only is used.
+
+ -- Garbage_Collected = True
+
+ -- The system provides full garbage collection, so it is never
+ -- necessary to release storage for controlled objects for which
+ -- a pragma Finalize_Storage_Only is used.
+
+ Garbage_Collected : constant Boolean := False;
+ -- The storage mode for this system (release on program exit)
+
+ ---------------------
+ -- Tasking Profile --
+ ---------------------
+
+ -- In the following sections, constant parameters are defined to
+ -- allow some optimizations and fine tuning within the tasking run time
+ -- based on restrictions on the tasking features.
+
+ -------------------
+ -- Task Abortion --
+ -------------------
+
+ No_Abort : constant Boolean := False;
+ -- This constant indicates whether abort statements and asynchronous
+ -- transfer of control (ATC) are disallowed. If set to True, it is
+ -- assumed that neither construct is used, and the run time does not
+ -- need to defer/undefer abort and check for pending actions at
+ -- completion points. A value of True for No_Abort corresponds to:
+ -- pragma Restrictions (No_Abort_Statements);
+ -- pragma Restrictions (Max_Asynchronous_Select_Nesting => 0);
+
+ ---------------------
+ -- Task Attributes --
+ ---------------------
+
+ Max_Attribute_Count : constant := 32;
+ -- Number of task attributes stored in the task control block
+
+ -----------------------
+ -- Task Image Length --
+ -----------------------
+
+ Max_Task_Image_Length : constant := 256;
+ -- This constant specifies the maximum length of a task's image
+
+ ------------------------------
+ -- Exception Message Length --
+ ------------------------------
+
+ Default_Exception_Msg_Max_Length : constant := 200;
+ -- This constant specifies the default number of characters to allow
+ -- in an exception message (200 is minimum required by RM 11.4.1(18)).
+
+end System.Parameters;
diff --git a/gcc/ada/libgnat/s-parame__vxworks.ads b/gcc/ada/libgnat/s-parame__vxworks.ads
index 8598a435ec4..11b408b660e 100644
--- a/gcc/ada/libgnat/s-parame__vxworks.ads
+++ b/gcc/ada/libgnat/s-parame__vxworks.ads
@@ -100,6 +100,21 @@ package System.Parameters is
-- Indicates if secondary stacks can grow and shrink at run-time. If False,
-- the size of a secondary stack is fixed at the point of its creation.
+ ------------------------------------
+ -- Characteristics of time_t type --
+ ------------------------------------
+
+ -- IMPORTANT NOTE:
+ -- Select the appropriate time_t_bits for the VSB in use, then rebuild
+ -- the runtime using instructions in adainclude/libada.gpr.
+
+ time_t_bits : constant := Long_Integer'Size;
+ -- Number of bits in type time_t for SR0650 and before and SR0660 with
+ -- non-default configuration.
+
+ -- time_t_bits : constant := Long_Long_Integer'Size;
+ -- Number of bits in type time_t for SR0660 with default configuration.
+
----------------------------------------------
-- Characteristics of types in Interfaces.C --
----------------------------------------------
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-09 12:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 12:39 [gcc r12-2210] [Ada] Declare time_t uniformly based on a system parameter 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).