mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@xenotime.net>
To: lkml <linux-kernel@vger.kernel.org>
Cc: Richard Kennedy <richard@rsk.demon.co.uk>
Subject: Re: kernel-doc : possible fix for non-fatal perl errors when parsing some function pointers
Date: Fri, 15 Feb 2008 09:44:37 -0800	[thread overview]
Message-ID: <20080215094437.5f6d7b3b.rdunlap@xenotime.net> (raw)
In-Reply-To: <20080215092154.4a8cbba7.rdunlap@xenotime.net>

On Fri, 15 Feb 2008 09:21:54 -0800 Randy Dunlap wrote:

> On Fri, 15 Feb 2008 17:13:12 +0000 Richard Kennedy wrote:
> 
> > When running "make htmldocs" I'm seeing some non-fatal perl errors
> > caused by trying to parse the callback function definitions in
> > blk-core.c.
> > 
> > The errors are "Use of uninitialized value in concatenation (.)..."
> > 
> > The function pointers are defined without a * i.e. 
> > int (drv_callback)(struct request *)
> > 
> > The compiler is happy with them, but kernel-doc isn't. 
> > 
> > This patch teaches create_parameterlist in kernel-doc to parse this type
> > of function pointer definition, but is it the right way to fix the
> > problem ? The problem only seems to occur in blk-core.c.
> > 
> > However with the patch applied, kernel-doc finds the correct parameter
> > description for the callback in blk_end_request_callback, which is
> > doesn't normally.
> > (the patch is against v2.6.25-rc1)
> > 
> > I thought it would be a bit odd to change to code to use the more normal
> > form of function pointers just to get the documentation to work, so I
> > fixed kernel-doc instead - even though this is teaching it to understand
> > code that might go away (The comment for blk_end_request_callback says
> > that it should not be used and will removed at some point). 
> > 
> > Any ideas on which is the best way to fix this?
> 
> Hi Richard,
> Thanks for the patch.  I was planning to look into this problem
> this weekend.
> 
> I think that changing scripts/kernel-doc to accept the current
> kernel source tree usage is the right thing to do, even if the
> block/blk code is a bit different.  I'll test it a bit and then
> push it.

I'm not quite happy with the way that these function pointer
parameters are presented.  E.g.,
the callback function above is presented by kernel-doc as:

		int ()(struct request *) drv_callback);
whereas this
		int (drv_callback)(struct request *)
would be much better.  If you could look into massaging that
parameter output, that would be great.  If not, I'll look into
later.


> I appreciate the patch.
> 
> > diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> > index 26146cb..68b2e4e 100755
> > --- a/scripts/kernel-doc
> > +++ b/scripts/kernel-doc
> > @@ -1512,13 +1512,13 @@ sub create_parameterlist($$$) {
> >  	    # corresponding data structures "correctly". Catch it later in
> >  	    # output_* subs.
> >  	    push_parameter($arg, "", $file);
> > -	} elsif ($arg =~ m/\(.*\*/) {
> > +	} elsif ($arg =~ m/\(.+\)\s*\(/) {
> >  	    # pointer-to-function
> >  	    $arg =~ tr/#/,/;
> > -	    $arg =~ m/[^\(]+\(\*\s*([^\)]+)\)/;
> > +	    $arg =~ m/[^\(]+\(\*?\s*(\w*)\s*\)/;
> >  	    $param = $1;
> >  	    $type = $arg;
> > -	    $type =~ s/([^\(]+\(\*)$param/$1/;
> > +	    $type =~ s/([^\(]+\(\*?)$param/$1/;
> >  	    push_parameter($param, $type, $file);
> >  	} elsif ($arg) {
> >  	    $arg =~ s/\s*:\s*/:/g;


---
~Randy

  parent reply	other threads:[~2008-02-15 17:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-15 17:13 Richard Kennedy
2008-02-15 17:21 ` Randy Dunlap
2008-02-15 17:42   ` Richard Kennedy
2008-02-15 22:46     ` Randy Dunlap
2008-02-16 11:02       ` Richard Kennedy
2008-02-15 17:44   ` Randy Dunlap [this message]
2008-02-15 17:53     ` Randy Dunlap
2008-02-15 18:14     ` Richard Kennedy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080215094437.5f6d7b3b.rdunlap@xenotime.net \
    --to=rdunlap@xenotime.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard@rsk.demon.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®