Re: [PATCH] checkpatch: allow single space before labels
From: Joe Perches
Date: Mon Oct 18 2010 - 15:09:55 EST
On Mon, 2010-10-18 at 20:32 +0200, Peter Zijlstra wrote:
> On Mon, 2010-10-18 at 14:21 -0400, Mike Frysinger wrote:
> > sounds like an ACK for Joe's patch
I didn't submit a patch, I suggested a possible improvement to
your patch. If you agree with it, you could resubmit.
> There are checks I don't really like, for those I simply ignore its
> output, I suggest others do the same.
Seems sensible.
Mike, checkpatch does already allow a single space to precede
a label but there's a conflict between the leading spaces test
and this test below it, so something like your patch is useful.
----------------
#goto labels aren't indented, allow a single space however
if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and
!($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) {
WARN("labels should not be indented\n" . $herecurr);
}
----------------
The leading space test may be overly noisy.
Maybe Andy can fix it a different way.
About 1% (~500) of the labels in the kernel source tree use
leading tabs. I think that label style is harder for me to
visually scan and find, but it's probably not code I'd change
just for conformity.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/