]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Update contracts on Strings libraries
authorYannick Moy <moy@adacore.com>
Fri, 28 Jun 2024 15:31:19 +0000 (17:31 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 1 Aug 2024 15:14:38 +0000 (17:14 +0200)
commit8739098f8d2b7de85516be4272e70f1898ba1271
tree0b579f2d7566b2b4e55293ed524c0f9b242746a7
parentaced54ff681f671b2c5b99d18dddbbc570ac2a57
ada: Update contracts on Strings libraries

The contracts of Ada.Strings.Bounded.To_String and
Ada.Strings.Fixed.Delete are updated to reflect the standard spec and to
allow proof of callers.

gcc/ada/

* libgnat/a-strbou.ads (To_String): Add a postcondition to state
the value of bounds of the returned string, which helps with proof
of callers.
* libgnat/a-strfix.adb (Delete): Fix implementation to produce
correct result in all cases. For example, returned string should
always have a lower bound of 1, which was not respected in one
case. This was not detected by proof, since this code was dead
according to the too strict precondition.
* libgnat/a-strfix.ads (Delete): State the correct precondition
from standard which allows a value of Through beyond the last
valid index, and also restricts values of From from below. Update
the Contract_Cases accordingly to allow new values of parameters.
gcc/ada/libgnat/a-strbou.ads
gcc/ada/libgnat/a-strfix.adb
gcc/ada/libgnat/a-strfix.ads