summaryrefslogtreecommitdiffstats
path: root/util/check-format.pl
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2022-01-06 22:05:22 +0100
committerPauli <ppzgs1@gmail.com>2022-01-09 13:19:52 +1100
commit15ae69fa7bc0f367edded19bc48e6d9a5ce8d547 (patch)
tree28c195e6ca878abe4049b14ad8669ccedc7f59a1 /util/check-format.pl
parentd8662f2f8716645164a9d4d8795a9c353fe315fb (diff)
check-format.pl: Fix report on constant on LHS of comparison/assignment
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17434)
Diffstat (limited to 'util/check-format.pl')
-rwxr-xr-xutil/check-format.pl3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/check-format.pl b/util/check-format.pl
index aa2566e28e..8861b2bd8a 100755
--- a/util/check-format.pl
+++ b/util/check-format.pl
@@ -886,7 +886,8 @@ while (<>) { # loop over all lines of all input files
report("single-letter name '$2'") if (m/(^|.*\W)([IO])(\W.*|$)/); # single-letter name 'I' or 'O' # maybe re-add 'l'?
# constant on LHS of comparison or assignment, e.g., NULL != x or 'a' < c, but not a + 1 == b
report("constant on LHS of '$3'")
- if (m/(['"]|([\+\-\*\/\/%\&\|\^<>]\s*)?\W[0-9]+L?|NULL)\s*([\!<>=]=|[<=>][^<>])/ && $2 eq "");
+ if (m/(['"]|([\+\-\*\/\/%\&\|\^<>]\s*)?\W[0-9]+L?|\WNULL)\s*([\!<>=]=|[<=>])([<>]?)/ &&
+ $2 eq "" && (($3 ne "<" && $3 ne "='" && $3 ne ">") || $4 eq ""));
# TODO report #if 0 and #if 1