diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-12-22 12:46:29 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-05-06 11:11:31 +0200 |
commit | 98b26f695bdcb1e4eee2c27742fd6ab534bb7d55 (patch) | |
tree | 298ae23657f36e66695a09e8e9865b350d5f6e78 /gcc | |
parent | 22a9ce9946525b4b039841786d82631617b2ef41 (diff) | |
download | gcc-98b26f695bdcb1e4eee2c27742fd6ab534bb7d55.zip gcc-98b26f695bdcb1e4eee2c27742fd6ab534bb7d55.tar.gz gcc-98b26f695bdcb1e4eee2c27742fd6ab534bb7d55.tar.bz2 |
ada: Do not attempt to generate finalization actions with restricted profile
These actions are not supported with this profile, but we were nevertheless
attempting to generate them for protected objects.
gcc/ada/
* exp_ch7.adb (Build_Finalizer.Process_Declarations): Do not call
Processing_Actions for simple protected objects if the profile is
restricted.
* exp_util.adb (Requires_Cleanup_Actions): Do not return True for
simple protected objects if the profile is restricted.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/exp_ch7.adb | 6 | ||||
-rw-r--r-- | gcc/ada/exp_util.adb | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 7a84576..99142a5 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -2526,9 +2526,12 @@ package body Exp_Ch7 is then Processing_Actions (Decl); - -- Simple protected objects which use type System.Tasking. + -- Simple protected objects which use the type System.Tasking. -- Protected_Objects.Protection to manage their locks should -- be treated as controlled since they require manual cleanup. + -- but not for restricted run-time libraries (Ravenscar), see + -- also Cleanup_Protected_Object. + -- The only exception is illustrated in the following example: -- package Pkg is @@ -2561,6 +2564,7 @@ package body Exp_Ch7 is elsif Ekind (Obj_Id) = E_Variable and then not In_Library_Level_Package_Body (Obj_Id) and then Has_Simple_Protected_Object (Obj_Typ) + and then not Restricted_Profile then Processing_Actions (Decl, Is_Protected => True); end if; diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 732a02f..533127f 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -12999,9 +12999,12 @@ package body Exp_Util is then return True; - -- Simple protected objects which use type System.Tasking. + -- Simple protected objects which use the type System.Tasking. -- Protected_Objects.Protection to manage their locks should be - -- treated as controlled since they require manual cleanup. + -- treated as controlled since they require manual cleanup, but + -- not for restricted run-time libraries (Ravenscar), see also + -- Cleanup_Protected_Object in Exp_Ch7. + -- The only exception is illustrated in the following example: -- package Pkg is @@ -13034,6 +13037,7 @@ package body Exp_Util is elsif Ekind (Obj_Id) = E_Variable and then not In_Library_Level_Package_Body (Obj_Id) and then Has_Simple_Protected_Object (Obj_Typ) + and then not Restricted_Profile then return True; end if; |