From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755440AbbDNOBZ (ORCPT ); Tue, 14 Apr 2015 10:01:25 -0400 Received: from smtprelay0177.hostedemail.com ([216.40.44.177]:56671 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752843AbbDNOBS (ORCPT ); Tue, 14 Apr 2015 10:01:18 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:541:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2691:2828:3138:3139:3140:3141:3142:3353:3653:3865:3866:3868:3870:3872:3874:4250:4321:4605:5007:6119:6261:7904:10004:10400:10848:11232:11658:11914:12043:12050:12517:12519:12555:12700:12737:12740:13069:13141:13221:13229:13230:13311:13357:14093:14097:14394:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: knife34_b19727318e60 X-Filterd-Recvd-Size: 2360 Message-ID: <1429020074.2672.22.camel@perches.com> Subject: [PATCH] checkpatch: Avoid "spaces required around that ':'" false positive From: Joe Perches To: Andrew Morton Cc: Andy Whitcroft , Hanna Hawa , Yehuda Yitschak , LKML Date: Tue, 14 Apr 2015 07:01:14 -0700 In-Reply-To: <1429001444138.31694@marvell.com> References: <1429001444138.31694@marvell.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit 1f65f947a6a8 ("checkpatch: add checks for question mark and colon spacing") back in 2008, checkpatch has reported false positive for asm volatile uses of "::" checkpatch thinks colons should always have spaces around it. Add an exception for colons with colons on either side for this valid asm volatile (and c++) use. Signed-off-by: Joe Perches Reported-by: Yehuda Yitschak --- On Tue, 2015-04-14 at 08:46 +0000, Yehuda Yitschak wrote: > i believe i found a false positive in checkpatch script > When embedding ARM assembly code in C files checkpatch shouts about spaces after semicolon but that's the syntax of inline assembly. > ERROR: spaces required around that ':' (ctx:WxO) > #43: FILE: arch/arm64/kernel/perf_event.c:1221: > + asm volatile("msr pmuserenr_el0, %0" :: "r" (0xf)); scripts/checkpatch.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 78a951f..bf1cc43 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3837,6 +3837,14 @@ sub process { $ok = 1; } + # for asm volatile statements + # ignore a colon with another + # colon immediately before or after + if (($op eq ':') && + ($ca =~ /:$/ || $cc =~ /^:/)) { + $ok = 1; + } + # messages are ERROR, but ?: are CHK if ($ok == 0) { my $msg_type = \&ERROR;