This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add levels to -Wmisleading-indentation; add level 1 to -Wall
- From: Pedro Alves <pedro at palves dot net>
- To: David Malcolm <dmalcolm at redhat dot com>, Bernd Schmidt <bschmidt at redhat dot com>
- Cc: Jeff Law <law at redhat dot com>, Patrick Palka <patrick at parcs dot ath dot cx>, Richard Biener <richard dot guenther at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 09 Dec 2015 17:19:01 +0000
- Subject: Re: [PATCH] Add levels to -Wmisleading-indentation; add level 1 to -Wall
- Authentication-results: sourceware.org; auth=none
- References: <5637F4A5 dot 1000405 at redhat dot com> <1449675493-43470-1-git-send-email-dmalcolm at redhat dot com> <56684B84 dot 6010906 at redhat dot com> <1449679792 dot 1916 dot 18 dot camel at surprise>
On 12/09/2015 04:49 PM, David Malcolm wrote:
> This is about managing the signal:noise ratio for something in -Wall.
>
> The distinction I want to make here is between badly indented code vs
> misleadingly indented code. Yes, the code is badly indented, but to my
> eyes the code is sufficiently badly indented that it has become *not*
> misleading: I can immediately see that something is awry. I want to
> preserve the -Wall level of the warning for the cases when it's not
> immediately clear that there's a problem.
>
> The levels idea means that you can turn off the blank-lines heuristic by
> setting -Wmisleading-indentation=2.
IMHO, the problem with the levels idea will be if/when later you
come up with some other orthogonal heuristic to catch some other
class of indentation problem, and users want to enable it but
not the blank-lines heuristic, or vice-versa.
Also, levels don't allow finer-selection
with "-Werror -Wno-error=misleading-indentation", IIUC.
Did you consider -Wmisleading-indentation=blank-lines,foo,bar
instead, or totally separate switches like:
-Wmisleading-indentation
-Wmisleading-indentation-blank-lines
-Wmisleading-indentation-foo
-Wmisleading-indentation-bar
?