mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [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

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

all inboxes | Powered by JetHome®