On Wed, Apr 13, 2016 at 04:14:44PM +0200, Marek Polacek wrote:
> This patch is meant to be applied on top of the "Wparentheses overhaul" patch.
> 
> I really think that warning about the dangling else problem isn't appropriate
> as a part of the -Wparentheses warning, which I think should only deal with
> stuff like precedence of operators, i.e. things where ()'s are missing and not
> {}'s.
> 
> This new warning is, however, a subset of -Wparentheses.
> 
> Bootstrapped/regtested on x86_64-linux, ok for trunk or should I stash it
> for the next stage1?
> 
> 2016-04-13  Marek Polacek  <pola...@redhat.com>
> 
>       * c.opt (Wdangling-else): New option.
> 
>       * c-parser.c (c_parser_if_statement): Replace OPT_Wparentheses with
>       OPT_Wdangling_else.
> 
>       * parser.c (cp_parser_selection_statement): Replace OPT_Wparentheses
>       with OPT_Wdangling_else.
> 
>       * doc/invoke.texi: Document -Wdangling-else.
> 
>       * c-c++-common/Wdangling-else-1.c: New test.
>       * c-c++-common/Wdangling-else-2.c: New test.
>       * c-c++-common/Wdangling-else-3.c: New test.

LGTM, though I think it would be useful to include in invoke.texi also a
small example with for to make it clear the option also handles that.

        Jakub

Reply via email to