Skip to content

Commit

Permalink
kernel-doc: handle arrays with arithmetic expressions as initializers
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Borislav Petkov authored and Linus Torvalds committed May 8, 2007
1 parent 1525dcc commit 884f281
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion scripts/kernel-doc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 884f281

Please sign in to comment.