On Wed, Apr 13, 2016 at 05:09:58PM +0200, Jakub Jelinek wrote:
> On Wed, Apr 13, 2016 at 04:14:03PM +0200, Marek Polacek wrote:
> >     PR c/70436
> >     * c-parser.c
> >     (c_parser_statement_after_labels): Add IF_P argument and adjust
> >     callers.
> 
> Can you put 
 
Were you going to say to put them on the same line?  ;)
Done.

> > @@ -5533,7 +5548,7 @@ c_parser_switch_statement (c_parser *parser)
> >    c_start_case (switch_loc, switch_cond_loc, expr, explicit_cast_p);
> >    save_break = c_break_label;
> >    c_break_label = NULL_TREE;
> > -  body = c_parser_c99_block_statement (parser);
> > +  body = c_parser_c99_block_statement (parser, NULL/*if??*/);
> >    c_finish_case (body, ce.original_type);
> >    if (c_break_label)
> >      {
> 
> Is:
> void bar (int);
> 
> void
> foo (int a, int b, int c)
> {
>   if (a)
>     switch (b)
>       case 0:
>         if (c)
>           bar (1);
>   else
>     bar (2);
> }
> something -Wdangling-else should warn about?  Note, g++ does not warn
> about it, and clang nor clang++ doesn't either.
> As it is something that unlikely happens in user code, I guess it is ok
> to not warn about this for GCC 6, and we can deal with that later on.

Seems quite artificial in the sense that I wouldn't expect many switch
statements to be lacking {}'s, but also I don't think that the warning
would be inappropriate here.  Since I already regtested my patch, I'll
go ahead with that, but sure, could be something to address in the future.

        Marek

Reply via email to