From: Robert Elliott <elliott@hpe.com>
To: apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com,
lukas.bulwahn@gmail.com
Cc: linux-kernel@vger.kernel.org, Robert Elliott <elliott@hpe.com>
Subject: [PATCH v2 4/5] checkpatch: discard processed lines
Date: Tue, 22 Nov 2022 19:12:01 -0600 [thread overview]
Message-ID: <20221123011202.939319-5-elliott@hpe.com> (raw)
In-Reply-To: <20221123011202.939319-1-elliott@hpe.com>
Advance the line numbers so messages don't repeat previously
processed lines.
Before:
WARNING: please write 4 lines of help text that fully describes the
config symbol (detected 3 lines)
#195: FILE: crypto/Kconfig:837:
+config CRYPTO_GHASH_CLMUL_NI_INTEL
+ tristate "GHASH (x86_64 with CLMUL-NI)"
depends on X86 && 64BIT
+ select CRYPTO_CRYPTD
+ select CRYPTO_CRYPTD
+ select CRYPTO_CRYPTD
help
+ GCM GHASH hash function (NIST SP800-38D)
+ GCM GHASH hash function (NIST SP800-38D)
Architecture: x86_64 using:
+ * CLMUL-NI (carry-less multiplication new instructions)
+ * CLMUL-NI (carry-less multiplication new instructions)
+ * CLMUL-NI (carry-less multiplication new instructions)
+config CRYPTO_GHASH_S390
+config CRYPTO_GHASH_S390
+config CRYPTO_GHASH_S390
+config CRYPTO_GHASH_S390
After:
WARNING: please write 4 lines of help text that fully describes the
config symbol (detected 3 lines)
#195: FILE: crypto/Kconfig:837:
+config CRYPTO_GHASH_CLMUL_NI_INTEL
+ tristate "GHASH (x86_64 with CLMUL-NI)"
depends on X86 && 64BIT
+ select CRYPTO_CRYPTD
help
+ GCM GHASH hash function (NIST SP800-38D)
Architecture: x86_64 using:
+ * CLMUL-NI (carry-less multiplication new instructions)
+config CRYPTO_GHASH_S390
Signed-off-by: Robert Elliott <elliott@hpe.com>
---
scripts/checkpatch.pl | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 1b7a98adcaeb..d11d58e36ee9 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1971,21 +1971,25 @@ sub raw_line {
$cnt++;
my $line;
+ my $consumed;
while ($cnt) {
$line = $rawlines[$offset++];
+ $consumed++;
next if (defined($line) && $line =~ /^-/);
$cnt--;
}
- return $line;
+ return ($line, $consumed);
}
sub get_stat_real {
my ($linenr, $lc) = @_;
- my $stat_real = raw_line($linenr, 0);
+ my ($stat_real, $consumed) = raw_line($linenr, 0);
for (my $count = $linenr + 1; $count <= $lc; $count++) {
- $stat_real = $stat_real . "\n" . raw_line($count, 0);
+ my ($more, $consumed) = raw_line($count, 0);
+ $stat_real = $stat_real . "\n" . $more;
+ $count += $consumed - 1;
}
return $stat_real;
@@ -1996,7 +2000,8 @@ sub get_stat_here {
my $herectx = $here . "\n";
for (my $n = 0; $n < $cnt; $n++) {
- $herectx .= raw_line($linenr, $n) . "\n";
+ my ($more, $consumed) = raw_line($linenr, $n);
+ $herectx .= $more . "\n";
}
return $herectx;
@@ -4323,7 +4328,7 @@ sub process {
}
my (undef, $sindent) = line_stats("+" . $s);
- my $stat_real = raw_line($linenr, $cond_lines);
+ my ($stat_real, $consumed) = raw_line($linenr, $cond_lines);
# Check if either of these lines are modified, else
# this is not this patch's fault.
@@ -5420,7 +5425,7 @@ sub process {
$herectx = $here . "\n";
my $cnt = statement_rawlines($if_stat);
for (my $n = 0; $n < $cnt; $n++) {
- my $rl = raw_line($linenr, $n);
+ my ($rl, $consumed) = raw_line($linenr, $n);
$herectx .= $rl . "\n";
last if $rl =~ /^[ \+].*\{/;
}
@@ -5617,8 +5622,9 @@ sub process {
my $cond_lines = 1 + $#newlines;
my $stat_real = '';
- $stat_real = raw_line($linenr, $cond_lines)
- . "\n" if ($cond_lines);
+ my $consumed;
+ ($stat_real, $consumed) = raw_line($linenr, $cond_lines)
+ . "\n" if ($cond_lines);
if (defined($stat_real) && $cond_lines > 1) {
$stat_real = "[...]\n$stat_real";
}
@@ -7024,7 +7030,7 @@ sub process {
my $cnt = statement_rawlines($stat);
my $herectx = $here . "\n";
for (my $n = 0; $n < $cnt; $n++) {
- my $rl = raw_line($linenr, $n);
+ my ($rl, $consumed) = raw_line($linenr, $n);
$herectx .= $rl . "\n";
$ok = 1 if ($rl =~ /^[ \+]\{/);
$ok = 1 if ($rl =~ /\{/ && $n == 0);
--
2.38.1
next prev parent reply other threads:[~2022-11-23 1:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-15 4:15 [PATCH 0/3] checkpatch: enhance Kconfig parsing Robert Elliott
2022-08-15 4:15 ` [PATCH 1/3] checkpatch: improve Kconfig help text patch parsing Robert Elliott
2022-08-15 4:15 ` [PATCH 2/3] checkpatch: don't sanitise quotes in Kconfig files Robert Elliott
2022-08-15 4:15 ` [PATCH 3/3] checkpatch: check line length in Kconfig help text Robert Elliott
2022-11-23 1:11 ` [PATCH v2 0/5] checkpatch: enhance Kconfig parsing Robert Elliott
2022-11-23 1:11 ` [PATCH v2 1/5] checkpatch: improve Kconfig help text patch parsing Robert Elliott
2022-11-24 1:09 ` Joe Perches
2022-11-23 1:11 ` [PATCH v2 2/5] checkpatch: don't sanitise quotes in Kconfig files Robert Elliott
2022-11-23 1:12 ` [PATCH v2 3/5] checkpatch: check line length in Kconfig help text Robert Elliott
2022-11-24 1:04 ` Joe Perches
2022-11-23 1:12 ` Robert Elliott [this message]
2022-11-24 1:07 ` [PATCH v2 4/5] checkpatch: discard processed lines Joe Perches
2022-11-23 1:12 ` [PATCH v2 5/5] checkpatch: ignore a file named b Robert Elliott
2022-11-24 1:08 ` Joe Perches
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=20221123011202.939319-5-elliott@hpe.com \
--to=elliott@hpe.com \
--cc=apw@canonical.com \
--cc=dwaipayanray1@gmail.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).