summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/warn-bitwise-compare.c
Commit message (Collapse)AuthorAgeFilesLines
* Add -Wtautological-compare to -WallWeverything2019-11-121-0/+1
| | | | | | | | Some warnings in -Wtautological-compare subgroups are DefaultIgnore. Adding this group to -Wmost, which is part of -Wall, will aid in their discoverability. Differential Revision: https://reviews.llvm.org/D69292
* New tautological warning for bitwise-or with non-zero constant always true.Richard Trieu2019-10-191-1/+20
| | | | | | | | | | | | | | | | | | Taking a value and the bitwise-or it with a non-zero constant will always result in a non-zero value. In a boolean context, this is always true. if (x | 0x4) {} // always true, intended '&' This patch creates a new warning group -Wtautological-bitwise-compare for this warning. It also moves in the existing tautological bitwise comparisons into this group. A few other changes were needed to the CFGBuilder so that all bool contexts would be checked. The warnings in -Wtautological-bitwise-compare will be off by default due to using the CFG. Fixes: https://bugs.llvm.org/show_bug.cgi?id=42666 Differential Revision: https://reviews.llvm.org/D66046 llvm-svn: 375318
* Add a check for tautological bitwise comparisons to -Wtautological-compare.Jordan Rose2014-05-201-0/+28
This catches issues like: if ((x & 8) == 4) { ... } if ((x | 4) != 3) { ... } Patch by Anders Rönnholm! llvm-svn: 209221
OpenPOWER on IntegriCloud