]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Remove checks for the old rule 20
authorViljar Indus <indus@adacore.com>
Tue, 2 Sep 2025 07:30:53 +0000 (10:30 +0300)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 15 Sep 2025 12:59:31 +0000 (14:59 +0200)
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.

gcc/ada/ghost.adb

index d097c70b707f08d63c8bd7444f3191096bf6a711..40075bdf0a6b50e81f7f41d8b085fe989cd01b03 100644 (file)
@@ -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