Skip to content

Commit 3dff544

Browse files
author
Jonathan Corbet
committed
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. Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent 370f430 commit 3dff544

1 file changed

Lines changed: 13 additions & 17 deletions

File tree

scripts/lib/kdoc/kdoc_parser.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -999,32 +999,28 @@ def dump_function(self, ln, prototype):
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
"""

0 commit comments

Comments
 (0)