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: 70125 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 77ED93857359 for ; Fri, 26 May 2023 07:38:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77ED93857359 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685086732; bh=BxLbSc7gzhWJAC8eMbB7jf8qJBMq6A0oS9BRn8aV9Lw=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=PBQoThO6qxa4VN2sv9iWkk4SUkIchOyR7q3fX8udUIBQRxCR++rcUFuIWiUUaW/3O wIAwu1pMH5bveu2qJYOeuz/98FCavoVuDIIwR6n2OYC1t6+MOtCZgZAt7Bcdb6aEna OszQNhUGvcHBRBAm136PjZ7h+wvS8Vj+I5n5ENDM= 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-Google-Smtp-Source: ACHHUZ6pgcd0c0wjVYSbAKaiTNNsibaf9LWin7GcCfA3uHz7prmKi7oINVsk+oPlkYxFYLezOSJVgA== 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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