diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/kernel-doc | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 8be269ffbf9d..c3a4854e5ee9 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -381,10 +381,10 @@ sub output_highlight { | |||
381 | eval $dohighlight; | 381 | eval $dohighlight; |
382 | die $@ if $@; | 382 | die $@ if $@; |
383 | foreach $line (split "\n", $contents) { | 383 | foreach $line (split "\n", $contents) { |
384 | if ($line eq ""){ | 384 | if ($line eq ""){ |
385 | print $lineprefix, $blankline; | 385 | print $lineprefix, $blankline; |
386 | } else { | 386 | } else { |
387 | $line =~ s/\\\\\\/\&/g; | 387 | $line =~ s/\\\\\\/\&/g; |
388 | print $lineprefix, $line; | 388 | print $lineprefix, $line; |
389 | } | 389 | } |
390 | print "\n"; | 390 | print "\n"; |
@@ -414,7 +414,7 @@ sub output_enum_html(%) { | |||
414 | print "<b>enum ".$args{'enum'}."</b> {<br>\n"; | 414 | print "<b>enum ".$args{'enum'}."</b> {<br>\n"; |
415 | $count = 0; | 415 | $count = 0; |
416 | foreach $parameter (@{$args{'parameterlist'}}) { | 416 | foreach $parameter (@{$args{'parameterlist'}}) { |
417 | print " <b>".$parameter."</b>"; | 417 | print " <b>".$parameter."</b>"; |
418 | if ($count != $#{$args{'parameterlist'}}) { | 418 | if ($count != $#{$args{'parameterlist'}}) { |
419 | $count++; | 419 | $count++; |
420 | print ",\n"; | 420 | print ",\n"; |
@@ -462,7 +462,7 @@ sub output_struct_html(%) { | |||
462 | my $parameter_name = $parameter; | 462 | my $parameter_name = $parameter; |
463 | $parameter_name =~ s/\[.*//; | 463 | $parameter_name =~ s/\[.*//; |
464 | 464 | ||
465 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; | 465 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; |
466 | $type = $args{'parametertypes'}{$parameter}; | 466 | $type = $args{'parametertypes'}{$parameter}; |
467 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { | 467 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { |
468 | # pointer-to-function | 468 | # pointer-to-function |
@@ -483,7 +483,7 @@ sub output_struct_html(%) { | |||
483 | my $parameter_name = $parameter; | 483 | my $parameter_name = $parameter; |
484 | $parameter_name =~ s/\[.*//; | 484 | $parameter_name =~ s/\[.*//; |
485 | 485 | ||
486 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; | 486 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; |
487 | print "<dt><b>".$parameter."</b>\n"; | 487 | print "<dt><b>".$parameter."</b>\n"; |
488 | print "<dd>"; | 488 | print "<dd>"; |
489 | output_highlight($args{'parameterdescs'}{$parameter_name}); | 489 | output_highlight($args{'parameterdescs'}{$parameter_name}); |
@@ -525,7 +525,7 @@ sub output_function_html(%) { | |||
525 | my $parameter_name = $parameter; | 525 | my $parameter_name = $parameter; |
526 | $parameter_name =~ s/\[.*//; | 526 | $parameter_name =~ s/\[.*//; |
527 | 527 | ||
528 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; | 528 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; |
529 | print "<dt><b>".$parameter."</b>\n"; | 529 | print "<dt><b>".$parameter."</b>\n"; |
530 | print "<dd>"; | 530 | print "<dd>"; |
531 | output_highlight($args{'parameterdescs'}{$parameter_name}); | 531 | output_highlight($args{'parameterdescs'}{$parameter_name}); |
@@ -691,7 +691,7 @@ sub output_struct_xml(%) { | |||
691 | $parameter_name =~ s/\[.*//; | 691 | $parameter_name =~ s/\[.*//; |
692 | 692 | ||
693 | defined($args{'parameterdescs'}{$parameter_name}) || next; | 693 | defined($args{'parameterdescs'}{$parameter_name}) || next; |
694 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; | 694 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; |
695 | $type = $args{'parametertypes'}{$parameter}; | 695 | $type = $args{'parametertypes'}{$parameter}; |
696 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { | 696 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { |
697 | # pointer-to-function | 697 | # pointer-to-function |
@@ -767,11 +767,11 @@ sub output_enum_xml(%) { | |||
767 | print "enum ".$args{'enum'}." {\n"; | 767 | print "enum ".$args{'enum'}." {\n"; |
768 | $count = 0; | 768 | $count = 0; |
769 | foreach $parameter (@{$args{'parameterlist'}}) { | 769 | foreach $parameter (@{$args{'parameterlist'}}) { |
770 | print " $parameter"; | 770 | print " $parameter"; |
771 | if ($count != $#{$args{'parameterlist'}}) { | 771 | if ($count != $#{$args{'parameterlist'}}) { |
772 | $count++; | 772 | $count++; |
773 | print ","; | 773 | print ","; |
774 | } | 774 | } |
775 | print "\n"; | 775 | print "\n"; |
776 | } | 776 | } |
777 | print "};"; | 777 | print "};"; |
@@ -1007,7 +1007,7 @@ sub output_enum_man(%) { | |||
1007 | print "enum ".$args{'enum'}." {\n"; | 1007 | print "enum ".$args{'enum'}." {\n"; |
1008 | $count = 0; | 1008 | $count = 0; |
1009 | foreach my $parameter (@{$args{'parameterlist'}}) { | 1009 | foreach my $parameter (@{$args{'parameterlist'}}) { |
1010 | print ".br\n.BI \" $parameter\"\n"; | 1010 | print ".br\n.BI \" $parameter\"\n"; |
1011 | if ($count == $#{$args{'parameterlist'}}) { | 1011 | if ($count == $#{$args{'parameterlist'}}) { |
1012 | print "\n};\n"; | 1012 | print "\n};\n"; |
1013 | last; | 1013 | last; |
@@ -1054,7 +1054,7 @@ sub output_struct_man(%) { | |||
1054 | my $parameter_name = $parameter; | 1054 | my $parameter_name = $parameter; |
1055 | $parameter_name =~ s/\[.*//; | 1055 | $parameter_name =~ s/\[.*//; |
1056 | 1056 | ||
1057 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; | 1057 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; |
1058 | $type = $args{'parametertypes'}{$parameter}; | 1058 | $type = $args{'parametertypes'}{$parameter}; |
1059 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { | 1059 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { |
1060 | # pointer-to-function | 1060 | # pointer-to-function |
@@ -1077,7 +1077,7 @@ sub output_struct_man(%) { | |||
1077 | my $parameter_name = $parameter; | 1077 | my $parameter_name = $parameter; |
1078 | $parameter_name =~ s/\[.*//; | 1078 | $parameter_name =~ s/\[.*//; |
1079 | 1079 | ||
1080 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; | 1080 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; |
1081 | print ".IP \"".$parameter."\" 12\n"; | 1081 | print ".IP \"".$parameter."\" 12\n"; |
1082 | output_highlight($args{'parameterdescs'}{$parameter_name}); | 1082 | output_highlight($args{'parameterdescs'}{$parameter_name}); |
1083 | } | 1083 | } |
@@ -1187,7 +1187,7 @@ sub output_enum_text(%) { | |||
1187 | print "enum ".$args{'enum'}." {\n"; | 1187 | print "enum ".$args{'enum'}." {\n"; |
1188 | $count = 0; | 1188 | $count = 0; |
1189 | foreach $parameter (@{$args{'parameterlist'}}) { | 1189 | foreach $parameter (@{$args{'parameterlist'}}) { |
1190 | print "\t$parameter"; | 1190 | print "\t$parameter"; |
1191 | if ($count != $#{$args{'parameterlist'}}) { | 1191 | if ($count != $#{$args{'parameterlist'}}) { |
1192 | $count++; | 1192 | $count++; |
1193 | print ","; | 1193 | print ","; |
@@ -1232,7 +1232,7 @@ sub output_struct_text(%) { | |||
1232 | my $parameter_name = $parameter; | 1232 | my $parameter_name = $parameter; |
1233 | $parameter_name =~ s/\[.*//; | 1233 | $parameter_name =~ s/\[.*//; |
1234 | 1234 | ||
1235 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; | 1235 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; |
1236 | $type = $args{'parametertypes'}{$parameter}; | 1236 | $type = $args{'parametertypes'}{$parameter}; |
1237 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { | 1237 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { |
1238 | # pointer-to-function | 1238 | # pointer-to-function |
@@ -1252,7 +1252,7 @@ sub output_struct_text(%) { | |||
1252 | my $parameter_name = $parameter; | 1252 | my $parameter_name = $parameter; |
1253 | $parameter_name =~ s/\[.*//; | 1253 | $parameter_name =~ s/\[.*//; |
1254 | 1254 | ||
1255 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; | 1255 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; |
1256 | print "$parameter\n\t"; | 1256 | print "$parameter\n\t"; |
1257 | print $args{'parameterdescs'}{$parameter_name}."\n"; | 1257 | print $args{'parameterdescs'}{$parameter_name}."\n"; |
1258 | } | 1258 | } |
@@ -1284,7 +1284,7 @@ sub output_declaration { | |||
1284 | ( $function_only == 1 && defined($function_table{$name})) || | 1284 | ( $function_only == 1 && defined($function_table{$name})) || |
1285 | ( $function_only == 2 && !defined($function_table{$name}))) | 1285 | ( $function_only == 2 && !defined($function_table{$name}))) |
1286 | { | 1286 | { |
1287 | &$func(@_); | 1287 | &$func(@_); |
1288 | $section_counter++; | 1288 | $section_counter++; |
1289 | } | 1289 | } |
1290 | } | 1290 | } |
@@ -1317,8 +1317,8 @@ sub dump_struct($$) { | |||
1317 | my $file = shift; | 1317 | my $file = shift; |
1318 | 1318 | ||
1319 | if ($x =~/(struct|union)\s+(\w+)\s*{(.*)}/) { | 1319 | if ($x =~/(struct|union)\s+(\w+)\s*{(.*)}/) { |
1320 | $declaration_name = $2; | 1320 | $declaration_name = $2; |
1321 | my $members = $3; | 1321 | my $members = $3; |
1322 | 1322 | ||
1323 | # ignore embedded structs or unions | 1323 | # ignore embedded structs or unions |
1324 | $members =~ s/{.*?}//g; | 1324 | $members =~ s/{.*?}//g; |
@@ -1345,7 +1345,7 @@ sub dump_struct($$) { | |||
1345 | }); | 1345 | }); |
1346 | } | 1346 | } |
1347 | else { | 1347 | else { |
1348 | print STDERR "Error(${file}:$.): Cannot parse struct or union!\n"; | 1348 | print STDERR "Error(${file}:$.): Cannot parse struct or union!\n"; |
1349 | ++$errors; | 1349 | ++$errors; |
1350 | } | 1350 | } |
1351 | } | 1351 | } |
@@ -1356,15 +1356,15 @@ sub dump_enum($$) { | |||
1356 | 1356 | ||
1357 | $x =~ s@/\*.*?\*/@@gos; # strip comments. | 1357 | $x =~ s@/\*.*?\*/@@gos; # strip comments. |
1358 | if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { | 1358 | if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { |
1359 | $declaration_name = $1; | 1359 | $declaration_name = $1; |
1360 | my $members = $2; | 1360 | my $members = $2; |
1361 | 1361 | ||
1362 | foreach my $arg (split ',', $members) { | 1362 | foreach my $arg (split ',', $members) { |
1363 | $arg =~ s/^\s*(\w+).*/$1/; | 1363 | $arg =~ s/^\s*(\w+).*/$1/; |
1364 | push @parameterlist, $arg; | 1364 | push @parameterlist, $arg; |
1365 | if (!$parameterdescs{$arg}) { | 1365 | if (!$parameterdescs{$arg}) { |
1366 | $parameterdescs{$arg} = $undescribed; | 1366 | $parameterdescs{$arg} = $undescribed; |
1367 | print STDERR "Warning(${file}:$.): Enum value '$arg' ". | 1367 | print STDERR "Warning(${file}:$.): Enum value '$arg' ". |
1368 | "not described in enum '$declaration_name'\n"; | 1368 | "not described in enum '$declaration_name'\n"; |
1369 | } | 1369 | } |
1370 | 1370 | ||
@@ -1382,7 +1382,7 @@ sub dump_enum($$) { | |||
1382 | }); | 1382 | }); |
1383 | } | 1383 | } |
1384 | else { | 1384 | else { |
1385 | print STDERR "Error(${file}:$.): Cannot parse enum!\n"; | 1385 | print STDERR "Error(${file}:$.): Cannot parse enum!\n"; |
1386 | ++$errors; | 1386 | ++$errors; |
1387 | } | 1387 | } |
1388 | } | 1388 | } |
@@ -1393,12 +1393,12 @@ sub dump_typedef($$) { | |||
1393 | 1393 | ||
1394 | $x =~ s@/\*.*?\*/@@gos; # strip comments. | 1394 | $x =~ s@/\*.*?\*/@@gos; # strip comments. |
1395 | while (($x =~ /\(*.\)\s*;$/) || ($x =~ /\[*.\]\s*;$/)) { | 1395 | while (($x =~ /\(*.\)\s*;$/) || ($x =~ /\[*.\]\s*;$/)) { |
1396 | $x =~ s/\(*.\)\s*;$/;/; | 1396 | $x =~ s/\(*.\)\s*;$/;/; |
1397 | $x =~ s/\[*.\]\s*;$/;/; | 1397 | $x =~ s/\[*.\]\s*;$/;/; |
1398 | } | 1398 | } |
1399 | 1399 | ||
1400 | if ($x =~ /typedef.*\s+(\w+)\s*;/) { | 1400 | if ($x =~ /typedef.*\s+(\w+)\s*;/) { |
1401 | $declaration_name = $1; | 1401 | $declaration_name = $1; |
1402 | 1402 | ||
1403 | output_declaration($declaration_name, | 1403 | output_declaration($declaration_name, |
1404 | 'typedef', | 1404 | 'typedef', |
@@ -1410,7 +1410,7 @@ sub dump_typedef($$) { | |||
1410 | }); | 1410 | }); |
1411 | } | 1411 | } |
1412 | else { | 1412 | else { |
1413 | print STDERR "Error(${file}:$.): Cannot parse typedef!\n"; | 1413 | print STDERR "Error(${file}:$.): Cannot parse typedef!\n"; |
1414 | ++$errors; | 1414 | ++$errors; |
1415 | } | 1415 | } |
1416 | } | 1416 | } |
@@ -1424,14 +1424,14 @@ sub create_parameterlist($$$) { | |||
1424 | 1424 | ||
1425 | # temporarily replace commas inside function pointer definition | 1425 | # temporarily replace commas inside function pointer definition |
1426 | while ($args =~ /(\([^\),]+),/) { | 1426 | while ($args =~ /(\([^\),]+),/) { |
1427 | $args =~ s/(\([^\),]+),/$1#/g; | 1427 | $args =~ s/(\([^\),]+),/$1#/g; |
1428 | } | 1428 | } |
1429 | 1429 | ||
1430 | foreach my $arg (split($splitter, $args)) { | 1430 | foreach my $arg (split($splitter, $args)) { |
1431 | # strip comments | 1431 | # strip comments |
1432 | $arg =~ s/\/\*.*\*\///; | 1432 | $arg =~ s/\/\*.*\*\///; |
1433 | # strip leading/trailing spaces | 1433 | # strip leading/trailing spaces |
1434 | $arg =~ s/^\s*//; | 1434 | $arg =~ s/^\s*//; |
1435 | $arg =~ s/\s*$//; | 1435 | $arg =~ s/\s*$//; |
1436 | $arg =~ s/\s+/ /; | 1436 | $arg =~ s/\s+/ /; |
1437 | 1437 | ||
@@ -1514,15 +1514,15 @@ sub push_parameter($$$) { | |||
1514 | $parameterdescs{$param_name} = $undescribed; | 1514 | $parameterdescs{$param_name} = $undescribed; |
1515 | 1515 | ||
1516 | if (($type eq 'function') || ($type eq 'enum')) { | 1516 | if (($type eq 'function') || ($type eq 'enum')) { |
1517 | print STDERR "Warning(${file}:$.): Function parameter ". | 1517 | print STDERR "Warning(${file}:$.): Function parameter ". |
1518 | "or member '$param' not " . | 1518 | "or member '$param' not " . |
1519 | "described in '$declaration_name'\n"; | 1519 | "described in '$declaration_name'\n"; |
1520 | } | 1520 | } |
1521 | print STDERR "Warning(${file}:$.):". | 1521 | print STDERR "Warning(${file}:$.):". |
1522 | " No description found for parameter '$param'\n"; | 1522 | " No description found for parameter '$param'\n"; |
1523 | ++$warnings; | 1523 | ++$warnings; |
1524 | } | 1524 | } |
1525 | } | 1525 | } |
1526 | 1526 | ||
1527 | push @parameterlist, $param; | 1527 | push @parameterlist, $param; |
1528 | $parametertypes{$param} = $type; | 1528 | $parametertypes{$param} = $type; |
@@ -1664,10 +1664,10 @@ sub process_state3_function($$) { | |||
1664 | # do nothing | 1664 | # do nothing |
1665 | } | 1665 | } |
1666 | elsif ($x =~ /([^\{]*)/) { | 1666 | elsif ($x =~ /([^\{]*)/) { |
1667 | $prototype .= $1; | 1667 | $prototype .= $1; |
1668 | } | 1668 | } |
1669 | if (($x =~ /\{/) || ($x =~ /\#define/) || ($x =~ /;/)) { | 1669 | if (($x =~ /\{/) || ($x =~ /\#define/) || ($x =~ /;/)) { |
1670 | $prototype =~ s@/\*.*?\*/@@gos; # strip comments. | 1670 | $prototype =~ s@/\*.*?\*/@@gos; # strip comments. |
1671 | $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's. | 1671 | $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's. |
1672 | $prototype =~ s@^\s+@@gos; # strip leading spaces | 1672 | $prototype =~ s@^\s+@@gos; # strip leading spaces |
1673 | dump_function($prototype,$file); | 1673 | dump_function($prototype,$file); |
@@ -1688,17 +1688,17 @@ sub process_state3_type($$) { | |||
1688 | } | 1688 | } |
1689 | 1689 | ||
1690 | while (1) { | 1690 | while (1) { |
1691 | if ( $x =~ /([^{};]*)([{};])(.*)/ ) { | 1691 | if ( $x =~ /([^{};]*)([{};])(.*)/ ) { |
1692 | $prototype .= $1 . $2; | 1692 | $prototype .= $1 . $2; |
1693 | ($2 eq '{') && $brcount++; | 1693 | ($2 eq '{') && $brcount++; |
1694 | ($2 eq '}') && $brcount--; | 1694 | ($2 eq '}') && $brcount--; |
1695 | if (($2 eq ';') && ($brcount == 0)) { | 1695 | if (($2 eq ';') && ($brcount == 0)) { |
1696 | dump_declaration($prototype,$file); | 1696 | dump_declaration($prototype,$file); |
1697 | reset_state(); | 1697 | reset_state(); |
1698 | last; | 1698 | last; |
1699 | } | 1699 | } |
1700 | $x = $3; | 1700 | $x = $3; |
1701 | } else { | 1701 | } else { |
1702 | $prototype .= $x; | 1702 | $prototype .= $x; |
1703 | last; | 1703 | last; |
1704 | } | 1704 | } |
@@ -1756,7 +1756,7 @@ sub process_file($) { | |||
1756 | } else { | 1756 | } else { |
1757 | $section = $1; | 1757 | $section = $1; |
1758 | } | 1758 | } |
1759 | } | 1759 | } |
1760 | elsif (/$doc_decl/o) { | 1760 | elsif (/$doc_decl/o) { |
1761 | $identifier = $1; | 1761 | $identifier = $1; |
1762 | if (/\s*([\w\s]+?)\s*-/) { | 1762 | if (/\s*([\w\s]+?)\s*-/) { |
@@ -1849,13 +1849,13 @@ sub process_file($) { | |||
1849 | } | 1849 | } |
1850 | } elsif ($state == 3) { # scanning for function '{' (end of prototype) | 1850 | } elsif ($state == 3) { # scanning for function '{' (end of prototype) |
1851 | if ($decl_type eq 'function') { | 1851 | if ($decl_type eq 'function') { |
1852 | process_state3_function($_, $file); | 1852 | process_state3_function($_, $file); |
1853 | } else { | 1853 | } else { |
1854 | process_state3_type($_, $file); | 1854 | process_state3_type($_, $file); |
1855 | } | 1855 | } |
1856 | } elsif ($state == 4) { | 1856 | } elsif ($state == 4) { |
1857 | # Documentation block | 1857 | # Documentation block |
1858 | if (/$doc_block/) { | 1858 | if (/$doc_block/) { |
1859 | dump_section($section, $contents); | 1859 | dump_section($section, $contents); |
1860 | output_intro({'sectionlist' => \@sectionlist, | 1860 | output_intro({'sectionlist' => \@sectionlist, |
1861 | 'sections' => \%sections }); | 1861 | 'sections' => \%sections }); |
@@ -1873,7 +1873,7 @@ sub process_file($) { | |||
1873 | } else { | 1873 | } else { |
1874 | $section = $1; | 1874 | $section = $1; |
1875 | } | 1875 | } |
1876 | } | 1876 | } |
1877 | elsif (/$doc_end/) | 1877 | elsif (/$doc_end/) |
1878 | { | 1878 | { |
1879 | dump_section($section, $contents); | 1879 | dump_section($section, $contents); |
@@ -1900,8 +1900,8 @@ sub process_file($) { | |||
1900 | { | 1900 | { |
1901 | $contents .= $1 . "\n"; | 1901 | $contents .= $1 . "\n"; |
1902 | } | 1902 | } |
1903 | } | 1903 | } |
1904 | } | 1904 | } |
1905 | } | 1905 | } |
1906 | if ($initial_section_counter == $section_counter) { | 1906 | if ($initial_section_counter == $section_counter) { |
1907 | print STDERR "Warning(${file}): no structured comments found\n"; | 1907 | print STDERR "Warning(${file}): no structured comments found\n"; |