diff options
author | Marek Polacek <polacek@redhat.com> | 2017-09-04 14:05:01 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2017-09-04 14:05:01 +0000 |
commit | bc7fe95200214ce70419fde6f965dc88bbd645a6 (patch) | |
tree | ece5a8c4fb2b7d91d89c483d88f20c4058b89390 /gcc/doc | |
parent | 8713d0f1c46f81107ea61781e2f4dc918d0fb67d (diff) | |
download | gcc-bc7fe95200214ce70419fde6f965dc88bbd645a6.zip gcc-bc7fe95200214ce70419fde6f965dc88bbd645a6.tar.gz gcc-bc7fe95200214ce70419fde6f965dc88bbd645a6.tar.bz2 |
re PR c/81783 (-Wtautological-compare could do better)
PR c/81783
* c-warn.c (warn_tautological_bitwise_comparison): New function.
(warn_tautological_cmp): Call it.
* doc/invoke.texi: Update -Wtautological-compare documentation.
* c-c++-common/Wtautological-compare-5.c: New test.
From-SVN: r251660
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index d15497c..ed438d4 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -5492,6 +5492,14 @@ int i = 1; @dots{} if (i > i) @{ @dots{} @} @end smallexample + +This warning also warns about bitwise comparisons that always evaluate +to true or false, for instance: +@smallexample +if ((a & 16) == 10) @{ @dots{} @} +@end smallexample +will always be false. + This warning is enabled by @option{-Wall}. @item -Wtrampolines |