aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_util.ads
diff options
context:
space:
mode:
authorHristian Kirtchev <kirtchev@adacore.com>2019-07-11 08:01:39 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-07-11 08:01:39 +0000
commita3d1ca0127cf4ca6bb8d0da5a525d17dfc58cbc9 (patch)
tree08358a7861132e462da9dc251181ad271b2ebad9 /gcc/ada/exp_util.ads
parent6c1657116a2c9cf7c0c14b6dfa7f8bbb7672d3c8 (diff)
downloadgcc-a3d1ca0127cf4ca6bb8d0da5a525d17dfc58cbc9.zip
gcc-a3d1ca0127cf4ca6bb8d0da5a525d17dfc58cbc9.tar.gz
gcc-a3d1ca0127cf4ca6bb8d0da5a525d17dfc58cbc9.tar.bz2
[Ada] Missing finalization of private protected type
This patch updates the analysis of protected types to properly mark the type as having controlled components when it contains at least one such component. This in turn marks a potential partial view as requiring finalization actions. ------------ -- Source -- ------------ -- types.ads with Ada.Finalization; use Ada.Finalization; package Types is type Ctrl_Typ is new Controlled with null record; procedure Finalize (Obj : in out Ctrl_Typ); type Prot_Typ is limited private; private protected type Prot_Typ is private Comp : Ctrl_Typ; end Prot_Typ; end Types; -- types.adb with Ada.Text_IO; use Ada.Text_IO; package body Types is procedure Finalize (Obj : in out Ctrl_Typ) is begin Put_Line ("finalize"); end Finalize; protected body Prot_Typ is end Prot_Typ; end Types; -- main.adb with Types; use Types; procedure Main is Obj : Prot_Typ; begin null; end Main; 2019-07-11 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * exp_util.ads, exp_util.adb (Needs_Finalization): Move to Sem_Util. * sem_ch9.adb (Analyze_Protected_Definition): Code cleanup. Mark the protected type as having controlled components when it contains at least one such component. * sem_util.ads, sem_util.adb (Needs_Finalization): New function. From-SVN: r273383
Diffstat (limited to 'gcc/ada/exp_util.ads')
-rw-r--r--gcc/ada/exp_util.ads4
1 files changed, 0 insertions, 4 deletions
diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads
index 7cb9d2d..c0848c7 100644
--- a/gcc/ada/exp_util.ads
+++ b/gcc/ada/exp_util.ads
@@ -944,10 +944,6 @@ package Exp_Util is
-- consist of constants, when the object has a nontrivial initialization
-- or is controlled.
- function Needs_Finalization (Typ : Entity_Id) return Boolean;
- -- Determine whether type Typ is controlled and this requires finalization
- -- actions.
-
function Non_Limited_Designated_Type (T : Entity_Id) return Entity_Id;
-- An anonymous access type may designate a limited view. Check whether
-- non-limited view is available during expansion, to examine components