Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Randy Dunlap and committed by
Linus Torvalds
52dc5aec 00a62ce9

+9 -5
+5 -2
Documentation/kernel-doc-nano-HOWTO.txt
··· 269 269 270 270 Inside a struct description, you can use the "private:" and "public:" 271 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 277 Example: 275 278 ··· 286 283 struct my_struct { 287 284 int a; 288 285 int b; 289 - /* private: */ 286 + /* private: internal use only */ 290 287 int c; 291 288 }; 292 289
+4 -3
scripts/kernel-doc
··· 1411 1411 my $file = shift; 1412 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 1416 $declaration_name = $2; 1416 1417 my $members = $3; 1417 1418 ··· 1421 1420 $nested = $1; 1422 1421 1423 1422 # ignore members marked private: 1424 - $members =~ s/\/\*.*?private:.*?public:.*?\*\///gos; 1425 - $members =~ s/\/\*.*?private:.*//gos; 1423 + $members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gos; 1424 + $members =~ s/\/\*\s*private:.*//gos; 1426 1425 # strip comments: 1427 1426 $members =~ s/\/\*.*?\*\///gos; 1428 1427 $nested =~ s/\/\*.*?\*\///gos;