From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id 35EDA3858CD1; Mon, 6 May 2024 09:17:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 35EDA3858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714987059; bh=0WwAptsWFl1UJSKbS/OFKW7s72zEsEN3SrJ7+ck4zsQ=; h=From:To:Subject:Date:From; b=gOyzUJfKcOnVjj99M94ZA+H0uiUDTX2pi3uTURSS2+nh/oRn8qunnl4cNRHxzaVwJ OIHYe2rvAK4FxYW8gYPUDjmNlRS81lKZcqFze1e7UQAXmbOr78ooYZhkYGyNAHeu5I l3tKFdwo/TxSTNvE+oj0jxTOcwu5DWVA+M4x86eE= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r15-196] ada: Do not attempt to generate finalization actions with restricted profile X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/master X-Git-Oldrev: 22a9ce9946525b4b039841786d82631617b2ef41 X-Git-Newrev: 98b26f695bdcb1e4eee2c27742fd6ab534bb7d55 Message-Id: <20240506091739.35EDA3858CD1@sourceware.org> Date: Mon, 6 May 2024 09:17:39 +0000 (GMT) List-Id: https://gcc.gnu.org/g:98b26f695bdcb1e4eee2c27742fd6ab534bb7d55 commit r15-196-g98b26f695bdcb1e4eee2c27742fd6ab534bb7d55 Author: Eric Botcazou Date: Fri Dec 22 12:46:29 2023 +0100 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. Diff: --- 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;