scripts: checkpatch.pl: fix constant comparison false positives
Comparisons that have constants on both side of the operator were getting flagged incorrectly. Adjust the check so that pure constant comparisons are not flagged, reducing false positives. WARNING:CONSTANT_COMPARISON: \ Comparisons should place the constant on the right side of \ the test +BUILD_ASSERT(CONFIG_MAX_PTHREAD_COUNT == \ CONFIG_MAX_PTHREAD_MUTEX_COUNT - 1); Signed-off-by: Christopher Friedt <cfriedt@meta.com>
This commit is contained in:
parent
248324b67a
commit
a37254140b
|
@ -5004,6 +5004,7 @@ sub process {
|
|||
# only fix matches surrounded by parentheses to avoid incorrect
|
||||
# conversions like "FOO < baz() + 5" being "misfixed" to "baz() > FOO + 5"
|
||||
if ($perl_version_ok &&
|
||||
!($line =~ /^\+(.*)($Constant|[A-Z_][A-Z0-9_]*)\s*($Compare)\s*(.*)($Constant|[A-Z_][A-Z0-9_]*)(.*)/) &&
|
||||
$line =~ /^\+(.*)\b($Constant|[A-Z_][A-Z0-9_]*)\s*($Compare)\s*($LvalOrFunc)/) {
|
||||
my $lead = $1;
|
||||
my $const = $2;
|
||||
|
|
Loading…
Reference in a new issue