diff options
author | Steve Baird <baird@adacore.com> | 2022-12-15 16:50:05 -0800 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-05-15 11:36:42 +0200 |
commit | a3594ab9646e083eb0e5984907285f6f2162eeea (patch) | |
tree | 2e17aeb06f6cfc5a13933dd56a1a59f2f5349316 /libgcc | |
parent | a1f35b49196ca219863cc6e64eb1d1eb1483cca9 (diff) | |
download | gcc-a3594ab9646e083eb0e5984907285f6f2162eeea.zip gcc-a3594ab9646e083eb0e5984907285f6f2162eeea.tar.gz gcc-a3594ab9646e083eb0e5984907285f6f2162eeea.tar.bz2 |
ada: Emit warnings for (some) ineffective static predicate tests
Generate a warning if a static predicate tests for a value that
does not belong to the parent subtype. For example, in
subtype S is Positive with Static_Predicate => S not in 0 | 11 | 222;
the 0 is ineffective because Positive already excludes that value.
Generation of this new warning is controlled by the -gnatw_s switch,
which can also be enabled via -gnatwa.
gcc/ada/
* warnsw.ads: Add a new element,
Warn_On_Ineffective_Predicate_Test, to the Opt_Warnings_Enum
enumeration type.
* warnsw.adb: Bind "-gnatw_s" to the new
Warn_On_Ineffective_Predicate_Test switch. Add the new switch to
the set of switches enabled by -gnata .
* sem_ch13.adb
(Build_Discrete_Static_Predicate): Declare new local procedure,
Warn_If_Test_Ineffective, which conditionally generates new
warning. Call this new procedure when building a new element of an
RList.
* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
Document the -gnatw_s switch (and the corresponding -gnatw_S
switch).
* gnat_ugn.texi: Regenerate.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions