kernel-doc: Update script to find more "Return:" sections
PATCH 1/1 kernel-doc: Update script to find more "Return:" sections
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:"
---
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(+)
scripts/kernel-doc +1 -0
@@ -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";
Quoted 20 lines · Joe Perches
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:"
Quoted 7 lines
Signed-off-by Joe Perches <[email protected]>---
I don't know that this actually works.
It does seem right though.Randy? Rob? Can you test this please?
Works for me. Thanks.
Quoted 19 lines
scripts/kernel-doc | 1 + 1 file changed, 1 insertion(+)scripts/kernel-doc +1
-1@@ -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"; --
Signature · 1 line
~Randy
Quoted 20 lines · Joe Perches
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:"
Quoted 7 lines
Signed-off-by Joe Perches <[email protected]>---
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
Quoted 24 lines · Rob Landley
Quoted 23 lines · Joe Perches
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 <[email protected]>---
Quoted 8 lines
Quoted 4 lines
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.
Quoted 2 lines
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: