Just like functions and structs had their transform variables placed at the beginning, move variable transforms to there as well. No functional changes.
Showing the changes to tools/lib/python (1 of 1 file). Show all
Unified · Split
| @@ -192,6 +192,18 @@ function_xforms = [ · 191 unmodified lines | ||
| 192 | 192 | (KernRe(r"__attribute__\s*\(\((?:[\w\s]+(?:\([^)]*\))?\s*,?)+\)\)\s+"), ""), |
| 193 | 193 | ] |
| 194 | 194 | |
| 195 | +# | |
| 196 | +# Transforms for variable prototypes | |
| 197 | +# | |
| 198 | +var_xforms = [ | |
| 199 | + (KernRe(r"__read_mostly"), ""), | |
| 200 | + (KernRe(r"__ro_after_init"), ""), | |
| 201 | + (KernRe(r"(?://.*)$"), ""), | |
| 202 | + (KernRe(r"(?:/\*.*\*/)"), ""), | |
| 203 | + (KernRe(r";$"), ""), | |
| 204 | + (KernRe(r"=.*"), ""), | |
| 205 | +] | |
| 206 | + | |
| 195 | 207 | # |
| 196 | 208 | # Ancillary functions |
| 197 | 209 | # |
| @@ -972,15 +984,6 @@ class KernelDoc: · 774 unmodified lines | ||
| 972 | 984 | ] |
| 973 | 985 | OPTIONAL_VAR_ATTR = "^(?:" + "|".join(VAR_ATTRIBS) + ")?" |
| 974 | 986 | |
| 975 | − sub_prefixes = [ | |
| 976 | − (KernRe(r"__read_mostly"), ""), | |
| 977 | − (KernRe(r"__ro_after_init"), ""), | |
| 978 | − (KernRe(r"(?://.*)$"), ""), | |
| 979 | − (KernRe(r"(?:/\*.*\*/)"), ""), | |
| 980 | − (KernRe(r";$"), ""), | |
| 981 | − (KernRe(r"=.*"), ""), | |
| 982 | − ] | |
| 983 | − | |
| 984 | 987 | # |
| 985 | 988 | # Store the full prototype before modifying it |
| 986 | 989 | # |
| @@ -1004,7 +1007,7 @@ class KernelDoc: · 17 unmodified lines | ||
| 1004 | 1007 | # Drop comments and macros to have a pure C prototype |
| 1005 | 1008 | # |
| 1006 | 1009 | if not declaration_name: |
| 1007 | − for r, sub in sub_prefixes: | |
| 1010 | + for r, sub in var_xforms: | |
| 1008 | 1011 | proto = r.sub(sub, proto) |
| 1009 | 1012 | |
| 1010 | 1013 | proto = proto.rstrip() |