Commit 51f5a0c8 authored by Randy Dunlap's avatar Randy Dunlap Committed by Linus Torvalds

kernel-doc: strip C99 comments

Strip C99-style comments from the input stream.
/*...*/ comments are already stripped.
C99 comments confuse the kernel-doc script.

Also update some comments.
Signed-off-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5f8c7c98
...@@ -719,6 +719,7 @@ sub output_struct_xml(%) { ...@@ -719,6 +719,7 @@ sub output_struct_xml(%) {
# pointer-to-function # pointer-to-function
print " $1 $parameter) ($2);\n"; print " $1 $parameter) ($2);\n";
} elsif ($type =~ m/^(.*?)\s*(:.*)/) { } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
# bitfield
print " $1 $parameter$2;\n"; print " $1 $parameter$2;\n";
} else { } else {
print " ".$type." ".$parameter.";\n"; print " ".$type." ".$parameter.";\n";
...@@ -1261,6 +1262,7 @@ sub output_struct_text(%) { ...@@ -1261,6 +1262,7 @@ sub output_struct_text(%) {
# pointer-to-function # pointer-to-function
print "\t$1 $parameter) ($2);\n"; print "\t$1 $parameter) ($2);\n";
} elsif ($type =~ m/^(.*?)\s*(:.*)/) { } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
# bitfield
print "\t$1 $parameter$2;\n"; print "\t$1 $parameter$2;\n";
} else { } else {
print "\t".$type." ".$parameter.";\n"; print "\t".$type." ".$parameter.";\n";
...@@ -1697,6 +1699,8 @@ sub process_state3_function($$) { ...@@ -1697,6 +1699,8 @@ sub process_state3_function($$) {
my $x = shift; my $x = shift;
my $file = shift; my $file = shift;
$x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line
if ($x =~ m#\s*/\*\s+MACDOC\s*#io || ($x =~ /^#/ && $x !~ /^#define/)) { if ($x =~ m#\s*/\*\s+MACDOC\s*#io || ($x =~ /^#/ && $x !~ /^#define/)) {
# do nothing # do nothing
} }
...@@ -1719,6 +1723,8 @@ sub process_state3_type($$) { ...@@ -1719,6 +1723,8 @@ sub process_state3_type($$) {
$x =~ s@[\r\n]+@ @gos; # strip newlines/cr's. $x =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
$x =~ s@^\s+@@gos; # strip leading spaces $x =~ s@^\s+@@gos; # strip leading spaces
$x =~ s@\s+$@@gos; # strip trailing spaces $x =~ s@\s+$@@gos; # strip trailing spaces
$x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line
if ($x =~ /^#/) { if ($x =~ /^#/) {
# To distinguish preprocessor directive from regular declaration later. # To distinguish preprocessor directive from regular declaration later.
$x .= ";"; $x .= ";";
...@@ -1802,7 +1808,7 @@ sub process_file($) { ...@@ -1802,7 +1808,7 @@ sub process_file($) {
$state = 2; $state = 2;
if (/-(.*)/) { if (/-(.*)/) {
# strip leading/trailing/multiple spaces #RDD:T: # strip leading/trailing/multiple spaces
$descr= $1; $descr= $1;
$descr =~ s/^\s*//; $descr =~ s/^\s*//;
$descr =~ s/\s*$//; $descr =~ s/\s*$//;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment