This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -Wparentheses lumps too much together
- From: Ian Lance Taylor <iant at google dot com>
- To: "Doug Gregor" <doug dot gregor at gmail dot com>
- Cc: jklowden at freetds dot org, gcc-patches at gcc dot gnu dot org, gcc at gnu dot org
- Date: 11 Jan 2008 18:52:27 -0800
- Subject: Re: -Wparentheses lumps too much together
- References: <20071219200235.GA21525@oak.schemamania.org> <24b520d20801111427r6081fec6k6a4a513e5022c492@mail.gmail.com>
"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