This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Some real-life feedback on -Wmisleading-indentation


Compiling Wine with GCC trunk (to become GCC 6) I noticed four
dozen of warnings triggered by -Wmisleading-indentation.

Some are simply weird formatting, some may be indicative of 
real issues -- and I have started to look into them one by 
one and submitting patches (to Wine).

However, there is a pattern I noticed which, while a bit weird 
in terms of formatting, does not really strike me as something
-Wmisleading-indentation should warn about:

    VariantInit(&ret);
    hr = IWinHttpRequest_Invoke(request, ...);
    ok(hr == DISP_E_UNKNOWNINTERFACE, "error %#x\n", hr);
        
    VariantInit(&ret);
if (0) /* crashes */
    hr = IWinHttpRequest_Invoke(request, ...);
            
    params.cArgs = 1;
    hr = IWinHttpRequest_Invoke(request, ...);
    ok(hr == DISP_E_TYPEMISMATCH, "error %#x\n", hr);

    VariantInit(&arg[2]);

This is from the Wine testsuite, and the if (0) in colum one guards 
one invication of the function under test that would crash (so is 
the equivalent of #if 0...#endif, except that it avoids conditional 
compilation).

Is this a bit unusual?  Definitely?  Does it look like a one of
those cases a programmer would actually be tempted to misread?
I don't think so.

What do you think?

Gerald


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]