aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/doc/gnat_rm
AgeCommit message (Collapse)AuthorFilesLines
4 daysada: Document hardening features not supported by LLVMJose Ruiz1-0/+2
gcc/ada/ChangeLog: * doc/gnat_rm/security_hardening_features.rst: clarify that hardening options are not supported by the LLVM back end. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
4 daysada: Add System.C_Time and GNAT.C_Time units to libgnatNicolas Boulenguez1-2/+12
The first unit provides the time_t, timeval and timespec types corresponding to the C types defined by the OS, as well as various conversion functions. The second unit is a mere renaming of the first under the GNAT hierarchy. This removes C time types and conversions under System, and from bodies and private parts under GNAT, while keeping visible types and conversions under GNAT as Obsolescent. gcc/ada/ChangeLog: PR ada/114065 * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add g-c_time$(objext) and s-c_time$(objext). (Aarch64/Android): Do not use s-osinte__android.adb. (SPARC/Solaris): Do not use s-osprim__solaris.adb. (x86/Solaris): Likewise. (LynxOS178): Do not use s-parame__posix2008.ads. (RTEMS): Likewise. (x32/Linux): Likewise, as well as s-linux__x32.ads. Replace s-osprim__x32.adb with s-osprim__posix.adb. (LIBGNAT_OBJS): Remove cal.o. * cal.c: Delete. * doc/gnat_rm/the_gnat_library.rst (GNAT.C_Time): New entry. (GNAT.Calendar): Do not mention the obsolete conversion functions. * impunit.adb (Non_Imp_File_Names_95): Add g-c_time. * libgnarl/a-exetim__posix.adb: Add with clause for System.C_Time (Clock): Use type and functions from System.C_Time. * libgnarl/s-linux.ads: Remove with clause for System.Parameters. Remove declarations of C time types. * libgnarl/s-linux__alpha.ads: Likewise. * libgnarl/s-linux__android-aarch64.ads: Likewise. * libgnarl/s-linux__android-arm.ads: Likewise. * libgnarl/s-linux__hppa.ads: Likewise. * libgnarl/s-linux__loongarch.ads: Likewise. * libgnarl/s-linux__mips.ads: Likewise. * libgnarl/s-linux__riscv.ads: Likewise. * libgnarl/s-linux__sparc.ads: Likewise. * libgnarl/s-osinte__aix.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__cheribsd.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.ads: Likewise. * libgnarl/s-osinte__kfreebsd-gnu.ads: Likewise. * libgnarl/s-osinte__linux.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. * libgnarl/s-qnx.ads: Likewise. * libgnarl/s-linux__x32.ads: Delete. * libgnarl/s-osinte__darwin.adb (To_Duration): Remove. (To_Timespec): Likewise. * libgnarl/s-osinte__aix.adb: Likewise. * libgnarl/s-osinte__dragonfly.adb: Likewise. * libgnarl/s-osinte__freebsd.adb: Likewise. * libgnarl/s-osinte__gnu.adb: Likewise. * libgnarl/s-osinte__lynxos178.adb: Likewise. * libgnarl/s-osinte__posix.adb: Likewise. * libgnarl/s-osinte__qnx.adb: Likewise. * libgnarl/s-osinte__rtems.adb: Likewise. * libgnarl/s-osinte__solaris.adb: Likewise. * libgnarl/s-osinte__vxworks.adb: Likewise. * libgnarl/s-osinte__x32.adb: Likewise. * libgnarl/s-taprop__solaris.adb: Add with clause for System.C_Time. (Monotonic_Clock): Use type and functions from System.C_Time. (RT_Resolution): Likewise. (Timed_Sleep): Likewise. (Timed_Delay): Likewise. * libgnarl/s-taprop__vxworks.adb: Likewise. * libgnarl/s-tpopmo.adb: Likewise. * libgnarl/s-osinte__android.adb: Delete. * libgnat/g-c_time.ads: New file. * libgnat/g-calend.adb: Delegate to System.C_Time. * libgnat/g-calend.ads: Likewise. * libgnat/g-socket.adb: Likewise. * libgnat/g-socthi.adb: Likewise. * libgnat/g-socthi__vxworks.adb: Likewise. * libgnat/g-sothco.ads: Likewise. * libgnat/g-spogwa.adb: Likewise. * libgnat/s-c_time.adb: New file. * libgnat/s-c_time.ads: Likewise. * libgnat/s-optide.adb: Import nanosleep here. * libgnat/s-os_lib.ads (time_t): Remove. (To_Ada): Adjust. (To_C): Likewise. * libgnat/s-os_lib.adb: Likewise. * libgnat/s-osprim__darwin.adb: Delegate to System.C_Time. * libgnat/s-osprim__posix.adb: Likewise. * libgnat/s-osprim__posix2008.adb: Likewise. * libgnat/s-osprim__rtems.adb: Likewise. * libgnat/s-osprim__unix.adb: Likewise. * libgnat/s-osprim__solaris.adb: Delete. * libgnat/s-osprim__x32.adb: Likewise. * libgnat/s-parame.ads (time_t_bits): Remove. * libgnat/s-parame__hpux.ads: Likewise. * libgnat/s-parame__vxworks.ads: Likewise. * libgnat/s-parame__posix2008.ads: Delete. * s-oscons-tmplt.c (SIZEOF_tv_nsec): New constant. * gnat_rm.texi: Regenerate.
4 daysada: Fix section of Finalizable extension in GNAT RMRonan Desplanques1-131/+131
The generalized finalization extension was awarded the title of curated extension some time ago, but this wasn't reflected in the GNAT reference manual before this patch, which moves the documentation for generalized finalization in the curated extension section. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Fix section of Finalizable. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
10 daysada: Unsigned_Base_Range aspectJavier Miranda1-0/+23
This patch adds support for a new GNAT aspect/pragma for integer type definitions to explicitly enforce the use of an unsigned base type. gcc/ada/ChangeLog: * aspects.ads (Aspect_Unsigned_Base_Range): New aspect. * checks.adb (Determine_Range): Handle types with unsigned base range aspect. (Enable_Overflow_Check): ditto (Apply_Arithmetic_Overflow_Strict): ditto * debug.adb (d_o): Document new usage. * einfo.ads (Has_Unsigned_Base_Range_Aspect): New flag. * exp_attr.adb (Expand_N_Attribute_Reference): No action since it has been already handled at this stage. * exp_ch4.adb (Expand_N_Op_Add): Generate aritmetic overflow check on unsigned base range type operands. (Expand_N_Op_Subtract): ditto (Expand_N_Op_Multiply): ditto (Expand_N_Op_Minus): ditto * gen_il-fields.ads (Has_Unsigned_Base_Range_Aspect): New flag. * gen_il-gen-gen_entities.adb (Has_Unsigned_Base_Range_Aspect): New flag. * gen_il-internals.adb (Has_Unsigned_Base_Range_Aspect): New flag. * gnat1drv.adb (Adjust_Global_Switches): Handle -gnatd_o * par-prag.adb (Pragma_Unsigned_Base_Range): No action since it will be entirely handled by the semantic analyzer. * rtsfind.ads (RE_Id): Add RE_Uns_[Add|Subtract|Multiply]_With_ Ovflo_Check * sem_attr.ads (Attribute_Unsigned_Base_Range): Added to the set of implementation defined attributes. * sem_attr.adb (Analyze_Attribute): Analyze attribute Unsigned_Base_Range. (Eval_Attribute): Evaluate attribute Unsigned_Base_Range. * sem_ch13.adb (Analyze_One_Aspect): Defer checks for this aspect to the analysis of the corresponding pragma. * sem_ch3.ads (Unsigned_Base_Range_Type_Declaration): New subprogram. * sem_ch3.adb (Build_Derived_Numeric_Type): Inherit flag Has_Unsigned_Base_Range_Aspect. (Unsigned_Base_Range_Type_Declaration): New subprogram. (Has_Pragma_Unsigned_Base_Range): New subprogram. * sem_prag.adb (Analyze_Pragma): Handle Pragma_Unsigned_Base_Range. * snames.adb-tmpl (Get_Pragma_Id): Handle Name_Unsigned_Base_Range. (Is_Pragma_Name): ditto. * snames.ads-tmpl (Name_Unsigned_Base_Range): New name. (Attribute_Unsigned_Base_Range): New attribute. (Pragma_Unsigned_Base_Range): New pragma. * libgnat/s-aridou.ads (Add_With_Ovflo_Check): New routine for Double_Uns. (Subtract_With_Ovflo_Check): ditto. (Multiply_With_Ovflo_Check): ditto. * libgnat/s-aridou.adb (Add_With_Ovflo_Check): ditto. (Subtract_With_Ovflo_Check): ditto. (Multiply_With_Ovflo_Check): ditto. * libgnat/s-arit64.ads (Uns_Add_With_Ovflo_Check64): New subprogram. (Uns_Subtract_With_Ovflo_Check64): ditto. (Uns_Multiply_With_Ovflo_Check64): ditto. * libgnat/s-arit64.adb (Uns_Add_With_Ovflo_Check64): New subprogram. (Uns_Subtract_With_Ovflo_Check64): ditto. (Uns_Multiply_With_Ovflo_Check64): ditto. * libgnat/s-arit128.ads (Uns_Add_With_Ovflo_Check128): New subprogram. (Uns_Subtract_With_Ovflo_Check128): ditto. (Uns_Multiply_With_Ovflo_Check128): ditto. * libgnat/s-arit128.adb (Uns_Add_With_Ovflo_Check128): New subprogram. (Uns_Subtract_With_Ovflo_Check128): ditto. (Uns_Multiply_With_Ovflo_Check128): ditto. * doc/gnat_rm/gnat_language_extensions.rst: Document unsigned base range. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2025-07-31Revert "Ada: Add System.C_Time and GNAT.C_Time units to libgnat"Eric Botcazou1-12/+2
This reverts commit 41974d6ed349507ca1532629851b7b5d74f44abc.
2025-07-31Ada: Add System.C_Time and GNAT.C_Time units to libgnatNicolas Boulenguez1-2/+12
The first unit provides the time_t, timeval and timespec types corresponding to the C types defined by the OS, as well as various conversion functions. The second unit is a mere renaming of the first under the GNAT hierarchy. This removes C time types and conversions under System, and from bodies and private parts under GNAT, while keeping visible types and conversions under GNAT as Obsolescent. [changelog] PR ada/114065 * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add g-c_time$(objext) and s-c_time$(objext). (Aarch64/Android): Do not use s-osinte__android.adb. (SPARC/Solaris): Do not use s-osprim__solaris.adb. (x86/Solaris): Likewise. (LynxOS178): Do not use s-parame__posix2008.ads. (RTEMS): Likewise. (x32/Linux): Likewise, as well as s-linux__x32.ads. Replace s-osprim__x32.adb with s-osprim__posix.adb. (LIBGNAT_OBJS): Remove cal.o. * cal.c: Delete. * doc/gnat_rm/the_gnat_library.rst (GNAT.C_Time): New entry. (GNAT.Calendar): Do not mention the obsolete conversion functions. * impunit.adb (Non_Imp_File_Names_95): Add g-c_time. * libgnarl/a-exetim__posix.adb: Add with clause for System.C_Time (Clock): Use type and functions from System.C_Time. * libgnarl/s-linux.ads: Remove with clause for System.Parameters. Remove declarations of C time types. * libgnarl/s-linux__alpha.ads: Likewise. * libgnarl/s-linux__android-aarch64.ads: Likewise. * libgnarl/s-linux__android-arm.ads: Likewise. * libgnarl/s-linux__hppa.ads: Likewise. * libgnarl/s-linux__loongarch.ads: Likewise. * libgnarl/s-linux__mips.ads: Likewise. * libgnarl/s-linux__riscv.ads: Likewise. * libgnarl/s-linux__sparc.ads: Likewise. * libgnarl/s-osinte__aix.ads: Likewise. * libgnarl/s-osinte__android.ads: Likewise. * libgnarl/s-osinte__cheribsd.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.ads: Likewise. * libgnarl/s-osinte__kfreebsd-gnu.ads: Likewise. * libgnarl/s-osinte__linux.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. * libgnarl/s-qnx.ads: Likewise. * libgnarl/s-linux__x32.ads: Delete. * libgnarl/s-osinte__darwin.adb (To_Duration): Remove. (To_Timespec): Likewise. * libgnarl/s-osinte__aix.adb: Likewise. * libgnarl/s-osinte__dragonfly.adb: Likewise. * libgnarl/s-osinte__freebsd.adb: Likewise. * libgnarl/s-osinte__gnu.adb: Likewise. * libgnarl/s-osinte__lynxos178.adb: Likewise. * libgnarl/s-osinte__posix.adb: Likewise. * libgnarl/s-osinte__qnx.adb: Likewise. * libgnarl/s-osinte__rtems.adb: Likewise. * libgnarl/s-osinte__solaris.adb: Likewise. * libgnarl/s-osinte__vxworks.adb: Likewise. * libgnarl/s-osinte__x32.adb: Likewise. * libgnarl/s-taprop__solaris.adb: Add with clause for System.C_Time. (Monotonic_Clock): Use type and functions from System.C_Time. (RT_Resolution): Likewise. (Timed_Sleep): Likewise. (Timed_Delay): Likewise. * libgnarl/s-taprop__vxworks.adb: Likewise. * libgnarl/s-tpopmo.adb: Likewise. * libgnarl/s-osinte__android.adb: Delete. * libgnat/g-c_time.ads: New file. * libgnat/g-calend.adb: Delegate to System.C_Time. * libgnat/g-calend.ads: Likewise. * libgnat/g-socket.adb: Likewise. * libgnat/g-socthi.adb: Likewise. * libgnat/g-socthi__vxworks.adb: Likewise. * libgnat/g-sothco.ads: Likewise. * libgnat/g-spogwa.adb: Likewise. * libgnat/s-c_time.adb: New file. * libgnat/s-c_time.ads: Likewise. * libgnat/s-optide.adb: Import nanosleep here. * libgnat/s-os_lib.ads (time_t): Remove. (To_Ada): Adjust. (To_C): Likewise. * libgnat/s-os_lib.adb: Likewise. * libgnat/s-osprim__darwin.adb: Delegate to System.C_Time. * libgnat/s-osprim__posix.adb: Likewise. * libgnat/s-osprim__posix2008.adb: Likewise. * libgnat/s-osprim__rtems.adb: Likewise. * libgnat/s-osprim__unix.adb: Likewise. * libgnat/s-osprim__solaris.adb: Delete. * libgnat/s-osprim__x32.adb: Likewise. * libgnat/s-parame.ads (time_t_bits): Remove. * libgnat/s-parame__hpux.ads: Likewise. * libgnat/s-parame__vxworks.ads: Likewise. * libgnat/s-parame__posix2008.ads: Delete. * s-oscons-tmplt.c (SIZEOF_tv_nsec): New constant.
2025-07-24ada: Minor adjustment to the doc of Last_Chance_HandlerTonu Naks1-3/+3
gcc/ada/ChangeLog: * doc/gnat_rm/standard_and_implementation_defined_restrictions.rst: clarify parameter description. * gnat_rm.texi: Regenerate.
2025-07-22ada: Add destructors extensionRonan Desplanques1-0/+68
This patch adds a GNAT-specific extension which enables "destructors". Destructors are an optional replacement for Ada.Finalization where some aspects of the interaction with type derivation are different. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Document new extension. * snames.ads-tmpl: Add name for new aspect. * gen_il-fields.ads (Has_Destructor, Is_Destructor): Add new fields. * gen_il-gen-gen_entities.adb (E_Procedure, Type_Kind): Add new fields. * einfo.ads (Has_Destructor, Is_Destructor): Document new fields. * aspects.ads: Add new aspect. * sem_ch13.adb (Analyze_Aspect_Specifications, Check_Aspect_At_Freeze_Point, Check_Aspect_At_End_Of_Declarations): Add semantic analysis for new aspect. (Resolve_Finalization_Procedure): New function. (Resolve_Finalizable_Argument): Use new function above. * sem_util.adb (Propagate_Controlled_Flags): Extend for new field. * freeze.adb (Freeze_Entity): Add legality check for new aspect. * exp_ch3.adb (Expand_Freeze_Record_Type, Predefined_Primitive_Bodies): Use new field. * exp_ch7.adb (Build_Finalize_Statements): Add expansion for destructors. (Make_Final_Call, Build_Record_Deep_Procs): Adapt to new Has_Destructor field. (Build_Adjust_Statements): Tweak to handle cases of empty lists. * gnat_rm.texi: Regenerate.
2025-07-04ada: Pragma Short_Circuit_And_OrBob Duff1-6/+26
Improve documentation of pragma Short_Circuit_And_Or. Also disallow renamings, because the semantics as currently implemented is confusing. gcc/ada/ChangeLog: * doc/gnat_rm/implementation_defined_pragmas.rst (Short_Circuit_And_Or): Add more documentation. * sem_ch8.adb (Analyze_Subprogram_Renaming): Disallow renamings. * gnat_rm.texi: Regenerate.
2025-07-03ada: Correct documentation of policy_identifiers for Assertion_PolicyBob Duff1-1/+1
Follow-on to gnat-945. Change Ignore to Disable; Ignore is defined by the language, Disable is the implementation-defined one. Also minor code cleanup. gcc/ada/ChangeLog: * doc/gnat_rm/implementation_defined_characteristics.rst: Change Ignore to Disable. * sem_ch13.ads (Analyze_Aspect_Specifications): Minor: Remove incorrect comment; there is no need to check Has_Aspects (N) at the call site. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2025-07-03ada: Support Potentially_Invalid aspect in the frontendJoffrey Huguet1-0/+8
The Potentially_Invalid aspect is used to disable the SPARK assumption that all read data is valid on a case-by-case basis in GNATprove. gcc/ada/ChangeLog: * aspects.ads: Define an identifier for Potentially_Invalid. * doc/gnat_rm/implementation_defined_aspects.rst: Add section for Potentially_Invalid. * sem_attr.adb (Analyze_Attribute_Old_Result): Attribute Old is allowed to occur in a Potentially_Invalid aspect. * sem_ch13.adb (Analyze_Aspect_Specifications): Handle Potentially_Invalid. * sem_util.adb (Has_Potentially_Invalid): Returns True iff an entity is subject to the Potentially_Invalid aspect. * sem_util.ads (Has_Potentially_Invalid): Idem. * snames.ads-tmpl: New name for Potentially_Invalid. * gnat_rm.texi: Regenerate.
2025-07-01ada: Add "continue" GNAT extensionRonan Desplanques1-0/+16
This extension adds "continue" as a nonreserved keyword, and this is the first occurrence of a nonreserved keyword in GNAT, which causes this patch to add unusual overload resolution code. New node kinds are introduced, but since they are entirely transformed into existing constructs during expansion, back ends that don't turn off expansion do not need to be updated. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Document new extension. * gen_il-fields.ads (Opt_Field_Enum): Add new fields. * gen_il-types.ads (N_Loop_Flow_Statement, N_Continue_Statement): New node kinds. * gen_il-gen-gen_nodes.adb (N_Loop_Flow_Statement): New abstract node kind. (N_Continue_Statement): New node kind. (N_Exit_Statement): Reparent below N_Loop_Flow_Statement. * sinfo.ads (N_Continue_Statement): Add description. * sinfo-utils.ads (Loop_Flow_Keyword): New function. * sinfo-utils.adb (Loop_Flow_Keyword): New function. * gen_il-gen-gen_entities.adb (E_Loop): Add new field. * einfo.ads (Continue_Mark): Document new field. * sprint.adb (Sprint_Node_Actual): Update for new node kind. * snames.ads-tmpl: Add new keyword. * par-ch5.adb (P_Continue_Statement, Parse_Loop_Flow_Statement): New functions. (P_Sequence_Of_Statements): Handle continue statements. (P_Exit_Statement): Use Parse_Loop_Flow_Statement. * sem.adb (Analyze): Handle new node kind. * sem_ch5.adb (Analyze_Loop_Flow_Statement): New function. (Analyze_Continue_Statement): New procedure. (Analyze_Exit_Statement): Use new Analyze_Loop_Flow_Statement function. * sem_ch5.ads (Analyze_Continue_Statement): New procedure. * expander.adb (Expand): Handle new node kind. * exp_ch5.ads (Expand_N_Continue_Statement): New procedure. * exp_ch5.adb (Expand_Loop_Flow_Statement): New procedure. (Expand_N_Continue_Statement): New procedure. (Expand_N_Exit_Statement): Use new Expand_Loop_Flow_Statement procedure. (Build_Formal_Container_Iteration): Always reuse original loop entity. * gnat_rm.texi: Regenerate.
2025-07-01ada: Drop the chapter listing implemented Ada 2012 AI'sTonu Naks4-1337/+5
We support Ada 2012 fully. The chapter is out of date and would serve no purpose if it was up to date. gcc/ada/ChangeLog: * doc/gnat_rm.rst: remove ref to 2012 chapter * doc/gnat_rm/about_this_guide.rst: remove ref to 2012 chapter * doc/gnat_rm/compatibility_and_porting_guide.rst: update list of supported versions * doc/gnat_rm/implementation_of_ada_2012_features.rst: delete * doc/gnat_rm/specialized_needs_annexes.rst: update list of supported versions * gnat_rm.texi: Regenerate.
2025-07-01ada: Replace references for GLADE with PolyORBTonu Naks4-22/+12
gcc/ada/ChangeLog: * doc/gnat_rm/implementation_advice.rst: remove GLADE * doc/gnat_rm/implementation_defined_characteristics.rst: remove GLADE * doc/gnat_rm/specialized_needs_annexes.rst: remove GLADE * doc/gnat_rm/the_gnat_library.rst: remove GLADE * gnat_rm.texi: Regenerate.
2025-06-30ada: Add documentation of implemented Ada 2022 featuresTonu Naks3-4/+2253
gcc/ada/ChangeLog: * doc/gnat_rm.rst: add entry point for the new chapter * doc/gnat_rm/about_this_guide.rst: add reference to the new chapter * doc/gnat_rm/implementation_of_ada_2022_features.rst: new file * doc/gnat_rm/implementation_of_ada_2012_features.rst: update explanation about RM references * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2025-06-30ada: 'Size'Class and interface types documentationSteve Baird1-76/+113
Update GNAT RM documentation of the Size'Class aspect. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Update documentation for mutably tagged types and the Size'Class aspect. * gnat_rm.texi: Regenerate.
2025-06-12ada: Fix documentation of Generalized Finalization extensionEric Botcazou1-99/+57
The current documentation does not reflect the implementation present in the compiler and contains various other inaccuracies. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst (Generalized Finalization): Document the actual implementation. (No_Raise): Move to separate section. * gnat_rm.texi: Regenerate.
2025-06-09ada: Pragma Ada_XX not propagated from library level spec to bodyJavier Miranda1-0/+25
Add documentation to pragmas Ada_83, Ada_95, Ada_05, Ada_12, and Ada_2022: when placed before a library level package specification they are not propagated to the corresponding package body; they must be added explicitly to the package body. gcc/ada/ChangeLog: * doc/gnat_rm/implementation_defined_pragmas.rst: Adding documentation. * doc/gnat_ugn/the_gnat_compilation_model.rst: ditto. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2025-06-06ada: Add case for Program_Exit in Exit_CasesClaire Dross1-1/+2
Extend the syntax for Exit_Cases to support exiting the program. gcc/ada/ChangeLog: * doc/gnat_rm/implementation_defined_pragmas.rst (Pragma Exit_Cases): Update the documentation for Exit_Cases. * sem_prag.adb (Anlayze_Pragma): Accept Program_Exit as an exit kind. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2025-06-06ada: Support aspect Program_Exit with no expressionPiotr Trojanek1-1/+1
New aspect Program_Exit for SPARK was originally designed to require an expression, but now we want this expression to be optional. gcc/ada/ChangeLog: * aspects.ads (Aspect_Argument): Argument for Program_Exit is now optional. * doc/gnat_rm/implementation_defined_pragmas.rst (Pragma Program_Exit): Change documentation for pragma syntax. * sem_prag.adb (Analyze_Pragma): Argument for Program_Exit is now optional. (Analyze_Program_Exit_In_Decl_Part): Likewise. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2025-06-06ada: Add new aspect Program_Exit for SPARKPiotr Trojanek2-0/+20
A new aspect Program_Exit is added for SPARK to specify that a subprogram can exit the entire program, e.g. GNAT.System.OS_Exit. The implementation is based on the existing machinery for similar aspects, in particular, for aspects Subprogram_Variant and Always_Terminates. gcc/ada/ChangeLog: * aspects.ads (Aspect_Id): Add new aspect identifier. (Aspect_Argument): Specify argument for the new aspect. (Is_Representation_Aspect): New aspect is not a representation aspect. (Aspect_Names): Map new aspect to name. (Aspect_Delay): New aspect is always delayed. * contracts.adb (Expand_Subprogram_Contract) (Add_Pre_Post_Condition, Add_Contract_Item) (Analyze_Entry_Or_Subprogram_Contract) (Analyze_Entry_Or_Subprogram_Body_Contract) (Analyze_Subprogram_Body_Stub_Contract): Support new aspect. * contracts.ads (Add_Contract_Item, Analyze_Entry_Or_Subprogram_Contract, Analyze_Entry_Or_Subprogram_Body_Contract, Analyze_Subprogram_Body_Stub_Contract): Mention new contract in comment. * doc/gnat_rm/implementation_defined_aspects.rst (Aspect Program_Exit): Document new aspect. * doc/gnat_rm/implementation_defined_pragmas.rst (Pragma Program_Exit): Document new pragma. * einfo-utils.adb (Get_Pragma): Support new pragma. * einfo-utils.ads (Get_Pragma): Mention new pragma in comment. * exp_prag.adb (Expand_Pragma_Program_Exit): Expand new pragma; body. * exp_prag.ads (Expand_Pragma_Program_Exit): Expand new pragma; spec. * inline.adb (Remove_Aspects_And_Pragmas): Support new pragma. * par-prag.adb (Prag): Support new pragma. * sem_attr.adb (Analyze_Attribute_Old_Result): Accept attribute Old in new pragma. * sem_ch12.adb (Implementation of Generic Contracts): Mention new aspect in comment. * sem_ch13.adb (Insert_Pragma, Analyze_Aspect_Specifications): Convert new new aspect to pragma. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Renumber subsequent rule in comment. * sem_prag.adb (Check_Postcondition_Use_In_Inlined_Subprogram) (Contract_Freeze_Error): Mention new pragma in comment. (Analyze_Pragma): Support new pragma; renumber subsequent rule in comment. (Analyze_Program_Exit_In_Decl_Part): Analyze new pragma; body. (Sig_Flags): References in new pragma are significant when detecting unreferenced objects. * sem_prag.ads (Aspect_Specifying_Pragma) (Assertion_Expression_Pragma, Pragma_Significant_To_Subprograms): Support new aspect and pragma. (Analyze_Program_Exit_In_Decl_Part): Analyze new pragma; spec. (Find_Related_Package_Or_Body): Mention new pragma in comment. * sem_util.adb (Is_Subprogram_Contract_Annotation): Support new pragma. * sem_util.ads (Is_Subprogram_Contract_Annotation): Mention new pragma in comment. * sinfo.ads (Is_Generic_Contract_Pragma): Mention new pragma in comment. * snames.ads-tmpl (Preset Names, Pragma_Id): Add name and pragma identifiers. * gnat_rm.texi: Regenerate.
2025-06-06ada: Fix typo in documentation about convention and representationPiotr Trojanek1-1/+1
Currently there are only three exceptions to the general rule; the fourth exception applied to OpenVMS, whose support has been deconstructed. gcc/ada/ChangeLog: * doc/gnat_rm/representation_clauses_and_pragmas.rst (Effect of Convention on Representation): Fix number of list items. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2025-06-06ada: Implement use implies with experimental extensionsquirek1-0/+16
The patch implements the experimental feature to allow use package clauses within the context area to imply with. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Add documentation. * gnat_rm.texi: Regenerate.
2025-06-05ada: Reject Valid_Value arguments originating from StandardViljar Indus1-3/+3
The constraint for Valid_Value not applying to types from Standard should also apply to all types derived from those types. gcc/ada/ChangeLog: * doc/gnat_rm/implementation_defined_attributes.rst: Update the documentation for Valid_Value. * sem_attr.adb (Analyze_Attribute): Reject types where the root type originates from Standard. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2025-01-07ada: Add "finally" GNAT extensionRonan Desplanques1-0/+43
This patch adds a new reserved word, "finally", and accompanying new syntax that's similar to the Java equivalent. gcc/ada/ChangeLog: * atree.adb (Parent_Or_List_Containing): New function. * atree.ads (Parent_Or_List_Containing): Likewise. * gen_il-fields.ads: Add new field. * gen_il-gen-gen_nodes.adb (Gen_Nodes): Extend handled sequence of statements node. * par-ch11.adb (P_Handled_Sequence_Of_Statements, P_Exception_Handler): Add new syntactic construct. * par-ch5.adb (P_Sequence_Of_Statements): Likewise. * par.adb: Likewise. * par-util.adb (Check_Future_Keyword): Warn that "finally" becomes a reserved word with extensions. * scans.adb (Initialize_Ada_Keywords): Add new reserved word. * snames.adb-tmpl: Likewise. * snames.ads-tmpl: Likewise. * scans.ads: Likewise. * sem_ch11.adb (Analyze_Handled_Statements): Adapt to new node field. * sem_ch5.adb (Analyze_Exit_Statement): Add legality check. (Analyze_Goto_Statement): Likewise. * sem_ch6.adb (Analyze_Return_Statement): Likewise. * sinfo-utils.adb (Lowest_Common_Ancestor, Destroy_Element): New subprograms. * sinfo-utils.ads (Lowest_Common_Ancestor): New function. * sinfo.ads: Add documentation for new field. * xsnamest.adb: Fix typo in comment. * doc/gnat_rm/gnat_language_extensions.rst: Document new extension. * warnsw.adb: Add new option. * warnsw.ads: Likewise. * exp_ch11.adb (Expand_N_Handled_Sequence_Of_Statements): Add abort deferral to finally part. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate. * gcc-interface/trans.cc (Handled_Sequence_Of_Statements_to_gnu): Handle finally statements.
2025-01-06ada: Support new SPARK aspect Exit_CasesClaire Dross2-2/+34
The aspect Exit_Cases allows annotating a subprogram with a list of cases specifying, for all input which satisfy a guard, how the subprogram is allowed to terminate. For now, it can only be either returning normally or propagating an exception. This contract is not checked at runtime, it is only meant for static verification in SPARK. gcc/ada/ChangeLog: * aspects.ads: Add aspect Aspect_Exit_Cases. * contracts.adb (Analyze_Entry_Or_Subprogram_Contract): Handle Exit_Cases. (Expand_Subprogram_Contract): Idem. * einfo-utils.adb (Get_Pragma): Allow Pragma_Exit_Cases. * einfo-utils.ads (Get_Pragma): Idem. * exp_prag.adb (Expand_Pragma_Exit_Cases): Ignore the pragma, currently we don't expand it. * exp_prag.ads (Expand_Pragma_Exit_Cases): Idem. * inline.adb (Remove_Aspects_And_Pragmas): Add Exit_Cases to the list. (Remove_Items): Idem. * par-prag.adb (Last_Arg_Is_Reason): Idem. * sem_ch12.adb: Idem. * sem_ch13.adb: Idem. * sem_util.adb: Idem. * sem_util.ads: Idem. * sinfo.ads: Idem. * snames.ads-tmpl: Add names Name_Exit_Cases, Name_Exception_Raised, and Name_Normal_Return as well as pragma Pragma_Exit_Cases. * sem_prag.adb (Analyze_Exit_Cases_In_Decl_Part): Make sure that a pragma or aspect Exit_Cases is well formed. (Analyze_Pragma): Make sure that a pragma or aspect Exit_Cases is at the right place. * sem_prag.ads (Analyze_Exit_Cases_In_Decl_Part): Declaration. * doc/gnat_rm/implementation_defined_pragmas.rst: Document the Exit_Cases pragma. * doc/gnat_rm/implementation_defined_aspects.rst: Document the Exit_Cases aspect. * gnat_rm.texi: Regenerate.
2025-01-06Ada: fix documentation of pragma Unimplemented_UnitEric Botcazou1-3/+3
gcc/ada PR ada/117936 * doc/gnat_rm/implementation_defined_pragmas.rst (Unimplemented_Unit): Adjust the description of the error message. * gnat_rm.texi: Regenerate.
2025-01-03ada: Handle C++ exception hierarchiesAlexandre Oliva1-1/+162
This patch introduces support for defining exceptions in Ada with C++'s notion of exception type compatibility, such as handling occurrences of derived types, and obtaining class-wide access to the thrown/raised objects. As a bonus, it adds support for C++ dependent (wrapped) exceptions, and introduces types and interfaces to match C++'s std::type_info and std::exception. Support for C++ exceptions with base-type matching, added to raise-gcc by calling subprograms in Ada units, requires these units and their dependencies to be linked into programs that link with raise-gcc. gcc/ada/ChangeLog: * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add g-cpp, g-cppstd, and g-cstyin. * doc/gnat_rm/interfacing_to_other_languages.rst (Interfacing to C++): Document class-wide matching and new interfaces. * exp_prag.adb (Expand_Pragma_Import_Or_Interface): Add class-wide exception matching support with 'B' as language identifier. * libgnat/a-exexpr.adb (Setup_Current_Excep): Add Id formal. (Set_Foreign_Occurrence): Likewise. (Propagate_GCC_Exception): Adjust. (Set_Exception_Parameter): Likewise. (Unhandled_Except_Handler): Likewise. * libgnat/g-cpp.ads: New. * libgnat/g-cppexc.adb (Raise_Cpp_Exception): Match 'B' lang id. (Get_Object_Address): New. (Get_Object): Rewrite. (Get_Access_To_Object): New. (Get_Access_To_Tagged_Object): New. (Get_Type_Info): New. (Convert_Caught_Object): New. * libgnat/g-cppexc.ads (Get_Object_Address): New. (Get_Object): Note the Cpp Convention requirement. (Get_Access_To_Object): New. (Get_Access_To_Tagged_Object): New. (Get_Type_Info): New. * libgnat/g-cppstd.adb: New. * libgnat/g-cppstd.ads: New. * libgnat/g-csclex.ads: New, unused. * libgnat/g-cstyin.adb: New. * libgnat/g-cstyin.ads: New. * libgnat/g-excact.adb (Exception_Language): New. (Is_Foreign_Exception): Rewrite. * libgnat/g-excact.ads (Exception_Languages): New. (Exception_Language): New. * libgnat/s-stalib.ads (Lang): Document 'B'. * raise-gcc.c (__gnat_setup_current_excep): Add Exception_Id formal. (CXX_DEPENDENT_EXCEPTION_CLASS): New. (cxx_type_info): New. (__cxa_exception): Rename exceptionType to encompass PrimaryException. (_GNAT_Exception): Drop wrapper. (EID_For): Adjust. (exception_class_eq): Likewise. (__gnat_exception_language_is_cplusplus): New. (__gnat_exception_language_is_ada): New. (__gnat_convert_caught_object): Declare. (__gnat_get_cxx_dependent_exception): New. (__gnat_maybe_get_cxx_dependent_exception): New. (__gnat_get_cxx_exception_type_info): New. (__gnat_obtain_caught_object): New. (is_handled_by): Adjust. [!CERT] Add eid formal, handle dependent exceptions and base-type matches. (get_action_description_for) [!CERT]: Add eid formal. Adjust. (personality_body): Adjust. * gcc-interface/Make-lang.in (GNAT_ADA_OBJS, GNATBIND_OBJS) [!STAGE1]: Add new g-cpp, g-cppstd, g-cstyin + preexisting g-cppexc and i-cstrin. * gnat-style.texi: Regenerate. * gnat_rm.texi: Regenerate.
2024-12-13ada: Fix typo in reference manualRonan Desplanques1-1/+1
gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Fix typo. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-12-13ada: Fix documentation of Ada.Real_Time.Timing_EventsRonan Desplanques1-1/+2
The GNAT reference manual stated that GNAT did not implement this language-defined package, but GNAT in fact does offer an implementation of it. gcc/ada/ChangeLog: * doc/gnat_rm/standard_library_routines.rst: Fix documentation. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-12-12ada: Update documentation for External_InitializationRonan Desplanques1-1/+1
This fixes an omission in the recent change that was made to file lookup for External_Initialization. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Update External_Initialization section. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-11-18ada: Atomic_Synchronization is not a user-visible checkBob Duff2-29/+18
Remove all user-level documentation of the check name "Atomic_Synchronization". The documentation was confusing because this check should never be used in source code, and because it raises the question of whether All_Checks applies to it (it does not). Change the name Atomic_Synchronization to be _Atomic_Synchronization (with a leading underscore) so that it cannot be used in source code. This "check" is not really a check at all; it is used only internally in the implementation of Disable/Enable_Atomic_Synchronization, because the placement and scope of these pragmas match pragma Suppress. gcc/ada/ChangeLog: * doc/gnat_rm/implementation_defined_characteristics.rst: Remove Atomic_Synchronization. * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Likewise. * doc/gnat_rm/implementation_defined_pragmas.rst: DRY. Consolidate documentation of Disable/Enable_Atomic_Synchronization. * checks.adb: Comment fix. * exp_util.ads: Likewise. * targparm.ads: Likewise. * types.ads: Likewise. * gnat1drv.adb: Likewise. DRY. * sem_prag.adb (Process_Disable_Enable_Atomic_Sync): Change name of Atomic_Synchronization to start with underscore. (Process_Suppress_Unsuppress): No need to check Comes_From_Source for Atomic_Synchronization anymore; _Atomic_Synchronization can never come from source. (Anyway, it shouldn't be ignored; it should be an error.) * snames.ads-tmpl (Atomic_Synchronization): Change name to start with underscore. * switch-c.adb (Scan_Front_End_Switches): Minor cleanup: Use 'in'. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-11-12ada: Detect sharing of external file in inconsistent read-write modesPiotr Trojanek1-1/+1
When opening files with "shared=yes", as described in GNAT RM 11.10, Sharing Files, we now prevent sharing a single file in inconsistent read-write modes. gcc/ada/ChangeLog: * doc/gnat_rm/the_implementation_of_standard_i_o.rst (Shared Files): Add trailing period. * libgnat/s-ficobl.ads (AFCB): Reflect new behavior in comment. * libgnat/s-fileio.adb (Open): Detect inconsistent sharing, just like we do in System.File_IO.Reset. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-11-04ada: Add doc for deep delta aggregatesRaphaël AMIARD1-0/+148
gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Adjust documentation. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-10-26Fix old glitch in the GNAT Reference ManualEric Botcazou1-1/+1
gcc/ada PR ada/62122 * doc/gnat_rm/implementation_defined_attributes.rst (Unrestricted_Access): Remove null exclusion. * gnat_rm.texi: Regenerate.
2024-10-25ada: Adjust documentation of External_InitializationRonan Desplanques1-5/+1
The parameters Maximum_Size and If_Empty were mentioned during the request for comments phase but are not implemented, at least for now. This patch changes the GNAT reference manual accordingly. It also makes a minor punctuation change. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Adjust documentation. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-10-25ada: Update simpler accessibility model docTonu Naks1-102/+108
gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: update simpler accessibility model * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-10-25ada: Misc improvements to gnat RMBob Duff1-33/+48
...in the "GNAT language extensions" section. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Minor wording improvments. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-10-08ada: Remove references to internal gnat RFC'sTonu Naks1-89/+836
gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: replace references to RFC's with appropriate text from the rfc * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-10-08ada: Use semantics from the RFC for declarative items mixed with statementsRaphaël AMIARD1-3/+49
We want to allow statements lists with declarations *and* an exception handler. What follows from this is that declarations declared in the statement list are *not* visible from the exception handler, and that the following code: declare A : Integer := 12; begin A : Integer := 15; <stmts> exception when others => ... Roughly expands to: declare A : Integer := 12; begin declare A : Integer := 15; begin <stmts> exception when others => ... As such, in the code above, there is no more error triggered for conflicting declarations of `A`. Move "Local declarations without block" into curated extensions Restrict legal local decls in statement lists Only accept object declarations & renamings, as well as use clauses for gcc/ada/ChangeLog: * par-ch11.adb (P_Sequence_Of_Statements): Remove Handled parameter. Always wrap the statements in a block when there are declarations in it. * par-ch5.adb: Adapt call to P_Sequence_Of_Statements Update outdated comment, remove useless `Style_Checks` pragma. (P_Sequence_Of_Statements): Don't emit an error in core extensions mode. Emit an error when a non valid declaration is parsed in sequence of statements. * par.adb: Adapt P_Sequence_Of_Statements' signature * doc/gnat_rm/gnat_language_extensions.rst: Adapt documentation now. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-10-08ada: Add External_Initialization extensionRonan Desplanques1-0/+25
This patch introduces a GNAT extension that adds a new aspect, External_Initialization. A section is added to the reference manual with a description of what the aspect does. The implementation reuses existing mechanisms, in particular Sinput.L.Load_Source_File and Sem_Res.Set_String_Literal_Subtype. A new node kind is added, and nodes of that type are present in what is passed to the back ends. That makes it necessary to update the back ends to handle the new node type. The C interface is extended to make that possible. gcc/ada/ChangeLog: * aspects.ads: Add entities for External_Initialization. * checks.adb (Selected_Length_Checks): Add support for N_External_Initializer nodes. * doc/gnat_rm/gnat_language_extensions.rst: Add section for the added extension. * exp_util.adb (Insert_Actions): Add support for N_External_Initializer nodes. * fe.h (C_Source_Buffer): New function. * gen_il-fields.ads: Add new field. * gen_il-gen-gen_nodes.adb: Add N_External_Initializer node kind. * gen_il-gen.adb: Add new field type. * gen_il-types.ads: Add new node kind and new field type. * pprint.adb (Expr_Name): Handle new node kind. * sem.adb (Analyze): Add support for N_External_Initializer nodes. * sem_ch13.adb (Analyze_Aspect_Specifications, Check_Aspect_At_Freeze_Point): Add support for External_Initialization aspect. * sem_ch3.adb (Apply_External_Initialization): New subprogram. (Analyze_Object_Declaration): Add support for External_Initialization aspect. * sem_res.adb (Resolve_External_Initializer): New procedure. (Resolve): Add support for N_External_Initializer nodes. (Set_String_Literal_Subtype): Extend to handle N_External_Initializer nodes. * sinfo-utils.adb (Is_In_Union_Id): Adapt to new field addition. * sinfo.ads: Add documentation for new node kind and new field. * sinput.adb, sinput.ads (C_Source_Buffer): Add new C interface function. * snames.ads-tmpl: Add new aspect identifier. * sprint.adb (Sprint_Node_Actual): Add nop handling of N_External_Initializer nodes. * types.ads: Modify type to allow for new C interface. * gcc-interface/trans.cc (gnat_to_gnu): Handle new GNAT node type. * gcc-interface/Make-lang.in: Update list of stage1 run-time library units. * gnat-style.texi: Regenerate. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-09-02ada: Documentation for generic type inferenceBob Duff1-1/+79
...plus minor improvements to existing documentation. gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst: I assume "extended set of extensions" was a typo for "experimental set of extensions", because "extended extensions" is repetitive and redundant. "in addition" clarifies that the one subsumes the other. Add a reminder at the start of each subsection about what switch/pragma enables what extensions. Add new section about "Inference of Dependent Types in Generic Instantiations". * gnat_rm.texi: Regenerate.
2024-08-29ada: First controlling parameter aspectJavier Miranda1-0/+82
gcc/ada/ * usage.adb (Usage): Document switch -gnatw_j * doc/gnat_rm/gnat_language_extensions.rst: Add documentation. * gnat_rm.texi: Regenerate.
2024-08-29ada: Update documentation for conditional when constructsJustin Squirek1-71/+70
This patch moves the documentation for conditional when constructs out of the curated set (e.g. into -gnatX0). gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst: Move conditional when constructs out of the curated set. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-08-02ada: Update doc of Style_Checks pragmaTonu Naks1-5/+74
gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst: Add examples. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-08-02ada: Implement No_Raise aspect & pragma on subprogramsEric Botcazou4-6/+30
The new aspect is automatically set on the Adjust and Finalize primitives of finalizable types, unless Relaxed_Finalization is explicitly set to False, but it can also be specified directly on subprograms. It is also available in earlier versions of the language by means of the associated pragma. gcc/ada/ * aspects.ads (Aspect_Id): Add Aspect_No_Raise identifier. (Implementation_Defined_Aspect): Add True for Aspect_No_Raise. (Is_Representation_Aspect): Add False for Aspect_No_Raise. (Aspect_Names): Add Name_No_Raise for Aspect_No_Raise. (Aspect_Delay): Add Always_Delay for Aspect_No_Raise. * checks.ads (Raise_Checks_Suppressed): New function. (Apply_Raise_Check): New procedure. * checks.adb (Apply_Raise_Check): New procedure. (Raise_Checks_Suppressed): New function. * doc/gnat_rm/gnat_language_extensions.rst (Generalized Finalization): Update. * doc/gnat_rm/implementation_defined_aspects.rst (No_Raise): New. * doc/gnat_rm/implementation_defined_characteristics.rst (Check names): Document Raise_Check and alphabetize others. * doc/gnat_rm/implementation_defined_pragmas.rst (No_Raise): New. * einfo.ads (No_Raise): New flag defined in subprograms and generic subprograms. * exp_ch6.adb (Expand_N_Subprogram_Body): Call Apply_Raise_Check at the end of the processing. * exp_ch11.adb (Get_RT_Exception_Name): Add alternative for PE_Raise_Check_Failed to case statement. * gen_il-fields.ads (Opt_Field_Enum): Add No_Raise identifier. * gen_il-gen-gen_entities.adb (Subprogram_Kind): Add No_Raise as semantical flag. (Generic_Subprogram_Kind): Likewise. * par-prag.adb (Prag): Add alternative for Pragma_No_Raise to case statement. * sem_ch13.adb (Validate_Finalizable_Aspect): Set No_Raise on the Adjust and Finalize primitives if Relaxed_Finalization is set. * sem_prag.adb (Analyze_Pragma): Add alternative for Pragma_No_Raise to case statement. (Sig_Flag): Add 0 for Pragma_No_Raise. * snames.ads-tmpl (Remaining pragma names): Add Name_No_Raise. (Names of recognized checks): Add Name_Raise_Check. (Pragma_Id): Add Pragma_No_Raise identifier. * types.ads (Raise_Check): New named number. (All_Checks): Adjust. (RT_Exception_Code): Add PE_Raise_Check_Failed identifier. (Rkind): Add PE_Reason for PE_Raise_Check_Failed and alphabetize. * types.h (RT_Exception_Code): Add PE_Raise_Check_Failed as 38. (LAST_REASON_CODE): Adjust. * libgnat/a-except.adb (Rcheck_PE_Raise_Check): New procedure with pragmas Export, No_Return and Machine_Attributes. (Rmsg_38): New string constant. * gnat_rm.texi: Regenerate.
2024-08-02ada: Improve documenation about security of PRGNsJohannes Kliemann2-3/+7
The pseudo random number generators used in GNAT are not suitable for applications that require cryptographic security. While this was mentioned in some places others did not have a corresponding note, leading to these generators being used in a non-suitable context. gcc/ada/ * doc/gnat_rm/standard_library_routines.rst: Add note to section of Ada.Numerics.Discrete_Random and Ada.Numerics.Float_Random. * doc/gnat_rm/the_gnat_library.rst: Add note to section about GNAT.Random_Numbers. * libgnat/a-nudira.ads: Add note about cryptographic properties. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-08-02ada: Fix layout of GNAT reference manual sectionRonan Desplanques1-2/+3
gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst: Fix layout of section. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-08-01ada: Restrict string interpolation to single string literalJavier Miranda1-14/+2
gcc/ada/ * par-ch2.adb (P_Interpolated_String_Literal): remove support of multi-line string literals. * doc/gnat_rm/gnat_language_extensions.rst: Update documentation. * gnat_rm.texi: Regenerate.
2024-08-01ada: Implement full relaxed finalization semantics for controlled objectsEric Botcazou1-2/+1
These semantics state that the compiler is permitted to enforce none of the guarantees specified by the RM 7.6.1(14/1) and following subclauses, and to instead just let the exception be propagated upward. The guarantees impose a significant overhead in terms of complexity and run-time performance compared to similar constructs in other languages, and the goal is to reduce it significantly, if not eliminate it totally: for example, untagged record types declared with the Finalizable aspect, the relaxed finalization semantics and inline Initialize/Adjust/Finalize primitives, and used with abort disabled: pragma Restrictions (No_Abort_Statements); pragma Restrictions (Max_Asynchronous_Select_Nesting => 0); pragma Restrictions (No_Asynchronous_Control); should behave like simple C++ classes. The implementation morally boils down to undoing the changes made a few months ago to the support of finalization for controlled objects, i.e. to getting rid of the added linked list and the associated indirection for controlled objects with relaxed finalization semantics. But, in order to keep a unified processing for both kinds of controlled objects and not to bring back the issues addressed by the aforementioned changes, the work is split between the front-end and the code generator: the front-end drops the linked list and the code generator is in charge of eliminating the indirection with the help of the optimizer. gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst (Generalized Finalization): Update status. * einfo.ads (Has_Relaxed_Finalization): Add more details. * exp_ch4.adb (Process_Transients_In_Expression): Invoke Make_Finalize_Call_For_Node instead of building the call. * exp_ch5.adb (Expand_N_Assignment_Statement): Do not set up an exception handler around the assignment for a controlled type with relaxed finalization semantics. Streamline the code implementing the protection against aborts and do not use an At_End handler for a controlled type with relaxed finalization semantics. * exp_ch7.ads (Make_Finalize_Call_For_Node): New function. * exp_ch7.adb (Finalize_Address_For_Node): New function renaming. (Set_Finalize_Address_For_Node): New procedure renaming. (Attach_Object_To_Master_Node): Also attach the Finalize_Address primitive to the Master_Node statically. (Build_Finalizer): Add Has_Strict_Ctrl_Objs local variable. Insert back the body of the finalizer at the end of the statement list in the non-package case and restore the associated support code to that effect. When all the controlled objects have the relaxed finalization semantics, do not create a Finalization_Master and finalize the objects directly instead. (Processing_Actions): Add Strict parameter and use it to set the Has_Strict_Ctrl_Objs variable. (Process_Declarations): Make main loop more robust and adjust calls to Processing_Actions. (Make_Finalize_Address_Body): Mark the primitive as inlined if the type has relaxed finalization semantics. (Make_Finalize_Call_For_Node): New function. * sem_ch6.adb (Check_Statement_Sequence): Skip subprogram bodies. * libgnat/s-finpri.ads (Finalize_Object): Add Finalize_Address parameter. (Master_Node): Remove superfluous qualification. * libgnat/s-finpri.adb (Attach_Object_To_Node): Likewise. (Finalize_Master): Adjust calls to Finalize_Object. (Finalize_Object): Add Finalize_Address parameter and assert that it is equal to the component of the node. Use the Object_Address component as guard. (Suppress_Object_Finalize_At_End): Clear Object_Address component. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.