Messages in this thread | | | From | David Howells <> | Subject | Re: checkpatch problem | Date | Thu, 23 Sep 2010 19:15:39 +0100 |
| |
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
| |