This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/46742] -Wparentheses unexpectedly misses some cases
- From: "sirl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 17 Jul 2017 14:09:36 +0000
- Subject: [Bug c/46742] -Wparentheses unexpectedly misses some cases
- Auto-submitted: auto-generated
- References: <bug-46742-4@http.gcc.gnu.org/bugzilla/>
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.