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