kernel-doc: Support arrays of pointers struct fields
authorSakari Ailus <sakari.ailus@linux.intel.com>
Wed, 31 Jan 2024 08:49:34 +0000 (10:49 +0200)
committerJonathan Corbet <corbet@lwn.net>
Mon, 5 Feb 2024 16:53:02 +0000 (09:53 -0700)
In a rather unusual arrangement in include/media/v4l2-vp9.h struct
v4l2_vp9_frame_symbol_counts has fields that are arrays of pointers, not a
pointer to an array, which is what's usually done.

Add support for such arrays of pointers to kernel-doc.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20240131084934.191226-1-sakari.ailus@linux.intel.com
scripts/kernel-doc

index 915e7bd97486ed750b2ca728a35dfd4656d01e30..014ef55351be004973ba368b489eaa3215de2bab 100755 (executable)
@@ -1509,6 +1509,15 @@ sub create_parameterlist($$$$) {
            $type =~ s/([^\(]+\(\*?)\s*$param/$1/;
            save_struct_actual($param);
            push_parameter($param, $type, $arg, $file, $declaration_name);
+       } elsif ($arg =~ m/\(.+\)\s*\[/) {
+           # array-of-pointers
+           $arg =~ tr/#/,/;
+           $arg =~ m/[^\(]+\(\s*\*\s*([\w\[\]\.]*?)\s*(\s*\[\s*[\w]+\s*\]\s*)*\)/;
+           $param = $1;
+           $type = $arg;
+           $type =~ s/([^\(]+\(\*?)\s*$param/$1/;
+           save_struct_actual($param);
+           push_parameter($param, $type, $arg, $file, $declaration_name);
        } elsif ($arg) {
            $arg =~ s/\s*:\s*/:/g;
            $arg =~ s/\s*\[/\[/g;