All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Whitcroft <apw@canonical.com>,
	Hanna Hawa <hannah@marvell.com>,
	Yehuda Yitschak <yehuday@marvell.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] checkpatch: Avoid "spaces required around that ':'" false positive
Date: Tue, 14 Apr 2015 07:01:14 -0700	[thread overview]
Message-ID: <1429020074.2672.22.camel@perches.com> (raw)
In-Reply-To: <1429001444138.31694@marvell.com>

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 <joe@perches.com>
Reported-by: Yehuda Yitschak <yehuday@marvell.com>
---
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;



           reply	other threads:[~2015-04-14 14:01 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1429001444138.31694@marvell.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1429020074.2672.22.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=hannah@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yehuday@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.