mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* kernel-doc: Not stripped #define/#ifdef/#endif in enums
@ 2015-11-01 16:20 conchur
  2015-11-02 17:16 ` Jonathan Corbet
  0 siblings, 1 reply; 5+ messages in thread
From: conchur @ 2015-11-01 16:20 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jonathan Corbet, Ben Hutchings, Andrew Morton, Randy Dunlap,
	Danilo Cesar Lemes de Paula, "Jérémy Bobbio",
	Johannes Berg, Bart Van Assche

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;


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-20 19:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-01 16:20 kernel-doc: Not stripped #define/#ifdef/#endif in enums conchur
2015-11-02 17:16 ` Jonathan Corbet
2015-11-20 11:27   ` Aw: " conchur
2015-11-20 14:37     ` Jonathan Corbet
2015-11-20 19:49       ` Aw: " conchur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®