From patchwork Mon May 29 08:29:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 100157 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1365074vqr; Mon, 29 May 2023 01:42:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7HO8nTAR/GkNq0n4v2mwE7RSUmq+mHbz511nv2PbbdaiHQBKPzjwaD/xmzIFU1xbQEZAjs X-Received: by 2002:aa7:c44b:0:b0:514:7e8a:7ee7 with SMTP id n11-20020aa7c44b000000b005147e8a7ee7mr6589764edr.33.1685349720537; Mon, 29 May 2023 01:42:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685349720; cv=none; d=google.com; s=arc-20160816; b=HChmp/2Xc90rUd5J4/MBqI2+E1HTRyZHkDgvtRaXwN6WqiqV2pzqL/PM4jCq6DMG5z 5R7VQSC4S3Kt+QdoMz37FMucgM7A+LrjvNzVSOSGmmpy8/pA2cHP6iWsuvxR9Ge8AW99 V/5mBX004AtPunhfHxkZGRB6U4LLvJcSkHrZbmt/7z9XYYAYUTGnbdLnrj1LY3emlygZ VuK5YM725XH6UMA/1Bjwx2uxFYuqCuEiHRppHHx03Jx0Qykdz1+j8gY5nyQlnqHaRfMB 2phUo3qW8JXxze/I3nuz5UzERYVBb+Dytm1QbH2BCC+gZjMqeEj3Ph+Sj1XMF81xgTzZ k3/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=54xIBg9vd5EDjr2dhzJ0SN18ptdP6gG3s80O19f8oHA=; b=BZS5UUt6uPTGxjmTtvNb3pKwOexY9bRBKnR0oRgqEZ3Xrlj/7w8+vHQzYYg/hPXDCn SgCy11lDq/Ps4BMdBgf5DlyBWQAoExd/ngoXFFWcQ+q2r2SjML1EVKBQiMfBKAfyqjKe DIFpMDiYJ7w8vmn81VgXDAMc+JspSJKZhNdTH3w654sip1F9bwdg7X39aJlRIjT32xm/ vhdnabce0lEMWxDHjPCo4uyqcnRXGcHeaezyy7MNJy/F6WB7vnsa5ytHxGdENeubgrFP cOBtp11GvewUsQ1cz7bPmSj98Jumebxfk5Ge+a16UffBhfTXkx+YCaBRPKkBFbVGZSBp l/Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=suWoSuah; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id m15-20020aa7c2cf000000b00514a495a024si429135edp.132.2023.05.29.01.42.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 01:42:00 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=suWoSuah; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C4C62395381D for ; Mon, 29 May 2023 08:36:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C4C62395381D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685349365; bh=54xIBg9vd5EDjr2dhzJ0SN18ptdP6gG3s80O19f8oHA=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=suWoSuahJAz2UPYXj2xrtVADIL6ese0BakCCE/xNFX1enWvm9FaMv8WVYabG+qO1E OCLpBbVwDVo5mvLlNGiw4CM8peyweo1E1VLuKqxKzj4uvPVxKsxRxZKS+c00ZQDSDU rsvaT8TO9cYzlZ39OmBNctfuH+yvCGj9VN+LtTHM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id E906E3857347 for ; Mon, 29 May 2023 08:29:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E906E3857347 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3f606a80d34so19716595e9.0 for ; Mon, 29 May 2023 01:29:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685348985; x=1687940985; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=54xIBg9vd5EDjr2dhzJ0SN18ptdP6gG3s80O19f8oHA=; b=J7JEjOdHPFXa41Sd2d7u/CJCZK6UY+g5xDWzJOdvQU33NOVDXej3Bq/ZFWJWoBZKPH 4KKbUSXzSUe/v2UHRGS0CKpUnTvlXiXPE6Ju3Ofe9CwnsO+zuUf3KkB1hHJ3bbGPmFHV QSSwsbgmZwjPqVAe6DBsFmibfVz9ZHNEJgrqx5GgVFpNkaPh7dpjyCfKjIxam6XLSY3n UMeiNHYtKVUdO2oqUZpQpw21nAFx8WYUxjh/j+csBrt2lC59EYMi0cKGstOduYT2x7Tx 5GNb/Y0urKCxh/s5kyfYq73wx/qIZgfD6n1KaGoYceNNfBlKH1UFFelLB24U5T4PrXPz FHMw== X-Gm-Message-State: AC+VfDwPV3fkkOtbpoAZtl+rDWcVV2Dp+De6oeKf18Ho0QbKb4nSzjwy Lftc1/EVSrSIrmI0g5Q3COyaGr6gM41gGENwn6O8qA== X-Received: by 2002:a7b:c044:0:b0:3f6:be1:b8d9 with SMTP id u4-20020a7bc044000000b003f60be1b8d9mr7476882wmc.6.1685348985834; Mon, 29 May 2023 01:29:45 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id 13-20020a05600c24cd00b003f4dde07956sm17040796wmu.42.2023.05.29.01.29.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 01:29:45 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Remove redundant protection against empty lists Date: Mon, 29 May 2023 10:29:44 +0200 Message-Id: <20230529082944.2410880-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767217268373776919?= X-GMAIL-MSGID: =?utf-8?q?1767217268373776919?= From: Piotr Trojanek Calls to First on No_List intentionally return Empty, so explicit guards against No_List are unnecessary. Code cleanup; semantics is unaffected. gcc/ada/ * sem_util.adb (Check_Function_Writable_Actuals): Remove guard against a membership test with no alternatives; simplify with a membership test. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index a42b2dff60f..34ea06432cf 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -2882,9 +2882,7 @@ package body Sem_Util is Collect_Identifiers (Right_Opnd (N)); end if; - if Nkind (N) in N_In | N_Not_In - and then Present (Alternatives (N)) - then + if Nkind (N) in N_Membership_Test then Expr := First (Alternatives (N)); while Present (Expr) loop Collect_Identifiers (Expr);