Re: checkpatch problem

From: David Howells
Date: Thu Sep 23 2010 - 14:16:03 EST



The problem is that the second matcher (looking for " to \\n) matches on more
than just the logfunction line. Instrumenting the code supplied by your patch
thusly:

if ($line =~ /^.*($logFunctions)/) {
print "QQQQ $1 QQQQ\n";
my $ln = $linenr;
my $cnt = $realcnt;
my ($off, $dstat, $dcond, $rest);
($dstat, $dcond, $ln, $cnt, $off) =
ctx_statement_block($linenr, $realcnt, 0);
for (my $n = 0; $n < $cnt; $n++) {
my $l = $rawlines[$ln-1+$n];
if ($l =~ /(\".*[ \t]\\n)/) {
print "&&&$line&&&\n";
print "^^^^^ Matched '$1' ^^^^^\n";
WARN("Logging function has unnecessary whitespace before a newline\n" . $herecurr);
}
}
}

I see:

QQQQ printk QQQQ
QQQQ printk QQQQ
QQQQ printk QQQQ
QQQQ printk QQQQ
QQQQ printk QQQQ
&&&+#define Dprintk(fmt, ...) printk(KERN_DEBUG fmt, ##__VA_ARGS__)&&&
^^^^^ Matched '"mov %0,sp \n' ^^^^^
&&&+#define Dprintk(fmt, ...) printk(KERN_DEBUG fmt, ##__VA_ARGS__)&&&
^^^^^ Matched '"jmp (%1) \n' ^^^^^
&&&+#define Dprintk(fmt, ...) printk(KERN_DEBUG fmt, ##__VA_ARGS__)&&&
^^^^^ Matched '" movhu (%1),%0 \n' ^^^^^


It seems that it doesn't like a #define dealing with a logging function
followed by an inline asm statement that has whitespace before '\\n'.

I suspect checkpatch doesn't handle #defines correctly, and goes beyond their
end looking for a semicolon.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/