public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top, Stefano Brivio <sbrivio@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH v2 1/2] conf: Fix clang-tidy warning about using an undefined enum value
Date: Tue, 14 May 2024 00:57:57 +1000	[thread overview]
Message-ID: <20240513145758.713647-2-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20240513145758.713647-1-david@gibson.dropbear.id.au>

In conf() we temporarily set the forwarding mode variables to 0 - an
invalid value, so that we can check later if they've been set by the
intervening logic.  clang-tidy 18.1.1 in Fedora 40 now complains about
this.  Satisfy it by giving an name in the enum to the 0 value.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 conf.c | 4 ++--
 fwd.h  | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/conf.c b/conf.c
index 3f30725..21d46fe 100644
--- a/conf.c
+++ b/conf.c
@@ -1203,8 +1203,8 @@ void conf(struct ctx *c, int argc, char **argv)
 		optstring = "dqfel:hs:F:p:P:m:a:n:M:g:i:o:D:S:461t:u:";
 	}
 
-	c->tcp.fwd_in.mode = c->tcp.fwd_out.mode = 0;
-	c->udp.fwd_in.f.mode = c->udp.fwd_out.f.mode = 0;
+	c->tcp.fwd_in.mode = c->tcp.fwd_out.mode = FWD_UNSET;
+	c->udp.fwd_in.f.mode = c->udp.fwd_out.f.mode = FWD_UNSET;
 
 	do {
 		name = getopt_long(argc, argv, optstring, options, NULL);
diff --git a/fwd.h b/fwd.h
index 23281d9..41645d7 100644
--- a/fwd.h
+++ b/fwd.h
@@ -11,6 +11,7 @@
 #define	NUM_PORTS	(1U << 16)
 
 enum fwd_ports_mode {
+	FWD_UNSET = 0,
 	FWD_SPEC = 1,
 	FWD_NONE,
 	FWD_AUTO,
-- 
@@ -11,6 +11,7 @@
 #define	NUM_PORTS	(1U << 16)
 
 enum fwd_ports_mode {
+	FWD_UNSET = 0,
 	FWD_SPEC = 1,
 	FWD_NONE,
 	FWD_AUTO,
-- 
2.45.0


  reply	other threads:[~2024-05-13 14:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-13 14:57 [PATCH v2 0/2] LLVM 18.1.1 / Fedora 40 clang-tidy fixes David Gibson
2024-05-13 14:57 ` David Gibson [this message]
2024-05-13 14:57 ` [PATCH v2 2/2] clang-tidy: Suppress macro to enum conversion warnings David Gibson
2024-05-13 21:36   ` 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=20240513145758.713647-2-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /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).