From patchwork Wed Dec 18 09:52:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1212167 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-516201-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="cB4cet4M"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47d9L81jGpz9sPJ for ; Wed, 18 Dec 2019 20:53:02 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=NZcoLcnuLNSDn8mA tRJZZPDWDQ0IaCwxL3PA9ZehECjUK1p2Vm6Q7djl7YzKrkTai4UN/xYLHZPkko13 R64Nh7MTqv8td+18PCgHCJmIhNJptnxCDw0Xn1CnVHXU4XEIAzIWZQBq1Pl5C4H2 vrC6JKLenfcS5/6pcoKZqeZbZWA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=VfBpIeBAIPaJ4IBRrS8bXr nWJ54=; b=cB4cet4MxUpzwVxNXzlRL84ReVP0/VCdk+N/xyniAOS1g3yXDBBEN+ vA5S4Nm1mIwtS9ppqfMoZYlM61PWzuXgSSrxSFiHJURSmzmsNCjpYvuAALfAnxG8 79IA5584UYk9immTz1rOsIn//obwk/NH6kg2damgVUWGv52Q2Ra8k= Received: (qmail 65911 invoked by alias); 18 Dec 2019 09:52:54 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 65903 invoked by uid 89); 18 Dec 2019 09:52:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1928, Next X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Dec 2019 09:52:52 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 32A0A8150F for ; Wed, 18 Dec 2019 10:52:50 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6NHgGgrd-E2Q for ; Wed, 18 Dec 2019 10:52:50 +0100 (CET) Received: from polaris.localnet (unknown [IPv6:2a01:e0a:41b:9230:1a03:73ff:fe45:373a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 0FDB6813A0 for ; Wed, 18 Dec 2019 10:52:50 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Small tweak to pragma Warnings (On) Date: Wed, 18 Dec 2019 10:52:48 +0100 Message-ID: <4521178.57jyJhvGRC@polaris> MIME-Version: 1.0 This changes pragma Warnings (On) from reenabling all the warnings previously silenced to reenabling only those warnings which were enabled when the latest pragma Warnings (Off) was processed (excluding the front-end warnings which are handled separately by the front-end). Tested on x86_64-suse-linux, applied on the mainline. 2019-12-18 Eric Botcazou * gcc-interface/trans.c (Pragma_to_gnu) : Push a diagnostics state for pragma Warnings (Off) before turning off all the warnings and only pop it for pragma Warnings (On). 2019-12-18 Eric Botcazou * gnat.dg/warn32.adb: New test. Index: gcc-interface/trans.c =================================================================== --- gcc-interface/trans.c (revision 338441) +++ gcc-interface/trans.c (revision 338442) @@ -1975,7 +1975,21 @@ Pragma_to_gnu (Node_Id gnat_node) gnat_expr = Expression (Next (gnat_temp)); } else - gnat_expr = Empty; + { + gnat_expr = Empty; + + /* For pragma Warnings (Off), we save the current state... */ + if (kind == DK_IGNORED) + diagnostic_push_diagnostics (global_dc, location); + + /* ...so that, for pragma Warnings (On), we do not enable all + the warnings but just restore the previous state. */ + else + { + diagnostic_pop_diagnostics (global_dc, location); + break; + } + } imply = false; }