[Ada] Facilitate proof of Overwrite in bounded strings library
Consistently use >= operator in both the code and contracts of function/procedure Overwrite, to facilitate proof, instead of the strict inequality > sometimes, as only New_Item remains in the result in the case of equal size too. gcc/ada/ * libgnat/a-strbou.ads (Overwrite): Switch to >= operator in contracts. * libgnat/a-strsup.adb (Super_Overwrite): Switch to >= operator in code of procedure (function already uses it). * libgnat/a-strsup.ads (Super_Overwrite): Switch to >= operator in contracts.
This commit is contained in:
parent
9e5b1b076a
commit
3fe35ab093
|
@ -1898,7 +1898,7 @@ package Ada.Strings.Bounded with SPARK_Mode is
|
||||||
-- some characters of Source are remaining at the left.
|
-- some characters of Source are remaining at the left.
|
||||||
|
|
||||||
and then
|
and then
|
||||||
(if New_Item'Length > Max_Length then
|
(if New_Item'Length >= Max_Length then
|
||||||
|
|
||||||
-- New_Item covers all Max_Length characters
|
-- New_Item covers all Max_Length characters
|
||||||
|
|
||||||
|
@ -1984,7 +1984,7 @@ package Ada.Strings.Bounded with SPARK_Mode is
|
||||||
-- some characters of Source are remaining at the left.
|
-- some characters of Source are remaining at the left.
|
||||||
|
|
||||||
and then
|
and then
|
||||||
(if New_Item'Length > Max_Length then
|
(if New_Item'Length >= Max_Length then
|
||||||
|
|
||||||
-- New_Item covers all Max_Length characters
|
-- New_Item covers all Max_Length characters
|
||||||
|
|
||||||
|
|
|
@ -1226,7 +1226,7 @@ package body Ada.Strings.Superbounded with SPARK_Mode is
|
||||||
(New_Item (New_Item'First .. New_Item'Last - Droplen));
|
(New_Item (New_Item'First .. New_Item'Last - Droplen));
|
||||||
|
|
||||||
when Strings.Left =>
|
when Strings.Left =>
|
||||||
if New_Item'Length > Max_Length then
|
if New_Item'Length >= Max_Length then
|
||||||
Source.Data (1 .. Max_Length) := Super_String_Data
|
Source.Data (1 .. Max_Length) := Super_String_Data
|
||||||
(New_Item
|
(New_Item
|
||||||
(New_Item'Last - Max_Length + 1 .. New_Item'Last));
|
(New_Item'Last - Max_Length + 1 .. New_Item'Last));
|
||||||
|
|
|
@ -2000,7 +2000,7 @@ package Ada.Strings.Superbounded with SPARK_Mode is
|
||||||
-- Source are remaining at the left.
|
-- Source are remaining at the left.
|
||||||
|
|
||||||
and then
|
and then
|
||||||
(if New_Item'Length > Source.Max_Length then
|
(if New_Item'Length >= Source.Max_Length then
|
||||||
|
|
||||||
-- New_Item covers all Max_Length characters
|
-- New_Item covers all Max_Length characters
|
||||||
|
|
||||||
|
@ -2089,7 +2089,7 @@ package Ada.Strings.Superbounded with SPARK_Mode is
|
||||||
-- Source are remaining at the left.
|
-- Source are remaining at the left.
|
||||||
|
|
||||||
and then
|
and then
|
||||||
(if New_Item'Length > Source.Max_Length then
|
(if New_Item'Length >= Source.Max_Length then
|
||||||
|
|
||||||
-- New_Item covers all Max_Length characters
|
-- New_Item covers all Max_Length characters
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue