scripts/kernel-doc: reindent

This file is using an ungodly mixture of 4 spaces, 2-wide tabs, 4-wide
tabs, _and_ 8-wide tabs, making it really hard to find good editor
settings for working with this file.

Bite the bullet and reindent it by hand. I tried using both perltidy
and vim, but neither of them were up to the task without changing too
much or getting confused about what they were supposed to be doing.

I did change a few instances of

    }
    else

into

    } else

(and same for elsif); the file is again written using both styles, and
I left functions which already seemed self-consistent alone.

You can verify that this commit only changes whitespace using e.g.:

    git diff --ignore-all-space --word-diff

or to see (only) the instances where newlines were added/removed:

    git diff --ignore-all-space

You can also see the delta from what perltidy would have wanted to
do to this file (when asked to only indent it), which isn't that much
in the end:

    perltidy -io -fnl scripts/kernel-doc
    git diff --no-index scripts/kernel-doc{,.tdy}

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20240208161705.888385-1-vegard.nossum@oracle.com
This commit is contained in:
Vegard Nossum 2024-02-08 17:17:05 +01:00 committed by Jonathan Corbet
parent 84b4cc8189
commit af404fb1ed

View file

@ -99,6 +99,7 @@ my $blankline_man = "";
my @highlights_rst = (
[$type_constant, "``\$1``"],
[$type_constant2, "``\$1``"],
# Note: need to escape () to avoid func matching later
[$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"],
[$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"],
@ -109,6 +110,7 @@ my @highlights_rst = (
[$type_struct, "\\:c\\:type\\:`\$1 <\$2>`"],
[$type_typedef, "\\:c\\:type\\:`\$1 <\$2>`"],
[$type_union, "\\:c\\:type\\:`\$1 <\$2>`"],
# in rst this can refer to any type
[$type_fallback, "\\:c\\:type\\:`\$1`"],
[$type_param_ref, "**\$1\$2**"]
@ -631,8 +633,7 @@ sub output_enum_man(%) {
if ($count == $#{$args{'parameterlist'}}) {
print "\n};\n";
last;
}
else {
} else {
print ", \n.br\n";
}
$count++;
@ -1279,8 +1280,7 @@ sub dump_struct($$) {
'purpose' => $declaration_purpose,
'type' => $decl_type
});
}
else {
} else {
print STDERR "${file}:$.: error: Cannot parse struct or union!\n";
++$errors;
}
@ -1456,8 +1456,7 @@ sub dump_typedef($$) {
'sections' => \%sections,
'purpose' => $declaration_purpose
});
}
else {
} else {
print STDERR "${file}:$.: error: Cannot parse typedef!\n";
++$errors;
}
@ -1544,14 +1543,12 @@ sub create_parameterlist($$$$) {
save_struct_actual($2);
push_parameter($2, "$type $1", $arg, $file, $declaration_name);
}
elsif ($param =~ m/(.*?):(\d+)/) {
} elsif ($param =~ m/(.*?):(\d+)/) {
if ($type ne "") { # skip unnamed bit-fields
save_struct_actual($1);
push_parameter($1, "$type:$2", $arg, $file, $declaration_name)
}
}
else {
} else {
save_struct_actual($param);
push_parameter($param, $type, $arg, $file, $declaration_name);
}
@ -1580,8 +1577,7 @@ sub push_parameter($$$$$) {
if (!$param =~ /\w\.\.\.$/) {
# handles unnamed variable parameters
$param = "...";
}
elsif ($param =~ /\w\.\.\.$/) {
} elsif ($param =~ /\w\.\.\.$/) {
# for named variable parameters of the form `x...`, remove the dots
$param =~ s/\.\.\.$//;
}
@ -1668,8 +1664,7 @@ sub check_sections($$$$$) {
"Excess function parameter " .
"'$sects[$sx]' " .
"description in '$decl_name'\n");
}
elsif (($decl_type eq "struct") or
} elsif (($decl_type eq "struct") or
($decl_type eq "union")) {
emit_warning("${file}:$.",
"Excess $decl_type member " .
@ -1694,7 +1689,8 @@ sub check_return_section {
}
if (!defined($sections{$section_return}) ||
$sections{$section_return} eq "") {
$sections{$section_return} eq "")
{
emit_warning("${file}:$.",
"No description found for return value of " .
"'$declaration_name'\n");
@ -1918,8 +1914,7 @@ sub process_proto_function($$) {
if ($x =~ /^#/ && $x !~ /^#\s*define/) {
# do nothing
}
elsif ($x =~ /([^\{]*)/) {
} elsif ($x =~ /([^\{]*)/) {
$prototype .= $1;
}
@ -2368,8 +2363,7 @@ sub process_file($) {
if ($output_selection == OUTPUT_INCLUDE) {
emit_warning("${file}:1", "'$_' not found\n")
for keys %function_table;
}
else {
} else {
emit_warning("${file}:1", "no structured comments found\n");
}
}