[PATCH] Remove a compilation warning

Rich Felker dalias at libc.org
Fri Jan 1 20:39:20 UTC 2016


On Fri, Jan 01, 2016 at 02:44:25PM -0500, Jody Bruchon wrote:
> How about putting the left side in parentheses to silence the
> warning instead of turning the warning off completely?

My point was that the parentheses make the code less readable, not
more readable, and that nobody would reasonably mistake the operator
precedence in this case or in any case reported by
-Wlogical-not-parentheses. It's a bogus warning.

Rich

> On January 1, 2016 2:14:55 PM EST, Rich Felker <dalias at libc.org> wrote:
> >On Thu, Dec 31, 2015 at 11:01:24AM +0100, Cristian Ionescu-Idbohrn
> >wrote:
> >> Reported by gcc (Debian 5.3.1-4) 5.3.1 20151219
> >> 
> >> shell/ash.c: In function 'evaltree':
> >> shell/ash.c:8432:19: warning: logical not is only applied to the left
> >hand side of comparison [-Wlogical-not-parentheses]
> >>    if (!exitstatus == is_or)
> >>                    ^
> >
> >I would prefer turning off this warning instead of making the code
> >harder to read. If someone would read !a == b as !(a==b) then they
> >have much bigger C comprehension problems they need to work on.
> >
> >Rich
> >_______________________________________________
> >busybox mailing list
> >busybox at busybox.net
> >http://lists.busybox.net/mailman/listinfo/busybox
> 
> -- 
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.


More information about the busybox mailing list