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

kernel-doc: add support for one line inline struct member doc comments

kernel-doc supports documenting struct members "inline" since
a4c6ebede2f9 ("scripts/kernel-doc Allow struct arguments documentation
in struct body"). This requires the inline kernel-doc comments to have
the opening and closing comment markers (/** and */ respectively) on
lines of their own, even for short comments. For example:

/**
* struct foo - struct documentation
*/
struct foo {
/**
* @bar: member documentation
*/
int bar;
};

Add support for one line inline comments:

/**
* struct foo - struct documentation
*/
struct foo {
/** @bar: member documentation */
int bar;
};

Note that mixing of the two in one doc comment is not allowed; either
both comment markers must be on lines of their own, or both must be on
the one line. This limitation keeps both the comments more uniform, and
kernel-doc less complicated.

Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Jani Nikula and committed by
Jonathan Corbet
0c9aa209 dc92726e

+11 -1
+11 -1
scripts/kernel-doc
··· 421 421 my $doc_inline_start = '^\s*/\*\*\s*$'; 422 422 my $doc_inline_sect = '\s*\*\s*(@[\w\s]+):(.*)'; 423 423 my $doc_inline_end = '^\s*\*/\s*$'; 424 + my $doc_inline_oneline = '^\s*/\*\*\s*(@[\w\s]+):\s*(.*)\s*\*/\s*$'; 424 425 my $export_symbol = '^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*;'; 425 426 426 427 my %parameterdescs; ··· 3025 3024 } 3026 3025 } 3027 3026 } elsif ($state == STATE_PROTO) { # scanning for function '{' (end of prototype) 3028 - if (/$doc_inline_start/) { 3027 + if (/$doc_inline_oneline/) { 3028 + $section = $1; 3029 + $contents = $2; 3030 + if ($contents ne "") { 3031 + $contents .= "\n"; 3032 + dump_section($file, $section, xml_escape($contents)); 3033 + $section = $section_default; 3034 + $contents = ""; 3035 + } 3036 + } elsif (/$doc_inline_start/) { 3029 3037 $state = STATE_INLINE; 3030 3038 $inline_doc_state = STATE_INLINE_NAME; 3031 3039 } elsif ($decl_type eq 'function') {