Skip to contentSkip to conversation

checkpatch.pl: WxV false positive

DISCUSSION Vivien Didelot 2 participants 3 messages Jan 23, 2012 – Jan 30, 2012 Checkpatch

lore
Share & tools
lore
#0 lore raw

Hi Andy,

In the code below, checkpatch thinks that the asterisk is a multiplication, so it is complaining about coding style.

    ERROR: need consistent spacing around '*' (ctx:WxV)
    #304: FILE: x86/platform/ts5500/ts5500_adc.c:304:
    +	.attrs = (struct attribute *[]) {

Cheers!

-vivien

maintainer
#1 lore raw
Quoted 6 lines · Vivien Didelot

In the code below, checkpatch thinks that the asterisk is a multiplication, so it is complaining about coding style.

    ERROR: need consistent spacing around '*' (ctx:WxV)
    #304: FILE: x86/platform/ts5500/ts5500_adc.c:304:
    +	.attrs = (struct attribute *[]) {

C types are the pits. How does the version below handle for you:

http://people.canonical.com/~apw/checkpatch/checkpatch-next.pl

Relative patch below.

-apw

commit f8a73045dcaac70f9be770cca06f21c762a13878

Author: Andy Whitcroft <[email protected]>
Date:   Sun Jan 29 21:46:04 2012 +0000
    checkpatch: add [] to type extensions
    
    Add [] to a type extensions.  Fixes false positives on:
    
        .attrs = (struct attribute *[]) {
    
    Signed-off-by: Andy Whitcroft <[email protected]>
scripts/checkpatch.pl +1 -1
index d1dd544..64de1bd 100755
@@ -323,7 +323,7 @@ sub build_types {
 		  }x;
 	$Type	= qr{
 			$NonptrType
-			(?:[\s\*]+\s*const|[\s\*]+|(?:\s*\[\s*\])+)?
+			(?:(?:\s|\*|\[\])+\s*const|(?:\s|\*|\[\])+|(?:\s*\[\s*\])+)?
 			(?:\s+$Inline|\s+$Modifier)*
 		  }x;
 	$Declare	= qr{(?:$Storage\s+)?$Type};
#2 lore raw

Hi Andy,

Quoted 5 lines · Andy Whitcroft
Quoted 3 lines · Vivien Didelot

In the code below, checkpatch thinks that the asterisk is a multiplication, so it is complaining about coding style.

Quoted 8 lines
Quoted 3 lines
    ERROR: need consistent spacing around '*' (ctx:WxV)
    #304: FILE: x86/platform/ts5500/ts5500_adc.c:304:
    +	.attrs = (struct attribute *[]) {

C types are the pits. How does the version below handle for you:

http://people.canonical.com/~apw/checkpatch/checkpatch-next.pl

This version works for me!

Quoted 26 lines

Relative patch below.

-apw

commit f8a73045dcaac70f9be770cca06f21c762a13878

Author: Andy Whitcroft <[email protected]>
Date:   Sun Jan 29 21:46:04 2012 +0000
    checkpatch: add [] to type extensions
    
    Add [] to a type extensions.  Fixes false positives on:
    
        .attrs = (struct attribute *[]) {
    
    Signed-off-by: Andy Whitcroft <[email protected]>
scripts/checkpatch.pl +1 -1
index d1dd544..64de1bd 100755
@@ -323,7 +323,7 @@ sub build_types {
 		  }x;
 	$Type	= qr{
 			$NonptrType
-			(?:[\s\*]+\s*const|[\s\*]+|(?:\s*\[\s*\])+)?
+
Quoted 3 lines

(?:(?:\s|\*|\[\])+\s*const|(?:\s|\*|\[\])+|(?:\s*\[\s*\])+)? (?:\s+$Inline|\s+$Modifier)* }x;
$Declare = qr{(?:$Storage\s+)?$Type};

Thanks,
Vivien

Signature · 3 lines
Vivien Didelot
Savoir-faire Linux Inc.
Tel: (514) 276-5468 #149