* [PATCH] checkpatch: fix false positive on casting to double pointer
@ 2010-06-17 20:26 Scott J. Goldman
2010-06-18 13:15 ` Andy Whitcroft
0 siblings, 1 reply; 5+ messages in thread
From: Scott J. Goldman @ 2010-06-17 20:26 UTC (permalink / raw)
To: Andy Whitcroft; +Cc: linux-kernel, Scott J. Goldman
Signed-off-by: Scott J. Goldman <scottjg@vmware.com>
---
scripts/checkpatch.pl | 4 +++-
tests/t/t9190-double-pointers | 6 ++++++
2 files changed, 9 insertions(+), 1 deletions(-)
create mode 100644 tests/t/t9190-double-pointers
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 87bbb8b..687bd6f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1982,7 +1982,9 @@ sub process {
$op eq '*' or $op eq '/' or
$op eq '%')
{
- if ($ctx =~ /Wx[^WCE]|[^WCE]xW/) {
+ if ($op eq '*' && $cc =~ /^\*/) {
+ # double pointer is ok
+ } elsif ($ctx =~ /Wx[^WCE]|[^WCE]xW/) {
ERROR("need consistent spacing around '$op' $at\n" .
$hereptr);
}
diff --git a/tests/t/t9190-double-pointers b/tests/t/t9190-double-pointers
new file mode 100644
index 0000000..3f3f7f9
--- /dev/null
+++ b/tests/t/t9190-double-pointers
@@ -0,0 +1,6 @@
+pass "foo **x;"
+pass "x = **y;"
+pass "x = (foo **)y;"
+
+err='"(foo ** )" should be "(foo **)"'
+fail "x = (foo ** )y;" "$err"
--
1.6.0.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] checkpatch: fix false positive on casting to double pointer
2010-06-17 20:26 [PATCH] checkpatch: fix false positive on casting to double pointer Scott J. Goldman
@ 2010-06-18 13:15 ` Andy Whitcroft
2010-06-18 13:19 ` Andy Whitcroft
0 siblings, 1 reply; 5+ messages in thread
From: Andy Whitcroft @ 2010-06-18 13:15 UTC (permalink / raw)
To: Scott J. Goldman; +Cc: linux-kernel
On Thu, Jun 17, 2010 at 9:26 PM, Scott J. Goldman <scottjg@vmware.com> wrote:
>
> Signed-off-by: Scott J. Goldman <scottjg@vmware.com>
> ---
> scripts/checkpatch.pl | 4 +++-
> tests/t/t9190-double-pointers | 6 ++++++
> 2 files changed, 9 insertions(+), 1 deletions(-)
> create mode 100644 tests/t/t9190-double-pointers
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 87bbb8b..687bd6f 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1982,7 +1982,9 @@ sub process {
> $op eq '*' or $op eq '/' or
> $op eq '%')
> {
> - if ($ctx =~ /Wx[^WCE]|[^WCE]xW/) {
> + if ($op eq '*' && $cc =~ /^\*/) {
> + # double pointer is ok
> + } elsif ($ctx =~ /Wx[^WCE]|[^WCE]xW/) {
> ERROR("need consistent spacing around '$op' $at\n" .
> $hereptr);
Hrm, I would expect any number of levels of pointers to be detected
already correctly.
/me goes check.
-apw
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] checkpatch: fix false positive on casting to double pointer
2010-06-18 13:15 ` Andy Whitcroft
@ 2010-06-18 13:19 ` Andy Whitcroft
2010-06-18 16:11 ` Scott Goldman
2010-06-18 18:07 ` [PATCH] checkpatch: fix false positives involving __percpu attribute Scott J. Goldman
0 siblings, 2 replies; 5+ messages in thread
From: Andy Whitcroft @ 2010-06-18 13:19 UTC (permalink / raw)
To: Scott J. Goldman; +Cc: linux-kernel
> Hrm, I would expect any number of levels of pointers to be detected
> already correctly.
>
> /me goes check.
We already have tests for both types which are passing generally, in
t730-* and t7020-* so I think this is more likely a failure to detect
the type as a type. If you could send on the sample that triggers
this I will have a look.
-apw
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] checkpatch: fix false positive on casting to double pointer
2010-06-18 13:19 ` Andy Whitcroft
@ 2010-06-18 16:11 ` Scott Goldman
2010-06-18 18:07 ` [PATCH] checkpatch: fix false positives involving __percpu attribute Scott J. Goldman
1 sibling, 0 replies; 5+ messages in thread
From: Scott Goldman @ 2010-06-18 16:11 UTC (permalink / raw)
To: Andy Whitcroft; +Cc: linux-kernel
> > Hrm, I would expect any number of levels of pointers to be detected
> > already correctly.
> >
> > /me goes check.
>
> We already have tests for both types which are passing generally, in
> t730-* and t7020-* so I think this is more likely a failure to detect
> the type as a type. If you could send on the sample that triggers
> this I will have a look.
>
> -apw
Yikes! you're right, lousy tests on my part. The part of my patch that triggered it was:
+ return snmp_fold_field((void __percpu **)net->mib.udp_statistics,
+ UDP_MIB_RCVBUFERRORS) +
+ snmp_fold_field((void __percpu **)net->mib.udplite_statistics,
+ UDP_MIB_RCVBUFERRORS);
ERROR: need consistent spacing around '*' (ctx:WxO)
#115: FILE: drivers/net/vmxnet3/vmxnet3_drv.c:1784:
+ return snmp_fold_field((void __percpu **)net->mib.udp_statistics,
^
Maybe caused by the __percpu attr?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] checkpatch: fix false positives involving __percpu attribute
2010-06-18 13:19 ` Andy Whitcroft
2010-06-18 16:11 ` Scott Goldman
@ 2010-06-18 18:07 ` Scott J. Goldman
1 sibling, 0 replies; 5+ messages in thread
From: Scott J. Goldman @ 2010-06-18 18:07 UTC (permalink / raw)
To: Andy Whitcroft; +Cc: linux-kernel, Scott J. Goldman
Signed-off-by: Scott J. Goldman <scottjg@vmware.com>
---
scripts/checkpatch.pl | 3 ++-
tests/t/t7005-attr-matcher | 2 ++
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 87bbb8b..d701956 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -150,7 +150,8 @@ our $Attribute = qr{
____cacheline_aligned|
____cacheline_aligned_in_smp|
____cacheline_internodealigned_in_smp|
- __weak
+ __weak|
+ __percpu
}x;
our $Modifier;
our $Inline = qr{inline|__always_inline|noinline};
diff --git a/tests/t/t7005-attr-matcher b/tests/t/t7005-attr-matcher
index a50405f..738da4c 100755
--- a/tests/t/t7005-attr-matcher
+++ b/tests/t/t7005-attr-matcher
@@ -31,6 +31,8 @@ attr "____cacheline_internodealigned_in_smp"
attr "__weak"
+attr "__percpu"
+
attr "__user"
attr "__kernel"
attr "__force"
--
1.6.0.3
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-06-18 18:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-17 20:26 [PATCH] checkpatch: fix false positive on casting to double pointer Scott J. Goldman
2010-06-18 13:15 ` Andy Whitcroft
2010-06-18 13:19 ` Andy Whitcroft
2010-06-18 16:11 ` Scott Goldman
2010-06-18 18:07 ` [PATCH] checkpatch: fix false positives involving __percpu attribute Scott J. Goldman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome