From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 826645A02CB for ; Mon, 13 May 2024 16:58:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1715612280; bh=847LhBmX659jNgnWfCY/b39MCKghBNw7CJ4CSl6Yvcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NMTGh7c9Ls4zUu8MbTLL3TQhQVgJSWalr6muK0/vY0RsbucggPC3bNC/PLatTdWak 8GR2CsbptGzmGti0IG+yi9EZ2mZBHNvLY83JU7hcuYJHbXv0iR1LI4Yod50iOEZiBP PwwXxyx1VPrhBZBDyzfUVh4DC54Rtowdrt1+At50kYbqMmyFodjPFj618auYE6af2S Vo8Rrza8o9fuFWV92scLiAA1MytNLsbMtLthbWDhcGVhxAvXyACKv3oftwd29jstuy 7ARoK8DxaBNQg92c1XwfrkdKLz8geK6z1DBo+l27cY9aXsjLRlMO08LFigNLrZHvtN j4K+okDDfJU/w== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4VdMzr33bVz4x0K; Tue, 14 May 2024 00:58:00 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio 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 Message-ID: <20240513145758.713647-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240513145758.713647-1-david@gibson.dropbear.id.au> References: <20240513145758.713647-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: SPLQLFEUHSK4W454EDVZCILQDVKCWGWZ X-Message-ID-Hash: SPLQLFEUHSK4W454EDVZCILQDVKCWGWZ X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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, -- 2.45.0