Re: C PATCH to overhaul warning about dangling else (PR c/70436)

2016-04-15 Thread Jakub Jelinek
On Wed, Apr 13, 2016 at 04:14:03PM +0200, Marek Polacek wrote: > I revamped the warning so that it follows what the C++ FE does (i.e. passing > IF_P bools here and there) and it seems to work quite well. I didn't mean to > tackle the OMP bits but I bet it would be just a matter of passing IF_P >

Re: C PATCH to overhaul warning about dangling else (PR c/70436)

2016-04-13 Thread Marek Polacek
On Wed, Apr 13, 2016 at 05:00:00PM +0200, Bernd Schmidt wrote: > On 04/13/2016 04:14 PM, Marek Polacek wrote: > >I revamped the warning so that it follows what the C++ FE does (i.e. passing > >IF_P bools here and there) and it seems to work quite well. I didn't mean to > >tackle the OMP bits but

Re: C PATCH to overhaul warning about dangling else (PR c/70436)

2016-04-13 Thread Jakub Jelinek
On Wed, Apr 13, 2016 at 05:43:25PM +0200, Marek Polacek wrote: > 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

Re: C PATCH to overhaul warning about dangling else (PR c/70436)

2016-04-13 Thread Marek Polacek
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

Re: C PATCH to overhaul warning about dangling else (PR c/70436)

2016-04-13 Thread Jakub Jelinek
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 > @@ -5533,7 +5548,7 @@ c_parser_switch_statement (c_parser *parser) >c_start_case

Re: C PATCH to overhaul warning about dangling else (PR c/70436)

2016-04-13 Thread Bernd Schmidt
On 04/13/2016 04:14 PM, Marek Polacek wrote: I revamped the warning so that it follows what the C++ FE does (i.e. passing IF_P bools here and there) and it seems to work quite well. I didn't mean to tackle the OMP bits but I bet it would be just a matter of passing IF_P somewhere.

Re: C PATCH to overhaul warning about dangling else (PR c/70436)

2016-04-13 Thread Marek Polacek
Looks like Joseph will be on vacation for the next few days so if we want to get this in sooner, someone else will need to review & approve the patch.

Re: C PATCH to overhaul warning about dangling else (PR c/70436)

2016-04-13 Thread Jakub Jelinek
On Wed, Apr 13, 2016 at 04:14:03PM +0200, Marek Polacek wrote: > I said I'd take care of the C FE part of this PR, so here it is. > > As this PR shows, our dangling else warning regressed in such a way that we > weren't warning about cases such as > > if (A) > for (;;) > if (B) > bar

C PATCH to overhaul warning about dangling else (PR c/70436)

2016-04-13 Thread Marek Polacek
I said I'd take care of the C FE part of this PR, so here it is. As this PR shows, our dangling else warning regressed in such a way that we weren't warning about cases such as if (A) for (;;) if (B) bar (); else baz (); The problem was that we were setting FIRST_IF only when an