diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2024-07-03 18:24:37 +0200 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2024-08-02 09:08:04 +0200 |
commit | 3067fdd87bfb5666460094ce9b783deb7b643145 (patch) | |
tree | 5ab4a04fa48841caf7dff3d6e32529b5f75cf4dd /gcc/ada/einfo.ads | |
parent | dc72d4dca9e6ee5af2ea2af0353a994a7a109db3 (diff) | |
download | gcc-3067fdd87bfb5666460094ce9b783deb7b643145.zip gcc-3067fdd87bfb5666460094ce9b783deb7b643145.tar.gz gcc-3067fdd87bfb5666460094ce9b783deb7b643145.tar.bz2 |
ada: Implement No_Raise aspect & pragma on subprograms
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.
Diffstat (limited to 'gcc/ada/einfo.ads')
-rw-r--r-- | gcc/ada/einfo.ads | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index 95f524e..9d0f2ee 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -3794,6 +3794,10 @@ package Einfo is -- in the spec of a generic package, in constructs that forbid discrete -- types with predicates. +-- No_Raise +-- Defined in subprograms and generic subprograms. Set if a valid aspect +-- or pragma No_Raise applies. + -- No_Reordering [implementation base type only] -- Defined in record types. Set only for a base type to which a valid -- pragma No_Component_Reordering applies. @@ -5578,6 +5582,7 @@ package Einfo is -- Is_Visible_Lib_Unit -- Is_Wrapper -- Needs_No_Actuals + -- No_Raise -- No_Return -- Requires_Overriding (non-generic case only) -- Return_Present @@ -5939,6 +5944,7 @@ package Einfo is -- Is_Valued_Procedure -- Is_Visible_Lib_Unit -- Needs_No_Actuals + -- No_Raise -- No_Return -- Requires_Overriding (non-generic case only) -- Sec_Stack_Needed_For_Return |