This is the mail archive of the 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: PATCH RFA: Add support for -Wparentheses to the C++ frontend (PR c++/19564)

Ian Lance Taylor wrote:

>  tree
> -build_x_binary_op (enum tree_code code, tree arg1, tree arg2,
> -		   bool *overloaded_p)
> +build_x_binary_op (enum tree_code code, tree arg1, enum tree_code arg1_code,
> +		   tree arg2, enum tree_code arg2_code, bool *overloaded_p)

Please add documentation for the new arguments, documenting, in
particular, the ERROR_MARK case.  And, why not just have
build_x_binary_op check TREE_NO_WARNING itself?  And, could we just have
one "bool honor_warn_parentheses_p" parameter?

I'm sure I'm being dense here, but I'm hoping you can tell me the answer
quicker than I can work it out.

> +  /* Check for cases such as x+y<<z which users are likely to
> +     misinterpret.  But don't warn about obj << x + y, since that is a
> +     common idiom for I/O.  */
> +  if (warn_parentheses
> +      && !processing_template_decl
> +      && !error_operand_p (arg1)
> +      && !error_operand_p (arg2)
> +      && (code != LSHIFT_EXPR
> +	  || !IS_AGGR_TYPE (TREE_TYPE (arg1))))
> +    warn_about_parentheses (code, arg1_code, arg2_code);

It would be better to check !CLASS_TYPE_P here.  IS_AGGR_TYPE should
really be named MAYBE_CLASS_TYPE_P -- and since we know we're not in a
template, MAYBE_CLASS_TYPE_P is just CLASS_TYPE_P. :-)

OK with those changes.

Mark Mitchell
(650) 331-3385 x713

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