Skip to content

Commit 1081de2

Browse files
mchehabJonathan Corbet
authored andcommitted
scripts: kernel-doc: get rid of $nested parameter
The check_sections() function has a $nested parameter, meant to identify when a nested struct is present. As we now have a logic that handles it, get rid of such parameter. Suggested-by: Markus Heiser <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Jonathan Corbet <[email protected]>
1 parent 8ad7216 commit 1081de2

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

scripts/kernel-doc

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,6 @@ sub dump_union($$) {
10031003
sub dump_struct($$) {
10041004
my $x = shift;
10051005
my $file = shift;
1006-
my $nested;
10071006

10081007
if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) {
10091008
my $decl_type = $1;
@@ -1063,11 +1062,9 @@ sub dump_struct($$) {
10631062

10641063
# Ignore other nested elements, like enums
10651064
$members =~ s/({[^\{\}]*})//g;
1066-
$nested = $decl_type;
1067-
$nested =~ s/\/\*.*?\*\///gos;
10681065

10691066
create_parameterlist($members, ';', $file);
1070-
check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual, $nested);
1067+
check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual);
10711068

10721069
# Adjust declaration for better display
10731070
$declaration =~ s/([{;])/$1\n/g;
@@ -1372,8 +1369,8 @@ sub push_parameter($$$) {
13721369
$parametertypes{$param} = $type;
13731370
}
13741371

1375-
sub check_sections($$$$$$) {
1376-
my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck, $nested) = @_;
1372+
sub check_sections($$$$$) {
1373+
my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck) = @_;
13771374
my @sects = split ' ', $sectcheck;
13781375
my @prms = split ' ', $prmscheck;
13791376
my $err;
@@ -1407,14 +1404,6 @@ sub check_sections($$$$$$) {
14071404
"'$sects[$sx]' " .
14081405
"description in '$decl_name'\n";
14091406
++$warnings;
1410-
} else {
1411-
if ($nested !~ m/\Q$sects[$sx]\E/) {
1412-
print STDERR "${file}:$.: warning: " .
1413-
"Excess $decl_type member " .
1414-
"'$sects[$sx]' " .
1415-
"description in '$decl_name'\n";
1416-
++$warnings;
1417-
}
14181407
}
14191408
}
14201409
}
@@ -1525,7 +1514,7 @@ sub dump_function($$) {
15251514
}
15261515

15271516
my $prms = join " ", @parameterlist;
1528-
check_sections($file, $declaration_name, "function", $sectcheck, $prms, "");
1517+
check_sections($file, $declaration_name, "function", $sectcheck, $prms);
15291518

15301519
# This check emits a lot of warnings at the moment, because many
15311520
# functions don't have a 'Return' doc section. So until the number

0 commit comments

Comments
 (0)