[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.
This commit is contained in:
Doug Rupp 2021-06-05 12:58:35 -07:00 committed by Pierre-Marie de Rodat
parent fbc72d0b4a
commit 175c2f98ea
37 changed files with 342 additions and 33 deletions

View file

@ -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 \

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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 --
----------------------------------------------

View file

@ -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 --
----------------------------------------------

View file

@ -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 --
----------------------------------------------

View file

@ -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;

View file

@ -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 --
----------------------------------------------