Em Tue, 06 Jun 2017 16:12:30 +0200
Johannes Berg <johan...@sipsolutions.net> escreveu:

> On Tue, 2017-06-06 at 10:59 -0300, Mauro Carvalho Chehab wrote:
> > 
> > A trivial "fix" would be to use just one line for the struct field :-
> > )  
> 
> Sure, we did this, but it makes checkpatch unhappy. We have a
> relatively long struct name, a relatively long member name, and then
> it's also an array so you have another constant that needs to fit ...
> (I didn't puth the array part into the example, but without that it'd
> actually fit on 80 cols)
> 
> > The logic that handle structs is at sub dump_struct() function at
> > kernel-doc, with is called by dump_declaration().
> > 
> > I added some debug prints at kernel-doc...
> > I guess the problem you're noticing is at process_proto_type():
> >   
> [...]
> > Basically, that while(1) loop there seems to be misinterpreting the
> > line with "very_long_member_name;"  
> 
> Oh, that's possible - I may have been looking in the wrong place.
> 
> johannes

The enclosed patch should fix the issue, hopefully not introducing
any regressions ;-)

-

[PATCH] be sure that multiline definitions will be properly espaced

When handling comments from structs with multiple lines, like:
        /**
         * struct something
         * @very_long_member_name: abcde
         */
        struct something {
                struct this_is_a_very_long_struct_name_so_need_to_break_for_the
                        very_long_member_name;
        };

The logic adds the continuation line without a proper space, causing
it to be misinterpreted. Be sure to add an space to replace the
end of line.

Reported-by: Johannes Berg <johan...@sipsolutions.net>
Signed-off-by: Mauro Carvalho Chehab <mche...@s-opensource.com>

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index a26a5f2dce39..1aa44c299f78 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -2763,17 +2763,18 @@ sub process_proto_type($$) {
 
     while (1) {
        if ( $x =~ /([^{};]*)([{};])(.*)/ ) {
-           $prototype .= $1 . $2;
+           $prototype .= $1 . $2 . " ";
            ($2 eq '{') && $brcount++;
            ($2 eq '}') && $brcount--;
            if (($2 eq ';') && ($brcount == 0)) {
+               $prototype =~ s/\s+/ /g;
                dump_declaration($prototype, $file);
                reset_state();
                last;
            }
            $x = $3;
        } else {
-           $prototype .= $x;
+           $prototype .= $x . " ";
            last;
        }
     }


Thanks,
Mauro
--
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