Skip to content

Commit 910111f

Browse files
committed
tools: fix checkpatch.pl for 'FOO < BAR && ...'
In the check $to gets value from $LvalOrFunc in regular expression that ends with '\s*', so in case of check for if (FOO < BAR && somethingelse) $to equals 'BAR ' and check that on right side there is also a constant fails. Simple fix: add '\s*' to re that checks whether $to is constant. Signed-off-by: Kyrylo Yatsenko <hedrok@gmail.com>
1 parent 6474018 commit 910111f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/checkpatch.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5542,7 +5542,7 @@ sub process {
55425542
my $to = $4;
55435543
my $newcomp = $comp;
55445544
if ($lead !~ /(?:$Operators|\.)\s*$/ &&
5545-
$to !~ /^(?:Constant|[A-Z_][A-Z0-9_]*)$/ &&
5545+
$to !~ /^(?:Constant|[A-Z_][A-Z0-9_]*)\s*$/ &&
55465546
WARN("CONSTANT_COMPARISON",
55475547
"Comparisons should place the constant on the right side of the test\n" . $herecurr) &&
55485548
$fix) {

0 commit comments

Comments
 (0)