The regular expressions meant to pick variable types are too naive: they forgot that the type word may contain underlines. It also means that we need to change the regex which detects var attributes to handle "const".
Unified · Split
| @@ -981,8 +981,9 @@ class KernelDoc: · 980 unmodified lines | |||
| 981 | """ | 981 | """ |
| 982 | VAR_ATTRIBS = [ | 982 | VAR_ATTRIBS = [ |
| 983 | "extern", | 983 | "extern", |
| 984 | "const", | ||
| 984 | ] | 985 | ] |
| 985 | OPTIONAL_VAR_ATTR = "^(?:" + "|".join(VAR_ATTRIBS) + ")?" | 986 | OPTIONAL_VAR_ATTR = r"^(?:\b(?:" +"|".join(VAR_ATTRIBS) +r")\b\s*)*" |
| 986 | 987 | ||
| 987 | # | 988 | # |
| 988 | # Store the full prototype before modifying it | 989 | # Store the full prototype before modifying it |
| @@ -1018,14 +1019,14 @@ class KernelDoc: · 29 unmodified lines | |||
| 1018 | 1019 | ||
| 1019 | default_val = None | 1020 | default_val = None |
| 1020 | 1021 | ||
| 1021 | r= KernRe(OPTIONAL_VAR_ATTR + r"\w.*\s+(?:\*+)?([\w_]+)\s*[\d\]\[]*\s*(=.*)?") | 1022 | r= KernRe(OPTIONAL_VAR_ATTR + r"[\w_]*\s+(?:\*+)?([\w_]+)\s*[\d\]\[]*\s*(=.*)?") |
| 1022 | if r.match(proto): | 1023 | if r.match(proto): |
| 1023 | if not declaration_name: | 1024 | if not declaration_name: |
| 1024 | declaration_name = r.group(1) | 1025 | declaration_name = r.group(1) |
| 1025 | 1026 | ||
| 1026 | default_val = r.group(2) | 1027 | default_val = r.group(2) |
| 1027 | else: | 1028 | else: |
| 1028 | r= KernRe(OPTIONAL_VAR_ATTR + r"(?:\w.*)?\s+(?:\*+)?(?:[\w_]+)\s*[\d\]\[]*\s*(=.*)?") | 1029 | r= KernRe(OPTIONAL_VAR_ATTR + r"(?:[\w_]*)?\s+(?:\*+)?(?:[\w_]+)\s*[\d\]\[]*\s*(=.*)?") |
| 1029 | if r.match(proto): | 1030 | if r.match(proto): |
| 1030 | default_val = r.group(1) | 1031 | default_val = r.group(1) |
| 1031 | 1032 | ||