-Wparentheses lumps too much together

Ian Lance Taylor iant@google.com
Sat Jan 12 11:40:00 GMT 2008


"Doug Gregor" <doug.gregor@gmail.com> writes:

> To make this discussion a bit more concrete, the attached patch
> removes this particular warning from -Wparentheses and puts it into a
> new warning, -Wprecedence, that is not enabled by -Wall. This is
> slightly more fine-grained than what -Wparentheses does now. Opinions?

Personally, I think it should stay in -Wall.  But I'm willing to hear
other opinions.


> @@ -6430,7 +6430,7 @@ convert_for_assignment (tree type, tree 
>  
>    /* If -Wparentheses, warn about a = b = c when a has type bool and b
>       does not.  */
> -  if (warn_parentheses
> +  if ((warn_parentheses || warn_precedence)
>        && type == boolean_type_node
>        && TREE_CODE (rhs) == MODIFY_EXPR
>        && !TREE_NO_WARNING (rhs)

I believe this case (in cp/typeck.c) should only check
warn_parentheses, not warn_precedence.


I'm inclined to approve this if -Wprecedence stays in -Wall, but I'd
like to hear if anybody else has anything to say.

Ian



More information about the Gcc-patches mailing list