From 66ddc92135ca7f8979a78324ecf266565e3d123d Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 18 Sep 2018 18:44:21 +0200 Subject: [PATCH] checkpatch: detect some whitespace errors Vim's trademark. --- contrib/scripts/checkpatch.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contrib/scripts/checkpatch.pl b/contrib/scripts/checkpatch.pl index f06ac7fc05..6fcccd6528 100755 --- a/contrib/scripts/checkpatch.pl +++ b/contrib/scripts/checkpatch.pl @@ -58,10 +58,12 @@ our @functions_seen; our $type; our $filename; our $line_no; +our $indent; sub new_hunk { $type = undef; + $indent = ""; } sub new_file @@ -139,6 +141,10 @@ 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 # looks too much like a function declaration