Thread (4 messages) 4 messages, 3 authors, 2015-01-08
DORMANTno replies

[PATCH] checkpatch: Allow comments in macros tested for single statements

From: joe@perches.com (Joe Perches)
Date: 2015-01-08 21:31:41
Also in: lkml
Subsystem: checkpatch, the rest · Maintainers: Andy Whitcroft, Joe Perches, Linus Torvalds

Convert all the comments to spaces before testing for
single statement macros.

Reported-by: Valdis Kletnieks <redacted>
Signed-off-by: Joe Perches <joe@perches.com>
---
It's interesting that the warning only popped on the one case where the
"/* looping version */" is on a separate line, not on the #else line.

Am cc'ing Joe Perches for that question. Joe - to get you up to speed,
checkpatch was run against drivers/staging/skein/skein_block.c, and it
flagged one definition of the macro R256, but not the other one, or the
two definitions each for R512 and R1024.  Any idea why?
Yup, that was it...

 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 6afc24b..6ac355e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4260,6 +4260,7 @@ sub process {
 			$ctx = $dstat;
 
 			$dstat =~ s/\\\n.//g;
+			$dstat =~ s/$;/ /g;
 
 			if ($dstat =~ /^\+\s*#\s*define\s+$Ident\s*${balanced_parens}\s*do\s*{(.*)\s*}\s*while\s*\(\s*0\s*\)\s*([;\s]*)\s*$/) {
 				my $stmts = $2;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help