From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 328503AAB4AA; Fri, 9 Jul 2021 12:39:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 328503AAB4AA MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-2210] [Ada] Declare time_t uniformly based on a system parameter X-Act-Checkin: gcc X-Git-Author: Doug Rupp X-Git-Refname: refs/heads/master X-Git-Oldrev: fbc72d0b4ac841fdf7d3ea15851f3be39361a86c X-Git-Newrev: 175c2f98ea85004f23acc4b40f0e4264420116fc Message-Id: <20210709123924.328503AAB4AA@sourceware.org> Date: Fri, 9 Jul 2021 12:39:24 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 12:39:24 -0000 https://gcc.gnu.org/g:175c2f98ea85004f23acc4b40f0e4264420116fc commit r12-2210-g175c2f98ea85004f23acc4b40f0e4264420116fc Author: Doug Rupp 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. -- +-- -- +-- 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 -- ----------------------------------------------