This is an automated email from Gerrit.

Antonio Borneo (borneo.anto...@gmail.com) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/5118

-- gerrit

commit cddf243bcca4993232297cd964abed76b238bd3c
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Thu Apr 11 17:09:56 2019 +0200

    [RFC] checkpatch: set TAB size of 4 blank characters
    
    Linux kernel coding stile requires TAB of 8 blank characters and
    the value 8 is directly embedded in the perl code.
    
    Replace the magic number 8 with the perl variable "tabsize".
    For OpenOCD, assign 4 to the variable "tabsize".
    
    This commit includes the OpenOCD commits:
    164450a01576 ("Change checkpatch.pl tab expanding to 4 characters.")
    667d510dabd5 ("checkpatch: fix false indent trigger")
    
    Change-Id: If765e785a28dc3b8a896f01562029794cd4a90fa
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>
    Signed-off-by: Erik Ahlén <erik.ah...@avalonenterprise.com>
    Signed-off-by: Spencer Oliver <s...@spen-soft.co.uk>

diff --git a/tools/scripts/checkpatch.pl b/tools/scripts/checkpatch.pl
index a09333f..6f44068 100755
--- a/tools/scripts/checkpatch.pl
+++ b/tools/scripts/checkpatch.pl
@@ -62,6 +62,7 @@ my $conststructsfile = "$D/const_structs.checkpatch";
 my $typedefsfile = "";
 my $color = "auto";
 my $allow_c99_comments = 1; # Can be overridden by --ignore 
C99_COMMENT_TOLERANCE
+my $tabsize = 4;
 
 sub help {
        my ($exitcode) = @_;
@@ -1211,7 +1212,7 @@ sub expand_tabs {
                if ($c eq "\t") {
                        $res .= ' ';
                        $n++;
-                       for (; ($n % 8) != 0; $n++) {
+                       for (; ($n % $tabsize) != 0; $n++) {
                                $res .= ' ';
                        }
                        next;
@@ -2224,7 +2225,7 @@ sub string_find_replace {
 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;
 
@@ -3153,7 +3154,7 @@ sub process {
                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";
@@ -3172,7 +3173,7 @@ sub process {
                                "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/) {}
                        }
@@ -3194,11 +3195,11 @@ sub process {
                if ($perl_version_ok &&
                    $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;
                                }
                        }
                }
@@ -3216,8 +3217,8 @@ sub process {
                                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 &&
@@ -3688,11 +3689,11 @@ 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 && $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");
                        }

-- 


_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to