This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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 ();
> else
>   baz ();
> 
> The problem was that we were setting FIRST_IF only when an "if" was immediately
> followed by an RID_IF token.
> 
> 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.

I'll look at the OMP bits both for C and C++ once/if this is committed.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]