[PATCH] kernel-doc: allow space in macro #define

Previous thread: [ANNOUNCE] GIT 1.6.0 by Junio C Hamano on Sunday, August 17, 2008 - 5:16 pm. (1 message)

Next thread: [PATCH] kernel.h: fix kernel-doc for might_sleep by Randy Dunlap on Sunday, August 17, 2008 - 6:50 pm. (1 message)
To: lkml <linux-kernel@...>
Cc: akpm <akpm@...>
Date: Sunday, August 17, 2008 - 6:50 pm

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

Allow macros that are annotated with kernel-doc to contain whitespace
between the '#' and "define". It's valid and being used, so allow it.

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

--- linux-2.6.27-rc3-git4.orig/scripts/kernel-doc
+++ linux-2.6.27-rc3-git4/scripts/kernel-doc
@@ -1644,7 +1644,7 @@ sub dump_function($$) {
$prototype =~ s/^noinline +//;
$prototype =~ s/__devinit +//;
$prototype =~ s/__init +//;
- $prototype =~ s/^#define\s+//; #ak added
+ $prototype =~ s/^#\s*define\s+//; #ak added
$prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//;

# Yes, this truly is vile. We are looking for:
@@ -1760,13 +1760,13 @@ sub process_state3_function($$) {

$x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line

- if ($x =~ m#\s*/\*\s+MACDOC\s*#io || ($x =~ /^#/ && $x !~ /^#define/)) {
+ if ($x =~ m#\s*/\*\s+MACDOC\s*#io || ($x =~ /^#/ && $x !~ /^#\s*define/)) {
# do nothing
}
elsif ($x =~ /([^\{]*)/) {
$prototype .= $1;
}
- if (($x =~ /\{/) || ($x =~ /\#define/) || ($x =~ /;/)) {
+ if (($x =~ /\{/) || ($x =~ /\#\s*define/) || ($x =~ /;/)) {
$prototype =~ s@/\*.*?\*/@@gos; # strip comments.
$prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
$prototype =~ s@^\s+@@gos; # strip leading spaces

---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
--

Previous thread: [ANNOUNCE] GIT 1.6.0 by Junio C Hamano on Sunday, August 17, 2008 - 5:16 pm. (1 message)

Next thread: [PATCH] kernel.h: fix kernel-doc for might_sleep by Randy Dunlap on Sunday, August 17, 2008 - 6:50 pm. (1 message)