Skip to content

Commit 8e93cb7

Browse files
jmberg-intelJonathan Corbet
authored andcommitted
kernel-doc: handle #if in enums as well
In addition to #ifdef, #define and #endif, also handle any #if since we may be using e.g. #if IS_ENABLED(...). I didn't find any instances of this in the kernel now, there are enums with such ifs inside, but I didn't find any with kernel-doc as well. However, it came up as we were adding such a construct in our driver and warnings from kernel-doc were the result. Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Jonathan Corbet <[email protected]> Link: https://lore.kernel.org/r/20240214142937.80ee86a3beae.Ibcc5bd97a20cd10a792663e4b254cd46c7e8b520@changeid
1 parent 27103dd commit 8e93cb7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/kernel-doc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ sub dump_enum($$) {
13281328

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

13331333
if ($x =~ /typedef\s+enum\s*\{(.*)\}\s*(\w*)\s*;/) {
13341334
$declaration_name = $2;

0 commit comments

Comments
 (0)