[COMMITTED] ada: Small cleanup in finalization machinery
Checks
Commit Message
From: Eric Botcazou <ebotcazou@adacore.com>
This removes an obsolete flag and adjusts a couple of obsolete comments.
gcc/ada/
* gen_il-fields.ads (Opt_Field_Enum): Remove Is_Finalization_Wrapper
* gen_il-gen-gen_nodes.adb (N_Block_Statement): Likewise.
* sinfo.ads (Is_Finalization_Wrapper): Delete.
* exp_ch7.adb (Build_Finalizer.Process_Declarations): Adjust comment
and remove obsolete code testing the Is_Finalization_Wrapper flag.
* exp_util.adb (Requires_Cleanup_Actions): Likewise.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/exp_ch7.adb | 20 ++------------------
gcc/ada/exp_util.adb | 24 ++++++------------------
gcc/ada/gen_il-fields.ads | 1 -
gcc/ada/gen_il-gen-gen_nodes.adb | 1 -
gcc/ada/sinfo.ads | 7 -------
5 files changed, 8 insertions(+), 45 deletions(-)
@@ -2248,8 +2248,8 @@ package body Exp_Ch7 is
-- Finalization of transient objects are treated separately in
-- order to handle sensitive cases. These include:
- -- * Aggregate expansion
- -- * If, case, and expression with actions expansion
+ -- * Conditional expressions
+ -- * Expressions with actions
-- * Transient scopes
-- If one of those contexts has marked the transient object as
@@ -2508,22 +2508,6 @@ package body Exp_Ch7 is
then
Last_Top_Level_Ctrl_Construct := Decl;
end if;
-
- -- Handle the case where the original context has been wrapped in
- -- a block to avoid interference between exception handlers and
- -- At_End handlers. Treat the block as transparent and process its
- -- contents.
-
- elsif Nkind (Decl) = N_Block_Statement
- and then Is_Finalization_Wrapper (Decl)
- then
- if Present (Handled_Statement_Sequence (Decl)) then
- Process_Declarations
- (Statements (Handled_Statement_Sequence (Decl)),
- Preprocess);
- end if;
-
- Process_Declarations (Declarations (Decl), Preprocess);
end if;
Prev_Non_Pragma (Decl);
@@ -13023,8 +13023,8 @@ package body Exp_Util is
-- Finalization of transient objects are treated separately in
-- order to handle sensitive cases. These include:
- -- * Aggregate expansion
- -- * If, case, and expression with actions expansion
+ -- * Conditional expressions
+ -- * Expressions with actions
-- * Transient scopes
-- If one of those contexts has marked the transient object as
@@ -13234,23 +13234,11 @@ package body Exp_Util is
return True;
end if;
- elsif Nkind (Decl) = N_Block_Statement
- and then
-
- -- Handle a rare case caused by a controlled transient object
- -- created as part of a record init proc. The variable is wrapped
- -- in a block, but the block is not associated with a transient
- -- scope.
-
- (Inside_Init_Proc
+ -- Handle a rare case caused by a controlled transient object created
+ -- as part of a record init proc. The variable is wrapped in a block,
+ -- but the block is not associated with a transient scope.
- -- Handle the case where the original context has been wrapped in
- -- a block to avoid interference between exception handlers and
- -- At_End handlers. Treat the block as transparent and process its
- -- contents.
-
- or else Is_Finalization_Wrapper (Decl))
- then
+ elsif Nkind (Decl) = N_Block_Statement and then Inside_Init_Proc then
if Requires_Cleanup_Actions (Decl, Lib_Level) then
return True;
end if;
@@ -255,7 +255,6 @@ package Gen_IL.Fields is
Is_Entry_Barrier_Function,
Is_Expanded_Build_In_Place_Call,
Is_Expanded_Contract,
- Is_Finalization_Wrapper,
Is_Folded_In_Parser,
Is_Generic_Contract_Pragma,
Is_Homogeneous_Aggregate,
@@ -1029,7 +1029,6 @@ begin -- Gen_IL.Gen.Gen_Nodes
Sm (Cleanup_Actions, List_Id),
Sm (Exception_Junk, Flag),
Sm (Is_Abort_Block, Flag),
- Sm (Is_Finalization_Wrapper, Flag),
Sm (Is_Initialization_Block, Flag),
Sm (Is_Task_Master, Flag)));
@@ -1723,12 +1723,6 @@ package Sinfo is
-- Present in N_Contract nodes. Set if the contract has already undergone
-- expansion activities.
- -- Is_Finalization_Wrapper
- -- This flag is present in N_Block_Statement nodes. It is set when the
- -- block acts as a wrapper of a handled construct which has controlled
- -- objects. The wrapper prevents interference between exception handlers
- -- and At_End handlers.
-
-- Is_Generic_Contract_Pragma
-- This flag is present in N_Pragma nodes. It is set when the pragma is
-- a source construct, applies to a generic unit or its body, and denotes
@@ -5238,7 +5232,6 @@ package Sinfo is
-- Is_Task_Allocation_Block
-- Exception_Junk
-- Is_Abort_Block
- -- Is_Finalization_Wrapper
-- Is_Initialization_Block
-- Is_Task_Master
-- At_End_Proc (set to Empty if no clean up procedure)