Add some more comments to dump_function(), add some comments, and trim out an unneeded duplicate output_declaration() call.
Unified · Split
| @@ -999,32 +999,28 @@ class KernelDoc: · 998 unmodified lines | ||
| 999 | 999 | declaration_name) |
| 1000 | 1000 | found = True |
| 1001 | 1001 | break |
| 1002 | + # | |
| 1003 | + # Parsing done; make sure that things are as we expect. | |
| 1004 | + # | |
| 1002 | 1005 | if not found: |
| 1003 | 1006 | self.emit_msg(ln, |
| 1004 | 1007 | f"cannot understand function prototype: '{prototype}'") |
| 1005 | 1008 | return |
| 1006 | − | |
| 1007 | 1009 | 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") | |
| 1010 | 1012 | return |
| 1011 | − | |
| 1012 | 1013 | self.check_sections(ln, declaration_name, "function") |
| 1013 | − | |
| 1014 | 1014 | 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) | |
| 1015 | 1023 | |
| 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) | |
| 1028 | 1024 | |
| 1029 | 1025 | def dump_typedef(self, ln, proto): |
| 1030 | 1026 | """ |