mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: bbpetkov@yahoo.de, akpm <akpm@linux-foundation.org>
Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>,
	lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH v3] kernel-doc: handle arrays with arithmetic expressions as initializers
Date: Sat, 7 Apr 2007 11:27:32 -0700	[thread overview]
Message-ID: <20070407112732.b937d0ef.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20070407150444.GC4048@gollum.tnic>

From: Borislav Petkov <bbpetkov@yahoo.de>

In a different approach here's a patch that handles the special case of
composite arithmetic expressions in array size initializers. With it,
prior to pushing the split strings on the @first_arg array, I split the
keywords before the array name as before and then keep the array name
along with the subscript expression as a single whole element which gets
pushed last. In this manner, kernel-doc produces correct output without
removing whitespaces which makes the array subscripts unreadable in the docs.

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 scripts/kernel-doc |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

--- linux-2.6.21-rc6.orig/scripts/kernel-doc
+++ linux-2.6.21-rc6/scripts/kernel-doc
@@ -1456,7 +1456,16 @@ sub create_parameterlist($$$) {
 	    if ($args[0] =~ m/\*/) {
 		$args[0] =~ s/(\*+)\s*/ $1/;
 	    }
-	    my @first_arg = split('\s+', shift @args);
+
+	    my @first_arg;
+	    if ($args[0] =~ /^(.*\s+)(.*?\[.*\].*)$/) {
+		    shift @args;
+		    push(@first_arg, split('\s+', $1));
+		    push(@first_arg, $2);
+	    } else {
+		    @first_arg = split('\s+', shift @args);
+	    }
+
 	    unshift(@args, pop @first_arg);
 	    $type = join " ", @first_arg;
 

      parent reply	other threads:[~2007-04-07 18:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-06 18:47 [PATCH] kernel-doc: handle spaces in array size Randy Dunlap
2007-04-06 19:24 ` Jan Engelhardt
2007-04-06 23:03   ` Randy Dunlap
2007-04-06 23:38     ` Jan Engelhardt
2007-04-07  0:53       ` [PATCH v2] " Randy Dunlap
2007-04-07 15:04         ` [PATCH] kernel-doc: handle arrays with arithmetic expressions as initializers <was Re: [PATCH v2] kernel-doc: handle spaces in array size> Borislav Petkov
2007-04-07 18:26           ` Randy Dunlap
2007-04-07 18:27           ` Randy Dunlap [this message]

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=20070407112732.b937d0ef.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=bbpetkov@yahoo.de \
    --cc=jengelh@linux01.gwdg.de \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome