Skip to content

Commit de258fa

Browse files
Sean AndersonJonathan Corbet
authored andcommitted
scripts: kernel-doc: fix parsing function-like typedefs (again)
Typedefs like typedef struct phylink_pcs *(*pcs_xlate_t)(const u64 *args); have a typedef_type that ends with a * and therefore has no word boundary. Add an extra clause for the final group of the typedef_type so we only require a word boundary if we match a word. [mchehab: modify also kernel-doc.py, as we're deprecating the perl version] Fixes: 7d2c6b1 ("scripts: kernel-doc: fix parsing function-like typedefs") Signed-off-by: Sean Anderson <sean.anderson@linux.dev> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/e0abb103c73a96d76602d909f60ab8fd6e2fd0bd.1744106242.git.mchehab+huawei@kernel.org
1 parent 04a383c commit de258fa

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

scripts/kernel-doc.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ ($$)
13251325
}
13261326
}
13271327

1328-
my $typedef_type = qr { ((?:\s+[\w\*]+\b){1,8})\s* }x;
1328+
my $typedef_type = qr { ((?:\s+[\w\*]+\b){0,7}\s+(?:\w+\b|\*+))\s* }x;
13291329
my $typedef_ident = qr { \*?\s*(\w\S+)\s* }x;
13301330
my $typedef_args = qr { \s*\((.*)\); }x;
13311331

scripts/lib/kdoc/kdoc_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ def dump_typedef(self, ln, proto):
10671067
Stores a typedef inside self.entries array.
10681068
"""
10691069

1070-
typedef_type = r'((?:\s+[\w\*]+\b){1,8})\s*'
1070+
typedef_type = r'((?:\s+[\w\*]+\b){0,7}\s+(?:\w+\b|\*+))\s*'
10711071
typedef_ident = r'\*?\s*(\w\S+)\s*'
10721072
typedef_args = r'\s*\((.*)\);'
10731073

0 commit comments

Comments
 (0)