Martin Roth has submitted this change. ( https://review.coreboot.org/c/coreboot/+/60874 )
Change subject: util/lint/checkpatch.pl: Use "tabsize" ......................................................................
util/lint/checkpatch.pl: Use "tabsize"
This is to reduce difference with linux v5.16.
Change-Id: Ifeb9c4406737fa24f9bd803af48d8b8d17654940 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr Reviewed-on: https://review.coreboot.org/c/coreboot/+/60874 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Martin Roth martinroth@google.com --- M util/lint/checkpatch.pl 1 file changed, 11 insertions(+), 11 deletions(-)
Approvals: build bot (Jenkins): Verified Martin Roth: Looks good to me, approved
diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl index 41aae93..0b8ab79 100755 --- a/util/lint/checkpatch.pl +++ b/util/lint/checkpatch.pl @@ -62,7 +62,7 @@ my $typedefsfile = ""; my $color = "auto"; my $allow_c99_comments = 1; - +my $tabsize = 8; # For coreboot jenkins # If taint mode is enabled, Untaint the path - files must be in /bin, /usr/bin or /usr/local/bin if ( ${^TAINT} ) { @@ -1178,7 +1178,7 @@ if ($c eq "\t") { $res .= ' '; $n++; - for (; ($n % 8) != 0; $n++) { + for (; ($n % $tabsize) != 0; $n++) { $res .= ' '; } next; @@ -2199,7 +2199,7 @@ sub tabify { my ($leading) = @_;
- my $source_indent = 8; + my $source_indent = $tabsize; my $max_spaces_before_tab = $source_indent - 1; my $spaces_to_tab = " " x $source_indent;
@@ -3074,7 +3074,7 @@ next if ($realfile !~ /.(h|c|pl|dtsi|dts)$/);
# at the beginning of a line any tabs must come first and anything -# more than 8 must use tabs. +# more than $tabsize must use tabs. if ($rawline =~ /^+\s* \t\s*\S/ || $rawline =~ /^+\s* \s*/) { my $herevet = "$here\n" . cat_vet($rawline) . "\n"; @@ -3093,7 +3093,7 @@ "please, no space before tabs\n" . $herevet) && $fix) { while ($fixed[$fixlinenr] =~ - s/(^+.*) {8,8}\t/$1\t\t/) {} + s/(^+.*) {$tabsize,$tabsize}\t/$1\t\t/) {} while ($fixed[$fixlinenr] =~ s/(^+.*) +\t/$1\t/) {} } @@ -3115,11 +3115,11 @@ if ($^V && $^V ge 5.10.0 && $sline =~ /^+\t+( +)(?:$c90_Keywords\b|{\s*$|}\s*(?:else\b|while\b|\s*$)|$Declare\s*$Ident\s*[;=])/) { my $indent = length($1); - if ($indent % 8) { + if ($indent % $tabsize) { if (WARN("TABSTOP", "Statements should start on a tabstop\n" . $herecurr) && $fix) { - $fixed[$fixlinenr] =~ s@(^+\t+) +@$1 . "\t" x ($indent/8)@e; + $fixed[$fixlinenr] =~ s@(^+\t+) +@$1 . "\t" x ($indent/$tabsize)@e; } } } @@ -3137,8 +3137,8 @@ my $newindent = $2;
my $goodtabindent = $oldindent . - "\t" x ($pos / 8) . - " " x ($pos % 8); + "\t" x ($pos / $tabsize) . + " " x ($pos % $tabsize); my $goodspaceindent = $oldindent . " " x $pos;
if ($newindent ne $goodtabindent && @@ -3609,11 +3609,11 @@ #print "line<$line> prevline<$prevline> indent<$indent> sindent<$sindent> check<$check> continuation<$continuation> s<$s> cond_lines<$cond_lines> stat_real<$stat_real> stat<$stat>\n";
if ($check && $s ne '' && - (($sindent % 8) != 0 || + (($sindent % $tabsize) != 0 || ($sindent < $indent) || ($sindent == $indent && ($s !~ /^\s*(?:}|{|else\b)/)) || - ($sindent > $indent + 8))) { + ($sindent > $indent + $tabsize))) { WARN("SUSPECT_CODE_INDENT", "suspect code indent for conditional statements ($indent, $sindent)\n" . $herecurr . "$stat_real\n"); }