Re: [PATCH 1/1] kernel-doc: Support arrays of pointers struct fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jon,

On Mon, Feb 05, 2024 at 10:04:18AM -0700, Jonathan Corbet wrote:
> Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> writes:
> 
> > 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@xxxxxxxxxxxxxxx>
> > Acked-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
> > Tested-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
> > Tested-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
> > ---
> > No change since the RFC, just added the acks.
> >
> >  scripts/kernel-doc | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> > index e8aefd258a29..23c91b11585a 100755
> > --- a/scripts/kernel-doc
> > +++ b/scripts/kernel-doc
> > @@ -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) {
> 
> Sigh ... seeing more indecipherable regexes added to kernel-doc is like
> seeing another load of plastic bags dumped into the ocean...  it doesn't
> change the basic situation, but it's still sad.
> 
> Oh well, applied, thanks.

Thanks. I have to say I feel the same...

Regexes aren't great for parsing C, that's for sure. :-I But what are the
options? Write a proper parser for (a subset of) C?

-- 
Regards,

Sakari Ailus




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux