Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: kdoc: rework process_export() slightly

Reorganize process_export() to eliminate duplicated code, don't look for
exports in states where we don't expect them, and don't bother with normal
state-machine processing if an export declaration has been found.

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20250627184000.132291-6-corbet@lwn.net

+14 -16
+14 -16
scripts/lib/kdoc/kdoc_parser.py
··· 1211 1211 1212 1212 if export_symbol.search(line): 1213 1213 symbol = export_symbol.group(2) 1214 - for suffix in suffixes: 1215 - symbol = symbol.removesuffix(suffix) 1216 - function_set.add(symbol) 1217 - return 1218 - 1219 - if export_symbol_ns.search(line): 1214 + elif export_symbol_ns.search(line): 1220 1215 symbol = export_symbol_ns.group(2) 1221 - for suffix in suffixes: 1222 - symbol = symbol.removesuffix(suffix) 1223 - function_set.add(symbol) 1216 + else: 1217 + return False 1218 + # 1219 + # Found an export, trim out any special suffixes 1220 + # 1221 + for suffix in suffixes: 1222 + symbol = symbol.removesuffix(suffix) 1223 + function_set.add(symbol) 1224 + return True 1224 1225 1225 1226 def process_normal(self, ln, line): 1226 1227 """ ··· 1768 1767 # it was read twice. Here, we use the already-existing 1769 1768 # loop to parse exported symbols as well. 1770 1769 # 1771 - # TODO: It should be noticed that not all states are 1772 - # needed here. On a future cleanup, process export only 1773 - # at the states that aren't handling comment markups. 1774 - self.process_export(export_table, line) 1775 - 1776 - # Hand this line to the appropriate state handler 1777 - self.state_actions[self.state](self, ln, line) 1770 + if (self.state != state.NORMAL) or \ 1771 + not self.process_export(export_table, line): 1772 + # Hand this line to the appropriate state handler 1773 + self.state_actions[self.state](self, ln, line) 1778 1774 1779 1775 except OSError: 1780 1776 self.config.log.error(f"Error: Cannot open file {self.fname}")