mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
checkpatch: ensure we actually detect if assignments split across lines
When checking for assignments within if conditionals we check the whole of the condition, but the match is performed using a line constrained regular expression. This means we can miss split conditionals or those on the second line. Allow the check to span lines. Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
2d1bafd799
commit
b53c8e104e
1 changed files with 1 additions and 1 deletions
|
@ -2048,7 +2048,7 @@ sub process {
|
|||
$line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) {
|
||||
my ($s, $c) = ($stat, $cond);
|
||||
|
||||
if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/) {
|
||||
if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/s) {
|
||||
ERROR("do not use assignment in if condition\n" . $herecurr);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue