Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
7c0d7e87 151c468b

+26 -12
+26 -12
scripts/kernel-doc
··· 1041 1041 $id =~ s/^\*+//; 1042 1042 foreach my $arg (split /;/, $content) { 1043 1043 next if ($arg =~ m/^\s*$/); 1044 - my $type = $arg; 1045 - my $name = $arg; 1046 - $type =~ s/\s\S+$//; 1047 - $name =~ s/.*\s//; 1048 - $name =~ s/[:\[].*//; 1049 - $name =~ s/^\*+//; 1050 - next if (($name =~ m/^\s*$/)); 1051 - if ($id =~ m/^\s*$/) { 1052 - # anonymous struct/union 1053 - $newmember .= "$type $name;"; 1044 + if ($arg =~ m/^([^\(]+\(\*?\s*)([\w\.]*)(\s*\).*)/) { 1045 + # pointer-to-function 1046 + my $type = $1; 1047 + my $name = $2; 1048 + my $extra = $3; 1049 + next if (!$name); 1050 + if ($id =~ m/^\s*$/) { 1051 + # anonymous struct/union 1052 + $newmember .= "$type$name$extra;"; 1053 + } else { 1054 + $newmember .= "$type$id.$name$extra;"; 1055 + } 1054 1056 } else { 1055 - $newmember .= "$type $id.$name;"; 1057 + my $type = $arg; 1058 + my $name = $arg; 1059 + $type =~ s/\s\S+$//; 1060 + $name =~ s/.*\s+//; 1061 + $name =~ s/[:\[].*//; 1062 + $name =~ s/^\*+//; 1063 + next if (($name =~ m/^\s*$/)); 1064 + if ($id =~ m/^\s*$/) { 1065 + # anonymous struct/union 1066 + $newmember .= "$type $name;"; 1067 + } else { 1068 + $newmember .= "$type $id.$name;"; 1069 + } 1056 1070 } 1057 1071 } 1058 1072 $members =~ s/(struct|union)([^{};]+){([^{}]*)}([^{}\;]*)\;/$newmember/; ··· 1264 1250 } elsif ($arg =~ m/\(.+\)\s*\(/) { 1265 1251 # pointer-to-function 1266 1252 $arg =~ tr/#/,/; 1267 - $arg =~ m/[^\(]+\(\*?\s*(\w*)\s*\)/; 1253 + $arg =~ m/[^\(]+\(\*?\s*([\w\.]*)\s*\)/; 1268 1254 $param = $1; 1269 1255 $type = $arg; 1270 1256 $type =~ s/([^\(]+\(\*?)\s*$param/$1/;