public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	samr <sam@ravnborg.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] kernel-doc: fix param matching for array params
Date: Wed, 17 Jun 2009 17:37:47 -0700	[thread overview]
Message-ID: <4A398C5B.6040705@oracle.com> (raw)

From: Randy Dunlap <randy.dunlap@oracle.com>

Fix function actual parameter vs. kernel-doc description matching
so that a warning is not printed when it should not be:

Warning(include/linux/etherdevice.h:199): Excess function parameter 'addr' description in 'is_etherdev_addr'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 scripts/kernel-doc |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

--- linux-2.6.30-git11.orig/scripts/kernel-doc
+++ linux-2.6.30-git11/scripts/kernel-doc
@@ -1653,6 +1653,15 @@ sub push_parameter($$$) {
 	}
 	}
 
+	# strip spaces from $param so that it is one continous string
+	# on @parameterlist;
+	# this fixes a problem where check_sections() cannot find
+	# a parameter like "addr[6 + 2]" because it actually appears
+	# as "addr[6", "+", "2]" on the parameter list;
+	# but it's better to maintain the param string unchanged for output,
+	# so just weaken the string compare in check_sections() to ignore
+	# "[blah" in a parameter string;
+	###$param =~ s/\s*//g;
 	push @parameterlist, $param;
 	$parametertypes{$param} = $type;
 }
@@ -1671,6 +1680,14 @@ sub check_sections($$$$$$) {
 			$prm_clean = $prms[$px];
 			$prm_clean =~ s/\[.*\]//;
 			$prm_clean =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//;
+			# ignore array size in a parameter string;
+			# however, the original param string may contain
+			# spaces, e.g.:  addr[6 + 2]
+			# and this appears in @prms as "addr[6" since the
+			# parameter list is split at spaces;
+			# hence just ignore "[..." for the sections check;
+			$prm_clean =~ s/\[.*//;
+
 			##$prm_clean =~ s/^\**//;
 			if ($prm_clean eq $sects[$sx]) {
 				$err = 0;


-- 
~Randy
LPC 2009, Sept. 23-25, Portland, Oregon
http://linuxplumbersconf.org/2009/

             reply	other threads:[~2009-06-18  0:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-18  0:37 Randy Dunlap [this message]
2009-06-20 11:38 ` [PATCH] kernel-doc: fix param matching for array params Sam Ravnborg

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=4A398C5B.6040705@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    /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