Created attachment 44279 [details] test case with a block macro Today at work an instance of the "goto fail" bug was discovered and fixed (4 years after being introduced). We have a coding rule to enforce brackets even for single instructions, exactly to avoid that kind of bug. It's quite well respected, but we have no tool to check it. I learned about the Wmisleading-indentation feature, that is awesome ! But we already have gcc 6 and -Wall, and the bug was not found. That's because of that exception : "The warning is not issued after a #line directive, since this typically indicates autogenerated code, and no assumptions can be made about the layout of the file that the directive references.". That's a shame. We have a few #line directives in most of our files (compiled by gcc) because we use an apple extension called blocks (a kind of closure). More details at https://techtalk.intersec.com/2014/11/blocks-rewriting-with-clang/ So it would be great to have the Wmisleading-indentation feature even for files with #line directives, perhaps with another flag ? Any idea or suggestion or workaround is welcome. Well an easy workaround is to disable the #line directives just for running that check from time to time. So I just did that but still no warning, there is another problem, I just realized this case is more complex than it looked. See attachment for a simplified test case. Since the first line hides a block macro, the problem is not detected anyway.
(In reply to Xavier from comment #0) > > That's a shame. We have a few #line directives in most of our files > (compiled by gcc) because we use an apple extension called blocks (a kind of > closure). Tangent, but the bug for adding blocks support to gcc is bug 78352 > > More details at > https://techtalk.intersec.com/2014/11/blocks-rewriting-with-clang/ >
cc-ing author of -Wmisleading-indentation