https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70436
--- Comment #7 from Patrick Palka ---
BTW according to a working implementation of this -Wdangling-else warning (not
the above broken one I prematurely posted), the only suspicious use of dangling
else (i.e. a use in which the indentation is
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70436
--- Comment #6 from Patrick Palka ---
Turns out the prototype is pretty broken :P
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70436
--- Comment #5 from Marek Polacek ---
Thanks. I could take care of the C FE side ;). But let's strike this in the
next stage1.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70436
--- Comment #4 from Patrick Palka ---
Here's a prototype that seems to do the job. Whenever we see an unbraced if,
increment the counter. Whenever we see a compound statement, reset the
counter. Whenever we see an else, warn if counter > 1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70436
Marek Polacek changed:
What|Removed |Added
Status|UNCONFIRMED |NEW
Last reconfirmed|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70436
Patrick Palka changed:
What|Removed |Added
CC||ppalka at gcc dot gnu.org
--- Comment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70436
--- Comment #1 from Jakub Jelinek ---
Note clang warns here:
pr70405-3.c:11:3: warning: add explicit braces to avoid dangling else
[-Wdangling-else]
else
^
and it warns regardless of the indentation.