From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top
Subject: [PATCH v2 20/28] cppcheck: Suppress same-value-in-ternary branches warning
Date: Thu, 29 Sep 2022 13:38:24 +1000 [thread overview]
Message-ID: <20220929033832.923149-21-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20220929033832.923149-1-david@gibson.dropbear.id.au>
[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]
TIMER_INTERVAL is the minimum of two separately defined intervals which
happen to have the same value at present. This results in an expression
which has the same value in both branches of a ternary operator, which
cppcheck warngs about. This is logically sound in this case, so suppress
the error (we appear to already have a similar suppression for clang-tidy).
Also add an unmatchedSuppression suppression, since only some cppcheck
versions complain about this instance.
Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
passt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/passt.c b/passt.c
index 4796c89..2c4a986 100644
--- a/passt.c
+++ b/passt.c
@@ -305,6 +305,7 @@ int main(int argc, char **argv)
loop:
/* NOLINTNEXTLINE(bugprone-branch-clone): intervals can be the same */
+ /* cppcheck-suppress [duplicateValueTernary, unmatchedSuppression] */
nfds = epoll_wait(c.epollfd, events, EPOLL_EVENTS, TIMER_INTERVAL);
if (nfds == -1 && errno != EINTR) {
perror("epoll_wait");
--
@@ -305,6 +305,7 @@ int main(int argc, char **argv)
loop:
/* NOLINTNEXTLINE(bugprone-branch-clone): intervals can be the same */
+ /* cppcheck-suppress [duplicateValueTernary, unmatchedSuppression] */
nfds = epoll_wait(c.epollfd, events, EPOLL_EVENTS, TIMER_INTERVAL);
if (nfds == -1 && errno != EINTR) {
perror("epoll_wait");
--
2.37.3
next prev parent reply other threads:[~2022-09-29 3:38 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-29 3:38 [PATCH v2 00/28] Fixes for static checkers David Gibson
2022-09-29 3:38 ` [PATCH v2 01/28] Clean up parsing of port ranges David Gibson
2022-09-29 3:38 ` [PATCH v2 02/28] clang-tidy: Suppress warning about unchecked error in logfn macro David Gibson
2022-09-29 3:38 ` [PATCH v2 03/28] clang-tidy: Fix spurious null pointer warning in pasta_start_ns() David Gibson
2022-09-29 3:38 ` [PATCH v2 04/28] clang-tidy: Remove duplicate #include from icmp.c David Gibson
2022-09-29 3:38 ` [PATCH v2 05/28] Catch failures when installing signal handlers David Gibson
2022-09-29 3:38 ` [PATCH v2 06/28] Pack DHCPv6 "on wire" structures David Gibson
2022-09-29 3:38 ` [PATCH v2 07/28] Clean up parsing in conf_runas() David Gibson
2022-09-29 3:38 ` [PATCH v2 08/28] cppcheck: Reduce scope of some variables David Gibson
2022-09-29 3:38 ` [PATCH v2 09/28] Don't shadow 'i' in conf_ports() David Gibson
2022-09-29 3:38 ` [PATCH v2 10/28] Don't shadow global function names David Gibson
2022-09-29 3:38 ` [PATCH v2 11/28] Stricter checking for nsholder.c David Gibson
2022-09-29 3:38 ` [PATCH v2 12/28] cppcheck: Work around false positive NULL pointer dereference error David Gibson
2022-09-29 3:38 ` [PATCH v2 13/28] cppcheck: Use inline suppression for ffsl() David Gibson
2022-09-29 3:38 ` [PATCH v2 14/28] cppcheck: Use inline suppressions for qrap.c David Gibson
2022-09-29 3:38 ` [PATCH v2 15/28] cppcheck: Use inline suppression for strtok() in conf.c David Gibson
2022-09-29 3:38 ` [PATCH v2 16/28] Avoid ugly 'end' members in netlink structures David Gibson
2022-09-29 3:38 ` [PATCH v2 17/28] cppcheck: Broaden suppression for unused struct members David Gibson
2022-09-29 3:38 ` [PATCH v2 18/28] cppcheck: Remove localtime suppression for pcap.c David Gibson
2022-09-29 3:38 ` [PATCH v2 19/28] qrap: Handle case of PATH environment variable being unset David Gibson
2022-09-29 3:38 ` David Gibson [this message]
2022-09-29 3:38 ` [PATCH v2 21/28] cppcheck: Suppress NULL pointer warning in tcp_sock_consume() David Gibson
2022-09-29 3:38 ` [PATCH v2 22/28] Regenerate seccomp.h if seccomp.sh changes David Gibson
2022-09-29 3:38 ` [PATCH v2 23/28] cppcheck: Avoid errors due to zeroes in bitwise ORs David Gibson
2022-09-29 3:38 ` [PATCH v2 24/28] cppcheck: Remove unused knownConditionTrueFalse suppression David Gibson
2022-09-29 3:38 ` [PATCH v2 25/28] cppcheck: Remove unused objectIndex suppressions David Gibson
2022-09-29 3:38 ` [PATCH v2 26/28] cppcheck: Remove unused va_list_usedBeforeStarted suppression David Gibson
2022-09-29 3:38 ` [PATCH v2 27/28] Mark unused functions for cppcheck David Gibson
2022-09-29 3:38 ` [PATCH v2 28/28] cppcheck: Remove unused unmatchedSuppression suppressions David Gibson
2022-09-29 23:31 ` [PATCH v2 00/28] Fixes for static checkers Stefano Brivio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220929033832.923149-21-david@gibson.dropbear.id.au \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).