[Bug c/46742] -Wparentheses unexpectedly misses some cases
sirl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 17 14:09:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46742
--- Comment #4 from Franz Sirl <sirl at gcc dot gnu.org> ---
APPEARS_TO_BE_BOOLEAN_EXPR_P was introduced with r141340 (PR 7543), but I
cannot find a discussion on why this suppression makes sense. When I disable it
I only see 3 places where it triggers in trunk:
gcc/cp/lex.c:115:24: warning: suggest parentheses around operand of '!' or
change '&' to '&&' or '!' to '~' [-Wparentheses]
libdecnumber/decNumber.c:6036:11: warning: suggest parentheses around operand
of '!' or change '&' to '&&' or '!' to '~' [-Wparentheses]
libgcc/libgcc2.c:1949:36: warning: suggest parentheses around operand of '!' or
change '&' to '&&' or '!' to '~' [-Wparentheses]
To my eyes in all 3 cases a '&&' would be clearer, so the warning shouldn't be
suppressed?
If changing the behaviour of -Wparentheses after this long time is considered a
problem, maybe we could add the stricter check to the relatively new
-Wlogical-not-parentheses like clang?
Note: clang documents -Wlogical-not-parentheses for comparison AND bitwise
operators, GCC only for comparison operators.
More information about the Gcc-bugs
mailing list