All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Muezerie <andremue@linux.microsoft.com>
To: andremue@linux.microsoft.com
Cc: anatoly.burakov@intel.com, bruce.richardson@intel.com,
	dev@dpdk.org, dsinghrawat@marvell.com, palok@marvell.com,
	stephen@networkplumber.org
Subject: [PATCH v2 1/2] drivers/common: remove unused variables and add MSVC compiler flag
Date: Tue, 14 Jan 2025 12:46:50 -0800	[thread overview]
Message-ID: <1736887611-32186-2-git-send-email-andremue@linux.microsoft.com> (raw)
In-Reply-To: <1736887611-32186-1-git-send-email-andremue@linux.microsoft.com>

Removed unused variables and added MSVC specific compiler flag to
ignore warnings about unused variables, like is being done for
other compilers.

Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
 drivers/common/idpf/base/meson.build       | 13 ++++++++++---
 drivers/common/idpf/idpf_common_rxtx.c     |  2 --
 drivers/common/idpf/idpf_common_virtchnl.c |  4 ++--
 drivers/common/sfc_efx/base/efx_mae.c      |  2 +-
 drivers/common/sfc_efx/base/efx_table.c    |  1 -
 drivers/common/sfc_efx/base/meson.build    | 20 +++++++++++++-------
 6 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/common/idpf/base/meson.build b/drivers/common/idpf/base/meson.build
index f30ec7dfc2..c069507f12 100644
--- a/drivers/common/idpf/base/meson.build
+++ b/drivers/common/idpf/base/meson.build
@@ -6,9 +6,16 @@ sources += files(
         'idpf_controlq_setup.c',
 )
 
-error_cflags = [
-        '-Wno-unused-variable',
-]
+if is_ms_compiler
+    error_cflags = [
+            '/wd4101', # unreferenced local variable
+    ]
+else
+    error_cflags = [
+            '-Wno-unused-variable',
+    ]
+endif
+
 foreach flag: error_cflags
     if cc.has_argument(flag)
         cflags += flag
diff --git a/drivers/common/idpf/idpf_common_rxtx.c b/drivers/common/idpf/idpf_common_rxtx.c
index a04e54ce26..9b17279181 100644
--- a/drivers/common/idpf/idpf_common_rxtx.c
+++ b/drivers/common/idpf/idpf_common_rxtx.c
@@ -1178,7 +1178,6 @@ idpf_dp_singleq_recv_scatter_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	struct rte_mbuf *last_seg = rxq->pkt_last_seg;
 	struct rte_mbuf *rxm;
 	struct rte_mbuf *nmb;
-	struct rte_eth_dev *dev;
 	const uint32_t *ptype_tbl = rxq->adapter->ptype_tbl;
 	uint16_t rx_id = rxq->rx_tail;
 	uint16_t rx_packet_len;
@@ -1310,7 +1309,6 @@ idpf_xmit_cleanup(struct idpf_tx_queue *txq)
 	uint16_t nb_tx_desc = txq->nb_tx_desc;
 	uint16_t desc_to_clean_to;
 	uint16_t nb_tx_to_clean;
-	uint16_t i;
 
 	volatile struct idpf_base_tx_desc *txd = txq->tx_ring;
 
