]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Small cleanup in finalization machinery
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 23 Oct 2023 18:46:15 +0000 (20:46 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 21 Nov 2023 09:57:41 +0000 (10:57 +0100)
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.

gcc/ada/exp_ch7.adb
gcc/ada/exp_util.adb
gcc/ada/gen_il-fields.ads
gcc/ada/gen_il-gen-gen_nodes.adb
gcc/ada/sinfo.ads

index 369f0b07999e939c6b7d20d570f6c86328e7d9af..2e3da4cfaeda06b8f8f6f279bf7df6515b8367c2 100644 (file)
@@ -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);
index 730889cae3eacd20c20904abc2039a6794f65dd7..3b34e4659f165ebf6e04609f80564429ef5f7bd3 100644 (file)
@@ -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;
index a0bfb398ebb3163db26e303d6ce2ff52da048eaa..c565e19701d4ca2fa898824100fe709430bb210a 100644 (file)
@@ -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,
index 996d8d78aeae1798e95faa039a7ea517a10e8d59..087f78567f4e152bcb36b6814329d9eb4d965162 100644 (file)
@@ -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)));
 
index 8f9626019853e543d2d260f531c48263e0ed45b6..1a6317054cfcd5a02fcecb32647be2554b8a3d71 100644 (file)
@@ -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)