From patchwork Mon Sep 5 07:26:09 2022 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: 974 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp58178wrt; Mon, 5 Sep 2022 00:34:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR7armJHlFAkHNAvZZOWzzncZBeSVaYFyl3AZpnW+MIU8RCowN94PHSd95piFfPdH3H/KCIa X-Received: by 2002:a17:907:60c7:b0:739:52ba:cbd0 with SMTP id hv7-20020a17090760c700b0073952bacbd0mr35239435ejc.152.1662363262830; Mon, 05 Sep 2022 00:34:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662363262; cv=none; d=google.com; s=arc-20160816; b=OpjildNRKLtoKVFfr2zO9kdOnwj3gr7K8Vsl3mVyLiAJc4a+DiP+3aLBYdnHo2XGG5 Wkx2B9DUSZ60nIhdpMsOhNA/oZJmeqQ759SBholGdejbOxmJw++yBPsmSOe7cj/JAZty bAsv4ix9HyoEu034RsxQewYvoId9IuqG46n072Q7OTR2T7uOd11P5HzZlVthG0o4XCXn u7J3j+yoo7K+M5ZkKYScKunhwzvKX+Uvkanl6QzyF/TSqS3P9Vbmd6M8xp5w7xhEBHD/ /rgdA8L/lBlCpq3jzIFaHi5gS6incYXu5Su/Di96KvUVeYYs44YHF9zunJapndmrhmlb 1/IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=BiXIclc1nFNZ9foGhHsvqxa0lhDHUCVeaG8+aBHIa7I=; b=CBsWYVA8H9ZjYqox0AvcVECD8Agu7hN4BrgEOd+K5ScNf1ha9GZD+gkxUtV+wdPdrk YhTplNdcm2tA1pnMEdpPvneO8ZxJJXbSo3OADBzxccexOUAJ5wFhkCUDF7f0MSLHxqZ1 cUDnrrbYLDmPeAz/mEtTrGXkko0LoOtjdoPTWYlfQrszLubhmFs3nrtYpLBqF2yK05/O 4LWpaOXUiPls5HIn3OObRg6mwupNiXkpJvGbv0Zbc2sbF7s4AhQbqzM0mSiPH6fwHUVM 6tzovI4JudkFOhYIkctHeWZEEm2rdvA7z/fr2zH/YElJpkJHewBxLSZWecD4qSnqWvw7 cLUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=fxNgc+qI; 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 go43-20020a1709070dab00b007318652a31bsi7104231ejc.577.2022.09.05.00.34.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 00:34:22 -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=fxNgc+qI; 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 2F5BE389A131 for ; Mon, 5 Sep 2022 07:29:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F5BE389A131 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662362990; bh=BiXIclc1nFNZ9foGhHsvqxa0lhDHUCVeaG8+aBHIa7I=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=fxNgc+qI8umOPRsGKgfpZgKXtKsMxW7pYj3zNqx3tYqF7wTP9RHT3+QExQykiSzwh upqXk10PTsPXRrA+I+MOPDHidUQWX4XTKm0oVKAM1cDocGuBVcHKBz9sJ2hL9euX+0 lzQOIUB5VqknQoNK/4Ltw98MNoBcWRvFvuPde4wM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id 772DC3856DD6 for ; Mon, 5 Sep 2022 07:26:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 772DC3856DD6 Received: by mail-wm1-x333.google.com with SMTP id d5so4760429wms.5 for ; Mon, 05 Sep 2022 00:26:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=BiXIclc1nFNZ9foGhHsvqxa0lhDHUCVeaG8+aBHIa7I=; b=iFXZuvWY6D7zqTR5qGn2Xaav0OpvDuIo1oSEIQkP+a1Tlg3VW1ADMjitvuLSoiLXrw 2a/mStobYW2GJZOHEDeiFXsJQ7er2SOE3G2dYtZDJrm33YbwWpOd5vvnSBVllkftAR2M AqaqP0KMkiGFRx4owIeEzwGkoYgafI0zrBcLu4CX+vcOe5OaR7q4kPDZHtCPLHEl1cnO pYfm+y2BJH4vT8u1vmbhufuCLdQ4CIuH012qJhUoOLSbtORHsu5bfoX6n6Wq6fTB7OUq Xavg+lqaBo7NgMHqZN4wfQTHaAo994q7Ww3GO/rSZh0Zwdn7PF5BigkCtBkWMLk8YmiW 9q5g== X-Gm-Message-State: ACgBeo0nFOGq1vk+bwy7n+p7N1PP/gnDL71NGMMM3cq4pEHZJ/Kht1Om NqTVh1hgKs+RrvcYBb235+PIfS+VIN2EyA== X-Received: by 2002:a1c:a107:0:b0:3a6:8b06:cf19 with SMTP id k7-20020a1ca107000000b003a68b06cf19mr9714216wme.195.1662362770322; Mon, 05 Sep 2022 00:26:10 -0700 (PDT) Received: from poulhies-Precision-5550 (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id e3-20020a5d5303000000b0022584e771adsm8016355wrv.113.2022.09.05.00.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 00:26:09 -0700 (PDT) Date: Mon, 5 Sep 2022 09:26:09 +0200 To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix detection of unused warning suppression Message-ID: <20220905072609.GA1174760@poulhies-Precision-5550> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.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: Marc =?iso-8859-1?q?Poulhi=E8s?= Cc: Piotr Trojanek 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?1743114220599483431?= X-GMAIL-MSGID: =?utf-8?q?1743114220599483431?= The comment for Warnings_Off says: "clients should generally not test this flag directly, but instead use function Has_Warnings_Off". Primarily a code cleanup, as this only affects minor a corner case. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch13.adb (Validate_Unchecked_Conversions): Use Has_Warnings_Off. * sem_elab.adb (Check_Internal_Call_Continue): Likewise. diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -17726,7 +17726,9 @@ package body Sem_Ch13 is begin -- Skip if function marked as warnings off - if Warnings_Off (Act_Unit) or else Serious_Errors_Detected > 0 then + if Has_Warnings_Off (Act_Unit) + or else Serious_Errors_Detected > 0 + then goto Continue; end if; diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -18767,9 +18767,9 @@ package body Sem_Elab is T : constant Entity_Id := Etype (First_Formal (E)); begin if Is_Controlled (T) then - if Warnings_Off (T) + if Has_Warnings_Off (T) or else (Ekind (T) = E_Private_Type - and then Warnings_Off (Full_View (T))) + and then Has_Warnings_Off (Full_View (T))) then goto Output; end if;