From mboxrd@z Thu Jan 1 00:00:00 1970 From: joe@perches.com (Joe Perches) Date: Thu, 08 Jan 2015 13:31:33 -0800 Subject: [PATCH] checkpatch: Allow comments in macros tested for single statements In-Reply-To: <79493.1420750167@turing-police.cc.vt.edu> References: <78761.1420749142@turing-police.cc.vt.edu> <79493.1420750167@turing-police.cc.vt.edu> Message-ID: <1420752693.11784.13.camel@perches.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org Convert all the comments to spaces before testing for single statement macros. Reported-by: Valdis Kletnieks Signed-off-by: Joe Perches --- > 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;