lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <trinity-be6221a8-c495-4343-a356-92ccdcc96c22-1446976085409@3capp-webde-bs45>
Date:	Sun, 8 Nov 2015 10:48:05 +0100
From:	conchur@....de
To:	"Jonathan Corbet" <corbet@....net>
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH 2/3] kernel-doc: Strip #ifdef/#endif in enums

From: Conchúr Navid <conchur@....de>

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@....de>
---
 scripts/kernel-doc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 8313b49..f5c2971 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;
-- 
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