This is the mail archive of the
mailing list for the GCC project.
Re: [C++ PATCH] Fix -Wlogical-not-parentheses (PR c++/62199)
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: Jason Merrill <jason at redhat dot com>, Paolo Carlini <paolo dot carlini at oracle dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 22 Aug 2014 21:24:50 +0200 (CEST)
- Subject: Re: [C++ PATCH] Fix -Wlogical-not-parentheses (PR c++/62199)
- Authentication-results: sourceware.org; auth=none
- References: <20140820200252 dot GO14320 at redhat dot com> <53F50CE0 dot 5010305 at redhat dot com> <20140821154125 dot GS14320 at redhat dot com> <53F63BCE dot 4050006 at redhat dot com> <20140822144848 dot GB15033 at redhat dot com> <53F75981 dot 3020401 at oracle dot com> <20140822155914 dot GD15033 at redhat dot com> <53F76EB0 dot 7000507 at redhat dot com> <20140822163357 dot GE15033 at redhat dot com> <53F77563 dot 30301 at redhat dot com> <20140822184532 dot GF15033 at redhat dot com>
On Fri, 22 Aug 2014, Marek Polacek wrote:
On Fri, Aug 22, 2014 at 12:52:51PM -0400, Jason Merrill wrote:
On 08/22/2014 12:33 PM, Marek Polacek wrote:
On Fri, Aug 22, 2014 at 12:24:16PM -0400, Jason Merrill wrote:
Sorry to nitpick, but now that we aren't checking the lhs for BOOLEAN_TYPE,
do we need to look at it at all?
I believe so: if the LHS is an INTEGER_CST, we can't use TREE_OPERAND
on it. Happens e.g. for if (!5 > a).
Yes, but why do we want to use TREE_OPERAND on it?
Oh yeah, seems that we don't need that. Actually, I think we can take
this one step further: since we can't use unary ! on a vector, we can
drop the VECTOR_TYPE checks, meaning that we don't need the lhs
parameter at all! What do you say?
Note that there is a patch waiting for a review that makes us accept !v
for vector v:
I didn't check at what level you do the test, so I don't know if it can
see a TRUTH_NOT_EXPR for a vector or if it has already been replaced by
EQ_EXPR at that point.