diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-10-23 20:46:15 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-11-21 10:57:41 +0100 |
commit | d9481c5dc0bac26a2e1ae77eaef6143e0b723fe2 (patch) | |
tree | 60ea68291f69ba8ad843198436f9289e635f89ce | |
parent | d325c129d103cdc206165ee575a01e2bee7caad9 (diff) | |
download | gcc-d9481c5dc0bac26a2e1ae77eaef6143e0b723fe2.zip gcc-d9481c5dc0bac26a2e1ae77eaef6143e0b723fe2.tar.gz gcc-d9481c5dc0bac26a2e1ae77eaef6143e0b723fe2.tar.bz2 |
ada: Small cleanup in finalization machinery
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.
-rw-r--r-- | gcc/ada/exp_ch7.adb | 20 | ||||
-rw-r--r-- | gcc/ada/exp_util.adb | 24 | ||||
-rw-r--r-- | gcc/ada/gen_il-fields.ads | 1 | ||||
-rw-r--r-- | gcc/ada/gen_il-gen-gen_nodes.adb | 1 | ||||
-rw-r--r-- | gcc/ada/sinfo.ads | 7 |
5 files changed, 8 insertions, 45 deletions
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 369f0b0..2e3da4c 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -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); diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 730889c..3b34e46 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -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; diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads index a0bfb39..c565e19 100644 --- a/gcc/ada/gen_il-fields.ads +++ b/gcc/ada/gen_il-fields.ads @@ -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, diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb index 996d8d7..087f785 100644 --- a/gcc/ada/gen_il-gen-gen_nodes.adb +++ b/gcc/ada/gen_il-gen-gen_nodes.adb @@ -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))); diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index 8f96260..1a63170 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -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) |