This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Fix -Wlogical-not-parentheses (PR c++/62199)


On Fri, Aug 22, 2014 at 12:24:16PM -0400, Jason Merrill wrote:
> On 08/22/2014 11:59 AM, Marek Polacek wrote:
> >+	  if (TREE_CODE (current.lhs) == INTEGER_CST)
> >+	    warn_logical_not_parentheses (current.loc, current.tree_type,
> >+					  current.lhs, rhs);
> >+	  else if (EXPR_P (current.lhs))
> >+	    warn_logical_not_parentheses (current.loc, current.tree_type,
> >+					  TREE_OPERAND (current.lhs, 0), rhs);
> 
> 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).

	Marek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]