diff --git a/drivers/common/idpf/idpf_common_virtchnl.c b/drivers/common/idpf/idpf_common_virtchnl.c
index de511da788..0ae1d55d79 100644
--- a/drivers/common/idpf/idpf_common_virtchnl.c
+++ b/drivers/common/idpf/idpf_common_virtchnl.c
@@ -362,7 +362,7 @@ idpf_vc_queue_grps_add(struct idpf_vport *vport,
 {
 	struct idpf_adapter *adapter = vport->adapter;
 	struct idpf_cmd_info args;
-	int size, qg_info_size;
+	int size;
 	int err = -1;
 
 	size = sizeof(*p2p_queue_grps_info) +
@@ -1044,7 +1044,7 @@ int idpf_vc_rxq_config_by_info(struct idpf_vport *vport, struct virtchnl2_rxq_in
 	struct idpf_adapter *adapter = vport->adapter;
 	struct virtchnl2_config_rx_queues *vc_rxqs = NULL;
 	struct idpf_cmd_info args;
-	int size, err, i;
+	int size, err;
 
 	size = sizeof(*vc_rxqs) + (num_qs - 1) *
 		sizeof(struct virtchnl2_rxq_info);
diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c
index 9ae136dcce..1429e7dd0a 100644
--- a/drivers/common/sfc_efx/base/efx_mae.c
+++ b/drivers/common/sfc_efx/base/efx_mae.c
@@ -740,7 +740,6 @@ efx_mae_mport_by_pcie_function(
 	__in				uint32_t vf,
 	__out				efx_mport_sel_t *mportp)
 {
-	efx_dword_t dword;
 	efx_rc_t rc;
 
 	rc = efx_mae_mport_by_pcie_mh_function(EFX_PCIE_INTERFACE_CALLER,
@@ -4280,6 +4279,7 @@ efx_mae_action_set_replay(
 	__out			efx_mae_actions_t **spec_clonep)
 {
 	const efx_nic_cfg_t *encp = efx_nic_cfg_get(enp);
+	(void)encp;
 	efx_mae_actions_t *spec_clone;
 	efx_rc_t rc;
 
diff --git a/drivers/common/sfc_efx/base/efx_table.c b/drivers/common/sfc_efx/base/efx_table.c
index 13a12a116e..50e9a37d1c 100644
--- a/drivers/common/sfc_efx/base/efx_table.c
+++ b/drivers/common/sfc_efx/base/efx_table.c
@@ -240,7 +240,6 @@ efx_table_describe(
 	const efx_nic_cfg_t *encp = efx_nic_cfg_get(enp);
 	unsigned int n_entries;
 	efx_mcdi_req_t req;
-	unsigned int i;
 	efx_rc_t rc;
 	EFX_MCDI_DECLARE_BUF(payload,
 	    MC_CMD_TABLE_DESCRIPTOR_IN_LEN,
diff --git a/drivers/common/sfc_efx/base/meson.build b/drivers/common/sfc_efx/base/meson.build
index 7fc04aa57b..c8deb4555e 100644
--- a/drivers/common/sfc_efx/base/meson.build
+++ b/drivers/common/sfc_efx/base/meson.build
@@ -66,13 +66,19 @@ sources = [
         'rhead_virtio.c',
 ]
 
-extra_flags = [
-        '-Wno-sign-compare',
-        '-Wno-unused-parameter',
-        '-Wno-unused-variable',
-        '-Wno-empty-body',
-        '-Wno-unused-but-set-variable',
-]
+if is_ms_compiler
+    extra_flags = [
+            '/wd4101', # unreferenced local variable
+    ]
+else
+    extra_flags = [
+            '-Wno-sign-compare',
+            '-Wno-unused-parameter',
+            '-Wno-unused-variable',
+            '-Wno-empty-body',
+            '-Wno-unused-but-set-variable',
+    ]
+endif
 
 c_args = cflags
 foreach flag: extra_flags
-- 
2.47.0.vfs.0.3


  reply	other threads:[~2025-01-14 20:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-26 18:41 [PATCH 0/2] remove unused variables and add MSVC compiler flag Andre Muezerie
2024-12-26 18:41 ` [PATCH 1/2] drivers/common: " Andre Muezerie
2025-01-06 10:50   ` Bruce Richardson
2024-12-26 18:41 ` [PATCH 2/2] drivers/net: " Andre Muezerie
2025-01-14 17:46   ` Stephen Hemminger
2025-01-14 20:46   ` [PATCH v2 0/2] " Andre Muezerie
2025-01-14 20:46     ` Andre Muezerie [this message]
2025-01-14 20:46     ` [PATCH v2 2/2] drivers/net: add MSVC compiler flag for unused variables Andre Muezerie
2025-02-05 18:33       ` Stephen Hemminger
2025-02-05 18:54         ` Andre Muezerie
2025-02-05 18:53   ` [PATCH v3 0/2] remove unused variables and add MSVC compiler flag Andre Muezerie
2025-02-05 18:53     ` [PATCH v3 1/2] drivers/common: " Andre Muezerie
2025-02-05 18:53     ` [PATCH v3 2/2] drivers/net: add MSVC compiler flag for unused variables Andre Muezerie

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=1736887611-32186-2-git-send-email-andremue@linux.microsoft.com \
    --to=andremue@linux.microsoft.com \
    --cc=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=dsinghrawat@marvell.com \
    --cc=palok@marvell.com \
    --cc=stephen@networkplumber.org \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.