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: xforms_lists: handle struct_group directly

The previous logic was handling struct_group on two steps.
Remove the previous approach, as CMatch can do it the right
way on a single step.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <da7f879d90e3ffbc1f47771522f212a60df1fab6.1773770483.git.mchehab+huawei@kernel.org>

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
f63e6163 ae63a5b9

+6 -47
+6 -47
tools/lib/python/kdoc/xforms_lists.py
··· 32 32 (KernRe(r'\s*____cacheline_aligned_in_smp', re.S), ' '), 33 33 (KernRe(r'\s*____cacheline_aligned', re.S), ' '), 34 34 (KernRe(r'\s*__cacheline_group_(begin|end)\([^\)]+\);'), ''), 35 - # 36 - # Unwrap struct_group macros based on this definition: 37 - # __struct_group(TAG, NAME, ATTRS, MEMBERS...) 38 - # which has variants like: struct_group(NAME, MEMBERS...) 39 - # Only MEMBERS arguments require documentation. 40 - # 41 - # Parsing them happens on two steps: 42 - # 43 - # 1. drop struct group arguments that aren't at MEMBERS, 44 - # storing them as STRUCT_GROUP(MEMBERS) 45 - # 46 - # 2. remove STRUCT_GROUP() ancillary macro. 47 - # 48 - # The original logic used to remove STRUCT_GROUP() using an 49 - # advanced regex: 50 - # 51 - # \bSTRUCT_GROUP(\(((?:(?>[^)(]+)|(?1))*)\))[^;]*; 52 - # 53 - # with two patterns that are incompatible with 54 - # Python re module, as it has: 55 - # 56 - # - a recursive pattern: (?1) 57 - # - an atomic grouping: (?>...) 58 - # 59 - # I tried a simpler version: but it didn't work either: 60 - # \bSTRUCT_GROUP\(([^\)]+)\)[^;]*; 61 - # 62 - # As it doesn't properly match the end parenthesis on some cases. 63 - # 64 - # So, a better solution was crafted: there's now a CMatch 65 - # class that ensures that delimiters after a search are properly 66 - # matched. So, the implementation to drop STRUCT_GROUP() will be 67 - # handled in separate. 68 - # 69 - (KernRe(r'\bstruct_group\s*\(([^,]*,)', re.S), r'STRUCT_GROUP('), 70 - (KernRe(r'\bstruct_group_attr\s*\(([^,]*,){2}', re.S), r'STRUCT_GROUP('), 71 - (KernRe(r'\bstruct_group_tagged\s*\(([^,]*),([^,]*),', re.S), r'struct \1 \2; STRUCT_GROUP('), 72 - (KernRe(r'\b__struct_group\s*\(([^,]*,){3}', re.S), r'STRUCT_GROUP('), 73 - # 74 - # Replace macros 75 - # 76 - # TODO: use CMatch for FOO($1, $2, ...) matches 77 - # 78 - # it is better to also move those to the CMatch logic, 79 - # to ensure that parentheses will be properly matched. 80 - # 81 35 (KernRe(r'__ETHTOOL_DECLARE_LINK_MODE_MASK\s*\(([^\)]+)\)', re.S), 82 36 r'DECLARE_BITMAP(\1, __ETHTOOL_LINK_MODE_MASK_NBITS)'), 83 37 (KernRe(r'DECLARE_PHY_INTERFACE_MASK\s*\(([^\)]+)\)', re.S), ··· 60 106 (CMatch(r"__cond_acquires_shared"), ""), 61 107 (CMatch(r"__acquires_shared"), ""), 62 108 (CMatch(r"__releases_shared"), ""), 63 - (CMatch(r"STRUCT_GROUP"), r'\0'), 109 + 110 + (CMatch('struct_group'), r'\2'), 111 + (CMatch('struct_group_attr'), r'\3'), 112 + (CMatch('struct_group_tagged'), r'struct \1 \2; \3'), 113 + (CMatch('__struct_group'), r'\4'), 114 + 64 115 ] 65 116 66 117 #: Transforms for function prototypes.