diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2024-02-23 21:55:08 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-05-16 10:49:31 +0200 |
commit | 8e22376d8e2f2dd97e364aaf81a2b4260847e308 (patch) | |
tree | 984048ebd683c16f662665258f10fe3b97717fa2 /gcc/ada | |
parent | 55d11e8751e070e38f981e308d84dfde23c2af3d (diff) | |
download | gcc-8e22376d8e2f2dd97e364aaf81a2b4260847e308.zip gcc-8e22376d8e2f2dd97e364aaf81a2b4260847e308.tar.gz gcc-8e22376d8e2f2dd97e364aaf81a2b4260847e308.tar.bz2 |
ada: Propagate Program_Error from failed finalization of collection
This aligns finalization collections with finalization masters when it comes
to propagating an exception raised by the finalization of a specific object,
by always propagating Program_Error instead of the aforementioned exception.
gcc/ada/
* libgnat/s-finpri.adb (Raise_From_Controlled_Operation): New
declaration of imported procedure moved from...
(Finalize_Master): ...there.
(Finalize): Call Raise_From_Controlled_Operation instead of
Reraise_Occurrence to propagate the exception, if any.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/libgnat/s-finpri.adb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/ada/libgnat/s-finpri.adb b/gcc/ada/libgnat/s-finpri.adb index bd70e58..89f5f29 100644 --- a/gcc/ada/libgnat/s-finpri.adb +++ b/gcc/ada/libgnat/s-finpri.adb @@ -37,6 +37,10 @@ with System.Soft_Links; use System.Soft_Links; package body System.Finalization_Primitives is + procedure Raise_From_Controlled_Operation (X : Exception_Occurrence); + pragma Import (Ada, Raise_From_Controlled_Operation, + "__gnat_raise_from_controlled_operation"); + function To_Collection_Node_Ptr is new Ada.Unchecked_Conversion (Address, Collection_Node_Ptr); @@ -297,7 +301,7 @@ package body System.Finalization_Primitives is -- If one of the finalization actions raised an exception, reraise it if Finalization_Exception_Raised then - Reraise_Occurrence (Exc_Occur); + Raise_From_Controlled_Operation (Exc_Occur); end if; end Finalize; @@ -306,12 +310,8 @@ package body System.Finalization_Primitives is --------------------- procedure Finalize_Master (Master : in out Finalization_Master) is - procedure Raise_From_Controlled_Operation (X : Exception_Occurrence); - pragma Import (Ada, Raise_From_Controlled_Operation, - "__gnat_raise_from_controlled_operation"); - - Finalization_Exception_Raised : Boolean := False; Exc_Occur : Exception_Occurrence; + Finalization_Exception_Raised : Boolean := False; Node : Master_Node_Ptr; begin |