Re: kernel-doc mishandles declarations split into lines

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

 



> 
> [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 <johannes@xxxxxxxxxxxxxxxx>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxxx>
> 
> 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;

Interesting. I just ended with almost the same patch, but didn't have
the line inside the brcount if, so it didn't work. However, your
version also introduces regressions:

/**
 * enum foo - foo
 * @F1: f1
 * @F2: f2
 */
enum foo {
        F1,

        F2,
};

now generates a warning:

/tmp/test.c:20: warning: Enum value ' ' not described in enum 'foo'

johannes
--
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