Skip to content

Commit 5c5da9a

Browse files
committed
kernel-doc: support in-line comments on nested structs/unions
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>
1 parent f936ed1 commit 5c5da9a

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

docs/linuxdoc-howto/all-in-a-tumble.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,17 @@ struct my_long_struct {
148148
* Here, the member description may contain several paragraphs.
149149
*/
150150
int baz;
151-
/** @foobar: Single line description. */
152-
int foobar;
151+
union {
152+
/** @foobar: Single line description. */
153+
int foobar;
154+
};
155+
/** @bar2: Description for struct @bar2 inside @my_long_struct */
156+
struct {
157+
/**
158+
* @bar2.barbar: Description for @barbar inside @foo.bar2
159+
*/
160+
int barbar;
161+
} bar2;
153162
};
154163
/* parse-SNAP: */
155164

linuxdoc/kernel_doc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ def __getitem__(self, group):
157157

158158
# state: 5 - gathering documentation outside main block
159159
doc_state5_start = RE(r"^\s*/\*\*\s*$")
160-
doc_state5_sect = RE(r"\s*\*\s*(@[\w\s]+):(.*)")
160+
doc_state5_sect = RE(r"\s*\*\s*(@\s*[\w][\w\.]*\s*):(.*)")
161+
161162
doc_state5_end = RE(r"^\s*\*/\s*$")
162163
doc_state5_oneline = RE(r"^\s*/\*\*\s*(@[\w\s]+):\s*(.*)\s*\*/\s*$")
163164

0 commit comments

Comments
 (0)