From patchwork Mon Sep 15 13:01:24 2025 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: 120262 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 60F0B3857BB3 for ; Mon, 15 Sep 2025 13:11:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 60F0B3857BB3 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=bJG8JSZ9 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id AE6F6385695B for ; Mon, 15 Sep 2025 13:02:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE6F6385695B Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AE6F6385695B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757941327; cv=none; b=oUhaVY4XR0c5i0YMXmINhiFtsW5Hpu8DSc0I/o6Yo25q9XES97mIQiLi2JeH8xUlesykbOsSLiIukS0XjDEIAlhKSxVEOOVSs28u+hA0nnYm8g+zImMRK+VMNBOHaNTRIacmxLOUTzljmLUSzleQOUFAYYj+Y45pTHyZWlht1pU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757941327; c=relaxed/simple; bh=sNNuuafAadVjjSMnBie1+0MdTGhWsI7nrxXkT/T0qks=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=tUdpZe+Xa8RVpT7Yk+F4MYzIcx6J8C8cPZapQvTcQJpkRjeyJcAoCCqKM4Y0WjmdLeLxhk395u2EWBDiH+SnRJNAru9DJhXAP9bMbhkCULurTdj9H7VvIFNLmpIkHg2F01wotGrae01KGZxkrdEv8jAXjc7PDh/Ca/o15TaCKfE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE6F6385695B Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-45dd5e24d16so39729955e9.3 for ; Mon, 15 Sep 2025 06:02:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1757941325; x=1758546125; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=deTTNBr4T+VafXih2wUmy9xmlwJ76aJVdsep9XBAPlk=; b=bJG8JSZ93F8g71FH9XPZiBwplcQOijMmrdLPfJe9WobKZbPQ4EsCHcGY2iw3Hby6WM ttKGhhzlU5JIUO9EUjLT7PfUHTz+fDBGTEZlrh06KS97PzsbWHR4hc6uKOfDFsfnOKSc QxlYguGJ4UGR0vad5OzSBs3vnORax1GthZQxGBzXRwmIxYh17aYArCETCZjrYuHb+14d I0xT8AG6iTOJiFkU+hLniW0cJB/Lhyn2EFF5E4/pvnwNBvFa5HySGI08RCMPYeHG2CZH G4zqic1FAKW/Cwjlgd+/M1fvOnVSb+KWihTDXyzLgXhQ78X0ywVfxqzqXUgTA0akjpxT PYYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757941325; x=1758546125; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message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GdA6ULpZTYcwh/SOd4GpUqGAWqHUFo6Q+BbX1GNibCbGMSQgn8Q== X-Received: by 2002:a05:600c:6549:b0:45d:5c71:769a with SMTP id 5b1f17b1804b1-45f211efde9mr79626635e9.26.1757941325247; Mon, 15 Sep 2025 06:02:05 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3ea4b52b7fcsm5428733f8f.33.2025.09.15.06.02.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Sep 2025 06:02:04 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED 18/27] ada: Remove checks for the old rule 20 Date: Mon, 15 Sep 2025 15:01:24 +0200 Message-ID: <20250915130135.2720894-18-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250915130135.2720894-1-poulhies@adacore.com> References: <20250915130135.2720894-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org From: Viljar Indus This rule was removed. This can scenario can be detected by Rule 18. gcc/ada/ChangeLog: * ghost.adb (Is_Ok_Pragma): Remove calls to Check_Policies. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/ghost.adb | 48 +++++------------------------------------------ 1 file changed, 5 insertions(+), 43 deletions(-) diff --git a/gcc/ada/ghost.adb b/gcc/ada/ghost.adb index d097c70b707f..40075bdf0a6b 100644 --- a/gcc/ada/ghost.adb +++ b/gcc/ada/ghost.adb @@ -278,9 +278,9 @@ package body Ghost is -- -- * Be subject to pragma Ghost - function Is_OK_Pragma (Prag : Node_Id; Id : Entity_Id) return Boolean; - -- Determine whether node Prag is a suitable context for a reference - -- to a Ghost entity Id. To qualify as such, Prag must either + function Is_OK_Pragma (Prag : Node_Id) return Boolean; + -- Determine whether node Prag is a suitable context for a ghost + -- reference. To qualify as such, Prag must either -- -- * Be an assertion expression pragma -- @@ -424,45 +424,11 @@ package body Ghost is -- Is_OK_Pragma -- ------------------ - function Is_OK_Pragma (Prag : Node_Id; Id : Entity_Id) return Boolean + function Is_OK_Pragma (Prag : Node_Id) return Boolean is - procedure Check_Policies; - -- Verify that the Ghost policy in effect at the point of the - -- declaration of Ghost entity Id (if present) is the same as - -- the assertion policy for the pragma. Emit an error if this - -- is not the case. - - -------------------- - -- Check_Policies -- - -------------------- - - procedure Check_Policies is - begin - -- If the Ghost policy in effect at the point of the - -- declaration of Ghost entity Id is Ignore, then the assertion - -- policy of the pragma must be Ignore (SPARK RM 6.9(20)). - - if Present (Id) - and then not Is_Checked_Ghost_Entity (Id) - and then not Is_Ignored (Prag) - then - Error_Msg_N (Ghost_Policy_Error_Msg, Ghost_Ref); - Error_Msg_NE - ("\ghost entity & has policy `Ignore`", - Ghost_Ref, Ghost_Id); - Error_Msg_N - ("\assertion expression has policy `Check`", - Ghost_Ref); - end if; - end Check_Policies; - - -- Local variables - Prag_Id : Pragma_Id; Prag_Nam : Name_Id; - -- Start of processing for Is_OK_Pragma - begin if Nkind (Prag) /= N_Pragma then return False; @@ -493,10 +459,6 @@ package body Ghost is and then Assertion_Expression_Pragma (Prag_Id) and then Prag_Id /= Pragma_Predicate then - -- Ensure that the assertion policy and the Ghost policy are - -- compatible (SPARK RM 6.9(20)). - - Check_Policies; return True; -- A pragma that applies to a Ghost construct or specifies an @@ -781,7 +743,7 @@ package body Ghost is elsif Is_OK_Declaration (Par) then return True; - elsif Is_OK_Pragma (Par, Ghost_Id) then + elsif Is_OK_Pragma (Par) then return True; elsif Is_OK_Statement (Par, Ghost_Id, Prev) then