[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <trinity-73c3e379-1ca3-46e2-8f2f-8cee0d301d4f-1446975923690@3capp-webde-bs45>
Date: Sun, 8 Nov 2015 10:45:23 +0100
From: conchur@....de
To: "Jonathan Corbet" <corbet@....net>
Cc: linux-kernel@...r.kernel.org
Subject: kernel-doc: Fix stripping of #define in enums
From: Conchúr Navid <conchur@....de>
The regex to strip single line #define's in enumerations depends on the
fact that the defines are still stored on separate lines. But the
surrounding code already removed newlines and replaced them with
semicolons.
For example a simple input like
/**
* enum flags - test flags
* @flag1: first flag
* @flag2: second flag
* @flag3: third flag
* @flag4: fourth flag
*/
enum flags {
flag1 = BIT(0),
flag2 = BIT(1),
#define flags_small (flag1 | flag2)
flag3 = BIT(2),
flag4 = BIT(3),
#define flags_big (flag2 | flag3)
};
resulted in parsing warnings like
warning: Enum value '#define flags_small (flag1 | flag2);flag3 = BIT(2)' not described in enum 'flags'
warning: Enum value '#define flags_big (flag2 | flag3);' not described in enum 'flags'
Signed-off-by: Conchúr Navid <conchur@....de>
---
scripts/kernel-doc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 125b906..8313b49 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1844,7 +1844,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;
--
2.6.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists