From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 480523857C4A for ; Fri, 7 Jan 2022 16:27:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 480523857C4A Received: by mail-wr1-x42b.google.com with SMTP id r10so4382431wrc.3 for ; Fri, 07 Jan 2022 08:27:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=rLqxZGElorR4D/xcn4dMMIIb/7snFtHo91ZzgLVdw8A=; b=C0fbEXaoYRuvWIDnnFBneGJotKlS2ZbsZmL0q3MxKXzrHbfSyWHxALnA17C90Gsccw VJECItC+G/5W8T0VPq0pOzvB/KN+lx7SfXuGbrxI4lpxGKG843OZe6v6cqwU3RInJrL9 s0OL0xPJ/Z4LWrsrzLx3uuikvEChdGn1Cyq7CnNGTz/G+L0wNAw7d6FygB+D8nTKAbXl yNZVZASABIhSBDm+VFdf4kjgrgOtJWUPEGDz1bE1AsaNdfvIsUOaZgi2X7x8ZZX6tzqi nODJZz6lgokPdWWnvwVvHwfA4Fin97CzLIoEr9NGtapBQF6knWu0K8IOlkBQ4dOYrAcK anoA== X-Gm-Message-State: AOAM533dm5vpQ6JePqmnuhd5jehXxpi4gmBOnRcc9ogu8JULJtyQRc2U tAUksaggX1lPJZ3kURO+Nwe04v1+Dg9gUQ== X-Google-Smtp-Source: ABdhPJzcGA2A77bQbv8PabVAoyjeuRju5XFnFNj7AVfZJfo2TT5KIlaNrK4wrchAHJiLY2BlxXcSng== X-Received: by 2002:a5d:6d06:: with SMTP id e6mr54544441wrq.273.1641572823369; Fri, 07 Jan 2022 08:27:03 -0800 (PST) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id o15sm5632001wri.106.2022.01.07.08.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 08:27:02 -0800 (PST) Date: Fri, 7 Jan 2022 16:27:02 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [Ada] Remove unnecessary guards for appending non-empty lists Message-ID: <20220107162702.GA948210@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="9jxsPFA5p3P2qPhR" Content-Disposition: inline X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jan 2022 16:27:05 -0000 --9jxsPFA5p3P2qPhR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Calls to Append_List and Append_List_To applied with empty lists do nothing, so there is no need to explicitly guard against such calls. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch3.adb (Build_Init_Procedure): Remove unnecessary guard. * exp_disp.adb (Make_DT): Likewise. * sem_ch12.adb (Analyze_Associations): Likewise. --9jxsPFA5p3P2qPhR Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -2885,9 +2885,7 @@ package body Exp_Ch3 is Fixed_Comps => False, Variable_Comps => True); - if Is_Non_Empty_List (Init_Tags_List) then - Append_List_To (Body_Stmts, Init_Tags_List); - end if; + Append_List_To (Body_Stmts, Init_Tags_List); end if; end if; diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -6379,9 +6379,7 @@ package body Exp_Disp is New_List (New_Occurrence_Of (DT_Ptr, Loc)))); end if; - if not Is_Empty_List (Elab_Code) then - Append_List_To (Result, Elab_Code); - end if; + Append_List_To (Result, Elab_Code); -- Populate the two auxiliary tables used for dispatching asynchronous, -- conditional and timed selects for synchronized types that implement diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -2248,9 +2248,7 @@ package body Sem_Ch12 is -- explicit box associations for the formals that are covered by an -- Others_Choice. - if not Is_Empty_List (Default_Formals) then - Append_List (Default_Formals, Formals); - end if; + Append_List (Default_Formals, Formals); return Assoc_List; end Analyze_Associations; --9jxsPFA5p3P2qPhR--