lkml.org 
[lkml]   [2013]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 06/29] checkpatch: Don't warn about if ((status = _xbegin()) == _XBEGIN_STARTED)
Date
From: Andi Kleen <ak@linux.intel.com>

Writing _xbegin which is like setjmp in a if is very natural.
Stop checkpatch's whining about this.

Cc: apw@canonical.com
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
scripts/checkpatch.pl | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b28cc38..659e683 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2831,7 +2831,10 @@ sub process {
$line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) {
my ($s, $c) = ($stat, $cond);

- if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/s) {
+ # if ((status = _xbegin()) == _XBEGIN_STARTED) is natural,
+ # so don't warn about this case.
+ if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/s &&
+ $c !~ /_xbegin/) {
ERROR("ASSIGN_IN_IF",
"do not use assignment in if condition\n" . $herecurr);
}
--
1.7.7.6


\
 
 \ /
  Last update: 2013-03-23 03:01    [W:0.469 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site