On 06/02/2014 02:50 AM, Marek Polacek wrote:
+ && TREE_CODE (arg1.value) == EQ_EXPR)
...
+ && TREE_CODE (current.lhs) == EQ_EXPR
It seems like your version only warns about ==, while the clang version warns about all comparisons.
+ && (complain_flags (decltype_p) & tf_warning)
Let's not call complain_flags multiple times in the function. In fact this will always be true, so you could just drop it.
Also for C++, I think we don't want this warning to trigger when the operator (==, !=, >, <, <=, >=) is overloaded. But I admit I haven't even tried that, and I don't know how to detect overloaded operators except DECL_OVERLOADED_OPERATOR_P.
Overloaded operators have the same precedence, so I think it's appropriate to give the warning whether or not the operators are overloaded.
Jason