]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Add assertions to Uintp
authorBob Duff <duff@adacore.com>
Mon, 5 Jul 2021 22:01:22 +0000 (18:01 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 21 Sep 2021 15:24:59 +0000 (15:24 +0000)
commitb12d18a82597b97cbaccbac4253e8837f339d9a0
tree0ebb150fd5c953a4fc9dd1c8baa9d6a4d13a5027
parent97a5ed2071fffe85ee1a07e0655740162e4cce64
[Ada] Add assertions to Uintp

gcc/ada/

* uintp.ads, uintp.adb: Add assertions.
(Ubool, Opt_Ubool): New "boolean" subtypes.
(UI_Is_In_Int_Range): The parameter should probably be
Valid_Uint, but we don't change that for now, because it causes
failures in gigi.
* sem_util.ads, sem_util.adb (Is_True, Is_False,
Static_Boolean): Use Opt_Ubool subtype.  Document the fact that
Is_True (No_Uint) = True.  Implement Is_False in terms of
Is_True.  We considered changing Static_Boolean to return Uint_1
in case of error, but that doesn't fit in well with
Static_Integer.
(Has_Compatible_Alignment_Internal): Deal with cases where Offs
is No_Uint. Change one "and" to "and then" to ensure we don't
pass No_Uint to ">", which would violate the new assertions.
* exp_util.adb, freeze.adb, sem_ch13.adb: Avoid violating new
assertions in Uintp.
gcc/ada/exp_util.adb
gcc/ada/freeze.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads
gcc/ada/uintp.adb
gcc/ada/uintp.ads