checkpatch: check for whitespace before semicolon at EOL

Requires --strict option during invocation:
	~/linux$ scripts/checkpatch --strict foo.patch

This tests for a bad habits of mine like this:

	return 0 ;

Note that it does allow a special case of a bare semicolon
for empty loops:

	while (foo())
		;

Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Eric Nelson 2012-05-31 16:26:09 -07:00 committed by Linus Torvalds
parent 133fd9f5cd
commit 9a4cad4e25
1 changed files with 7 additions and 0 deletions

View File

@ -2448,6 +2448,13 @@ sub process {
"space prohibited between function name and open parenthesis '('\n" . $herecurr);
}
}
# check for whitespace before a non-naked semicolon
if ($line =~ /^\+.*\S\s+;/) {
CHK("SPACING",
"space prohibited before semicolon\n" . $herecurr);
}
# Check operator spacing.
if (!($line=~/\#\s*include/)) {
my $ops = qr{