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 08/21/2014 11:41 AM, Marek Polacek wrote:
+  current.lhs_type = cp_lexer_next_token_is (parser->lexer, CPP_NOT)
+		     ? TRUTH_NOT_EXPR : ERROR_MARK;
...
+      rhs_type = cp_lexer_next_token_is (parser->lexer, CPP_NOT)
+		 ? TRUTH_NOT_EXPR : ERROR_MARK;

Again, this indentation needs parens to survive Emacs.

+	  /* If the LHS was !CST, we have true/false now.  Convert it
+	     to integer type, otherwise we wouldn't warn.  */
+	  if (TREE_CODE (current.lhs) == INTEGER_CST)
+	    lhs = convert (integer_type_node, current.lhs);

Hmm, why are we checking for BOOLEAN_TYPE on the lhs, again? It seems to me that

bool b;
if (!b == 1)

is also probably an error.

Jason


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