Commit af404fb1 authored by Vegard Nossum's avatar Vegard Nossum Committed by Jonathan Corbet

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: default avatarVegard Nossum <vegard.nossum@oracle.com>
Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20240208161705.888385-1-vegard.nossum@oracle.com
parent 84b4cc81
...@@ -99,6 +99,7 @@ my $blankline_man = ""; ...@@ -99,6 +99,7 @@ my $blankline_man = "";
my @highlights_rst = ( my @highlights_rst = (
[$type_constant, "``\$1``"], [$type_constant, "``\$1``"],
[$type_constant2, "``\$1``"], [$type_constant2, "``\$1``"],
# Note: need to escape () to avoid func matching later # Note: need to escape () to avoid func matching later
[$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"], [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"],
[$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"], [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"],
...@@ -109,6 +110,7 @@ my @highlights_rst = ( ...@@ -109,6 +110,7 @@ my @highlights_rst = (
[$type_struct, "\\:c\\:type\\:`\$1 <\$2>`"], [$type_struct, "\\:c\\:type\\:`\$1 <\$2>`"],
[$type_typedef, "\\:c\\:type\\:`\$1 <\$2>`"], [$type_typedef, "\\:c\\:type\\:`\$1 <\$2>`"],
[$type_union, "\\:c\\:type\\:`\$1 <\$2>`"], [$type_union, "\\:c\\:type\\:`\$1 <\$2>`"],
# in rst this can refer to any type # in rst this can refer to any type
[$type_fallback, "\\:c\\:type\\:`\$1`"], [$type_fallback, "\\:c\\:type\\:`\$1`"],
[$type_param_ref, "**\$1\$2**"] [$type_param_ref, "**\$1\$2**"]
...@@ -631,8 +633,7 @@ sub output_enum_man(%) { ...@@ -631,8 +633,7 @@ sub output_enum_man(%) {
if ($count == $#{$args{'parameterlist'}}) { if ($count == $#{$args{'parameterlist'}}) {
print "\n};\n"; print "\n};\n";
last; last;
} } else {
else {
print ", \n.br\n"; print ", \n.br\n";
} }
$count++; $count++;
...@@ -1279,8 +1280,7 @@ sub dump_struct($$) { ...@@ -1279,8 +1280,7 @@ sub dump_struct($$) {
'purpose' => $declaration_purpose, 'purpose' => $declaration_purpose,
'type' => $decl_type 'type' => $decl_type
}); });
} } else {
else {
print STDERR "${file}:$.: error: Cannot parse struct or union!\n"; print STDERR "${file}:$.: error: Cannot parse struct or union!\n";
++$errors; ++$errors;
} }
...@@ -1456,8 +1456,7 @@ sub dump_typedef($$) { ...@@ -1456,8 +1456,7 @@ sub dump_typedef($$) {
'sections' => \%sections, 'sections' => \%sections,
'purpose' => $declaration_purpose 'purpose' => $declaration_purpose
}); });
} } else {
else {
print STDERR "${file}:$.: error: Cannot parse typedef!\n"; print STDERR "${file}:$.: error: Cannot parse typedef!\n";
++$errors; ++$errors;
} }
...@@ -1544,14 +1543,12 @@ sub create_parameterlist($$$$) { ...@@ -1544,14 +1543,12 @@ sub create_parameterlist($$$$) {
save_struct_actual($2); save_struct_actual($2);
push_parameter($2, "$type $1", $arg, $file, $declaration_name); push_parameter($2, "$type $1", $arg, $file, $declaration_name);
} } elsif ($param =~ m/(.*?):(\d+)/) {
elsif ($param =~ m/(.*?):(\d+)/) {
if ($type ne "") { # skip unnamed bit-fields if ($type ne "") { # skip unnamed bit-fields
save_struct_actual($1); save_struct_actual($1);
push_parameter($1, "$type:$2", $arg, $file, $declaration_name) push_parameter($1, "$type:$2", $arg, $file, $declaration_name)
} }
} } else {
else {
save_struct_actual($param); save_struct_actual($param);
push_parameter($param, $type, $arg, $file, $declaration_name); push_parameter($param, $type, $arg, $file, $declaration_name);
} }
...@@ -1580,8 +1577,7 @@ sub push_parameter($$$$$) { ...@@ -1580,8 +1577,7 @@ sub push_parameter($$$$$) {
if (!$param =~ /\w\.\.\.$/) { if (!$param =~ /\w\.\.\.$/) {
# handles unnamed variable parameters # handles unnamed variable parameters
$param = "..."; $param = "...";
} } elsif ($param =~ /\w\.\.\.$/) {
elsif ($param =~ /\w\.\.\.$/) {
# for named variable parameters of the form `x...`, remove the dots # for named variable parameters of the form `x...`, remove the dots
$param =~ s/\.\.\.$//; $param =~ s/\.\.\.$//;
} }
...@@ -1668,8 +1664,7 @@ sub check_sections($$$$$) { ...@@ -1668,8 +1664,7 @@ sub check_sections($$$$$) {
"Excess function parameter " . "Excess function parameter " .
"'$sects[$sx]' " . "'$sects[$sx]' " .
"description in '$decl_name'\n"); "description in '$decl_name'\n");
} } elsif (($decl_type eq "struct") or
elsif (($decl_type eq "struct") or
($decl_type eq "union")) { ($decl_type eq "union")) {
emit_warning("${file}:$.", emit_warning("${file}:$.",
"Excess $decl_type member " . "Excess $decl_type member " .
...@@ -1694,7 +1689,8 @@ sub check_return_section { ...@@ -1694,7 +1689,8 @@ sub check_return_section {
} }
if (!defined($sections{$section_return}) || if (!defined($sections{$section_return}) ||
$sections{$section_return} eq "") { $sections{$section_return} eq "")
{
emit_warning("${file}:$.", emit_warning("${file}:$.",
"No description found for return value of " . "No description found for return value of " .
"'$declaration_name'\n"); "'$declaration_name'\n");
...@@ -1918,8 +1914,7 @@ sub process_proto_function($$) { ...@@ -1918,8 +1914,7 @@ sub process_proto_function($$) {
if ($x =~ /^#/ && $x !~ /^#\s*define/) { if ($x =~ /^#/ && $x !~ /^#\s*define/) {
# do nothing # do nothing
} } elsif ($x =~ /([^\{]*)/) {
elsif ($x =~ /([^\{]*)/) {
$prototype .= $1; $prototype .= $1;
} }
...@@ -2368,8 +2363,7 @@ sub process_file($) { ...@@ -2368,8 +2363,7 @@ sub process_file($) {
if ($output_selection == OUTPUT_INCLUDE) { if ($output_selection == OUTPUT_INCLUDE) {
emit_warning("${file}:1", "'$_' not found\n") emit_warning("${file}:1", "'$_' not found\n")
for keys %function_table; for keys %function_table;
} } else {
else {
emit_warning("${file}:1", "no structured comments found\n"); emit_warning("${file}:1", "no structured comments found\n");
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment