From: Daniel Walker <dwalker@fifo99.com>
To: Greg KH <greg@kroah.com>
Cc: Andy Whitcroft <apw@canonical.com>, linux-kernel@vger.kernel.org
Subject: Re: checkpatch.pl is getting too slow
Date: Sun, 01 Feb 2009 09:47:26 -0800 [thread overview]
Message-ID: <1233510446.5903.87.camel@desktop> (raw)
In-Reply-To: <20090201044614.GA8589@kroah.com>
I found a little more on this.. It seems the problem with #define lines
only causes a few extra seconds delay .. I found another issue C99 style
comments.
On line 642 your file has this line,
// For the UART control registers, the application number need to be Or'ed
The quote in Or'ed causes checkpatch to treat the rest of the file as a
big string that never closes. Or that's my impression. The delay is
caused in the same way as the define delay. In order to check one line
in the file the rest of the file is scanned.
The fix below increased the number of errors found too.
total: 347 errors, 278 warnings, 3932 lines checked
---
This fixes the sanitation process in checkpatch.pl so that it blocks out
the text after a C99 style comment the same way it does with block style
comments. This prevents the text from getting processed as regular code.
Signed-off-by: Daniel Walker <dwalker@fifo99.com>
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 45eb0ae..a987972 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -355,6 +355,13 @@ sub sanitise_line {
$off++;
next;
}
+ if ($sanitise_quote eq '' && substr($line, $off, 2) eq '//') {
+ $sanitise_quote = '//';
+
+ substr($res, $off, 2, $sanitise_quote);
+ $off++;
+ next;
+ }
# A \ in a string means ignore the next character.
if (($sanitise_quote eq "'" || $sanitise_quote eq '"') &&
@@ -378,6 +385,8 @@ sub sanitise_line {
#print "c<$c> SQ<$sanitise_quote>\n";
if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") {
substr($res, $off, 1, $;);
+ } elsif ($off != 0 && $sanitise_quote eq '//' && $c ne "\t") {
+ substr($res, $off, 1, $;);
} elsif ($off != 0 && $sanitise_quote && $c ne "\t") {
substr($res, $off, 1, 'X');
} else {
@@ -385,6 +394,10 @@ sub sanitise_line {
}
}
+ if ($sanitise_quote eq '//') {
+ $sanitise_quote = '';
+ }
+
# The pathname on a #include may be surrounded by '<' and '>'.
if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) {
my $clean = 'X' x length($1);
next prev parent reply other threads:[~2009-02-01 17:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-31 18:55 checkpatch.pl is getting too slow Greg KH
2009-01-31 21:02 ` Andy Whitcroft
2009-01-31 21:35 ` Daniel Walker
2009-01-31 22:10 ` Daniel Walker
2009-02-01 0:57 ` Daniel Walker
2009-02-01 4:46 ` Greg KH
2009-02-01 14:33 ` Daniel Walker
2009-02-01 17:47 ` Daniel Walker [this message]
2009-02-03 5:16 ` Greg KH
2009-02-09 8:41 ` Andy Whitcroft
2009-02-09 8:58 ` Andy Whitcroft
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1233510446.5903.87.camel@desktop \
--to=dwalker@fifo99.com \
--cc=apw@canonical.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox