DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/2] remove unused variables and add MSVC compiler flag
@ 2024-12-26 18:41 Andre Muezerie
  2024-12-26 18:41 ` [PATCH 1/2] drivers/common: " Andre Muezerie
  2024-12-26 18:41 ` [PATCH 2/2] drivers/net: " Andre Muezerie
  0 siblings, 2 replies; 4+ messages in thread
From: Andre Muezerie @ 2024-12-26 18:41 UTC (permalink / raw)
  Cc: dev, Andre Muezerie

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>

Andre Muezerie (2):
  drivers/common: remove unused variables and add MSVC compiler flag
  drivers/net: remove unused variables and add MSVC compiler flag

 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 +++++---
 drivers/net/ice/base/ice_switch.c          |  2 -
 drivers/net/ice/base/meson.build           | 16 ++++--
 drivers/net/qede/base/ecore_dcbx.c         |  2 -
 drivers/net/qede/base/ecore_mcp.c          |  2 -
 drivers/net/qede/base/meson.build          | 57 ++++++++++++----------
 11 files changed, 69 insertions(+), 52 deletions(-)

--
2.47.0.vfs.0.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] drivers/common: remove unused variables and add MSVC compiler flag
  2024-12-26 18:41 [PATCH 0/2] remove unused variables and add MSVC compiler flag Andre Muezerie
@ 2024-12-26 18:41 ` Andre Muezerie
  2025-01-06 10:50   ` Bruce Richardson
  2024-12-26 18:41 ` [PATCH 2/2] drivers/net: " Andre Muezerie
  1 sibling, 1 reply; 4+ messages in thread
From: Andre Muezerie @ 2024-12-26 18:41 UTC (permalink / raw)
  To: Jingjing Wu, Praveen Shetty, Andrew Rybchenko; +Cc: dev, Andre Muezerie

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] drivers/net: remove unused variables and add MSVC compiler flag
  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
@ 2024-12-26 18:41 ` Andre Muezerie
  1 sibling, 0 replies; 4+ messages in thread
From: Andre Muezerie @ 2024-12-26 18:41 UTC (permalink / raw)
  To: Bruce Richardson, Anatoly Burakov, Devendra Singh Rawat, Alok Prasad
  Cc: dev, Andre Muezerie

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/net/ice/base/ice_switch.c  |  2 --
 drivers/net/ice/base/meson.build   | 16 ++++++---
 drivers/net/qede/base/ecore_dcbx.c |  2 --
 drivers/net/qede/base/ecore_mcp.c  |  2 --
 drivers/net/qede/base/meson.build  | 57 +++++++++++++++++-------------
 5 files changed, 43 insertions(+), 36 deletions(-)

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index a3786961e6..468a9f055d 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -8190,7 +8190,6 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	struct ice_sw_recipe *rm;
 	u8 i;
 	int status = ICE_SUCCESS;
-	u16 cnt;
 
 	if (!ice_is_prof_rule(rinfo->tun_type) && !lkups_cnt)
 		return ICE_ERR_PARAM;
@@ -9795,7 +9794,6 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	bool remove_rule = false;
 	struct ice_lock *rule_lock; /* Lock to protect filter rule list */
 	u16 i, rid, vsi_handle;
-	bool is_add = false;
 	int status = ICE_SUCCESS;
 
 	ice_memset(&lkup_exts, 0, sizeof(lkup_exts), ICE_NONDMA_MEM);
diff --git a/drivers/net/ice/base/meson.build b/drivers/net/ice/base/meson.build
index addb922ac9..a291d05b93 100644
--- a/drivers/net/ice/base/meson.build
+++ b/drivers/net/ice/base/meson.build
@@ -31,11 +31,17 @@ sources = [
         'ice_vf_mbx.c',
 ]
 
-error_cflags = [
-        '-Wno-unused-but-set-variable',
-        '-Wno-unused-variable',
-        '-Wno-unused-parameter',
-]
+if is_ms_compiler
+    error_cflags = [
+            '/wd4101', # unreferenced local variable
+    ]
+else
+    error_cflags = [
+            '-Wno-unused-but-set-variable',
+            '-Wno-unused-variable',
+            '-Wno-unused-parameter',
+    ]
+endif
 
 # Bugzilla ID: 678
 if (toolchain == 'gcc' and cc.version().version_compare('>=11.0.0'))
diff --git a/drivers/net/qede/base/ecore_dcbx.c b/drivers/net/qede/base/ecore_dcbx.c
index 31234f18cf..dc4f17ccbb 100644
--- a/drivers/net/qede/base/ecore_dcbx.c
+++ b/drivers/net/qede/base/ecore_dcbx.c
@@ -421,8 +421,6 @@ ecore_dcbx_get_priority_info(struct ecore_hwfn *p_hwfn,
 			     struct ecore_dcbx_app_prio *p_prio,
 			     struct ecore_dcbx_results *p_results)
 {
-	u8 val;
-
 	if (p_results->arr[DCBX_PROTOCOL_ETH].update &&
 	    p_results->arr[DCBX_PROTOCOL_ETH].enable)
 		p_prio->eth = p_results->arr[DCBX_PROTOCOL_ETH].priority;
diff --git a/drivers/net/qede/base/ecore_mcp.c b/drivers/net/qede/base/ecore_mcp.c
index ec83b244e6..ccd56a45d9 100644
--- a/drivers/net/qede/base/ecore_mcp.c
+++ b/drivers/net/qede/base/ecore_mcp.c
@@ -1193,7 +1193,6 @@ enum _ecore_status_t ecore_mcp_unload_done(struct ecore_hwfn *p_hwfn,
 					   struct ecore_ptt *p_ptt)
 {
 	struct ecore_mcp_mb_params mb_params;
-	struct mcp_mac wol_mac;
 
 	OSAL_MEM_ZERO(&mb_params, sizeof(mb_params));
 	mb_params.cmd = DRV_MSG_CODE_UNLOAD_DONE;
@@ -2531,7 +2530,6 @@ ecore_mcp_get_shmem_proto_mfw(struct ecore_hwfn *p_hwfn,
 			      enum ecore_pci_personality *p_proto)
 {
 	u32 resp = 0, param = 0;
-	enum _ecore_status_t rc;
 
 	DP_VERBOSE(p_hwfn, ECORE_MSG_IFUP,
 		   "According to capabilities, L2 personality is %08x [resp %08x param %08x]\n",
diff --git a/drivers/net/qede/base/meson.build b/drivers/net/qede/base/meson.build
index 4ad177b478..66251360bf 100644
--- a/drivers/net/qede/base/meson.build
+++ b/drivers/net/qede/base/meson.build
@@ -19,31 +19,38 @@ sources = [
 ]
 
 
-error_cflags = [
-        '-Wno-unused-parameter',
-        '-Wno-sign-compare',
-        '-Wno-missing-prototypes',
-        '-Wno-cast-qual',
-        '-Wno-unused-function',
-        '-Wno-unused-variable',
-        '-Wno-strict-aliasing',
-        '-Wno-missing-prototypes',
-        '-Wno-unused-value',
-        '-Wno-format-nonliteral',
-        '-Wno-shift-negative-value',
-        '-Wno-unused-but-set-variable',
-        '-Wno-missing-declarations',
-        '-Wno-maybe-uninitialized',
-        '-Wno-strict-prototypes',
-        '-Wno-shift-negative-value',
-        '-Wno-implicit-fallthrough',
-        '-Wno-format-extra-args',
-        '-Wno-visibility',
-        '-Wno-empty-body',
-        '-Wno-invalid-source-encoding',
-        '-Wno-sometimes-uninitialized',
-        '-Wno-pointer-bool-conversion',
-]
+if is_ms_compiler
+        error_cflags = [
+                '/wd4101', # unreferenced local variable
+        ]
+else
+        error_cflags = [
+                '-Wno-unused-parameter',
+                '-Wno-sign-compare',
+                '-Wno-missing-prototypes',
+                '-Wno-cast-qual',
+                '-Wno-unused-function',
+                '-Wno-unused-variable',
+                '-Wno-strict-aliasing',
+                '-Wno-missing-prototypes',
+                '-Wno-unused-value',
+                '-Wno-format-nonliteral',
+                '-Wno-shift-negative-value',
+                '-Wno-unused-but-set-variable',
+                '-Wno-missing-declarations',
+                '-Wno-maybe-uninitialized',
+                '-Wno-strict-prototypes',
+                '-Wno-shift-negative-value',
+                '-Wno-implicit-fallthrough',
+                '-Wno-format-extra-args',
+                '-Wno-visibility',
+                '-Wno-empty-body',
+                '-Wno-invalid-source-encoding',
+                '-Wno-sometimes-uninitialized',
+                '-Wno-pointer-bool-conversion',
+        ]
+endif
+
 c_args = cflags
 foreach flag: error_cflags
         if cc.has_argument(flag)
-- 
2.47.0.vfs.0.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] drivers/common: remove unused variables and add MSVC compiler flag
  2024-12-26 18:41 ` [PATCH 1/2] drivers/common: " Andre Muezerie
@ 2025-01-06 10:50   ` Bruce Richardson
  0 siblings, 0 replies; 4+ messages in thread
From: Bruce Richardson @ 2025-01-06 10:50 UTC (permalink / raw)
  To: Andre Muezerie; +Cc: Jingjing Wu, Praveen Shetty, Andrew Rybchenko, dev

On Thu, Dec 26, 2024 at 10:41:43AM -0800, Andre Muezerie wrote:
> 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
> +    ]

Just an idea here, since I see this same flag with the same constant
appearing multiple times in the patches: Would it be worthwhile defining
these MSVC flags as global strings in meson e.g. in a file in the "config"
directory. That would then allow them to put in the flags array using
meaningful names, and avoid the need for putting in the same comment each
time.

if is_ms_compiler
    error_cflags = [
        msvc_no_unref_local_var
    ]

If we want to take this a step further, we could define all common error
flags across all compilers this way, so that we avoid the need for
conditional in each individual meson.build file - we just define the names
of the errors we want and let the string replacement handle the conversion
to the appropriate compiler flag. The names could be, for example, the
gcc/clang error names without the "-W" bit. If no MSVC equivalent they
could be empty strings in those builds.

WDYT?

/Bruce

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-06 10:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

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 NNTP newsgroup(s).