X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=extras%2Fcheckpatch.pl;h=14e16fae12cb20d0743e960dea976a63c0bf95d9;hp=7b2d29b0b6695a648fefe40b71fd8c5c267f3bc0;hb=c26ada1f972a9f76ec75daf036e31bf05e1bfa7f;hpb=7a6dd8dde9ea347b5dedd7a712921ca1af1eba50 diff --git a/extras/checkpatch.pl b/extras/checkpatch.pl index 7b2d29b0b..14e16fae1 100755 --- a/extras/checkpatch.pl +++ b/extras/checkpatch.pl @@ -3,7 +3,8 @@ # (c) 2005, Joel Schopp (the ugly bit) # (c) 2007,2008, Andy Whitcroft (new conditions, test suite) # (c) 2008-2010 Andy Whitcroft -# Licensed under the terms of the GNU GPL License version 2 +# +# SPDX-License-Identifier: GPL-2.0-only use strict; @@ -500,7 +501,7 @@ sub expand_tabs { if ($c eq "\t") { $res .= ' '; $n++; - for (; ($n % 8) != 0; $n++) { + for (; ($n % 4) != 0; $n++) { $res .= ' '; } next; @@ -1860,8 +1861,8 @@ sub process { my $newindent = $2; my $goodtabindent = $oldindent . - "\t" x ($pos / 8) . - " " x ($pos % 8); + "\t" x ($pos / 4) . + " " x ($pos % 4); my $goodspaceindent = $oldindent . " " x $pos; if ($newindent ne $goodtabindent && @@ -2164,7 +2165,7 @@ sub process { #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 && (($sindent % 8) != 0 || + if ($check && (($sindent % 4) != 0 || ($sindent <= $indent && $s ne ''))) { WARN("SUSPECT_CODE_INDENT", "suspect code indent for conditional statements ($indent, $sindent)\n" . $herecurr . "$stat_real\n"); @@ -2432,8 +2433,8 @@ sub process { # function brace can't be on same line, except for #defines of do while, # or if closed on same line - if (($line=~/$Type\s*$Ident\(.*\).*\s{/) and - !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) { + if (($line=~/$Type\s*$Ident\(.*\).*\s\{/) and + !($line=~/\#\s*define.*do\s\{/) and !($line=~/\}/)) { ERROR("OPEN_BRACE", "open brace '{' following function declarations go on the next line\n" . $herecurr); } @@ -2708,8 +2709,8 @@ sub process { ## } #need space before brace following if, while, etc - if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) || - $line =~ /do{/) { + if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) || + $line =~ /do\{/) { ERROR("SPACING", "space required before the open brace '{'\n" . $herecurr); } @@ -3004,7 +3005,7 @@ sub process { $dstat !~ /^for\s*$Constant$/ && # for (...) $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar() $dstat !~ /^do\s*{/ && # do {... - $dstat !~ /^\({/) # ({... + $dstat !~ /^\(\{/) # ({... { $ctx =~ s/\n*$//; my $herectx = $here . "\n";