Messages in this thread | | | Subject | Re: [PATCH v2 4/5] checkpatch: discard processed lines | From | Joe Perches <> | Date | Wed, 23 Nov 2022 17:07:13 -0800 |
| |
On Tue, 2022-11-22 at 19:12 -0600, Robert Elliott wrote: > Advance the line numbers so messages don't repeat previously > processed lines.
I am concerned that this would create new breakage on existing patch content. Please show me this does not.
> > 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)fu > #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);
| |