On Fri, Aug 26, 2016 at 10:53:01AM +0200, Richard Biener wrote:
> On Thu, Aug 25, 2016 at 3:39 PM, Marek Polacek <pola...@redhat.com> wrote:
> > On Thu, Aug 25, 2016 at 11:17:37AM +0200, Richard Biener wrote:
> >> On Wed, Aug 24, 2016 at 7:43 PM, Marek Polacek <pola...@redhat.com> wrote:
> >> > The -Wlogical-not-parentheses deliberately doesn't warn when the RHS has
> >> > boolean type.  But since in C the type of a comparison is int, we need
> >> > to check for tcc_comparison, too.
> >> >
> >> > Bootstrapped/regtested on x86_64-linux and ppc64le-redhat-linux, ok for 
> >> > trunk?
> >>
> >> What about using truth_value_p ()?  That also includes && and || (just
> >> in case those
> >> do not have boolean type).
> >
> > You're right that I should also handle || and && (done in this patch).  But 
> > I
> > can't use truth_value_p because we want to warn for e.g. "!a == (a & b)".
> 
> But a & b isn't truth_value_p.  a && b is.  Do we want to warn about
> !a == (a && b)?

We don't want to warn about !a == (a && b), I think.  But truth_value_p returns
true for both TRUTH_AND_EXPR and TRUTH_ANDIF_EXPR.  I find that confusing, and
I can't use it in the current form because of that.

        Marek

Reply via email to