This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Some real-life feedback on -Wmisleading-indentation
- From: Gerald Pfeifer <gerald at pfeifer dot com>
- To: David Malcolm <dmalcolm at redhat dot com>, gcc at gcc dot gnu dot org
- Date: Mon, 11 Jan 2016 15:20:41 +0800 (WITA)
- Subject: Some real-life feedback on -Wmisleading-indentation
- Authentication-results: sourceware.org; auth=none
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