Skip to content

Commit 74272d5

Browse files
committed
KernelDoc: new parser
This one is disabled by default. Give --languages=+KernelDoc for enabling. Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 878db24 commit 74272d5

File tree

20 files changed

+650
-30
lines changed

20 files changed

+650
-30
lines changed
Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
1-
#NAME BASEPARSER DIRECTIONS
2-
AnsiblePlaybook Yaml base <> sub {bidirectional}
3-
Ant XML base <> sub {bidirectional}
4-
Autoconf M4 base <> sub {bidirectional}
5-
Automake Make base <= sub {dedicated}
6-
Bats Sh base <= sub {dedicated}
7-
DBusIntrospect XML base <> sub {bidirectional}
8-
FunctionParameters Perl base <> sub {bidirectional}
9-
GemSpec Ruby base <= sub {dedicated}
10-
Glade XML base <> sub {bidirectional}
11-
IPythonCell Python base => sub {shared}
12-
ITcl Tcl base <> sub {bidirectional}
13-
Maven2 XML base <> sub {bidirectional}
14-
Moose Perl base <> sub {bidirectional}
15-
OpenAPI Yaml base <> sub {bidirectional}
16-
PlistXML XML base <> sub {bidirectional}
17-
PythonLoggingConfig Iniconf base <> sub {bidirectional}
18-
QtMoc C++ base <> sub {bidirectional}
19-
R6Class R base <> sub {bidirectional}
20-
RMarkdown Markdown base <= sub {dedicated}
21-
RSpec Ruby base => sub {shared}
22-
Rake Ruby base <= sub {dedicated}
23-
RelaxNG XML base <> sub {bidirectional}
24-
S4Class R base <> sub {bidirectional}
25-
SVG XML base <> sub {bidirectional}
26-
SystemdUnit Iniconf base <= sub {dedicated}
27-
TclOO Tcl base <> sub {bidirectional}
28-
TeXBeamer Tex base <> sub {bidirectional}
29-
XSLT XML base <> sub {bidirectional}
30-
YumRepo Iniconf base <= sub {dedicated}
1+
#NAME BASEPARSER DIRECTIONS
2+
AnsiblePlaybook Yaml base <> sub {bidirectional}
3+
Ant XML base <> sub {bidirectional}
4+
Autoconf M4 base <> sub {bidirectional}
5+
Automake Make base <= sub {dedicated}
6+
Bats Sh base <= sub {dedicated}
7+
DBusIntrospect XML base <> sub {bidirectional}
8+
FunctionParameters Perl base <> sub {bidirectional}
9+
GemSpec Ruby base <= sub {dedicated}
10+
Glade XML base <> sub {bidirectional}
11+
IPythonCell Python base => sub {shared}
12+
ITcl Tcl base <> sub {bidirectional}
13+
KernelDoc CPreProcessor base => sub {shared}
14+
Maven2 XML base <> sub {bidirectional}
15+
Moose Perl base <> sub {bidirectional}
16+
OpenAPI Yaml base <> sub {bidirectional}
17+
PlistXML XML base <> sub {bidirectional}
18+
PythonLoggingConfig Iniconf base <> sub {bidirectional}
19+
QtMoc C++ base <> sub {bidirectional}
20+
R6Class R base <> sub {bidirectional}
21+
RMarkdown Markdown base <= sub {dedicated}
22+
RSpec Ruby base => sub {shared}
23+
Rake Ruby base <= sub {dedicated}
24+
RelaxNG XML base <> sub {bidirectional}
25+
S4Class R base <> sub {bidirectional}
26+
SVG XML base <> sub {bidirectional}
27+
SystemdUnit Iniconf base <= sub {dedicated}
28+
TclOO Tcl base <> sub {bidirectional}
29+
TeXBeamer Tex base <> sub {bidirectional}
30+
XSLT XML base <> sub {bidirectional}
31+
YumRepo Iniconf base <= sub {dedicated}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
--sort=no
2+
--languages=+KernelDoc
3+
--fields=+Kl
4+
--extras=+g
5+
--kinds-KernelDoc=*
6+
--kinds-C=
7+
--kinds-CPreProcessor=
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
dots in members input.c /^ * DOC: dots in members$/;" doc language:KernelDoc
2+
nested_foobar input.c /^ * struct nested_foobar - a struct with nested unions and structs$/;" struct language:KernelDoc doc:dots in members
3+
memb1 input.c /^ * @memb1: first member of anonymous union\/anonymous struct$/;" member language:KernelDoc struct:dots in members""nested_foobar
4+
memb2 input.c /^ * @memb2: second member of anonymous union\/anonymous struct$/;" member language:KernelDoc struct:dots in members""nested_foobar
5+
memb3 input.c /^ * @memb3: third member of anonymous union\/anonymous struct$/;" member language:KernelDoc struct:dots in members""nested_foobar
6+
memb4 input.c /^ * @memb4: fourth member of anonymous union\/anonymous struct$/;" member language:KernelDoc struct:dots in members""nested_foobar
7+
bar input.c /^ * @bar: non-anonymous union$/;" member language:KernelDoc struct:dots in members""nested_foobar
8+
bar.st1 input.c /^ * @bar.st1: struct st1 inside @bar$/;" member language:KernelDoc struct:dots in members""nested_foobar
9+
bar.st2 input.c /^ * @bar.st2: struct st2 inside @bar$/;" member language:KernelDoc struct:dots in members""nested_foobar
10+
bar.st1.memb1 input.c /^ * @bar.st1.memb1: first member of struct st1 on union bar$/;" member language:KernelDoc struct:dots in members""nested_foobar
11+
bar.st1.memb2 input.c /^ * @bar.st1.memb2: second member of struct st1 on union bar$/;" member language:KernelDoc struct:dots in members""nested_foobar
12+
bar.st2.memb1 input.c /^ * @bar.st2.memb1: first member of struct st2 on union bar$/;" member language:KernelDoc struct:dots in members""nested_foobar
13+
bar.st2.memb2 input.c /^ * @bar.st2.memb2: second member of struct st2 on union bar$/;" member language:KernelDoc struct:dots in members""nested_foobar
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/* Taken from linux/Documentation/doc-guide/kernel-doc.rst */
2+
/**
3+
* DOC: dots in members
4+
*/
5+
6+
/**
7+
* struct nested_foobar - a struct with nested unions and structs
8+
* @memb1: first member of anonymous union/anonymous struct
9+
* @memb2: second member of anonymous union/anonymous struct
10+
* @memb3: third member of anonymous union/anonymous struct
11+
* @memb4: fourth member of anonymous union/anonymous struct
12+
* @bar: non-anonymous union
13+
* @bar.st1: struct st1 inside @bar
14+
* @bar.st2: struct st2 inside @bar
15+
* @bar.st1.memb1: first member of struct st1 on union bar
16+
* @bar.st1.memb2: second member of struct st1 on union bar
17+
* @bar.st2.memb1: first member of struct st2 on union bar
18+
* @bar.st2.memb2: second member of struct st2 on union bar
19+
*/
20+
struct nested_foobar {
21+
/* Anonymous union/struct*/
22+
union {
23+
struct {
24+
int memb1;
25+
int memb2;
26+
};
27+
struct {
28+
void *memb3;
29+
int memb4;
30+
};
31+
};
32+
union {
33+
struct {
34+
int memb1;
35+
int memb2;
36+
} st1;
37+
struct {
38+
void *memb1;
39+
int memb2;
40+
} st2;
41+
} bar;
42+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
--sort=no
2+
--languages=+KernelDoc
3+
--fields=+Kl
4+
--extras=+g
5+
--kinds-KernelDoc=*
6+
--kinds-C=
7+
--kinds-CPreProcessor=
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
in-line input.c /^ * DOC: in-line$/;" doc language:KernelDoc
2+
foo input.c /^ * struct foo - Brief description.$/;" struct language:KernelDoc doc:in-line
3+
foo input.c /^ * @foo: The Foo member.$/;" member language:KernelDoc struct:in-line""foo
4+
bar input.c /^ * @bar: The Bar member.$/;" member language:KernelDoc struct:in-line""foo
5+
baz input.c /^ * @baz: The Baz member.$/;" member language:KernelDoc struct:in-line""foo
6+
foobar input.c /^ \/** @foobar: Single line description. *\/$/;" member language:KernelDoc struct:in-line""foo
7+
bar2 input.c /^ \/** @bar2: Description for struct @bar2 inside @foo *\/$/;" member language:KernelDoc struct:in-line""foo
8+
bar2.barbar input.c /^ * @bar2.barbar: Description for @barbar inside @foo.bar2$/;" member language:KernelDoc struct:in-line""foo
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/* Taken from linux/Documentation/doc-guide/kernel-doc.rst */
2+
/**
3+
* DOC: in-line
4+
*/
5+
6+
/**
7+
* struct foo - Brief description.
8+
* @foo: The Foo member.
9+
*/
10+
struct foo {
11+
int foo;
12+
/**
13+
* @bar: The Bar member.
14+
*/
15+
int bar;
16+
/**
17+
* @baz: The Baz member.
18+
*
19+
* Here, the member description may contain several paragraphs.
20+
*/
21+
int baz;
22+
union {
23+
/** @foobar: Single line description. */
24+
int foobar;
25+
};
26+
/** @bar2: Description for struct @bar2 inside @foo */
27+
struct {
28+
/**
29+
* @bar2.barbar: Description for @barbar inside @foo.bar2
30+
*/
31+
int barbar;
32+
} bar2;
33+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
--sort=no
2+
--languages=+KernelDoc
3+
--fields=+Kl
4+
--extras=+g
5+
--kinds-KernelDoc=*
6+
--kinds-C=
7+
--kinds-CPreProcessor=
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
simple input.c /^ * DOC: simple$/;" doc language:KernelDoc
2+
cpuhp_invoke_callback input.c /^ * cpuhp_invoke_callback - Invoke the callbacks for a given state$/;" unknown language:KernelDoc doc:simple
3+
cpu input.c /^ * @cpu: The cpu for which the callback should be invoked$/;" parameter language:KernelDoc unknown:simple""cpuhp_invoke_callback
4+
state input.c /^ * @state: The state to do callbacks for$/;" parameter language:KernelDoc unknown:simple""cpuhp_invoke_callback
5+
bringup input.c /^ * @bringup: True if the bringup callback should be invoked$/;" parameter language:KernelDoc unknown:simple""cpuhp_invoke_callback
6+
node input.c /^ * @node: For multi-instance, do a single entry callback for install\/remove$/;" parameter language:KernelDoc unknown:simple""cpuhp_invoke_callback
7+
lastp input.c /^ * @lastp: For multi-instance rollback, remember how far we got$/;" parameter language:KernelDoc unknown:simple""cpuhp_invoke_callback
8+
ACPI_DEVICE_CLASS input.c /^ * ACPI_DEVICE_CLASS - macro used to describe an ACPI device with$/;" unknown language:KernelDoc doc:simple
9+
_cls input.c /^ * @_cls : the class, subclass, prog-if triple for this device$/;" parameter language:KernelDoc unknown:simple""ACPI_DEVICE_CLASS
10+
_msk input.c /^ * @_msk : the class mask for this device$/;" parameter language:KernelDoc unknown:simple""ACPI_DEVICE_CLASS
11+
acpi_dma_spec input.c /^ * struct acpi_dma_spec - slave device DMA resources$/;" struct language:KernelDoc doc:simple
12+
chan_id input.c /^ * @chan_id: channel unique id$/;" member language:KernelDoc struct:simple""acpi_dma_spec
13+
slave_id input.c /^ * @slave_id: request line unique id$/;" member language:KernelDoc struct:simple""acpi_dma_spec
14+
dev input.c /^ * @dev: struct device of the DMA controller to be used in the filter$/;" member language:KernelDoc struct:simple""acpi_dma_spec
15+
dma_cookie_t input.c /^ * typedef dma_cookie_t - an opaque DMA cookie$/;" typedef language:KernelDoc doc:simple
16+
coresight_dev_subtype input.c /^ * union coresight_dev_subtype - further characterisation of a type$/;" union language:KernelDoc doc:simple
17+
sink_subtype input.c /^ * @sink_subtype: type of sink this component is, as defined$/;" member language:KernelDoc union:simple""coresight_dev_subtype
18+
link_subtype input.c /^ * @link_subtype: type of link this component is, as defined$/;" member language:KernelDoc union:simple""coresight_dev_subtype
19+
source_subtype input.c /^ * @source_subtype: type of source this component is, as defined$/;" member language:KernelDoc union:simple""coresight_dev_subtype
20+
helper_subtype input.c /^ * @helper_subtype: type of helper this component is, as defined$/;" member language:KernelDoc union:simple""coresight_dev_subtype
21+
ect_subtype input.c /^ * @ect_subtype: type of cross trigger this component is, as$/;" member language:KernelDoc union:simple""coresight_dev_subtype
22+
smp_cond_load_relaxed input-0.c /^ * smp_cond_load_relaxed() - (Spin) wait for cond with no ordering guarantees$/;" function language:KernelDoc
23+
ptr input-0.c /^ * @ptr: pointer to the variable to wait on$/;" parameter language:KernelDoc function:smp_cond_load_relaxed
24+
cond input-0.c /^ * @cond: boolean expression to wait for$/;" parameter language:KernelDoc function:smp_cond_load_relaxed
25+
extra test input input-0.c /^ * DOC: extra test input$/;" doc language:KernelDoc
26+
kunit_status input-0.c /^ * enum kunit_status - Type of result for a test or test suite$/;" enum language:KernelDoc doc:extra test input
27+
KUNIT_SUCCESS input-0.c /^ * @KUNIT_SUCCESS: Denotes the test suite has not failed nor been skipped$/;" enumerator language:KernelDoc enum:extra test input""kunit_status
28+
KUNIT_FAILURE input-0.c /^ * @KUNIT_FAILURE: Denotes the test has failed.$/;" enumerator language:KernelDoc enum:extra test input""kunit_status
29+
KUNIT_SKIPPED input-0.c /^ * @KUNIT_SKIPPED: Denotes the test has been skipped.$/;" enumerator language:KernelDoc enum:extra test input""kunit_status
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* Taken from linux/include/asm-generic/barrier.h */
2+
/**
3+
* smp_cond_load_relaxed() - (Spin) wait for cond with no ordering guarantees
4+
* @ptr: pointer to the variable to wait on
5+
* @cond: boolean expression to wait for
6+
*
7+
* Equivalent to using READ_ONCE() on the condition variable.
8+
*
9+
* Due to C lacking lambda expressions we load the value of *ptr into a
10+
* pre-named variable @VAL to be used in @cond.
11+
*/
12+
#ifndef smp_cond_load_relaxed
13+
#define smp_cond_load_relaxed(ptr, cond_expr) ({ \
14+
typeof(ptr) __PTR = (ptr); \
15+
__unqual_scalar_typeof(*ptr) VAL; \
16+
for (;;) { \
17+
VAL = READ_ONCE(*__PTR); \
18+
if (cond_expr) \
19+
break; \
20+
cpu_relax(); \
21+
} \
22+
(typeof(*ptr))VAL; \
23+
})
24+
#endif
25+
26+
/**
27+
* DOC: extra test input
28+
*/
29+
30+
/* Taken from linux/include/kunit/test.h */
31+
/**
32+
* enum kunit_status - Type of result for a test or test suite
33+
* @KUNIT_SUCCESS: Denotes the test suite has not failed nor been skipped
34+
* @KUNIT_FAILURE: Denotes the test has failed.
35+
* @KUNIT_SKIPPED: Denotes the test has been skipped.
36+
*/
37+
enum kunit_status {
38+
KUNIT_SUCCESS,
39+
KUNIT_FAILURE,
40+
KUNIT_SKIPPED,
41+
};

0 commit comments

Comments
 (0)