Fix false positive if cppcheck doesn't give a false positive

da46fdac "tcp: Suppress knownConditionTrueFalse cppcheck false positive"
introduced a suppression to work around a cppcheck bug causing a false
positive warning.  However, the suppression will itself cause a spurious
unmatchedSuppression warning if used with a version of cppcheck from before
the bug was introduced.  That includes the packaged version of cppcheck in
Fedora.

Suppress the unmatchedSuppression as well.

Fixes: da46fdac36 ("tcp: Suppress knownConditionTrueFalse cppcheck false positive")
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2023-03-21 14:55:00 +11:00 committed by Stefano Brivio
parent 34ade90957
commit 89d1494974

2
tcp.c
View file

@ -1822,7 +1822,7 @@ static void tcp_clamp_window(const struct ctx *c, struct tcp_tap_conn *conn,
* *
* drop this suppression once that's resolved. * drop this suppression once that's resolved.
*/ */
/* cppcheck-suppress knownConditionTrueFalse */ /* cppcheck-suppress [knownConditionTrueFalse, unmatchedSuppression] */
if ((wnd > prev_scaled && wnd * 99 / 100 < prev_scaled) || if ((wnd > prev_scaled && wnd * 99 / 100 < prev_scaled) ||
(wnd < prev_scaled && wnd * 101 / 100 > prev_scaled)) (wnd < prev_scaled && wnd * 101 / 100 > prev_scaled))
return; return;