aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRaffaele Recalcati <raffaele.recalcati@bticino.it>2010-08-09 20:20:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-09 23:45:09 -0400
commit5f7ddae6104d85e27c0fbcb508cfe8286a01a5e1 (patch)
tree2bd6316f18a27b8c2575b9f0844c47ff392d8fca /scripts
parent7840a94cd12559d8aee6382fafb85fbc9eb3a2c2 (diff)
checkpatch: fix handling of leading spaces
I've got a false positive when spaces are present at the beginning of a line. So I add this check, obviously excluding to check the lines in the middle of comments. For instance this code passes the checkpatch test: +struct davinci_mcbsp_data { + unsigned int fmt; + int clk_div; +}; + +static struct davinci_mcbsp_data mcbsp_data; Where, before the string "int clk_div", I have 4 spaces (\040 ascii character). With v2.6.34 scripts/checkpatch.pl script I get: scripts/checkpatch.pl 0001-ASoC-DaVinci-Added-support-for-stereo-I2S.patch total: 0 errors, 0 warnings, 201 lines checked 0001-ASoC-DaVinci-Added-support-for-stereo-I2S.patch has no obvious style problems and is ready for submission. That is not correct. Instead with the proposed patch I get: scripts/checkpatch.pl 0001-ASoC-DaVinci-Added-support-for-stereo-I2S.patch WARNING: please, no space for starting a line, excluding comments #63: FILE: sound/soc/davinci/davinci-i2s.c:165: + int clk_div;$ WARNING: please, no space for starting a line, excluding comments #95: FILE: sound/soc/davinci/davinci-i2s.c:406: + return 0;$ total: 0 errors, 2 warnings, 201 lines checked That is correct. Signed-off-by: Raffaele Recalcati <raffaele.recalcati@bticino.it> Cc: Wolfram Sang <w.sang@pengutronix.de> Cc: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 315faf99effd..d7a44fd3b224 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1454,6 +1454,13 @@ sub process {
1454 WARN("please, no space before tabs\n" . $herevet); 1454 WARN("please, no space before tabs\n" . $herevet);
1455 } 1455 }
1456 1456
1457# check for spaces at the beginning of a line.
1458 if ($rawline =~ /^\+ / && $rawline !~ /\+ +\*/) {
1459 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
1460 WARN("please, no space for starting a line, \
1461 excluding comments\n" . $herevet);
1462 }
1463
1457# check we are in a valid C source file if not then ignore this hunk 1464# check we are in a valid C source file if not then ignore this hunk
1458 next if ($realfile !~ /\.(h|c)$/); 1465 next if ($realfile !~ /\.(h|c)$/);
1459 1466