aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorConchúr Navid <conchur@web.de>2015-11-08 10:48:05 +0100
committerJonathan Corbet <corbet@lwn.net>2015-11-20 16:13:48 -0700
commit4468e21eed2dd7ee8dc91d94dbd2ccb0d291fb07 (patch)
tree29755f76a7435df66b52beee7cfc11cbf55efae7 /scripts
parentkernel-doc: Fix stripping of #define in enums (diff)
downloadlinux-dev-4468e21eed2dd7ee8dc91d94dbd2ccb0d291fb07.tar.xz
linux-dev-4468e21eed2dd7ee8dc91d94dbd2ccb0d291fb07.zip
kernel-doc: Strip #ifdef/#endif in enums
Some enumerations in the kernel headers use #ifdef to reduce their size based on the the configuration. These lines have to be stripped to avoid parsing problems. For example a simple input like /** * enum flags - test flags * @flag1: first flag * @flag2: second flag */ enum flags { flag1 = BIT(0), #ifdef SECOND_FLAG flag2 = BIT(1), #endif }; resulted in parsing warnings like warning: Enum value '#ifdef SECOND_FLAG;flag2 = BIT(1)' not described in enum 'flags' warning: Enum value '#endif;' not described in enum 'flags' Signed-off-by: Conchúr Navid <conchur@web.de> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/kernel-doc3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 8313b49b6cd0..f5c2971244a3 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1844,7 +1844,8 @@ sub dump_enum($$) {
my $file = shift;
$x =~ s@/\*.*?\*/@@gos; # strip comments.
- $x =~ s@#\s*define\s+[^;]*;@@gos; # strip #define macros inside enums
+ # strip #define macros inside enums
+ $x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos;
if ($x =~ /enum\s+(\w+)\s*{(.*)}/) {
$declaration_name = $1;