Skip to content

Commit 5f8e400

Browse files
keesJonathan Corbet
authored andcommitted
kernel-doc: fix struct_group_tagged() parsing
kernel-doc emits a warning on struct_group_tagged() if you describe your struct group member: include/net/libeth/rx.h:69: warning: Excess struct member 'fp' description in 'libeth_fq' The code: /** * struct libeth_fq - structure representing a buffer queue * @fp: hotpath part of the structure * @pp: &page_pool for buffer management [...] */ struct libeth_fq { struct_group_tagged(libeth_fq_fp, fp, struct page_pool *pp; [...] ); When a struct_group_tagged() is encountered, we need to build a `struct TAG NAME;` from it, so that it will be treated as a valid embedded struct. Decouple the regex and do the replacement there. As far as I can see, this doesn't produce any new warnings on the current mainline tree. Reported-by: Jakub Kicinski <[email protected]> Closes: https://lore.kernel.org/netdev/[email protected] Fixes: 50d7bd3 ("stddef: Introduce struct_group() helper macro") Signed-off-by: Kees Cook <[email protected]> Co-developed-by: Alexander Lobakin <[email protected]> Signed-off-by: Alexander Lobakin <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Signed-off-by: Jonathan Corbet <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a3b97f3 commit 5f8e400

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/kernel-doc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,8 @@ sub dump_struct($$) {
11511151
# - first eat non-declaration parameters and rewrite for final match
11521152
# - then remove macro, outer parens, and trailing semicolon
11531153
$members =~ s/\bstruct_group\s*\(([^,]*,)/STRUCT_GROUP(/gos;
1154-
$members =~ s/\bstruct_group_(attr|tagged)\s*\(([^,]*,){2}/STRUCT_GROUP(/gos;
1154+
$members =~ s/\bstruct_group_attr\s*\(([^,]*,){2}/STRUCT_GROUP(/gos;
1155+
$members =~ s/\bstruct_group_tagged\s*\(([^,]*),([^,]*),/struct $1 $2; STRUCT_GROUP(/gos;
11551156
$members =~ s/\b__struct_group\s*\(([^,]*,){3}/STRUCT_GROUP(/gos;
11561157
$members =~ s/\bSTRUCT_GROUP(\(((?:(?>[^)(]+)|(?1))*)\))[^;]*;/$2/gos;
11571158

0 commit comments

Comments
 (0)