Some real-life feedback on -Wmisleading-indentation

Bernd Schmidt bernds_cb1@t-online.de
Tue Jan 12 17:18:00 GMT 2016


On 01/12/2016 06:44 AM, Jeff Law wrote:
>>> I would argue that each of these does represent misleading
>>> indentation and that the warning is warranted for each.
>>> Perhaps they aren't as bad as prior cases, but I'd still
>>> consider them mis-leading.
>> (https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03242.html)
> I still stand by that assessment.
>
> ISTM for the wine case the backwards indentation (column-wise) of the IF
> may be the right filter, maybe that in conjunction with the blank line
> heuristic.  However, I stand by my belief that the blank line heuristic
> is wrong when used by itself.

I also still agree with this. It's worthy of note that most cases in 
Wine that use this pattern enclose the commented out code in braces, as in

if (0)
{
      /* stuff */
}
      normally indented code

If we warn about this, I'd agree it isn't helpful. IMO code that uses 
the pattern Gerald quoted should be fixed to use #if or add braces.


Bernd




More information about the Gcc mailing list