check-format.pl: Fix report on constant on LHS of comparison or assignment
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Fri, 12 Nov 2021 11:14:45 +0000 (12:14 +0100)
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>
Wed, 20 Jul 2022 11:05:19 +0000 (13:05 +0200)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(cherry picked from commit 2e6afe1079c6993868c5d8a813605d16980e8e10)

util/check-format.pl

index 62471e3c68055658d3047867c485f6353c8966d7..09bd6b627077f48c0670adbc1465124b76246fcb 100755 (executable)
@@ -858,7 +858,7 @@ 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 '$2'")
+    report("constant on LHS of '$3'")
         if (m/(['"]|([\+\-\*\/\/%\&\|\^<>]\s*)?\W[0-9]+L?|NULL)\s*([\!<>=]=|[<=>][^<>])/ && $2 eq "");
 
     # TODO report #if 0 and #if 1