Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760661Ab0FQU2T (ORCPT ); Thu, 17 Jun 2010 16:28:19 -0400 Received: from smtp-outbound-1.vmware.com ([65.115.85.69]:4490 "EHLO smtp-outbound-1.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757508Ab0FQU2S (ORCPT ); Thu, 17 Jun 2010 16:28:18 -0400 From: "Scott J. Goldman" To: Andy Whitcroft Cc: linux-kernel@vger.kernel.org, "Scott J. Goldman" Subject: [PATCH] checkpatch: fix false positive on casting to double pointer Date: Thu, 17 Jun 2010 13:26:51 -0700 Message-Id: <1276806411-15176-1-git-send-email-scottjg@vmware.com> X-Mailer: git-send-email 1.7.0.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1306 Lines: 43 Signed-off-by: Scott J. Goldman --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/