Skip to contentSkip to conversation

docs: kernel-doc: combine input and additional export sources

PATCH In review 闲逛 1 participant 1 message Nov 14

Subsystems (2)
lore
Share & tools
lore

闲逛

author
#0 lore raw

PATCH v2 2/4 docs: kernel-doc: combine input and additional export sources

From: yuehua-meng <[email protected]>

With multiple inputs, msg() defaults the export source to the first filename and reuses it for later files. An explicit -export-file instead excludes exports from the input files, despite the CLI documenting it as an additional source. Relative SRCTREE paths are also resolved twice when the already resolved input filenames pass through GlobSourceFiles again.

Build the export filter once from the cached input filenames and the resolved additional export files. This preserves exports from both kinds of source without adding SRCTREE a second time, and avoids rebuilding the same set for every input. Keep explicit symbol selection in the same set.

Add CLI regressions for multiple input files, declarations exported by a different input, additional export sources, and relative SRCTREE paths.

Fixes 16740c29dbf3 ("scripts/kernel_doc.py: better handle exported symbols")

---
Changes in v2:
Include exports from both inputs and additional export files. Avoid resolving relative SRCTREE paths twice and compute the filter once. Add regressions for those combinations and cross-file declarations.

 tools/lib/python/kdoc/kdoc_files.py  | 21 +++-----
 tools/unittests/test_kdoc_exports.py | 79 ++++++++++++++++++++++++++++
 2 files changed, 87 insertions(+), 13 deletions(-)
 create mode 100644 tools/unittests/test_kdoc_exports.py
tools/lib/python/kdoc/kdoc_files.py +8 -13
index d39b15edd..0118470aa 100644
@@ -339,20 +339,15 @@ class KernelFiles():
 
         glob = GlobSourceFiles(srctree=self.config.src_tree)
 
-        for fname in filenames:
-            function_table = set()
-
-            if internal or export:
-                if not export_file:
-                    export_file = [fname]
-
-                for f in glob.parse_files(export_file, self.file_not_found_cb):
-                    function_table |= self.export_table[f]
-
-            if symbol:
-                for s in symbol:
-                    function_table.add(s)
+        function_table = set(symbol or ())
+        if internal or export:
+            export_sources = set(filenames)
+            export_sources.update(glob.parse_files(export_file,
+                                                  self.file_not_found_cb))
+            for f in export_sources:
+                function_table.update(self.export_table.get(f, ()))
 
+        for fname in filenames:
             if fname not in self.results:
                 self.config.log.warning("No kernel-doc for file %s", fname)
                 continue
tools/unittests/test_kdoc_exports.py new file +79 -0

79 lines not on this page · raw message

Signature · 1 line
2.53.0.windows.2