summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2018-09-24 13:31:00 +0200
committerLubomir Rintel <lkundrak@v3.sk>2018-10-07 15:46:02 +0200
commite7a511a54fdc8da91751b9913c8197955d76c155 (patch)
tree51a632991ac240319de10ae67d665b3de84de72c
parent84d62285e4f82ebb52213ea4b8c880cec2eb9abd (diff)
contrib/checkpatch: correctly separate indentation across hunks
-rwxr-xr-xcontrib/scripts/checkpatch.pl12
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/scripts/checkpatch.pl b/contrib/scripts/checkpatch.pl
index 6fcccd652..6d997295e 100755
--- a/contrib/scripts/checkpatch.pl
+++ b/contrib/scripts/checkpatch.pl
@@ -63,7 +63,7 @@ our $indent;
sub new_hunk
{
$type = undef;
- $indent = "";
+ $indent = undef;
}
sub new_file
@@ -133,17 +133,17 @@ complain ("Don't use \"unsigned int\" but just use \"unsigned\"") if $line =~ /\
complain ("Please use LGPL2+ for new files") if $is_patch and $line =~ /under the terms of the GNU General Public License/;
complain ("Don't use space inside elvis operator ?:") if $line =~ /\?[\t ]+:/;
+new_hunk if $_ eq '';
+my ($this_indent) = /^(\s*)/;
+complain ("Bad indentation") if defined $indent and $this_indent =~ /^$indent\t+ +/;
+$indent = $this_indent;
+
# Further on we process stuff without comments.
$_ = $line;
s/\s*\/\*.*\*\///;
s/\s*\/\*.*//;
s/\s*\/\/.*//;
/^\s* \* / and next;
-new_hunk if $_ eq '';
-
-my ($this_indent) = /^(\s*)/;
-complain ('Bad indentation') if $this_indent =~ /^$indent\t+ +/;
-$indent = $this_indent;
if (/^typedef*/) {
# We expect the { on the same line as the typedef. Otherwise it