kernel-doc: Not stripped #define/#ifdef/#endif in enums

From: conchur
Date: Sun Nov 01 2015 - 11:21:12 EST


Hi,
Â
just noticed that #define in kernel-doc are not correctly stripped anymore from enums. Here is my patch

Â
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1830,7 +1830,7 @@ sub dump_enum($$) {
my $file = shift;

$x =~ s@/\*.*?\*/@@gos; # strip comments.
- $x =~ s/^#\s*define\s+.*$//; # strip #define macros inside enums
+ $x =~ s@#\s*define\s+[^;]*;@@gos; # strip #define macros inside enums

if ($x =~ /enum\s+(\w+)\s*{(.*)}/) {
$declaration_name = $1;

Â
But there are also places in the kernel where #ifdef/#endif is used inside enums. So maybe this should also be stripped:

--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1830,7 +1830,8 @@ sub dump_enum($$) {
my $file = shift;

$x =~ s@/\*.*?\*/@@gos; # strip comments.
- $x =~ s/^#\s*define\s+.*$//; # strip #define macros inside enums
+ # strip #define/#ifdef/#endif macros inside enums
+ $x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos;

if ($x =~ /enum\s+(\w+)\s*{(.*)}/) {
$declaration_name = $1;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/