public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel-doc: Update script to find more "Return:" sections
@ 2013-09-04  0:34 Joe Perches
  2013-09-05 18:20 ` Randy Dunlap
  2013-09-09  1:05 ` Rob Landley
  0 siblings, 2 replies; 4+ messages in thread
From: Joe Perches @ 2013-09-04  0:34 UTC (permalink / raw)
  To: Randy Dunlap, Rob Landley, Andrew Morton; +Cc: LKML, linux-doc

Many kernel-doc return description sections headers
use variants of the "Return:" section prefix.

(some or maybe even most of these aren't in
 kernel-doc sections, but many are)

$ git grep -E -i "^\s*\*\s*return[s]?:"| \
  cut -f2- -d":" | awk '{print $1 $2}' | \
  sort | uniq -c
    121 *return:
    838 *Return:
    778 *RETURN:
    191 *returns:
   1965 *Returns:
    603 *RETURNS:

Rather than change all of the variants to the
canonical "Return:", adapt the script to accept
case insensitive "Return:" and "Returns:"

Signed-off-by: Joe Perches <joe@perches.com>
---

I don't know that this actually works.
It does seem right though.

Randy?  Rob?  Can you test this please?

 scripts/kernel-doc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 4305b2f..2b96411 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -418,6 +418,7 @@ sub dump_section {
 	$parameterdescs{$name} = $contents;
 	$sectcheck = $sectcheck . $name . " ";
     } else {
+	$name = "Return" if $name =~ /^return[s]?$/i;
 #	print STDERR "other section '$name' = '$contents'\n";
 	if (defined($sections{$name}) && ($sections{$name} ne "")) {
 		print STDERR "Error(${file}:$.): duplicate section name '$name'\n";



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] kernel-doc: Update script to find more "Return:" sections
  2013-09-04  0:34 [PATCH] kernel-doc: Update script to find more "Return:" sections Joe Perches
@ 2013-09-05 18:20 ` Randy Dunlap
  2013-09-09  1:05 ` Rob Landley
  1 sibling, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2013-09-05 18:20 UTC (permalink / raw)
  To: Joe Perches; +Cc: Rob Landley, Andrew Morton, LKML, linux-doc

On 09/03/13 17:34, Joe Perches wrote:
> Many kernel-doc return description sections headers
> use variants of the "Return:" section prefix.
> 
> (some or maybe even most of these aren't in
>  kernel-doc sections, but many are)
> 
> $ git grep -E -i "^\s*\*\s*return[s]?:"| \
>   cut -f2- -d":" | awk '{print $1 $2}' | \
>   sort | uniq -c
>     121 *return:
>     838 *Return:
>     778 *RETURN:
>     191 *returns:
>    1965 *Returns:
>     603 *RETURNS:
> 
> Rather than change all of the variants to the
> canonical "Return:", adapt the script to accept
> case insensitive "Return:" and "Returns:"
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> 
> I don't know that this actually works.
> It does seem right though.
> 
> Randy?  Rob?  Can you test this please?

Works for me.  Thanks.

Tested-by: Randy Dunlap <rdunlap@infradead.org>


> 
>  scripts/kernel-doc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> index 4305b2f..2b96411 100755
> --- a/scripts/kernel-doc
> +++ b/scripts/kernel-doc
> @@ -418,6 +418,7 @@ sub dump_section {
>  	$parameterdescs{$name} = $contents;
>  	$sectcheck = $sectcheck . $name . " ";
>      } else {
> +	$name = "Return" if $name =~ /^return[s]?$/i;
>  #	print STDERR "other section '$name' = '$contents'\n";
>  	if (defined($sections{$name}) && ($sections{$name} ne "")) {
>  		print STDERR "Error(${file}:$.): duplicate section name '$name'\n";
> 
> 
> --



-- 
~Randy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kernel-doc: Update script to find more "Return:" sections
  2013-09-04  0:34 [PATCH] kernel-doc: Update script to find more "Return:" sections Joe Perches
  2013-09-05 18:20 ` Randy Dunlap
@ 2013-09-09  1:05 ` Rob Landley
  2013-09-09  4:01   ` Joe Perches
  1 sibling, 1 reply; 4+ messages in thread
From: Rob Landley @ 2013-09-09  1:05 UTC (permalink / raw)
  To: Joe Perches; +Cc: Randy Dunlap, Andrew Morton, LKML, linux-doc

On 09/03/2013 07:34:28 PM, Joe Perches wrote:
> Many kernel-doc return description sections headers
> use variants of the "Return:" section prefix.
> 
> (some or maybe even most of these aren't in
>  kernel-doc sections, but many are)
> 
> $ git grep -E -i "^\s*\*\s*return[s]?:"| \
>   cut -f2- -d":" | awk '{print $1 $2}' | \
>   sort | uniq -c
>     121 *return:
>     838 *Return:
>     778 *RETURN:
>     191 *returns:
>    1965 *Returns:
>     603 *RETURNS:
> 
> Rather than change all of the variants to the
> canonical "Return:", adapt the script to accept
> case insensitive "Return:" and "Returns:"
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> 
> I don't know that this actually works.
> It does seem right though.
> 
> Randy?  Rob?  Can you test this please?

I stopped reading this file at the line "#!/usr/bin/perl -w", but I'm  
not sure if this is the right approach. Something that finds these and  
lets us patch them to the cannonical version might be more appropriate.

Or are you going to add similar fuzzy matching for all the other  
keywords?

Rob

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kernel-doc: Update script to find more "Return:" sections
  2013-09-09  1:05 ` Rob Landley
@ 2013-09-09  4:01   ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2013-09-09  4:01 UTC (permalink / raw)
  To: Rob Landley; +Cc: Randy Dunlap, Andrew Morton, LKML, linux-doc

On Sun, 2013-09-08 at 20:05 -0500, Rob Landley wrote:
> On 09/03/2013 07:34:28 PM, Joe Perches wrote:
> > Many kernel-doc return description sections headers
> > use variants of the "Return:" section prefix.
> > 
> > (some or maybe even most of these aren't in
> >  kernel-doc sections, but many are)
> > 
> > $ git grep -E -i "^\s*\*\s*return[s]?:"| \
> >   cut -f2- -d":" | awk '{print $1 $2}' | \
> >   sort | uniq -c
> >     121 *return:
> >     838 *Return:
> >     778 *RETURN:
> >     191 *returns:
> >    1965 *Returns:
> >     603 *RETURNS:
> > 
> > Rather than change all of the variants to the
> > canonical "Return:", adapt the script to accept
> > case insensitive "Return:" and "Returns:"
> > 
> > Signed-off-by: Joe Perches <joe@perches.com>
> > ---
> > 
> > I don't know that this actually works.
> > It does seem right though.
> > 
> > Randy?  Rob?  Can you test this please?
> 
> I stopped reading this file at the line "#!/usr/bin/perl -w", but I'm  
> not sure if this is the right approach. Something that finds these and  
> lets us patch them to the cannonical version might be more appropriate.

~3500 different lines to patch is a lot.

> Or are you going to add similar fuzzy matching for all the other  
> keywords?

What other keywords are there that are not freeform?

The only other style I know of is @arg:


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-09  4:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-04  0:34 [PATCH] kernel-doc: Update script to find more "Return:" sections Joe Perches
2013-09-05 18:20 ` Randy Dunlap
2013-09-09  1:05 ` Rob Landley
2013-09-09  4:01   ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox