Skip to contentSkip to conversation

checkpatch: warn of whitespace before semicolon at end of line.

PATCH Superseded Eric Nelson 2 participants 3 messages May 1, 2012 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): http://lists.denx.de/pipermail/u-boot/2012-May#123595

#1 lore raw

PATCH v2 1/1 checkpatch: warn of whitespace before semicolon at end of line.

---
 tools/checkpatch.pl |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
tools/checkpatch.pl +6 -0
index 2048a44..0caffcb 100755
@@ -3139,6 +3139,12 @@ sub process {
 			 "Statements terminations use 1 semicolon\n" . $herecurr);
 		}
 
+# check for whitespace before semicolon (not allowed at end-of-line)
+		if ($line =~ /\s+;$/) {
+		    WARN("SPACEBEFORE_SEMICOLON",
+			 "Blank before semicolon\n" . $herecurr);
+		}
+
 # check for gcc specific __FUNCTION__
 		if ($line =~ /__FUNCTION__/) {
 			WARN("USE_FUNC",
Signature · 1 line
1.7.9
#2 lore raw

PATCH v2 1/1 checkpatch: warn of whitespace before semicolon at end of line.

Dear Eric Nelson,

tools/checkpatch.pl sub process { · line 3139

Quoted 11 lines
---
 tools/checkpatch.pl |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
tools/checkpatch.pl +0 -0
index 2048a44..0caffcb 100755
@@ -3139,6 +3139,12 @@ sub process {
 			 "Statements terminations use 1 semicolon\n" . 

$herecurr);

tools/checkpatch.pl sub process { · line 3150

Quoted 11 lines
tools/checkpatch.pl +6 -0
 		}
 
+# check for whitespace before semicolon (not allowed at end-of-line)
+		if ($line =~ /\s+;$/) {
+		    WARN("SPACEBEFORE_SEMICOLON",
+			 "Blank before semicolon\n" . $herecurr);
+		}
+
 # check for gcc specific __FUNCTION__
 		if ($line =~ /__FUNCTION__/) {
 			WARN("USE_FUNC",

Coolness, now let's also CC the linux (upstream) checkpatch author, to get it properly upstreamed :)

For me, add

Best regards,
Marek Vasut

#3 lore raw

PATCH v2 1/1 checkpatch: warn of whitespace before semicolon at end of line.

Quoted 16 lines · Marek Vasut

Dear Eric Nelson,

tools/checkpatch.pl sub process { · line 3139

Quoted 11 lines
---
  tools/checkpatch.pl |    6 ++++++
  1 files changed, 6 insertions(+), 0 deletions(-)
tools/checkpatch.pl +0 -0
index 2048a44..0caffcb 100755
@@ -3139,6 +3139,12 @@ sub process {
  			 "Statements terminations use 1 semicolon\n" .

$herecurr);

Quoted 2 lines
tools/checkpatch.pl +0 -0
  		}
 
Quoted 13 lines

tools/checkpatch.pl sub process { · line 3150

Quoted 9 lines
tools/checkpatch.pl +6 -0
+# check for whitespace before semicolon (not allowed at end-of-line)
+		if ($line =~ /\s+;$/) {
+		    WARN("SPACEBEFORE_SEMICOLON",
+			 "Blank before semicolon\n" . $herecurr);
+		}
+
  # check for gcc specific __FUNCTION__
  		if ($line =~ /__FUNCTION__/) {
  			WARN("USE_FUNC",

Coolness, now let's also CC the linux (upstream) checkpatch author, to get it properly upstreamed :)

That looks to be Andy.

It's not clear to me that this is a style violation though:

http://www.kernel.org/doc/Documentation/CodingStyle

Andy, we're discussing the inclusion of a test in checkpatch for space before semicolon at the end-of line to catch my bad habits like this:

	return 0 ;
Quoted 3 lines

For me, add