diff mbox

docs: make kernel-doc handle varargs properly

Message ID 20160826072544.2baadd47@lwn.net
State Accepted
Commit ef00028b20481647431ca8bffe5469fb86cf154f
Headers show

Commit Message

Jonathan Corbet Aug. 26, 2016, 1:25 p.m. UTC
As far as I can tell, the handling of "..." arguments has never worked
right, so any documentation provided was ignored in favor of "variable
arguments."  This makes kernel-doc handle "@...:" as documented.  It does
*not* fix spots in kerneldoc comments that don't follow that convention,
but they are no more broken than before.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>

---
 scripts/kernel-doc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.7.4

Comments

Jonathan Corbet Sept. 6, 2016, 1:36 p.m. UTC | #1
On Sat, 27 Aug 2016 11:43:18 +0300
Jani Nikula <jani.nikula@intel.com> wrote:

> On Fri, 26 Aug 2016, Jonathan Corbet <corbet@lwn.net> wrote:

> > As far as I can tell, the handling of "..." arguments has never worked

> > right, so any documentation provided was ignored in favor of "variable

> > arguments."  This makes kernel-doc handle "@...:" as documented.  It does

> > *not* fix spots in kerneldoc comments that don't follow that convention,

> > but they are no more broken than before.

> >

> > Signed-off-by: Jonathan Corbet <corbet@lwn.net>

> > ---

> >  scripts/kernel-doc | 3 ++-

> >  1 file changed, 2 insertions(+), 1 deletion(-)

> >

> > diff --git a/scripts/kernel-doc b/scripts/kernel-doc

> > index c681e8f0ecc2..e6c52ab938fd 100755

> > --- a/scripts/kernel-doc

> > +++ b/scripts/kernel-doc

> > @@ -414,7 +414,7 @@ my $doc_com_body = '\s*\* ?';

> >  my $doc_decl = $doc_com . '(\w+)';

> >  # @params and a strictly limited set of supported section names

> >  my $doc_sect = $doc_com . 

> > -    '\s*(\@\w+|description|context|returns?|notes?|examples?)\s*:(.*)';

> > +    '\s*(\@[.\w]+|description|context|returns?|notes?|examples?)\s*:(.*)';  

> 

> So this will now accept "@foo.bar.baz:" too, right? Should it be

> something like this instead?

> 

> '\s*(\@\w+|\@\.\.\.|description|context|returns?|notes?|examples?)\s*:(.*)';


That works too.

I had a sort of vision of catching the "args..." notation that a lot of
kerneldoc comments use and doing the right thing, but ran out of patience
before getting it to work.  There are times when I find Markus's python
kernel-doc replacement tempting...  Maybe I'll beat my head against that
wall one more time when I get a chance and, failing that, just use the
above.

Thanks,

jon
diff mbox

Patch

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index c681e8f0ecc2..e6c52ab938fd 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -414,7 +414,7 @@  my $doc_com_body = '\s*\* ?';
 my $doc_decl = $doc_com . '(\w+)';
 # @params and a strictly limited set of supported section names
 my $doc_sect = $doc_com . 
-    '\s*(\@\w+|description|context|returns?|notes?|examples?)\s*:(.*)';
+    '\s*(\@[.\w]+|description|context|returns?|notes?|examples?)\s*:(.*)';
 my $doc_content = $doc_com_body . '(.*)';
 my $doc_block = $doc_com . 'DOC:\s*(.*)?';
 my $doc_inline_start = '^\s*/\*\*\s*$';
@@ -2340,6 +2340,7 @@  sub push_parameter($$$) {
 
 	if ($type eq "" && $param =~ /\.\.\.$/)
 	{
+	    $param = "...";
 	    if (!defined $parameterdescs{$param} || $parameterdescs{$param} eq "") {
 		$parameterdescs{$param} = "variable arguments";
 	    }