diff options
author | Randy Dunlap <randy.dunlap@oracle.com> | 2009-04-30 18:08:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-05-02 18:36:10 -0400 |
commit | 52dc5aec9fe2eb591f1490278ae767448860118b (patch) | |
tree | e25afe95ef284448f65c7dbb6fb77323bd294e5f | |
parent | 00a62ce91e554198ef28234c91c36f850f5a3bc9 (diff) |
kernel-doc: restrict syntax for private: and public:
scripts/kernel-doc can (incorrectly) delete struct members that are
surrounded by /* ... */ <struct members> /* ... */ if there is a /*
private: */ comment in there somewhere also.
Fix that by making the "/* private:" only allow whitespace between /* and
"private:", not anything/everything in the world.
This fixes some erroneous kernel-doc warnings that popped up while
processing include/linux/usb/composite.h.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | Documentation/kernel-doc-nano-HOWTO.txt | 7 | ||||
-rwxr-xr-x | scripts/kernel-doc | 7 |
2 files changed, 9 insertions, 5 deletions
diff --git a/Documentation/kernel-doc-nano-HOWTO.txt b/Documentation/kernel-doc-nano-HOWTO.txt index 026ec7d57384..4d04572b6549 100644 --- a/Documentation/kernel-doc-nano-HOWTO.txt +++ b/Documentation/kernel-doc-nano-HOWTO.txt | |||
@@ -269,7 +269,10 @@ Use the argument mechanism to document members or constants. | |||
269 | 269 | ||
270 | Inside a struct description, you can use the "private:" and "public:" | 270 | Inside a struct description, you can use the "private:" and "public:" |
271 | comment tags. Structure fields that are inside a "private:" area | 271 | comment tags. Structure fields that are inside a "private:" area |
272 | are not listed in the generated output documentation. | 272 | are not listed in the generated output documentation. The "private:" |
273 | and "public:" tags must begin immediately following a "/*" comment | ||
274 | marker. They may optionally include comments between the ":" and the | ||
275 | ending "*/" marker. | ||
273 | 276 | ||
274 | Example: | 277 | Example: |
275 | 278 | ||
@@ -283,7 +286,7 @@ Example: | |||
283 | struct my_struct { | 286 | struct my_struct { |
284 | int a; | 287 | int a; |
285 | int b; | 288 | int b; |
286 | /* private: */ | 289 | /* private: internal use only */ |
287 | int c; | 290 | int c; |
288 | }; | 291 | }; |
289 | 292 | ||
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 0f11870116dc..3208a3a7e7fe 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -1411,7 +1411,8 @@ sub dump_struct($$) { | |||
1411 | my $file = shift; | 1411 | my $file = shift; |
1412 | my $nested; | 1412 | my $nested; |
1413 | 1413 | ||
1414 | if ($x =~/(struct|union)\s+(\w+)\s*{(.*)}/) { | 1414 | if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) { |
1415 | #my $decl_type = $1; | ||
1415 | $declaration_name = $2; | 1416 | $declaration_name = $2; |
1416 | my $members = $3; | 1417 | my $members = $3; |
1417 | 1418 | ||
@@ -1420,8 +1421,8 @@ sub dump_struct($$) { | |||
1420 | $nested = $1; | 1421 | $nested = $1; |
1421 | 1422 | ||
1422 | # ignore members marked private: | 1423 | # ignore members marked private: |
1423 | $members =~ s/\/\*.*?private:.*?public:.*?\*\///gos; | 1424 | $members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gos; |
1424 | $members =~ s/\/\*.*?private:.*//gos; | 1425 | $members =~ s/\/\*\s*private:.*//gos; |
1425 | # strip comments: | 1426 | # strip comments: |
1426 | $members =~ s/\/\*.*?\*\///gos; | 1427 | $members =~ s/\/\*.*?\*\///gos; |
1427 | $nested =~ s/\/\*.*?\*\///gos; | 1428 | $nested =~ s/\/\*.*?\*\///gos; |