diff options
| author | Sasha Levin <sashal@kernel.org> | 2025-08-19 11:52:10 -0400 |
|---|---|---|
| committer | Sasha Levin <sashal@kernel.org> | 2026-10-07 18:26:44 -0400 |
| commit | 6d009bd85fa4e6dbad869e1cb707404968f3f20d (patch) | |
| tree | f764bac49d89c2553cda715c7f02dd58776478de /tools/lib/python/kdoc/kdoc_files.py | |
| parent | ce4c52682d78fc08c9b1e2217aae6f00fa02bab3 (diff) | |
| download | linux-next-6d009bd85fa4e6dbad869e1cb707404968f3f20d.tar.gz linux-next-6d009bd85fa4e6dbad869e1cb707404968f3f20d.zip | |
kernel/api: enable kerneldoc-based API specifications
Add support for extracting API specifications from kernel-doc comments
and generating C macro invocations for the kernel API specification
framework.
Changes include:
- New kdoc_apispec.py module for generating API spec macros
- Updates to tools/docs/kernel-doc to support the -apispec output format
- Build system integration in Makefile.build
- Support for API-specific sections in kernel-doc comments
kernel-doc recognises the KAPI sections only in -apispec mode, so its
other output formats are unchanged. With CONFIG_KAPI_SPEC=y, Kbuild
generates <file>.apispec.h for each built source that has a contexts:
or context-flags: line plus another KAPI section, and force-includes it
when compiling that source.
Assisted-by: LLM
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc/kdoc_files.py')
| -rw-r--r-- | tools/lib/python/kdoc/kdoc_files.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/lib/python/kdoc/kdoc_files.py b/tools/lib/python/kdoc/kdoc_files.py index ed82b6e6ab25..5b81a1e4cc9e 100644 --- a/tools/lib/python/kdoc/kdoc_files.py +++ b/tools/lib/python/kdoc/kdoc_files.py @@ -94,13 +94,14 @@ class KdocConfig(): """ def __init__(self, verbose=False, werror=False, wreturn=False, wshort_desc=False, wcontents_before_sections=False, - logger=None): + logger=None, apispec=False): self.verbose = verbose self.werror = werror self.wreturn = wreturn self.wshort_desc = wshort_desc self.wcontents_before_sections = wcontents_before_sections + self.apispec = apispec if logger: self.log = logger @@ -159,6 +160,10 @@ class KernelFiles(): ``yaml_content`` Defines what will be inside the YAML file. + ``apispec`` + If True, also parse the kernel API specification sections used + by the ``-apispec`` output. Default: False. + Note: There are two type of parsers defined here: @@ -232,7 +237,8 @@ class KernelFiles(): def __init__(self, verbose=False, out_style=None, xforms=None, werror=False, wreturn=False, wshort_desc=False, wcontents_before_sections=False, - yaml_file=None, yaml_content=None, logger=None): + yaml_file=None, yaml_content=None, logger=None, + apispec=False): """ Initialize startup variables and parse all files. """ @@ -271,7 +277,7 @@ class KernelFiles(): # used to send control configuration to KernelDoc class. As such, # those variables are read-only inside the KernelDoc. self.config = KdocConfig(verbose, werror, wreturn, wshort_desc, - wcontents_before_sections, logger) + wcontents_before_sections, logger, apispec) # Override log warning, as we want to count errors self.config.warning = self.warning |
