Closed
Bug 1802540
Opened 3 years ago
Closed 3 years ago
Clang-tidy bogusly claims that "this expression can be simplified using De Morgan's law"
Categories
(Developer Infrastructure :: Source Code Analysis, defect)
Developer Infrastructure
Source Code Analysis
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1804160
People
(Reporter: jseward, Unassigned)
Details
Phabricator URL: https://phabricator.services.mozilla.com/D163112
Quite a lot. I think these claims are all bogus. They are certainly
distracting. Eg:
MOZ_ASSERT(elemSize >= 1 && elemSize <= 16);
Lint: clang-tidy
WARNING: boolean expression can be simplified by DeMorgan's theorem
| Reporter | ||
Comment 1•3 years ago
|
||
Looking at this more, all of the complaints occur inside uses of MOZ_ASSERT.
I guess this is because, starting with, eg
MOZ_ASSERT(x == 4 || x == 37)
and given
#define MOZ_ASSERT(_cond) \
if (!(_cond)) crash(); \
the analyser sees the text after macro-expansion, viz
if (!(x == 4 || x == 37)) crash();
and I suppose it is right to claim that it could, per de Morgan, be
converted into
if (x != 4 && x != 37) crash();
even though the complaint is un-actionable.
Maybe tell clang-tidy to not do this analysis inside MOZ_ASSERT et al?
Or just turn this warning off entirely?
Updated•3 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•