]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scripts: kernel-doc: fix parsing function-like typedefs (again)
authorSean Anderson <sean.anderson@linux.dev>
Tue, 8 Apr 2025 10:09:36 +0000 (18:09 +0800)
committerJonathan Corbet <corbet@lwn.net>
Wed, 9 Apr 2025 18:10:34 +0000 (12:10 -0600)
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: 7d2c6b1edf79 ("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
scripts/kernel-doc.pl
scripts/lib/kdoc/kdoc_parser.py

index af6cf408b96ddbe8c400d8cc8904e04485231f38..5db23cbf4eb2bc9586a695d8b16a1e0914b5a8d2 100755 (executable)
@@ -1325,7 +1325,7 @@ sub dump_enum($$) {
     }
 }
 
-my $typedef_type = qr { ((?:\s+[\w\*]+\b){1,8})\s* }x;
+my $typedef_type = qr { ((?:\s+[\w\*]+\b){0,7}\s+(?:\w+\b|\*+))\s* }x;
 my $typedef_ident = qr { \*?\s*(\w\S+)\s* }x;
 my $typedef_args = qr { \s*\((.*)\); }x;
 
index f60722bcc687c094492f7c127fceb50093fb08d1..4f036c720b360af9c753b76c879d72da24dc5c93 100755 (executable)
@@ -1067,7 +1067,7 @@ class KernelDoc:
         Stores a typedef inside self.entries array.
         """
 
-        typedef_type = r'((?:\s+[\w\*]+\b){1,8})\s*'
+        typedef_type = r'((?:\s+[\w\*]+\b){0,7}\s+(?:\w+\b|\*+))\s*'
         typedef_ident = r'\*?\s*(\w\S+)\s*'
         typedef_args = r'\s*\((.*)\);'