From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 43CB73857C70; Fri, 7 Jan 2022 16:27:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 43CB73857C70 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-6351] [Ada] Remove unnecessary guard for inserting non-empty list X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: 3174b67eefb20421d43a6c96473fe41ee4cd1bf9 X-Git-Newrev: e8a52167ea10797308ecc0497127ba0ce44b707b Message-Id: <20220107162729.43CB73857C70@sourceware.org> Date: Fri, 7 Jan 2022 16:27:29 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jan 2022 16:27:29 -0000 https://gcc.gnu.org/g:e8a52167ea10797308ecc0497127ba0ce44b707b commit r12-6351-ge8a52167ea10797308ecc0497127ba0ce44b707b Author: Piotr Trojanek Date: Mon Dec 13 20:25:15 2021 +0100 [Ada] Remove unnecessary guard for inserting non-empty list gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): Remove unnecessary guards. * exp_ch4.adb (Expand_N_If_Expression): Likewise; clarify comment. * exp_ch5.adb (Expand_N_If_Statement, Expand_Iterator_Loop_Over_Container): Likewise. * exp_ch9.adb (Expand_N_Task_Type_Declaration): Remove redundant guard. * freeze.adb (Freeze_All_Ent): Reduce scope of a local variable. Diff: --- gcc/ada/exp_ch3.adb | 4 +--- gcc/ada/exp_ch4.adb | 14 +++----------- gcc/ada/exp_ch5.adb | 8 ++------ gcc/ada/exp_ch9.adb | 8 +------- gcc/ada/freeze.adb | 2 +- 5 files changed, 8 insertions(+), 28 deletions(-) diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index e3f5d48dfa8..1e9373abcd7 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -6908,9 +6908,7 @@ package body Exp_Ch3 is New_Nodes := Make_DT (Base_Typ, N); end if; - if not Is_Empty_List (New_Nodes) then - Insert_List_Before (N, New_Nodes); - end if; + Insert_List_Before (N, New_Nodes); end; end if; diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 21fa5158e05..bf96e642e5c 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -6198,18 +6198,10 @@ package body Exp_Ch4 is Set_Sloc (Parent (N), Loc); end if; - -- Make sure Then_Actions and Else_Actions are appropriately moved - -- to the new if statement. + -- Move Then_Actions and Else_Actions, if any, to the new if statement - if Present (Then_Actions (N)) then - Insert_List_Before - (First (Then_Statements (New_If)), Then_Actions (N)); - end if; - - if Present (Else_Actions (N)) then - Insert_List_Before - (First (Else_Statements (New_If)), Else_Actions (N)); - end if; + Insert_List_Before (First (Then_Statements (New_If)), Then_Actions (N)); + Insert_List_Before (First (Else_Statements (New_If)), Else_Actions (N)); Insert_Action (N, Decl); Insert_Action (N, New_If); diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index b73a966faa2..f9a9e7e3125 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -4559,9 +4559,7 @@ package body Exp_Ch5 is Set_Else_Statements (N, New_List (New_If)); - if Present (Condition_Actions (E)) then - Insert_List_Before (New_If, Condition_Actions (E)); - end if; + Insert_List_Before (New_If, Condition_Actions (E)); Remove (E); @@ -5455,9 +5453,7 @@ package body Exp_Ch5 is -- Condition_Actions of the iterator. Insert them now at the head of -- the loop. - if Present (Condition_Actions (Isc)) then - Insert_List_Before (N, Condition_Actions (Isc)); - end if; + Insert_List_Before (N, Condition_Actions (Isc)); Rewrite (N, New_Loop); Analyze (N); diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index b0f81481005..82f61b3f960 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -12516,13 +12516,7 @@ package body Exp_Ch9 is -- procedure for this corresponding record type and we won't get it -- in time if we don't freeze now. - declare - L : constant List_Id := Freeze_Entity (Rec_Ent, N); - begin - if Is_Non_Empty_List (L) then - Insert_List_After (Body_Decl, L); - end if; - end; + Insert_List_After (Body_Decl, List => Freeze_Entity (Rec_Ent, N)); end if; -- Complete the expansion of access types to the current task type, if diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 32a82fb7933..2b891080885 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -2354,7 +2354,6 @@ package body Freeze is procedure Freeze_All_Ent (From : Entity_Id; After : in out Node_Id) is E : Entity_Id; Flist : List_Id; - Lastn : Node_Id; procedure Process_Flist; -- If freeze nodes are present, insert and analyze, and reset cursor @@ -2365,6 +2364,7 @@ package body Freeze is ------------------- procedure Process_Flist is + Lastn : Node_Id; begin if Is_Non_Empty_List (Flist) then Lastn := Next (After);