History

docs: kdoc_parser: don't mangle with function defines

Mangling with #defines is not nice, as we may end removing the macro names, preventing several macros from being properly documented. Also, on defines, we have something like: #define foo(a1, a2, a3, ...) \ /* some real implementation */ The prototype part (first line on this example) won't contain any macros, so no need to apply any regexes on it. With that, move the apply_transforms() logic to ensure that it will be called only on functions.

Mauro Carvalho Chehab committed 8 months ago

Commit cca1bbd1 parent 77e6e171 file · +7 −5Browse files

Showing the changes to tools/lib/python (1 of 1 file). Show all

Unified · Split

tools/lib/python/kdoc/kdoc_parser.py+7−5
@@ -163,7 +163,7 @@ struct_nested_prefixes = [ · 162 unmodified lines
163163 #
164164 # Transforms for function prototypes
165165 #
166−function_xforms = [
166+function_xforms = [
167167 (KernRe(r"^static +"), ""),
168168 (KernRe(r"^extern +"), ""),
169169 (KernRe(r"^asmlinkage +"), ""),
@@ -1066,10 +1066,7 @@ class KernelDoc: · 896 unmodified lines
10661066 found = func_macro = False
10671067 return_type = ''
10681068 decl_type = 'function'
1069− #
1070− # Apply the initial transformations.
1071− #
1072− prototype = apply_transforms(function_xforms, prototype)
1069+
10731070 #
10741071 # If we have a macro, remove the "#define" at the front.
10751072 #
@@ -1088,6 +1085,11 @@ class KernelDoc: · 12 unmodified lines
10881085 declaration_name = r.group(1)
10891086 func_macro = True
10901087 found = True
1088+ else:
1089+ #
1090+ # Apply the initial transformations.
1091+ #
1092+ prototype = apply_transforms(function_xforms, prototype)
10911093
10921094 # Yes, this truly is vile. We are looking for:
10931095 # 1. Return type (may be nothing if we're looking at a macro)

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