[all-commits] [llvm/llvm-project] f62d18: [Clang] Extend -Wbool-operation to warn about bitw...
Dávid Bolvanský via All-commits
all-commits at lists.llvm.org
Sun Oct 3 02:06:55 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f62d18ff140f67a8776a7a3c62a75645d8d540b5
https://github.com/llvm/llvm-project/commit/f62d18ff140f67a8776a7a3c62a75645d8d540b5
Author: Dávid Bolvanský <david.bolvansky at gmail.com>
Date: 2021-10-03 (Sun, 03 Oct 2021)
Changed paths:
M clang/include/clang/Basic/DiagnosticGroups.td
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/Sema/SemaChecking.cpp
M clang/test/Misc/warning-wall.c
A clang/test/Sema/warn-bitwise-and-bool.c
A clang/test/Sema/warn-bitwise-or-bool.c
Log Message:
-----------
[Clang] Extend -Wbool-operation to warn about bitwise and of bools with side effects
Motivation: https://arstechnica.com/gadgets/2021/07/google-pushed-a-one-character-typo-to-production-bricking-chrome-os-devices/
Warn for pattern boolA & boolB or boolA | boolB where boolA and boolB has possible side effects.
Casting one operand to int is enough to silence this warning: for example (int)boolA & boolB or boolA| (int)boolB
Fixes https://bugs.llvm.org/show_bug.cgi?id=51216
Differential Revision: https://reviews.llvm.org/D108003
More information about the All-commits
mailing list