* [COMMITTED] ada: Do not attempt to generate finalization actions with restricted profile
@ 2024-05-06 9:18 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2024-05-06 9:18 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
From: Eric Botcazou <ebotcazou@adacore.com>
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.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/exp_ch7.adb | 6 +++++-
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 7a8457683c5..99142a527fa 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 732a02fc5d8..533127f26c2 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;
--
2.43.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-06 9:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-06 9:18 [COMMITTED] ada: Do not attempt to generate finalization actions with restricted profile Marc Poulhiès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).