History

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'

Conchúr Navid committed 11 years ago

Commit 4468e211 parent 8a9260a1 file · +2 −1Browse files

Showing the changes to scripts/kernel-doc (1 of 1 file). Show all

Unified · Split

scripts/kernel-doc+2−1
@@ -1844,7 +1844,8 @@ sub dump_enum($$) { · 1843 unmodified lines
1844 my $file = shift;1844 my $file = shift;
1845 1845
1846 $x =~ s@/\*.*?\*/@@gos; # strip comments.1846 $x =~ s@/\*.*?\*/@@gos; # strip comments.
1847 $x =~ s@#\s*define\s+[^;]*;@@gos; # strip #define macros inside enums1847 # strip #define macros inside enums
1848 $x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos;
1848 1849
1849 if ($x =~ /enum\s+(\w+)\s*{(.*)}/) {1850 if ($x =~ /enum\s+(\w+)\s*{(.*)}/) {
1850 $declaration_name = $1;1851 $declaration_name = $1;