Skip to content

Commit

Permalink
kernel-doc: support in-line comments on nested structs/unions
Browse files Browse the repository at this point in the history
The parser at kernel-doc rejects names with dots in the middle.
Fix it, in order to support nested structs/unions.

--
The origin patch comes from Mauro [1] patching kernel-doc (perl)
parser of the Linux tree.

[1] https://www.mail-archive.com/linux-doc@vger.kernel.org/msg18197.html

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
  • Loading branch information
return42 committed Feb 16, 2018
1 parent f936ed1 commit 5c5da9a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 11 additions & 2 deletions docs/linuxdoc-howto/all-in-a-tumble.h
Expand Up @@ -148,8 +148,17 @@ struct my_long_struct {
* Here, the member description may contain several paragraphs.
*/
int baz;
/** @foobar: Single line description. */
int foobar;
union {
/** @foobar: Single line description. */
int foobar;
};
/** @bar2: Description for struct @bar2 inside @my_long_struct */
struct {
/**
* @bar2.barbar: Description for @barbar inside @foo.bar2
*/
int barbar;
} bar2;
};
/* parse-SNAP: */

Expand Down
3 changes: 2 additions & 1 deletion linuxdoc/kernel_doc.py
Expand Up @@ -157,7 +157,8 @@ def __getitem__(self, group):

# state: 5 - gathering documentation outside main block
doc_state5_start = RE(r"^\s*/\*\*\s*$")
doc_state5_sect = RE(r"\s*\*\s*(@[\w\s]+):(.*)")
doc_state5_sect = RE(r"\s*\*\s*(@\s*[\w][\w\.]*\s*):(.*)")

doc_state5_end = RE(r"^\s*\*/\s*$")
doc_state5_oneline = RE(r"^\s*/\*\*\s*(@[\w\s]+):\s*(.*)\s*\*/\s*$")

Expand Down

0 comments on commit 5c5da9a

Please sign in to comment.