]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Global contracts on expression functions in Ada.Strings.Superbounded
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 27 Jul 2021 14:06:30 +0000 (16:06 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 25 Oct 2021 15:07:20 +0000 (15:07 +0000)
gcc/ada/

* libgnat/a-strsup.ads (Super_Length, Super_Element,
Super_Slice): Add Global contracts.

gcc/ada/libgnat/a-strsup.ads

index 7428e9c2cd7ee17b7cb25aa1500a9e0514e61df6..ae4339f2957b27924a75edb3ec01e227e67c6116 100644 (file)
@@ -76,7 +76,8 @@ package Ada.Strings.Superbounded with SPARK_Mode is
    --  that they can be renamed in Ada.Strings.Bounded.Generic_Bounded_Length.
 
    function Super_Length (Source : Super_String) return Natural
-   is (Source.Current_Length);
+   is (Source.Current_Length)
+   with Global => null;
 
    --------------------------------------------------------
    -- Conversion, Concatenation, and Selection Functions --
@@ -620,7 +621,8 @@ package Ada.Strings.Superbounded with SPARK_Mode is
    is (if Index <= Source.Current_Length
        then Source.Data (Index)
        else raise Index_Error)
-   with Pre => Index <= Super_Length (Source);
+   with Pre    => Index <= Super_Length (Source),
+        Global => null;
 
    procedure Super_Replace_Element
      (Source : in out Super_String;
@@ -649,8 +651,9 @@ package Ada.Strings.Superbounded with SPARK_Mode is
           --  get the null string in accordance with normal Ada slice rules.
 
           String (Source.Data (Low .. High)))
-   with Pre => Low - 1 <= Super_Length (Source)
-                 and then High <= Super_Length (Source);
+   with Pre    => Low - 1 <= Super_Length (Source)
+                    and then High <= Super_Length (Source),
+        Global => null;
 
    function Super_Slice
      (Source : Super_String;