Skip to content

Commit 6b80975

Browse files
mchehabJonathan Corbet
authored andcommitted
scripts: kernel-doc: fix typedef parsing
The include/linux/genalloc.h file defined this typedef: typedef unsigned long (*genpool_algo_t)(unsigned long *map,unsigned long size,unsigned long start,unsigned int nr,void *data, struct gen_pool *pool, unsigned long start_addr); Because it has a type composite of two words (unsigned long), the parser gets the typedef name wrong: .. c:macro:: long **Typedef**: Allocation callback function type definition Fix the regex in order to accept composite types when defining a typedef for a function pointer. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/328e8018041cc44f7a1684e57f8d111230761c4f.1603792384.git.mchehab+huawei@kernel.org Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent d94df02 commit 6b80975

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/kernel-doc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,13 +1434,14 @@ sub dump_typedef($$) {
14341434
$x =~ s@/\*.*?\*/@@gos; # strip comments.
14351435

14361436
# Parse function prototypes
1437-
if ($x =~ /typedef\s+(\w+)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ ||
1438-
$x =~ /typedef\s+(\w+)\s*(\w\S+)\s*\s*\((.*)\);/) {
1437+
if ($x =~ /typedef((?:\s+[\w\*]+){1,8})\s*\(\*?\s*(\w\S+)\s*\)\s*\((.*)\);/ ||
1438+
$x =~ /typedef((?:\s+[\w\*]+\s+){1,8})\s*\*?(\w\S+)\s*\s*\((.*)\);/) {
14391439

14401440
# Function typedefs
14411441
$return_type = $1;
14421442
$declaration_name = $2;
14431443
my $args = $3;
1444+
$return_type =~ s/^\s+//;
14441445

14451446
create_parameterlist($args, ',', $file, $declaration_name);
14461447

0 commit comments

Comments
 (0)