]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Suppress warnings on membership test of ranges
authorBob Duff <duff@adacore.com>
Fri, 29 Apr 2022 12:08:58 +0000 (08:08 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 1 Jun 2022 08:43:15 +0000 (08:43 +0000)
commit3cd52053f80846df2ea22e3fff059ebc094e649b
tree11051597b326f842e119d7f9f28d5c81622f87b1
parentae575e93b6f7fb7077940cb7410f899da184ec2d
[Ada] Suppress warnings on membership test of ranges

For a membership test "X in A .. B", the compiler used to warn if it
could prove that X is within one of the bounds.  For example, if we know
at compile time that X >= A, then the above could be replaced by "X <=
B".

This patch suppresses that warning, because there is really
nothing wrong with the membership test, and programmers sometimes
find it annoying.

gcc/ada/

* exp_ch4.adb (Expand_N_In): Do not warn in the above-mentioned
cases.
* fe.h (Assume_No_Invalid_Values): Remove from fe.h, because
this is not used in gigi.
* opt.ads (Assume_No_Invalid_Values): Improve the comment. We
don't need to "clearly prove"; we can just "prove". Remove the
comment about fe.h, which is no longer true.
gcc/ada/exp_ch4.adb
gcc/ada/fe.h
gcc/ada/opt.ads