Re: [RFC PATCH 1/3] kernel-doc: better parsing of named variable arguments

2016-10-17 Thread S. Fricke
Hi Jani,

thanks for your review.

> On Sun, 16 Oct 2016, Silvio Fricke  wrote:
> > Without this patch we get warnings for named variable arguments.
> >
> > warning: No description found for parameter '...'
> > warning: Excess function parameter 'args' description in 
> > 'alloc_ordered_workqueue'
> >
> > Signed-off-by: Silvio Fricke 
> > ---
> >  scripts/kernel-doc |  9 +++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> > index 93721f3..cd5d830 100755
> > --- a/scripts/kernel-doc
> > +++ b/scripts/kernel-doc
> > @@ -211,7 +211,7 @@ my $anon_struct_union = 0;
> >  # match expressions used to find embedded type information
> >  my $type_constant = '\%([-_\w]+)';
> >  my $type_func = '(\w+)\(\)';
> > -my $type_param = '\@(\w+)';
> > +my $type_param = '\@(\w+\.{0,3})';
> 
> You need to be careful with this one, as it also impacts highlights in
> text. That should be 0 or 3 dots, not 0, 1, 2 or 3 dots, at the
> end. Otherwise a sentence ending in a "see @foo." would end up
> highlighting the single dot too.

Good point, thanks.
My first attempt was a regexp like this one '\@(\w+(?:\.\.\.)?)'. But I got
several errors like:

Sequence (? incomplete in regex; marked by <-- HERE in m/\@(\w+(? <-- HERE
/ at (eval 1) line 11,  line 146.

I have switched the inner non-cap group to a capture group via
'\@(\w+(\.\.\.)?)' and it works, but Is this wrong?

Best regards,
Silvio

> 
> >  my $type_fp_param = '\@(\w+)\(\)';  # Special RST handling for func ptr 
> > params
> >  my $type_struct = '\&((struct\s*)*[_\w]+)';
> >  my $type_struct_xml = '\\&((struct\s*)*[_\w]+)';
> > @@ -2353,7 +2353,12 @@ sub push_parameter($$$) {
> >  
> > if ($type eq "" && $param =~ /\.\.\.$/)
> > {
> > -   $param = "...";
> > +   if ($param =~ /\w\.\.\.$/) {
> > + # handles ARGNAME... parameter
> > + $param = $param;
> 
> What's the point? Why not just check if param does not match?
> 
> BR,
> Jani.
> 
> 
> > +   } else {
> > + $param = "...";
> > +   }
> > if (!defined $parameterdescs{$param} || $parameterdescs{$param} eq 
> > "") {
> > $parameterdescs{$param} = "variable arguments";
> > }
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center

-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 1/3] kernel-doc: better parsing of named variable arguments

2016-10-17 Thread Jani Nikula
On Sun, 16 Oct 2016, Silvio Fricke  wrote:
> Without this patch we get warnings for named variable arguments.
>
> warning: No description found for parameter '...'
> warning: Excess function parameter 'args' description in 
> 'alloc_ordered_workqueue'
>
> Signed-off-by: Silvio Fricke 
> ---
>  scripts/kernel-doc |  9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> index 93721f3..cd5d830 100755
> --- a/scripts/kernel-doc
> +++ b/scripts/kernel-doc
> @@ -211,7 +211,7 @@ my $anon_struct_union = 0;
>  # match expressions used to find embedded type information
>  my $type_constant = '\%([-_\w]+)';
>  my $type_func = '(\w+)\(\)';
> -my $type_param = '\@(\w+)';
> +my $type_param = '\@(\w+\.{0,3})';

You need to be careful with this one, as it also impacts highlights in
text. That should be 0 or 3 dots, not 0, 1, 2 or 3 dots, at the
end. Otherwise a sentence ending in a "see @foo." would end up
highlighting the single dot too.

>  my $type_fp_param = '\@(\w+)\(\)';  # Special RST handling for func ptr 
> params
>  my $type_struct = '\&((struct\s*)*[_\w]+)';
>  my $type_struct_xml = '\\&((struct\s*)*[_\w]+)';
> @@ -2353,7 +2353,12 @@ sub push_parameter($$$) {
>  
>   if ($type eq "" && $param =~ /\.\.\.$/)
>   {
> - $param = "...";
> + if ($param =~ /\w\.\.\.$/) {
> +   # handles ARGNAME... parameter
> +   $param = $param;

What's the point? Why not just check if param does not match?

BR,
Jani.


> + } else {
> +   $param = "...";
> + }
>   if (!defined $parameterdescs{$param} || $parameterdescs{$param} eq 
> "") {
>   $parameterdescs{$param} = "variable arguments";
>   }

-- 
Jani Nikula, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html