aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kernel-doc
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kernel-doc')
-rwxr-xr-xscripts/kernel-doc28
1 files changed, 22 insertions, 6 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index e5bf649e516a..1f5835115cad 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -154,6 +154,7 @@ use strict;
154 154
155my $errors = 0; 155my $errors = 0;
156my $warnings = 0; 156my $warnings = 0;
157my $anon_struct_union = 0;
157 158
158# match expressions used to find embedded type information 159# match expressions used to find embedded type information
159my $type_constant = '\%([-_\w]+)'; 160my $type_constant = '\%([-_\w]+)';
@@ -403,7 +404,11 @@ sub output_highlight {
403 print $lineprefix, $blankline; 404 print $lineprefix, $blankline;
404 } else { 405 } else {
405 $line =~ s/\\\\\\/\&/g; 406 $line =~ s/\\\\\\/\&/g;
406 print $lineprefix, $line; 407 if ($output_mode eq "man" && substr($line, 0, 1) eq ".") {
408 print "\\&$line";
409 } else {
410 print $lineprefix, $line;
411 }
407 } 412 }
408 print "\n"; 413 print "\n";
409 } 414 }
@@ -718,6 +723,7 @@ sub output_struct_xml(%) {
718 # pointer-to-function 723 # pointer-to-function
719 print " $1 $parameter) ($2);\n"; 724 print " $1 $parameter) ($2);\n";
720 } elsif ($type =~ m/^(.*?)\s*(:.*)/) { 725 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
726 # bitfield
721 print " $1 $parameter$2;\n"; 727 print " $1 $parameter$2;\n";
722 } else { 728 } else {
723 print " ".$type." ".$parameter.";\n"; 729 print " ".$type." ".$parameter.";\n";
@@ -1260,6 +1266,7 @@ sub output_struct_text(%) {
1260 # pointer-to-function 1266 # pointer-to-function
1261 print "\t$1 $parameter) ($2);\n"; 1267 print "\t$1 $parameter) ($2);\n";
1262 } elsif ($type =~ m/^(.*?)\s*(:.*)/) { 1268 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
1269 # bitfield
1263 print "\t$1 $parameter$2;\n"; 1270 print "\t$1 $parameter$2;\n";
1264 } else { 1271 } else {
1265 print "\t".$type." ".$parameter.";\n"; 1272 print "\t".$type." ".$parameter.";\n";
@@ -1510,8 +1517,13 @@ sub push_parameter($$$) {
1510 my $param = shift; 1517 my $param = shift;
1511 my $type = shift; 1518 my $type = shift;
1512 my $file = shift; 1519 my $file = shift;
1513 my $anon = 0;
1514 1520
1521 if (($anon_struct_union == 1) && ($type eq "") &&
1522 ($param eq "}")) {
1523 return; # ignore the ending }; from anon. struct/union
1524 }
1525
1526 $anon_struct_union = 0;
1515 my $param_name = $param; 1527 my $param_name = $param;
1516 $param_name =~ s/\[.*//; 1528 $param_name =~ s/\[.*//;
1517 1529
@@ -1530,16 +1542,16 @@ sub push_parameter($$$) {
1530 # handle unnamed (anonymous) union or struct: 1542 # handle unnamed (anonymous) union or struct:
1531 { 1543 {
1532 $type = $param; 1544 $type = $param;
1533 $param = "{unnamed_" . $param. "}"; 1545 $param = "{unnamed_" . $param . "}";
1534 $parameterdescs{$param} = "anonymous\n"; 1546 $parameterdescs{$param} = "anonymous\n";
1535 $anon = 1; 1547 $anon_struct_union = 1;
1536 } 1548 }
1537 1549
1538 # warn if parameter has no description 1550 # warn if parameter has no description
1539 # (but ignore ones starting with # as these are not parameters 1551 # (but ignore ones starting with # as these are not parameters
1540 # but inline preprocessor statements); 1552 # but inline preprocessor statements);
1541 # also ignore unnamed structs/unions; 1553 # also ignore unnamed structs/unions;
1542 if (!$anon) { 1554 if (!$anon_struct_union) {
1543 if (!defined $parameterdescs{$param_name} && $param_name !~ /^#/) { 1555 if (!defined $parameterdescs{$param_name} && $param_name !~ /^#/) {
1544 1556
1545 $parameterdescs{$param_name} = $undescribed; 1557 $parameterdescs{$param_name} = $undescribed;
@@ -1691,6 +1703,8 @@ sub process_state3_function($$) {
1691 my $x = shift; 1703 my $x = shift;
1692 my $file = shift; 1704 my $file = shift;
1693 1705
1706 $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line
1707
1694 if ($x =~ m#\s*/\*\s+MACDOC\s*#io || ($x =~ /^#/ && $x !~ /^#define/)) { 1708 if ($x =~ m#\s*/\*\s+MACDOC\s*#io || ($x =~ /^#/ && $x !~ /^#define/)) {
1695 # do nothing 1709 # do nothing
1696 } 1710 }
@@ -1713,6 +1727,8 @@ sub process_state3_type($$) {
1713 $x =~ s@[\r\n]+@ @gos; # strip newlines/cr's. 1727 $x =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
1714 $x =~ s@^\s+@@gos; # strip leading spaces 1728 $x =~ s@^\s+@@gos; # strip leading spaces
1715 $x =~ s@\s+$@@gos; # strip trailing spaces 1729 $x =~ s@\s+$@@gos; # strip trailing spaces
1730 $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line
1731
1716 if ($x =~ /^#/) { 1732 if ($x =~ /^#/) {
1717 # To distinguish preprocessor directive from regular declaration later. 1733 # To distinguish preprocessor directive from regular declaration later.
1718 $x .= ";"; 1734 $x .= ";";
@@ -1796,7 +1812,7 @@ sub process_file($) {
1796 1812
1797 $state = 2; 1813 $state = 2;
1798 if (/-(.*)/) { 1814 if (/-(.*)/) {
1799 # strip leading/trailing/multiple spaces #RDD:T: 1815 # strip leading/trailing/multiple spaces
1800 $descr= $1; 1816 $descr= $1;
1801 $descr =~ s/^\s*//; 1817 $descr =~ s/^\s*//;
1802 $descr =~ s/\s*$//; 1818 $descr =~ s/\s*$//;