]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Use ghost predicate in standard library
authorYannick Moy <moy@adacore.com>
Thu, 20 Apr 2023 10:15:16 +0000 (12:15 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 13 Jun 2023 07:31:43 +0000 (09:31 +0200)
In preparation for attribute Initialized to become ghost, use aspect
Ghost_Predicate instead of Predicate in unit Ada.Strings.Superbounded
of the standard library.

gcc/ada/

* libgnat/a-strsup.ads: Change predicate aspect.
* sem_ch13.adb (Add_Predicate): Fix for first predicate.

gcc/ada/libgnat/a-strsup.ads
gcc/ada/sem_ch13.adb

index 7a8a2bac996ea07afc087894ddb54e45839e08a1..2e0cd98f8d4c46da93b1b2cca2ff3774d857f730 100644 (file)
@@ -69,7 +69,7 @@ package Ada.Strings.Superbounded with SPARK_Mode is
       --  Leaving it out is more efficient.
    end record
    with
-     Predicate =>
+     Ghost_Predicate =>
        Current_Length <= Max_Length
          and then Data (1 .. Current_Length)'Initialized,
      Put_Image => Put_Image;
index 32771f06d76ca4c00db06cfb686d4c10a3d6791b..2b8b64aa392511ed90330bf5b682d6c272ab3558 100644 (file)
@@ -10101,9 +10101,13 @@ package body Sem_Ch13 is
          --  Start of processing for Add_Predicate
 
          begin
-            --  A ghost predicate is checked only when Ghost mode is enabled
+            --  A ghost predicate is checked only when Ghost mode is enabled.
+            --  Add a condition for the presence of a predicate to be recorded,
+            --  which is needed to generate the corresponding predicate
+            --  function.
 
             if Is_Ignored_Ghost_Pragma (Prag) then
+               Add_Condition (New_Occurrence_Of (Standard_True, Sloc (Prag)));
                return;
             end if;