https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70922
--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The warning is about dangling else, which you have in the source. if (cond) for (...) if (cond2) ... else and while the C/C++ grammar say they bind to the inner-most if, many people actually mistake this. Put all of the above into a macro and with Marek's patch you won't get desirable warning. Now, you say that if the outer if is not from a macro or outer macro and the inner else is together with the inner if from the same macro, we shouldn't warn? That sounds quite complicated set of rules. What if the outer if, inner if and else each comes from a different macro? Note, clang and clang++ warn on this as well.