]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Cleanup insertion of single freezing actions
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 25 Nov 2021 13:54:17 +0000 (14:54 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 2 Dec 2021 16:26:28 +0000 (16:26 +0000)
gcc/ada/

* exp_util.adb (Append_Freeze_Action): Tune whitespace to make
the code look similar to Append_Freeze_Actions, which takes a
List_Id.
* sem_ch6.adb (Analyze_Return_Type): Cleanup with
Append_Freeze_Action.
* exp_ch3.adb (Build_Access_Subprogram_Wrapper_Body): Likewise.
* sem_ch3.adb (Build_Access_Subprogram_Wrapper): Likewise.
* contracts.adb (Add_Indirect_Call_Wrapper): Remove extra call
to Ensure_Freeze_Node.
(Add_Call_Helper): Likewise.
* freeze.adb (Check_Inherited_Conditions): Likewise.
(Attribute_Renaming): Likewise.
* sem_ch8.adb: Likewise.

gcc/ada/contracts.adb
gcc/ada/exp_ch3.adb
gcc/ada/exp_util.adb
gcc/ada/freeze.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_ch8.adb

index 2726486d2002b1c9148f9c8d2a1b98b560922c49..98f469bf5b7bb7091aa7d7975e718ab53d3b267f 100644 (file)
@@ -3761,7 +3761,6 @@ package body Contracts is
 
          ICW_Decl := Build_ICW_Decl;
 
-         Ensure_Freeze_Node (Tagged_Type);
          Append_Freeze_Action (Tagged_Type, ICW_Decl);
          Analyze (ICW_Decl);
 
@@ -4034,7 +4033,6 @@ package body Contracts is
 
          --  Add the helper to the freezing actions of the tagged type
 
-         Ensure_Freeze_Node   (Tagged_Type);
          Append_Freeze_Action (Tagged_Type, Helper_Decl);
          Analyze (Helper_Decl);
 
index 9a0bbb45bb22b01f91ea53b7ee9c751a13000d27..828f5a5d17a2d7456d1187b8ce47751dd5d9341c 100644 (file)
@@ -580,8 +580,7 @@ package body Exp_Ch3 is
 
       --  Place body in list of freeze actions for the type.
 
-      Ensure_Freeze_Node (Type_Id);
-      Append_Freeze_Actions (Type_Id, New_List (Body_Node));
+      Append_Freeze_Action (Type_Id, Body_Node);
    end Build_Access_Subprogram_Wrapper_Body;
 
    ---------------------------
index 1bba0595741e215175d3b85fe396c8753d331cce..0aa7937b211f8c6332485c20d9c71f0f0149fe4b 100644 (file)
@@ -458,7 +458,6 @@ package body Exp_Util is
       else
          Append (N, Actions (Fnode));
       end if;
-
    end Append_Freeze_Action;
 
    ---------------------------
index 6804c046b462b547ab268361776abdb56d68d91e..bd03ffa5844faef403b5632e95cab4beb3972eb3 100644 (file)
@@ -2044,9 +2044,8 @@ package body Freeze is
                --  node of the record type declaration to ensure that it will
                --  override the internal primitive built by Derive_Subprogram.
 
-               Ensure_Freeze_Node (R);
-
                if Late_Overriding then
+                  Ensure_Freeze_Node (R);
                   Insert_Before_And_Analyze (Freeze_Node (R), DTW_Decl);
                else
                   Append_Freeze_Action (R, DTW_Decl);
index 02066e470c890d0979e059caa3e6ccb19578d556..6b25a6aee220b3a6c2913aed9556b60fe4262258 100644 (file)
@@ -6815,8 +6815,7 @@ package body Sem_Ch3 is
       --  in a dispatch table.
 
       if not GNATprove_Mode then
-         Ensure_Freeze_Node (Id);
-         Append_Freeze_Actions (Id, New_List (New_Decl));
+         Append_Freeze_Action (Id, New_Decl);
 
       --  Under GNATprove mode there is no such problem but we do not declare
       --  it in the freezing actions since they are not analyzed under this
index 9c21732e5f9a2166e48e78fe0f70fb96e65783c7..fa4de4cf76a4c7566712270c19df72b987db41a5 100644 (file)
@@ -2715,13 +2715,11 @@ package body Sem_Ch6 is
                   end if;
 
                else
-                  Ensure_Freeze_Node (Typ);
-
                   declare
                      IR : constant Node_Id := Make_Itype_Reference (Sloc (N));
                   begin
                      Set_Itype (IR, Etype (Designator));
-                     Append_Freeze_Actions (Typ, New_List (IR));
+                     Append_Freeze_Action (Typ, IR);
                   end;
                end if;
 
index e3a4881cf6cdfb52f3c5c7ad4c0184301d180a9e..34f7ac15e8a9afd46e2aac5d1f4f488379ea25f4 100644 (file)
@@ -4689,7 +4689,6 @@ package body Sem_Ch8 is
             if Is_Tagged_Type (Etype (P))
               and then In_Open_Scopes (Scope (Etype (P)))
             then
-               Ensure_Freeze_Node (Etype (P));
                Append_Freeze_Action (Etype (P), Body_Node);
             else
                Rewrite (N, Body_Node);