Fix warnings when building 'xmldocs' target:
PATCH 5/5 Fix warnings when building 'xmldocs' target:
This one fixes the case when a composite expression containing at least one \s is found in an array subscript braces (see include/linux/mtd/nand.h:303, for example)
20-rc5/scripts/kernel-doc +2 -0
@@ -1451,6 +1451,8 @@ } elsif ($arg) { $arg =~ s/\s*:\s*/:/g; $arg =~ s/\s*\[/\[/g; + # remove array subscript braces early + # $arg =~ s/\[.*$//; my @args = split('\s*,\s*', $arg); if ($args[0] =~ m/\*/) {
Signature · 6 lines
Regards/Gruß,
Boris.
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitorsQuoted 9 lines · On Fri, 6 Apr 2007 09:44:28 +0200 Borislav Petkov wrote:
This one fixes the case when a composite expression containing at least one \s is found in an array subscript braces (see
include/linux/mtd/nand.h:303, for example)Signed-off-by Borislav Petkov <[email protected]>
20-rc5/scripts/kernel-doc line 1458
Quoted 8 lines
20-rc5/scripts/kernel-doc +2
-0@@ -1451,6 +1451,8 @@ } elsif ($arg) { $arg =~ s/\s*:\s*/:/g; $arg =~ s/\s*\[/\[/g; + # remove array subscript braces early + # $arg =~ s/\[.*$//; my @args = split('\s*,\s*', $arg); if ($args[0] =~ m/\*/) {
[removed [email protected]]
Uh, you mean without the second '#' (comment), right?
I know that scripts/kernel-doc needs a patch for this problem, but I don't care for losing the array indication & sizes that this patch causes. Now the generated html output for this looks like:
struct nand_buffers — buffer structure for read/write Synopsis
struct nand_buffers {
uint8_t ecccalc;
uint8_t ecccode;
uint8_t databuf;
};
but it should look like:
struct nand_buffers — buffer structure for read/write Synopsis
struct nand_buffers {
uint8_t ecccalc[NAND_MAX_OOBSIZE];
uint8_t ecccode[NAND_MAX_OOBSIZE];
uint8_t databuf[NAND_MAX_PAGESIZE + NAND_MAX_OOBSIZE];
};
or at least use "[]" to indicate arrays on those lines.
I have worked on this buglet in the past. (scripts/kernel-doc parsing leaves a lot to be desired.) My patch is attached. It removes spaces inside [...]. After that, the script works and the output looks like this:
struct nand_buffers — buffer structure for read/write Synopsis
struct nand_buffers {
uint8_t ecccalc[NAND_MAX_OOBSIZE];
uint8_t ecccode[NAND_MAX_OOBSIZE];
uint8_t databuf[NAND_MAX_PAGESIZE+NAND_MAX_OOBSIZE];
};
I'll submit this patch for kernel inclusion, with some rude comment that it's just a hack.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
From: Randy Dunlap <[email protected]>
Unfortunately, kernel-doc has problems with a struct field like this:
uint8_t databuf[NAND_MAX_PAGESIZE + NAND_MAX_OOBSIZE];
simply due to the spaces around the "+" sign, so drop all spaces inside [...] so that parsing is done correctly (in some sense).
Warning(linux-2.6.20-git15/include/linux/mtd/nand.h:304): No description found for parameter 'NAND_MAX_OOBSIZE]'
This needs to sit in -mm for awhile to see if it has any adverse effects.
--- scripts/kernel-doc | 6 ++++++ 1 file changed, 6 insertions(+)
scripts/kernel-doc +6 -0
@@ -1470,6 +1470,12 @@ sub create_parameterlist($$$) { $arg =~ s/\s*:\s*/:/g; $arg =~ s/\s*\[/\[/g; + # no spaces inside [array size expression]; + # messes up split/pop/shift/unshift below; + while ($arg =~ m/\[.*\s.*\]/) { + $arg =~ s/\[(.*)\s(.*)\]/\[$1$2\]/; + } + my @args = split('\s*,\s*', $arg); if ($args[0] =~ m/\*/) { $args[0] =~ s/(\*+)\s*/ $1/;
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors