Skip to content

Commit

Permalink
checkpatch: avoid "spaces required around that ':'" false positive
Browse files Browse the repository at this point in the history
Since commit 1f65f94 ("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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
JoePerches authored and torvalds committed Apr 17, 2015
1 parent 323b267 commit e0df7e1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3845,6 +3845,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;
Expand Down

0 comments on commit e0df7e1

Please sign in to comment.