git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
scripts
/
kernel-doc
diff --git
a/scripts/kernel-doc
b/scripts/kernel-doc
index
99fe4b7
..
f50a70f
100755
(executable)
--- a/
scripts/kernel-doc
+++ b/
scripts/kernel-doc
@@
-57,8
+57,8
@@
use strict;
# other functions are ignored.
#
# -nofunction funcname
# other functions are ignored.
#
# -nofunction funcname
-# If set, then only generate documentation for the other function(s).
All
-#
other functions are ignored. Cannot be used with -function together
+# If set, then only generate documentation for the other function(s).
+#
Cannot be used together with -function
# (yes, that's a bug -- perl hackers can fix it 8))
#
# c files - list of 'c' files to process
# (yes, that's a bug -- perl hackers can fix it 8))
#
# c files - list of 'c' files to process
@@
-253,6
+253,7
@@
my $lineprefix="";
# 3 - scanning prototype.
# 4 - documentation block
my $state;
# 3 - scanning prototype.
# 4 - documentation block
my $state;
+my $in_doc_sect;
#declaration types: can be
# 'function', 'struct', 'union', 'enum', 'typedef'
#declaration types: can be
# 'function', 'struct', 'union', 'enum', 'typedef'
@@
-1055,7
+1056,8
@@
sub output_struct_man(%) {
# pointer-to-function
print ".BI \" ".$1."\" ".$parameter." \") (".$2.")"."\"\n;\n";
} elsif ($type =~ m/^(.*?)\s*(:.*)/) {
# pointer-to-function
print ".BI \" ".$1."\" ".$parameter." \") (".$2.")"."\"\n;\n";
} elsif ($type =~ m/^(.*?)\s*(:.*)/) {
- print ".BI \" ".$1."\" ".$parameter.$2." \""."\"\n;\n";
+ # bitfield
+ print ".BI \" ".$1."\ \" ".$parameter.$2." \""."\"\n;\n";
} else {
$type =~ s/([^\*])$/$1 /;
print ".BI \" ".$type."\" ".$parameter." \""."\"\n;\n";
} else {
$type =~ s/([^\*])$/$1 /;
print ".BI \" ".$type."\" ".$parameter." \""."\"\n;\n";
@@
-1064,7
+1066,7
@@
sub output_struct_man(%) {
}
print "};\n.br\n";
}
print "};\n.br\n";
- print ".SH
Argument
s\n";
+ print ".SH
Member
s\n";
foreach $parameter (@{$args{'parameterlist'}}) {
($parameter =~ /^#/) && next;
foreach $parameter (@{$args{'parameterlist'}}) {
($parameter =~ /^#/) && next;
@@
-1117,7
+1119,10
@@
sub output_function_text(%) {
my %args = %{$_[0]};
my ($parameter, $section);
my %args = %{$_[0]};
my ($parameter, $section);
- print "Function:\n\n";
+ print "Name:\n\n";
+ print $args{'function'}." - ".$args{'purpose'}."\n";
+
+ print "\nSynopsis:\n\n";
my $start=$args{'functiontype'}." ".$args{'function'}." (";
print $start;
my $count = 0;
my $start=$args{'functiontype'}." ".$args{'function'}." (";
print $start;
my $count = 0;
@@
-1168,6
+1173,7
@@
sub output_enum_text(%) {
my $count;
print "Enum:\n\n";
my $count;
print "Enum:\n\n";
+ print "enum ".$args{'enum'}." - ".$args{'purpose'}."\n\n";
print "enum ".$args{'enum'}." {\n";
$count = 0;
foreach $parameter (@{$args{'parameterlist'}}) {
print "enum ".$args{'enum'}." {\n";
$count = 0;
foreach $parameter (@{$args{'parameterlist'}}) {
@@
-1196,7
+1202,7
@@
sub output_typedef_text(%) {
my $count;
print "Typedef:\n\n";
my $count;
print "Typedef:\n\n";
- print "typedef ".$args{'typedef'}."\n";
+ print "typedef ".$args{'typedef'}."
- ".$args{'purpose'}."
\n";
output_section_text(@_);
}
output_section_text(@_);
}
@@
-1205,7
+1211,7
@@
sub output_struct_text(%) {
my %args = %{$_[0]};
my ($parameter);
my %args = %{$_[0]};
my ($parameter);
- print $args{'type'}." ".$args{'struct'}."
:
\n\n";
+ print $args{'type'}." ".$args{'struct'}."
- ".$args{'purpose'}."
\n\n";
print $args{'type'}." ".$args{'struct'}." {\n";
foreach $parameter (@{$args{'parameterlist'}}) {
if ($parameter =~ /^#/) {
print $args{'type'}." ".$args{'struct'}." {\n";
foreach $parameter (@{$args{'parameterlist'}}) {
if ($parameter =~ /^#/) {
@@
-1256,7
+1262,9
@@
sub output_intro_text(%) {
}
##
}
##
-# generic output function for typedefs
+# generic output function for all types (function, struct/union, typedef, enum);
+# calls the generated, variable output_ function name based on
+# functype and output_mode
sub output_declaration {
no strict 'refs';
my $name = shift;
sub output_declaration {
no strict 'refs';
my $name = shift;
@@
-1272,8
+1280,7
@@
sub output_declaration {
}
##
}
##
-# generic output function - calls the right one based
-# on current output mode.
+# generic output function - calls the right one based on current output mode.
sub output_intro {
no strict 'refs';
my $func = "output_intro_".$output_mode;
sub output_intro {
no strict 'refs';
my $func = "output_intro_".$output_mode;
@@
-1423,7
+1430,7
@@
sub create_parameterlist($$$) {
# corresponding data structures "correctly". Catch it later in
# output_* subs.
push_parameter($arg, "", $file);
# corresponding data structures "correctly". Catch it later in
# output_* subs.
push_parameter($arg, "", $file);
- } elsif ($arg =~ m/\(/) {
+ } elsif ($arg =~ m/\(
.*\*
/) {
# pointer-to-function
$arg =~ tr/#/,/;
$arg =~ m/[^\(]+\(\*([^\)]+)\)/;
# pointer-to-function
$arg =~ tr/#/,/;
$arg =~ m/[^\(]+\(\*([^\)]+)\)/;
@@
-1462,6
+1469,7
@@
sub push_parameter($$$) {
my $param = shift;
my $type = shift;
my $file = shift;
my $param = shift;
my $type = shift;
my $file = shift;
+ my $anon = 0;
my $param_name = $param;
$param_name =~ s/\[.*//;
my $param_name = $param;
$param_name =~ s/\[.*//;
@@
-1477,9
+1485,20
@@
sub push_parameter($$$) {
$param="void";
$parameterdescs{void} = "no arguments";
}
$param="void";
$parameterdescs{void} = "no arguments";
}
+ elsif ($type eq "" && ($param eq "struct" or $param eq "union"))
+ # handle unnamed (anonymous) union or struct:
+ {
+ $type = $param;
+ $param = "{unnamed_" . $param. "}";
+ $parameterdescs{$param} = "anonymous\n";
+ $anon = 1;
+ }
+
# warn if parameter has no description
# warn if parameter has no description
- # (but ignore ones starting with # as these are no parameters
- # but inline preprocessor statements
+ # (but ignore ones starting with # as these are not parameters
+ # but inline preprocessor statements);
+ # also ignore unnamed structs/unions;
+ if (!$anon) {
if (!defined $parameterdescs{$param_name} && $param_name !~ /^#/) {
$parameterdescs{$param_name} = $undescribed;
if (!defined $parameterdescs{$param_name} && $param_name !~ /^#/) {
$parameterdescs{$param_name} = $undescribed;
@@
-1493,6
+1512,7
@@
sub push_parameter($$$) {
" No description found for parameter '$param'\n";
++$warnings;
}
" No description found for parameter '$param'\n";
++$warnings;
}
+ }
push @parameterlist, $param;
$parametertypes{$param} = $type;
push @parameterlist, $param;
$parametertypes{$param} = $type;
@@
-1512,6
+1532,10
@@
sub dump_function($$) {
$prototype =~ s/^asmlinkage +//;
$prototype =~ s/^inline +//;
$prototype =~ s/^__inline__ +//;
$prototype =~ s/^asmlinkage +//;
$prototype =~ s/^inline +//;
$prototype =~ s/^__inline__ +//;
+ $prototype =~ s/^__inline +//;
+ $prototype =~ s/^__always_inline +//;
+ $prototype =~ s/^noinline +//;
+ $prototype =~ s/__devinit +//;
$prototype =~ s/^#define +//; #ak added
$prototype =~ s/__attribute__ \(\([a-z,]*\)\)//;
$prototype =~ s/^#define +//; #ak added
$prototype =~ s/__attribute__ \(\([a-z,]*\)\)//;
@@
-1673,6
+1697,9
@@
sub process_state3_type($$) {
# replace <, >, and &
sub xml_escape($) {
my $text = shift;
# replace <, >, and &
sub xml_escape($) {
my $text = shift;
+ if (($output_mode eq "text") || ($output_mode eq "man")) {
+ return $text;
+ }
$text =~ s/\&/\\\\\\amp;/g;
$text =~ s/\</\\\\\\lt;/g;
$text =~ s/\>/\\\\\\gt;/g;
$text =~ s/\&/\\\\\\amp;/g;
$text =~ s/\</\\\\\\lt;/g;
$text =~ s/\>/\\\\\\gt;/g;
@@
-1706,6
+1733,7
@@
sub process_file($) {
if ($state == 0) {
if (/$doc_start/o) {
$state = 1; # next line is always the function name
if ($state == 0) {
if (/$doc_start/o) {
$state = 1; # next line is always the function name
+ $in_doc_sect = 0;
}
} elsif ($state == 1) { # this line is the function name (always)
if (/$doc_block/o) {
}
} elsif ($state == 1) { # this line is the function name (always)
if (/$doc_block/o) {
@@
-1756,12
+1784,21
@@
sub process_file($) {
$newcontents = $2;
if ($contents ne "") {
$newcontents = $2;
if ($contents ne "") {
+ if (!$in_doc_sect && $verbose) {
+ print STDERR "Warning(${file}:$.): contents before sections\n";
+ ++$warnings;
+ }
dump_section($section, xml_escape($contents));
$section = $section_default;
}
dump_section($section, xml_escape($contents));
$section = $section_default;
}
+ $in_doc_sect = 1;
$contents = $newcontents;
if ($contents ne "") {
$contents = $newcontents;
if ($contents ne "") {
+ while ((substr($contents, 0, 1) eq " ") ||
+ substr($contents, 0, 1) eq "\t") {
+ $contents = substr($contents, 1);
+ }
$contents .= "\n";
}
$section = $newsection;
$contents .= "\n";
}
$section = $newsection;
@@
-1776,7
+1813,7
@@
sub process_file($) {
$prototype = "";
$state = 3;
$brcount = 0;
$prototype = "";
$state = 3;
$brcount = 0;
-# print STDERR "end of doc comment, looking for prototype\n";
+#
print STDERR "end of doc comment, looking for prototype\n";
} elsif (/$doc_content/) {
# miguel-style comment kludge, look for blank lines after
# @parameter line to signify start of description
} elsif (/$doc_content/) {
# miguel-style comment kludge, look for blank lines after
# @parameter line to signify start of description
@@
-1793,7
+1830,7
@@
sub process_file($) {
print STDERR "Warning(${file}:$.): bad line: $_";
++$warnings;
}
print STDERR "Warning(${file}:$.): bad line: $_";
++$warnings;
}
- } elsif ($state == 3) { # scanning for function
{
(end of prototype)
+ } elsif ($state == 3) { # scanning for function
'{'
(end of prototype)
if ($decl_type eq 'function') {
process_state3_function($_, $file);
} else {
if ($decl_type eq 'function') {
process_state3_function($_, $file);
} else {