Re: [PATCH] kernel-doc parser mishandles declarations split into lines

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

 



> Am 03.07.2017 um 10:22 schrieb Daniel Vetter <daniel@xxxxxxxx>:
> 
> On Fri, Jun 16, 2017 at 09:27:48PM +0200, Markus Heiser wrote:
>> R---
>> 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;
> 
> Can't we avoid the issue in dump_enum if we're more careful with not
> adding blanks here when not needed, i.e.
> 
>           if( length $prototype && length ($1 . $2)) {
>                $prototype .= " "
>           }
> 
> Or do I miss something?

Hmm, I don't know, your suggestion needs more tests: $2 is from '([{};])'
so we do not really know if there is a leading whitespace in? I prefer my

>> $members =~ s/\s+$//;

in dump_enum. IMO its more robust since it fixes the bug by the
polluter / not by the caller.

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