From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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-wm1-x333.google.com with SMTP id d5so4760429wms.5 for ; Mon, 05 Sep 2022 00:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date; bh=BiXIclc1nFNZ9foGhHsvqxa0lhDHUCVeaG8+aBHIa7I=; b=MvlZPqBwdtIZC3AxH0FT+zUQhXIvyytifnkKRD+Y9cqOjCnwpz1FYwKZRmez2cPZE6 bJPXt2AIB9woaW05X6FEESbUKQEBa967yTIpbm/ZbJHq20pvyQkwO7nXC3jwQhEnpYGE BYvdDIPgpE++jyg7g4Vtb6QG2hJkB5bqPmXReF+m2pWuXewFa46TETTLJ7SufGP4yMfY gU3WsZBwFUlGH5U9zCwvhIlrmN3IswQV4T2RBalZMyh/ak6fHb/IyvoF08gTTzD5PmvK zm5MSIjqQy9YrSryploIF6nHymZOCJx3ojoTOE0vNVPnwvTCdyPvG4FADxU7Hk87aPFs qakw== 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-Google-Smtp-Source: AA6agR7fMLQ07L4jYj87hgHMDbZp9FCmG2J6UJZc2mbj2z0Fhn7+baTcvh6ayKy1QJh73TvymNgANQ== 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 From: Marc =?iso-8859-1?Q?Poulhi=E8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [Ada] Fix detection of unused warning suppression Message-ID: <20220905072609.GA1174760@poulhies-Precision-5550> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="M9NhX3UHpAaciwkO" 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 List-Id: --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --M9NhX3UHpAaciwkO Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" 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; --M9NhX3UHpAaciwkO--