[Bug c/72797] bogus -Wmisleading-indentation with -ftrack-macro-expansion=0 on a multi-statement macro
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Aug 3 22:05:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72797
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #0)
> When invoked with the -ftrack-macro-expansion=0 and
> -Wmisleading-indentation, GCC warns on the following program derived from a
> GCC test suite. Since the code is clearly indented and there is no mention
> of the -ftrack-macro-expansion option having this effect, the warning is
> unexpected.
No mention where? Some diagnostics rely on macro info to produce better
diagnostics. If you deactivate it, then you get bad diagnostics. Don't do that.
> In addition, the documentation for -ftrack-macro-expansion=level says that
>
> Value '0' of level de-activates this option just as if no
> -ftrack-macro-expansion was present on the command line.
>
> Contrary to the statement above, GCC output changes and the warning
> disappears when the -ftrack-macro-expansion option is removed.
Yes, this must be a relic of the time it was not the default.
Personally, I think we should get rid of this option. This was useful when
tracking macro expansion was new and to work-around bugs. There is no point in
maintaining two code paths and much less on trying to make diagnostics better
for the -ftrack-macro-expansion=0 path. That effort would be better spent in
making the default more efficient and useful.
If we give a warning for:
do { if (i) i = 0; i++; } while (0);
that is, the processed source, that would be different. But it doesn't seem to
be the case in 7.0
More information about the Gcc-bugs
mailing list