Reported by Johannes Berg [1].  Problem here: function
process_proto_type() concatenates the striped lines of declaration
without any whitespace. A one-liner of::

 struct something {
       struct foo
       bar;
       };

has to be::

 struct something {struct foo bar;};

Without the patching process_proto_type(), the result missed the space
between 'foo' and 'bar'::

 struct something {struct foobar;};

Bugfix of process_proto_type() brings next error when blank lines
between enum declaration::

 warning: Enum value ' ' not described in enum 'foo'

Problem here: dump_enum() does not strip leading whitespaces from
the concatenated string (with the new additional space from
process_proto_type).

[1] https://www.mail-archive.com/linux-doc@vger.kernel.org/msg12410.html

Signed-off-by: Markus Heiser <markus.hei...@darmarit.de>
---
 scripts/kernel-doc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index a26a5f2..fb67994 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -2223,6 +2223,7 @@ sub dump_enum($$) {
     if ($x =~ /enum\s+(\w+)\s*{(.*)}/) {
        $declaration_name = $1;
        my $members = $2;
+       $members =~ s/\s+$//;
 
        foreach my $arg (split ',', $members) {
            $arg =~ s/^\s*(\w+).*/$1/;
@@ -2763,6 +2764,9 @@ sub process_proto_type($$) {
 
     while (1) {
        if ( $x =~ /([^{};]*)([{};])(.*)/ ) {
+            if( length $prototype ) {
+                $prototype .= " "
+            }
            $prototype .= $1 . $2;
            ($2 eq '{') && $brcount++;
            ($2 eq '}') && $brcount--;
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to