[PATCH] D85287: Extend -Wtautological-bitwise-compare "bitwise or with non-zero value" warnings
Stephan Bergmann via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 5 02:28:13 PDT 2020
sberg created this revision.
sberg added reviewers: jordan_rose, rtrieu.
Herald added a project: clang.
sberg requested review of this revision.
...to C++ constant expression operands.
(I had been puzzled why Clang had not found <https://git.libreoffice.org/core/+/
55f3a4595891a8cc22272225d1c82419f28d4ef9%5E!/> "cid#1465512 Wrong operator used"
in the LibreOffice source code, only found by Coverity Scan. At least building
LibreOffice with this change caused no false positives.)
In C, values of const-qualified variables are never constant expressions, so
nothing should change for C code.
To avoid potential further false positives, restrict this change only to the
"bitwise or with non-zero value" warnings while keeping all other
-Wtautological-bitwise-compare warnings as-is, at least for now.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D85287
Files:
clang/lib/Analysis/CFG.cpp
clang/test/Sema/warn-bitwise-compare.c
clang/test/SemaCXX/warn-bitwise-compare.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85287.283171.patch
Type: text/x-patch
Size: 6916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200805/2984c6e8/attachment.bin>
More information about the cfe-commits
mailing list