Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a4cad4e authored by Eric Nelson's avatar Eric Nelson Committed by Linus Torvalds
Browse files

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: default avatarEric Nelson <eric.nelson@boundarydevices.com>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 133fd9f5
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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{