From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 96E0538654B4 for ; Tue, 5 Sep 2023 11:08:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 96E0538654B4 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-31c8321c48fso2031474f8f.1 for ; Tue, 05 Sep 2023 04:08:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1693912117; x=1694516917; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=aCljYiODeKLzYz9tc/KjMldu/H4WwLk/iPaH1+1JOJI=; b=Xd5lVn5D53rIqvaPnsRYsl6h4ofzndTsvblDDWyE503uLc5r040C3kvCBsfZH4ZM6a av+dmtwk/ODDjldrA13ZR9vxpVRmU8/zCiZsJA0sGW5SbTFcdUDdIN6t7qJRblJgxcrk gGe4Swgjbz6ltDmhRue062iEM3rYs3SEav5qlnQcUFXIqyriLma8+1niqFGyrPmaEymy 7FlrCPt4Rte9sMkk0keLAmPMIad+UnGjYOWvds11qRdb3a6OQld6nc0nJmrgxhiEeAqC rEmpYzm2S/myGt354eLnBBVhFQukF7P2p777xii1q2GqwquoqinKxLQPIUBborAssJ2y b3QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693912117; x=1694516917; 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=aCljYiODeKLzYz9tc/KjMldu/H4WwLk/iPaH1+1JOJI=; b=ILZIP4Cmh6OI2tBBXgUfgiZqajkY0Qee9FZSU3mB4juwHIn1gf+P5KTZ4CVyRQMLIz 1o+H1RAY4SuCiYwTwYZev61PngTrJFoH4BwwTOersNAcWUHIXkPYShhc4MHM6/yxYBsG F0nSqQrj26Nq9U+n5ZLcQ+3c2ANlczGsMWTtOA+Q6LWuHAB5/MwgRjqTG2cvSQt7q1hO tk5ETIoYLJcYYD0MOryT5MonbUeOX1LBigyEttPOCDMuBFjxU43Tvjhns6Om+65Jfq2g ujoqWwrmXGE8EJtv0fhyKCIpXDsuNVOENc/QNs1w0M8roUW2RKw7L1eZ4BC7Egav1GNa HUfw== X-Gm-Message-State: AOJu0YyctciGvpF22SnNihTpmjgLOXrOCMsI/p+NkdQjOahGriqz+yUm YqIjzrIlEuNrsfLr0180+DS2i0a+2uaXG3mtGcfXiw== X-Google-Smtp-Source: AGHT+IGwnzkp1A2ADXYKS5A1hS3BY71MbQoC5V/3iYpqmGLugtnvoP9htrgbdfApI+NYWfJ+dyuIvA== X-Received: by 2002:a5d:46c5:0:b0:317:558c:c15e with SMTP id g5-20020a5d46c5000000b00317558cc15emr12218682wrs.27.1693912117362; Tue, 05 Sep 2023 04:08:37 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:20fc:79e4:455c:1075]) by smtp.gmail.com with ESMTPSA id l9-20020a1c7909000000b003fe1c332810sm19821748wme.33.2023.09.05.04.08.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Sep 2023 04:08:36 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Remove redundant protection against empty list Date: Tue, 5 Sep 2023 13:08:35 +0200 Message-Id: <20230905110835.563486-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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_type.adb (Interface_Present_In_Ancestor): Remove guard against no list of interfaces; fix style in comments (trailing dots). Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_type.adb | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb index 8579130cdac..40de2951e20 100644 --- a/gcc/ada/sem_type.adb +++ b/gcc/ada/sem_type.adb @@ -2649,34 +2649,32 @@ package body Sem_Type is -- In case of concurrent types we can't use the Corresponding Record_Typ -- to look for the interface because it is built by the expander (and -- hence it is not always available). For this reason we traverse the - -- list of interfaces (available in the parent of the concurrent type) + -- list of interfaces (available in the parent of the concurrent type). if Is_Concurrent_Type (Target_Typ) then - if Present (Interface_List (Parent (Target_Typ))) then - declare - AI : Node_Id; + declare + AI : Node_Id; - begin - AI := First (Interface_List (Parent (Target_Typ))); + begin + AI := First (Interface_List (Parent (Target_Typ))); - -- The progenitor itself may be a subtype of an interface type. + -- The progenitor itself may be a subtype of an interface type - while Present (AI) loop - if Etype (AI) = Iface_Typ - or else Base_Type (Etype (AI)) = Iface_Typ - then - return True; + while Present (AI) loop + if Etype (AI) = Iface_Typ + or else Base_Type (Etype (AI)) = Iface_Typ + then + return True; - elsif Present (Interfaces (Etype (AI))) - and then Iface_Present_In_Ancestor (Etype (AI)) - then - return True; - end if; + elsif Present (Interfaces (Etype (AI))) + and then Iface_Present_In_Ancestor (Etype (AI)) + then + return True; + end if; - Next (AI); - end loop; - end; - end if; + Next (AI); + end loop; + end; return False; end if; -- 2.40.0