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.

scripts/kernel-doc.py: fix handling of doc output check

The filtering logic was seeking for the DOC name to check for
symbols, but such data is stored only inside a section. Add it
to the output_declaration, as it is quicker/easier to check
the declaration name than to check inside each section.

While here, make sure that the output for both ReST and man
after filtering will be similar to what kernel-doc Perl
version does.

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

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
408269ae c3597ab2

+14 -18
+12 -17
scripts/lib/kdoc/kdoc_output.py
··· 122 122 if self.no_doc_sections: 123 123 return False 124 124 125 + if name in self.nosymbol: 126 + return False 127 + 125 128 if self.out_mode == self.OUTPUT_ALL: 126 129 return True 127 130 128 131 if self.out_mode == self.OUTPUT_INCLUDE: 129 - if name in self.nosymbol: 130 - return False 131 - 132 132 if name in self.function_table: 133 133 return True 134 134 ··· 153 153 return True 154 154 155 155 return False 156 - 157 - def check_function(self, fname, name, args): 158 - return True 159 - 160 - def check_enum(self, fname, name, args): 161 - return True 162 - 163 - def check_typedef(self, fname, name, args): 164 - return True 165 156 166 157 def msg(self, fname, name, args): 167 158 self.data = "" ··· 297 306 for line in output.strip("\n").split("\n"): 298 307 self.data += self.lineprefix + line + "\n" 299 308 300 - def out_section(self, args, out_reference=False): 309 + def out_section(self, args, out_docblock=False): 301 310 """ 302 311 Outputs a block section. 303 312 ··· 316 325 continue 317 326 318 327 if not self.out_mode == self.OUTPUT_INCLUDE: 319 - if out_reference: 328 + if out_docblock: 320 329 self.data += f".. _{section}:\n\n" 321 330 322 331 if not self.symbol: ··· 330 339 def out_doc(self, fname, name, args): 331 340 if not self.check_doc(name): 332 341 return 333 - 334 - self.out_section(args, out_reference=True) 342 + self.out_section(args, out_docblock=True) 335 343 336 344 def out_function(self, fname, name, args): 337 345 ··· 573 583 574 584 for line in contents.strip("\n").split("\n"): 575 585 line = Re(r"^\s*").sub("", line) 586 + if not line: 587 + continue 576 588 577 - if line and line[0] == ".": 589 + if line[0] == ".": 578 590 self.data += "\\&" + line + "\n" 579 591 else: 580 592 self.data += line + "\n" ··· 585 593 module = args.get('module') 586 594 sectionlist = args.get('sectionlist', []) 587 595 sections = args.get('sections', {}) 596 + 597 + if not self.check_doc(name): 598 + return 588 599 589 600 self.data += f'.TH "{module}" 9 "{module}" "{self.man_date}" "API Manual" LINUX' + "\n" 590 601
+2 -1
scripts/lib/kdoc/kdoc_parser.py
··· 1198 1198 else: 1199 1199 self.entry.section = doc_block.group(1) 1200 1200 1201 + self.entry.identifier = self.entry.section 1201 1202 self.state = self.STATE_DOCBLOCK 1202 1203 return 1203 1204 ··· 1629 1628 1630 1629 if doc_end.search(line): 1631 1630 self.dump_section() 1632 - self.output_declaration("doc", None, 1631 + self.output_declaration("doc", self.entry.identifier, 1633 1632 sectionlist=self.entry.sectionlist, 1634 1633 sections=self.entry.sections, 1635 1634 section_start_lines=self.entry.section_start_lines,