[cfe-dev] Missing -Wparentheses warning
Mattias Haile via cfe-dev
cfe-dev at lists.llvm.org
Wed Sep 5 01:48:49 PDT 2018
Hi,
Im looking at an old minor bug for "Missing -Wparentheses warning" where
clang do not warning for a missing parentheses in the case of "assert(x &&
val == 4 || (!x && val == 5));" whereas GCC would complain about missing
parentheses for x && val == 4.
https://bugs.llvm.org/show_bug.cgi?id=18971
The following comments are found in the code so it seems like a conscious
decision.
// Warn about arg1 || arg2 && arg3, as GCC 4.3+ does.
// We don't warn for 'assert(a || b && "bad")' since this is safe.
And since we never warn on macros
if (Opc == BO_LOr && !OpLoc.isMacroID()/* Don't warn in macros. */)
This will not warn either.
define bar(x) \
( \
(void) 0 \
)
bar(x && val == 4 || !x && val == 5);
Not sure what to make of this bug.
Br. Mattias
PS. I'm new at this so play nice :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180905/384c86ae/attachment.html>
More information about the cfe-dev
mailing list