History

docs: kdoc: final dump_function() cleanups

Add some more comments to dump_function(), add some comments, and trim out an unneeded duplicate output_declaration() call.

Jonathan Corbet committed 1 year ago

Commit 3dff5441 parent 370f4301 file · +13 −17Browse files

Unified · Split

scripts/lib/kdoc/kdoc_parser.py+13−17
@@ -999,32 +999,28 @@ class KernelDoc: · 998 unmodified lines
999999 declaration_name)
10001000 found = True
10011001 break
1002+ #
1003+ # Parsing done; make sure that things are as we expect.
1004+ #
10021005 if not found:
10031006 self.emit_msg(ln,
10041007 f"cannot understand function prototype: '{prototype}'")
10051008 return
1006−
10071009 if self.entry.identifier != declaration_name:
1008− self.emit_msg(ln,
1009− f"expecting prototype for {self.entry.identifier}(). Prototype was for {declaration_name}() instead")
1010+ self.emit_msg(ln, f"expecting prototype for {self.entry.identifier}(). "
1011+ f"Prototype was for {declaration_name}() instead")
10101012 return
1011−
10121013 self.check_sections(ln, declaration_name, "function")
1013−
10141014 self.check_return_section(ln, declaration_name, return_type)
1015+ #
1016+ # Store the result.
1017+ #
1018+ self.output_declaration(decl_type, declaration_name,
1019+ typedef=('typedef' in return_type),
1020+ functiontype=return_type,
1021+ purpose=self.entry.declaration_purpose,
1022+ func_macro=func_macro)
10151023
1016− if 'typedef' in return_type:
1017− self.output_declaration(decl_type, declaration_name,
1018− typedef=True,
1019− functiontype=return_type,
1020− purpose=self.entry.declaration_purpose,
1021− func_macro=func_macro)
1022− else:
1023− self.output_declaration(decl_type, declaration_name,
1024− typedef=False,
1025− functiontype=return_type,
1026− purpose=self.entry.declaration_purpose,
1027− func_macro=func_macro)
10281024
10291025 def dump_typedef(self, ln, proto):
10301026 """

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t