Re: kernel-doc mishandles declarations split into lines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Am 06.06.2017 um 15:28 schrieb Johannes Berg <johannes@xxxxxxxxxxxxxxxx>:
> 
> Hi,
> 
> Apologies for the long CC list, wasn't sure who really feels like they
> understand this script anymore ... Markus, I think you had a rewrite of
> the script in python?

Hi Johannes, hi Mauro, (Jon)

sorry for my late reply. Yes I have a rewrite, its a part of my LinuxDoc
project: https://return42.github.io/linuxdoc/ 

The parser part is same state machine as the the perl one … with same
problems ;)

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 patch, the result missed the space between ‚foo' and 'bar'::

  struct something {struct foobar;};

Here is my fix for the Perl script:

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index a26a5f2..6aa52cc 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -2763,6 +2763,9 @@ sub process_proto_type($$) {
 
     while (1) {
 	if ( $x =~ /([^{};]*)([{};])(.*)/ ) {
+            if( length $prototype ) {
+                $prototype .= " "
+            }
 	    $prototype .= $1 . $2;
 	    ($2 eq '{') && $brcount++;
 	    ($2 eq '}') && $brcount--;

Can you test it?

To be complete, here is the patch of the parser from LinuxDoc:

  https://github.com/return42/linuxdoc/commit/f11bbd5

and here the impact on the whole parsed source tree:

  https://github.com/return42/sphkerneldoc/commit/56554

Mostly spaces are added to function’s arguments, but there are
also some real bugs fixed e.g.:

 https://github.com/return42/sphkerneldoc/commit/56554e5f16c68d46d9c361e46540ce48ec1a9f27#diff-523d26ea9da1bb7b97d2b763c75367e9

Thanks for the hint!

- Markus -

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



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux