checkpatch.pl: adjust checking for indentation/tabs

Our new format gets enforced by clang-format, and we now only use
four space indentation, instead of tabs.

Adjust the checkpatch script to account for that.

Also, now there are probably no cases left where we want to see any
tabs in our sources. Complain about any tabs we find.
This commit is contained in:
Thomas Haller 2020-09-23 09:17:24 +02:00 committed by Antonio Cardace
parent 76bb1f91a5
commit 419be5d0e7
No known key found for this signature in database
GPG key ID: 6BF80ABD43E377D3

View file

@ -190,19 +190,7 @@ complain ("XXX marker are reserved for development while work-in-progress. Use T
complain ("This gtk-doc annotation looks wrong") if $line =~ /\*.*\( *(transfer-(none|container|full)|allow none) *\) *(:|\()/;
complain ("Prefer nm_assert() or g_return*() to g_assert*()") if $line =~ /g_assert/ and not $filename =~ /\/tests\//;
complain ("Use gs_free_error with GError variables") if $line =~ /\bgs_free\b +GError *\*/;
new_hunk if $_ eq '';
my ($this_indent) = /^(\s*)/;
if (defined $indent) {
my $this_tabs_before_spaces = length $1 if $this_indent =~ /^(\t*) +/;
my $tabs_before_spaces = length $1 if $indent =~ /^(\t*) +/;
complain ("Bad indentation")
if $this_indent =~ /^$indent\t+ +/
or (defined $tabs_before_spaces and defined $this_tabs_before_spaces
and $this_tabs_before_spaces != $tabs_before_spaces);
}
$indent = $this_indent if $_ ne '';
#complain ("Use spaces instead of tabs") if $line =~ /\t/;
# Further on we process stuff without comments.
$_ = $line;
@ -228,7 +216,7 @@ if (/^typedef*/) {
# A function name
my $name = $1;
complain ('A single space should follow the function name') unless $2 eq ' ';
complain ('No space between function name and arguments') unless $2 eq '';
# Determine which function must not be preceding this one
foreach my $func (reverse @order) {