summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-18 15:30:16 +0300
committerJonathan Corbet <corbet@lwn.net>2017-12-21 23:41:47 +0300
commit7c0d7e87a16fe615e7913a3d56ce7bd26104ef0b (patch)
tree0794248e3eb713eea950fc5512d6f1c7515b11f4 /scripts
parent151c468b44a89a9f3173ab8575690014b7249893 (diff)
downloadlinux-7c0d7e87a16fe615e7913a3d56ce7bd26104ef0b.tar.xz
scripts: kernel-doc: handle nested struct function arguments
Function arguments are different than usual ones. So, an special logic is needed in order to handle such arguments on nested structs. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/kernel-doc38
1 files changed, 26 insertions, 12 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index c97b89f47795..5d03c9086323 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1041,18 +1041,32 @@ sub dump_struct($$) {
$id =~ s/^\*+//;
foreach my $arg (split /;/, $content) {
next if ($arg =~ m/^\s*$/);
- my $type = $arg;
- my $name = $arg;
- $type =~ s/\s\S+$//;
- $name =~ s/.*\s//;
- $name =~ s/[:\[].*//;
- $name =~ s/^\*+//;
- next if (($name =~ m/^\s*$/));
- if ($id =~ m/^\s*$/) {
- # anonymous struct/union
- $newmember .= "$type $name;";
+ if ($arg =~ m/^([^\(]+\(\*?\s*)([\w\.]*)(\s*\).*)/) {
+ # pointer-to-function
+ my $type = $1;
+ my $name = $2;
+ my $extra = $3;
+ next if (!$name);
+ if ($id =~ m/^\s*$/) {
+ # anonymous struct/union
+ $newmember .= "$type$name$extra;";
+ } else {
+ $newmember .= "$type$id.$name$extra;";
+ }
} else {
- $newmember .= "$type $id.$name;";
+ my $type = $arg;
+ my $name = $arg;
+ $type =~ s/\s\S+$//;
+ $name =~ s/.*\s+//;
+ $name =~ s/[:\[].*//;
+ $name =~ s/^\*+//;
+ next if (($name =~ m/^\s*$/));
+ if ($id =~ m/^\s*$/) {
+ # anonymous struct/union
+ $newmember .= "$type $name;";
+ } else {
+ $newmember .= "$type $id.$name;";
+ }
}
}
$members =~ s/(struct|union)([^{};]+){([^{}]*)}([^{}\;]*)\;/$newmember/;
@@ -1250,7 +1264,7 @@ sub create_parameterlist($$$$) {
} elsif ($arg =~ m/\(.+\)\s*\(/) {
# pointer-to-function
$arg =~ tr/#/,/;
- $arg =~ m/[^\(]+\(\*?\s*(\w*)\s*\)/;
+ $arg =~ m/[^\(]+\(\*?\s*([\w\.]*)\s*\)/;
$param = $1;
$type = $arg;
$type =~ s/([^\(]+\(\*?)\s*$param/$1/;