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: a few more dump_typedef() tweaks

Merge "typedef" into the typedef_type pattern rather than repeating it
later, and add some comments.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>

+11 -9
+11 -9
scripts/lib/kdoc/kdoc_parser.py
··· 1026 1026 """ 1027 1027 Stores a typedef inside self.entries array. 1028 1028 """ 1029 - 1030 - typedef_type = r'((?:\s+[\w*]+\b){0,7}\s+(?:\w+\b|\*+))\s*' 1029 + # 1030 + # We start by looking for function typedefs. 1031 + # 1032 + typedef_type = r'typedef((?:\s+[\w*]+\b){0,7}\s+(?:\w+\b|\*+))\s*' 1031 1033 typedef_ident = r'\*?\s*(\w\S+)\s*' 1032 1034 typedef_args = r'\s*\((.*)\);' 1033 1035 1034 - typedef1 = KernRe(r'typedef' + typedef_type + r'\(' + typedef_ident + r'\)' + typedef_args) 1035 - typedef2 = KernRe(r'typedef' + typedef_type + typedef_ident + typedef_args) 1036 + typedef1 = KernRe(typedef_type + r'\(' + typedef_ident + r'\)' + typedef_args) 1037 + typedef2 = KernRe(typedef_type + typedef_ident + typedef_args) 1036 1038 1037 1039 # Parse function typedef prototypes 1038 1040 for r in [typedef1, typedef2]: ··· 1050 1048 f"expecting prototype for typedef {self.entry.identifier}. Prototype was for typedef {declaration_name} instead\n") 1051 1049 return 1052 1050 1053 - decl_type = 'function' 1054 - self.create_parameter_list(ln, decl_type, args, ',', declaration_name) 1051 + self.create_parameter_list(ln, 'function', args, ',', declaration_name) 1055 1052 1056 - self.output_declaration(decl_type, declaration_name, 1053 + self.output_declaration('function', declaration_name, 1057 1054 typedef=True, 1058 1055 functiontype=return_type, 1059 1056 purpose=self.entry.declaration_purpose) 1060 1057 return 1061 - 1062 - # Parse simple typedefs 1058 + # 1059 + # Not a function, try to parse a simple typedef. 1060 + # 1063 1061 r = KernRe(r'typedef.*\s+(\w+)\s*;') 1064 1062 if r.match(proto): 1065 1063 declaration_name = r.group(1)