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: use tokenizer to handle comments on structs

Better handle comments inside structs. After those changes,
all unittests now pass:

test_private:
TestPublicPrivate:
test balanced_inner_private: OK
test balanced_non_greddy_private: OK
test balanced_private: OK
test no private: OK
test unbalanced_inner_private: OK
test unbalanced_private: OK
test unbalanced_struct_group_tagged_with_private: OK
test unbalanced_two_struct_group_tagged_first_with_private: OK
test unbalanced_without_end_of_line: OK

Ran 9 tests

This also solves a bug when handling STRUCT_GROUP() with a private
comment on it:

@@ -397134,7 +397134,7 @@ basic V4L2 device-level support.
unsigned int max_len;
unsigned int offset;
struct page_pool_params_slow slow;
- STRUCT_GROUP( struct net_device *netdev;
+ struct net_device *netdev;
unsigned int queue_idx;
unsigned int flags;
};

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Message-ID: <f83ee9e8c38407eaab6ad10d4ccf155fb36683cc.1773074166.git.mchehab+huawei@kernel.org>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <054763260f7b5459ad0738ed906d7c358d640692.1773770483.git.mchehab+huawei@kernel.org>

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
cd77a9aa df50e848

+4 -9
+4 -9
tools/lib/python/kdoc/kdoc_parser.py
··· 13 13 import re 14 14 from pprint import pformat 15 15 16 + from kdoc.c_lex import CTokenizer 16 17 from kdoc.kdoc_re import NestedMatch, KernRe 17 18 from kdoc.kdoc_item import KdocItem 18 19 ··· 85 84 """ 86 85 Remove ``struct``/``enum`` members that have been marked "private". 87 86 """ 88 - # First look for a "public:" block that ends a private region, then 89 - # handle the "private until the end" case. 90 - # 91 - text = KernRe(r'/\*\s*private:.*?/\*\s*public:.*?\*/', flags=re.S).sub('', text) 92 - text = KernRe(r'/\*\s*private:.*', flags=re.S).sub('', text) 93 - # 94 - # We needed the comments to do the above, but now we can take them out. 95 - # 96 - return KernRe(r'\s*/\*.*?\*/\s*', flags=re.S).sub('', text).strip() 87 + 88 + tokens = CTokenizer(text) 89 + return str(tokens) 97 90 98 91 class state: 99 92 """