Skip to content

Commit

Permalink
scripts: kernel-doc: get rid of $nested parameter
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
mchehab authored and Jonathan Corbet committed Dec 21, 2017
1 parent 8ad7216 commit 1081de2
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions scripts/kernel-doc
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,6 @@ sub dump_union($$) {
sub dump_struct($$) {
my $x = shift;
my $file = shift;
my $nested;

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

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

create_parameterlist($members, ';', $file);
check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual, $nested);
check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual);

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

sub check_sections($$$$$$) {
my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck, $nested) = @_;
sub check_sections($$$$$) {
my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck) = @_;
my @sects = split ' ', $sectcheck;
my @prms = split ' ', $prmscheck;
my $err;
Expand Down Expand Up @@ -1407,14 +1404,6 @@ sub check_sections($$$$$$) {
"'$sects[$sx]' " .
"description in '$decl_name'\n";
++$warnings;
} else {
if ($nested !~ m/\Q$sects[$sx]\E/) {
print STDERR "${file}:$.: warning: " .
"Excess $decl_type member " .
"'$sects[$sx]' " .
"description in '$decl_name'\n";
++$warnings;
}
}
}
}
Expand Down Expand Up @@ -1525,7 +1514,7 @@ sub dump_function($$) {
}

my $prms = join " ", @parameterlist;
check_sections($file, $declaration_name, "function", $sectcheck, $prms, "");
check_sections($file, $declaration_name, "function", $sectcheck, $prms);

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

0 comments on commit 1081de2

Please sign in to comment.