From patchwork Fri May 26 07:36:04 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: 99342 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp291352vqr; Fri, 26 May 2023 00:43:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ruDElmmP+KMVDoB0paLiMYLgz5NnMukqGwh57lJUgyjRsdDe22sKN517hdD4KKbXZ2vmA X-Received: by 2002:a17:907:6092:b0:966:1984:9d21 with SMTP id ht18-20020a170907609200b0096619849d21mr1511249ejc.9.1685086980144; Fri, 26 May 2023 00:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685086980; cv=none; d=google.com; s=arc-20160816; b=iQJq5TxvQ9PU7uzZk8gD8RmcbeSiUsCP7ROMqjEgxi9wz4283kuebqcteAKlzINiMk Kn2pEncUnFntGOpX82E9PU9pGBXm47zwENZkm/2kQfiTsyPsoOh1kbGq+Os7psZzz2Wi +nDSzqYslSIG99fuHWwsT62OpUaU4dI68ib5Y5BGbbCCqPd+RPglKnBrMF813m1auhyf B+j6EVXG0cd5fynXh+TSbCDtjSIHodKd2jE14QON0cYYU6ROS80SXXV39smH4kiej7+D gHOIflKlpf1VVYTlxdrHbjoZsLreF5xJvA3Hbvx/WiS6+MAcdrrbrm9Uf1rvzeAHXYXs VRkA== 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=BxLbSc7gzhWJAC8eMbB7jf8qJBMq6A0oS9BRn8aV9Lw=; b=FN+hhuZSlf0dIKuYl9NbheW/fo17x4BuIx7ZeegyApttOuUgfAsDwNrso4Blc7rfgD yLsBYonFqW26A+guStEu/X3tRyePZS7xvxsGVHwzALEsxwv5Zmsbo42a46xlLFZCLZmA JTq2XSy2C8MHGbjgmfKLvSWSmOQ55IbjBtCO8NL6FMoSAQ6HcIBgwY6GLKzPNigK9xY7 Fmp2b66JiB7yZTSeRRr+Nb8qAY2QX/J+ZIGAo+Qd2sksI6cROwHamh2U6Vng3d9Fh0lW 4lwteBNRUjZt0xpq9sXPACPA0cgJcjarsO36+MaCOufZ85BiSnvKmWounI9RJZAvrd+O VrFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="TD5m/Dkv"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id l14-20020a170906078e00b0094f6f952bebsi2837109ejc.775.2023.05.26.00.42.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 00:43:00 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="TD5m/Dkv"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 ED37D388200C for ; Fri, 26 May 2023 07:39:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ED37D388200C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685086749; bh=BxLbSc7gzhWJAC8eMbB7jf8qJBMq6A0oS9BRn8aV9Lw=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=TD5m/DkvTEAOiW4fBRrzEioUPh7JFdI50+J1C9+DbhHOsEl+UvrgVxSC0wZcCBo/P Y9CXI7vBvnCL+YAP+utVZG/KrEli2I4fOGxZHcz4d9SPBSyE3Ly93+ei52awtrU0/8 NJW+aZ5cwaxn5hRQN3NcJO2PeWnfVPVnnkf+cQ/o= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id DCB8C3846444 for ; Fri, 26 May 2023 07:36:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DCB8C3846444 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3f6ef9a928fso150165e9.3 for ; Fri, 26 May 2023 00:36:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685086565; x=1687678565; 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=BxLbSc7gzhWJAC8eMbB7jf8qJBMq6A0oS9BRn8aV9Lw=; b=FTvTSxDoB+tfBVglvXoD82ria6JGzsvXJIRxcwTjnpRq6OQDP0tD/XiIJ4NO707SU8 E9hByzWwg0OJDtRqBGFNUXAMNHPzmqOL3u05Mc37cJvl669yRzdcRpF5FBvGJ2bTU3/y R2Ptgo9BrYQE1rXoCnl+3GmgnrFx1G/2FyuFo5NY8Mn3v7WssNp4jS3kqpUmDQYk4pQU u4NKVXo5Fm7Xw1/Z29sDVYtmBp+ElMAQTqA1HK2KjgF2GZaZCjJzd01jfi65WCsat4wg IFSHOyiF+uKrpY0tPi0BiucaQZdnGhO8bWbiE17eLrGLA7HhIFxYQkDPZdtj8p0lDZ9E GjCg== X-Gm-Message-State: AC+VfDwONBHpwFozNHhiZVK+VYKc0SpTeB3KFXvzPDKQm84Uo4qKSvvi x18AFixKNsTaqaO8nBvZrwvc1W1qS0l9vhqPyxa8cQ== X-Received: by 2002:a1c:f704:0:b0:3f1:74bd:bc22 with SMTP id v4-20020a1cf704000000b003f174bdbc22mr800207wmh.6.1685086565716; Fri, 26 May 2023 00:36:05 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:777b:eef4:6f79:f26f]) by smtp.gmail.com with ESMTPSA id z18-20020a1c4c12000000b003f423f5b659sm4272716wmf.10.2023.05.26.00.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 00:36:05 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Remove redundant guards from handling of record components Date: Fri, 26 May 2023 09:36:04 +0200 Message-Id: <20230526073604.2068445-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.6 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?1766941765656789170?= X-GMAIL-MSGID: =?utf-8?q?1766941765656789170?= From: Piotr Trojanek Call to First on empty list is intentionally returning Empty. gcc/ada/ * sem_util.adb (Gather_Components): Remove guard for empty list of components. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index ea5be2ff4b5..d0e0fcd3da1 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -9748,14 +9748,9 @@ package body Sem_Util is if No (Comp_List) or else Null_Present (Comp_List) then return; - - elsif Present (Component_Items (Comp_List)) then - Comp_Item := First (Component_Items (Comp_List)); - - else - Comp_Item := Empty; end if; + Comp_Item := First (Component_Items (Comp_List)); while Present (Comp_Item) loop -- Skip the tag of a tagged record, as well as all items that are not