ada: Complete contracts of SPARK units
commit81c360bd932b38e91b82b7a98f88e61c764b56ff
authorYannick Moy <moy@adacore.com>
Thu, 23 Mar 2023 14:45:09 +0000 (23 15:45 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 26 May 2023 07:29:19 +0000 (26 09:29 +0200)
tree8c9d560ec899b5b2590168b0bac628e267cf062d
parent53d45e492ebb88a84d6440e7db089d5f78610274
ada: Complete contracts of SPARK units

SPARK units in the standard library (both Ada and GNAT ones) should have
subprograms correctly annotated with contracts, so that a SPARK subprogram
should always return (not fail or raise an exception) under the conditions
expressed in its precondition, unless it is a procedure annotated with
Might_Not_Return.

gcc/ada/

* libgnat/a-calend.ads: Mark with SPARK_Mode=>Off the functions which may
raise Time_Error.
* libgnat/a-ngelfu.ads: Mark with SPARK_Mode=>Off the functions which may
lead to an overflow (which is not the case of Tan with one parameter for
example, or Arctanh or Arcoth, despite their mathematical range covering
the reals).
* libgnat/a-textio.ads: Remove Always_Return annotation from functions, as
this is now compulsory for functions to always return in SPARK.
* libgnat/i-cstrin.ads: Add Might_Not_Return annotation to Update procedure
which may not return.
gcc/ada/libgnat/a-calend.ads
gcc/ada/libgnat/a-ngelfu.ads
gcc/ada/libgnat/a-textio.ads
gcc/ada/libgnat/i-cstrin.ads