* [PATCH 00/21] use portable variadic macros
@ 2024-12-11 2:05 Andre Muezerie
2024-12-11 2:05 ` [PATCH 01/21] app/test-acl: " Andre Muezerie
` (22 more replies)
0 siblings, 23 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
Cc: dev, Andre Muezerie
1) Use portable variadic macros
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
2) Add "do { } while (0)" to macros used to remove logging calls, to
ensure there's no code structure change when enabling/disabling
logging.
Andre Muezerie (21):
app/test-acl: use portable variadic macros
app/test-eventdev: use portable variadic macros
app/test-mldev: use portable variadic macros
app/test-pmd: use portable variadic macros
drivers/baseband: ensure code structure does not change
drivers/bus: use portable variadic macros
drivers/common: use portable variadic macros
drivers/compress: use portable variadic macros
drivers/crypto: use portable variadic macros
drivers/dma: use portable variadic macros
drivers/event: use portable variadic macros
drivers/mempool: use portable variadic macros
drivers/net: use portable variadic macros
drivers/raw: use portable variadic macros
drivers/vdpa: use portable variadic macros
lib/log: ensure code structure does not change
lib/pipeline: ensure code structure does not change
lib/port: ensure code structure does not change
lib/power: ensure code structure does not change
lib/rcu: ensure code structure does not change
lib/vhost: ensure code structure does not change
app/test-acl/main.c | 4 +-
app/test-eventdev/evt_common.h | 12 ++--
app/test-mldev/ml_common.h | 7 ++-
app/test-pmd/testpmd.h | 4 +-
drivers/baseband/acc/acc100_pmd.h | 2 +-
drivers/baseband/acc/vrb_pmd.h | 2 +-
drivers/bus/cdx/cdx_logs.h | 12 ++--
drivers/bus/dpaa/include/fman.h | 4 +-
drivers/bus/dpaa/rte_dpaa_logs.h | 18 +++---
drivers/bus/fslmc/fslmc_logs.h | 12 ++--
drivers/bus/fslmc/qbman/include/compat.h | 18 +++---
drivers/bus/ifpga/ifpga_logs.h | 16 ++---
drivers/bus/uacce/uacce.c | 8 +--
drivers/common/dpaax/compat.h | 16 ++---
drivers/common/dpaax/dpaax_logs.h | 18 +++---
drivers/common/idpf/base/idpf_osdep.h | 8 ++-
drivers/compress/octeontx/otx_zip.h | 8 +--
drivers/compress/zlib/zlib_pmd_private.h | 12 ++--
drivers/crypto/caam_jr/caam_jr_log.h | 28 ++++-----
drivers/crypto/ccp/ccp_pmd_private.h | 4 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h | 28 ++++-----
drivers/crypto/dpaa_sec/dpaa_sec_log.h | 28 ++++-----
drivers/crypto/virtio/virtio_logs.h | 60 +++++++++----------
drivers/dma/dpaa/dpaa_qdma_logs.h | 24 ++++----
drivers/dma/dpaa2/dpaa2_qdma_logs.h | 24 ++++----
drivers/dma/idxd/idxd_internal.h | 8 +--
drivers/dma/ioat/ioat_internal.h | 8 +--
drivers/event/dlb2/dlb2_log.h | 8 +--
drivers/event/dlb2/pf/base/dlb2_osdep.h | 12 ++--
drivers/event/dpaa/dpaa_eventdev.h | 16 ++---
drivers/event/dpaa2/dpaa2_eventdev_logs.h | 12 ++--
drivers/event/dsw/dsw_evdev.h | 8 +--
drivers/event/sw/sw_evdev_log.h | 12 ++--
drivers/mempool/dpaa/dpaa_mempool.h | 20 +++----
drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h | 30 +++++-----
drivers/net/ark/ark_logs.h | 4 +-
.../net/bnxt/hcapi/cfa_v3/include/cfa_trace.h | 12 ++--
drivers/net/bnxt/tf_core/cfa_tcam_mgr.h | 12 ++--
drivers/net/bnxt/tf_core/tfp.h | 8 +--
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h | 4 +-
drivers/net/dpaa/dpaa_ethdev.h | 16 ++---
drivers/net/dpaa/fmlib/fm_ext.h | 4 +-
drivers/net/dpaa2/dpaa2_pmd_logs.h | 28 ++++-----
drivers/net/e1000/base/e1000_osdep.h | 10 ++--
drivers/net/ena/base/ena_plat_dpdk.h | 16 ++---
drivers/net/enetc/enetc_logs.h | 32 +++++-----
drivers/net/enetfec/enet_pmd_logs.h | 18 +++---
drivers/net/enic/enic_compat.h | 16 ++---
drivers/net/fm10k/base/fm10k_osdep.h | 10 ++--
drivers/net/hns3/hns3_logs.h | 20 +++----
drivers/net/ice/base/ice_osdep.h | 4 +-
drivers/net/igc/base/igc_osdep.h | 10 ++--
drivers/net/ipn3ke/ipn3ke_logs.h | 16 ++---
drivers/net/ixgbe/base/ixgbe_osdep.h | 30 +++++-----
drivers/net/ngbe/base/ngbe_osdep.h | 2 +-
drivers/net/ngbe/ngbe_logs.h | 2 +-
drivers/net/pfe/pfe_logs.h | 18 +++---
drivers/net/qede/qede_ethdev.h | 4 +-
drivers/net/qede/qede_logs.h | 16 ++---
drivers/net/sfc/sfc_debug.h | 4 +-
drivers/net/txgbe/base/txgbe_osdep.h | 2 +-
drivers/net/txgbe/txgbe_logs.h | 2 +-
drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 24 ++++----
drivers/raw/ifpga/base/opae_debug.h | 4 +-
drivers/raw/ifpga/base/opae_osdep.h | 20 +++----
.../raw/ifpga/base/osdep_rte/osdep_generic.h | 4 +-
drivers/raw/ifpga/ifpga_rawdev.h | 16 ++---
drivers/raw/skeleton/skeleton_rawdev.h | 16 ++---
drivers/raw/skeleton/skeleton_rawdev_test.c | 8 +--
drivers/vdpa/ifc/base/ifcvf_osdep.h | 4 +-
lib/log/rte_log.h | 2 +-
lib/pipeline/rte_swx_pipeline_internal.h | 2 +-
lib/port/rte_swx_port_ethdev.c | 2 +-
lib/port/rte_swx_port_fd.c | 2 +-
lib/port/rte_swx_port_ring.c | 2 +-
lib/port/rte_swx_port_source_sink.c | 2 +-
lib/power/power_common.h | 2 +-
lib/rcu/rte_rcu_qsbr.h | 2 +-
lib/vhost/vhost_crypto.c | 2 +-
79 files changed, 474 insertions(+), 471 deletions(-)
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 01/21] app/test-acl: use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 02/21] app/test-eventdev: " Andre Muezerie
` (21 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Konstantin Ananyev; +Cc: dev, Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
app/test-acl/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/test-acl/main.c b/app/test-acl/main.c
index 41ce83db08..3a791b3ccf 100644
--- a/app/test-acl/main.c
+++ b/app/test-acl/main.c
@@ -423,9 +423,9 @@ static const char cb_port_delim[] = ":";
static char line[LINE_MAX];
-#define dump_verbose(lvl, fh, fmt, args...) do { \
+#define dump_verbose(lvl, fh, fmt, ...) do { \
if ((lvl) <= (int32_t)config.verbose) \
- fprintf(fh, fmt, ##args); \
+ fprintf(fh, fmt, ##__VA_ARGS__); \
} while (0)
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 02/21] app/test-eventdev: use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
2024-12-11 2:05 ` [PATCH 01/21] app/test-acl: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 03/21] app/test-mldev: " Andre Muezerie
` (20 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Jerin Jacob; +Cc: dev, Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
app/test-eventdev/evt_common.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/test-eventdev/evt_common.h b/app/test-eventdev/evt_common.h
index 901b8ba55d..63b782f11a 100644
--- a/app/test-eventdev/evt_common.h
+++ b/app/test-eventdev/evt_common.h
@@ -18,16 +18,16 @@
#define CLGRN "\x1b[32m"
#define CLYEL "\x1b[33m"
-#define evt_err(fmt, args...) \
- fprintf(stderr, CLRED"error: %s() "fmt CLNRM "\n", __func__, ## args)
+#define evt_err(fmt, ...) \
+ fprintf(stderr, CLRED"error: %s() "fmt CLNRM "\n", __func__, ## __VA_ARGS__)
-#define evt_info(fmt, args...) \
- fprintf(stdout, CLYEL""fmt CLNRM "\n", ## args)
+#define evt_info(fmt, ...) \
+ fprintf(stdout, CLYEL""fmt CLNRM "\n", ## __VA_ARGS__)
#define EVT_STR_FMT 20
-#define evt_dump(str, fmt, val...) \
- printf("\t%-*s : "fmt"\n", EVT_STR_FMT, str, ## val)
+#define evt_dump(str, fmt, ...) \
+ printf("\t%-*s : "fmt"\n", EVT_STR_FMT, str, ## __VA_ARGS__)
#define evt_dump_begin(str) printf("\t%-*s : {", EVT_STR_FMT, str)
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 03/21] app/test-mldev: use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
2024-12-11 2:05 ` [PATCH 01/21] app/test-acl: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 02/21] app/test-eventdev: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 04/21] app/test-pmd: " Andre Muezerie
` (19 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Srikanth Yalavarthi; +Cc: dev, Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
app/test-mldev/ml_common.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/test-mldev/ml_common.h b/app/test-mldev/ml_common.h
index 8d7cc9eeb7..45faed352c 100644
--- a/app/test-mldev/ml_common.h
+++ b/app/test-mldev/ml_common.h
@@ -14,11 +14,12 @@
#define ML_STR_FMT 20
-#define ml_err(fmt, args...) fprintf(stderr, CLRED "error: %s() " fmt CLNRM "\n", __func__, ##args)
+#define ml_err(fmt, ...) \
+ fprintf(stderr, CLRED "error: %s() " fmt CLNRM "\n", __func__, ##__VA_ARGS__)
-#define ml_info(fmt, args...) fprintf(stdout, CLYEL "" fmt CLNRM "\n", ##args)
+#define ml_info(fmt, ...) fprintf(stdout, CLYEL "" fmt CLNRM "\n", ##__VA_ARGS__)
-#define ml_dump(str, fmt, val...) printf("\t%-*s : " fmt "\n", ML_STR_FMT, str, ##val)
+#define ml_dump(str, fmt, ...) printf("\t%-*s : " fmt "\n", ML_STR_FMT, str, ##__VA_ARGS__)
#define ml_dump_begin(str) printf("\t%-*s :\n\t{\n", ML_STR_FMT, str)
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 04/21] app/test-pmd: use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (2 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 03/21] app/test-mldev: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 05/21] drivers/baseband: ensure code structure does not change Andre Muezerie
` (18 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Aman Singh; +Cc: dev, Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
app/test-pmd/testpmd.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 314482e69c..260e4761bd 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1311,7 +1311,7 @@ RTE_INIT(__##c) \
#endif
#endif /* __GCC__ */
-#define TESTPMD_LOG(level, fmt, args...) \
- rte_log(RTE_LOG_ ## level, testpmd_logtype, "testpmd: " fmt, ## args)
+#define TESTPMD_LOG(level, fmt, ...) \
+ rte_log(RTE_LOG_ ## level, testpmd_logtype, "testpmd: " fmt, ## __VA_ARGS__)
#endif /* _TESTPMD_H_ */
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 05/21] drivers/baseband: ensure code structure does not change
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (3 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 04/21] app/test-pmd: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 06/21] drivers/bus: use portable variadic macros Andre Muezerie
` (17 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Nicolas Chautru; +Cc: dev, Andre Muezerie
Add "do { } while (0)" to macros used to remove logging calls, to
ensure there's no code structure change when enabling/disabling
logging.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/baseband/acc/acc100_pmd.h | 2 +-
drivers/baseband/acc/vrb_pmd.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/baseband/acc/acc100_pmd.h b/drivers/baseband/acc/acc100_pmd.h
index 976593698e..ae66b1246c 100644
--- a/drivers/baseband/acc/acc100_pmd.h
+++ b/drivers/baseband/acc/acc100_pmd.h
@@ -18,7 +18,7 @@
#define rte_bbdev_log_debug(...) \
rte_bbdev_log(DEBUG, __VA_ARGS__)
#else
-#define rte_bbdev_log_debug(...)
+#define rte_bbdev_log_debug(...) do { } while (0)
#endif
/* ACC100 PF and VF driver names */
diff --git a/drivers/baseband/acc/vrb_pmd.h b/drivers/baseband/acc/vrb_pmd.h
index a4b81640e8..fb342d77fe 100644
--- a/drivers/baseband/acc/vrb_pmd.h
+++ b/drivers/baseband/acc/vrb_pmd.h
@@ -20,7 +20,7 @@
#define rte_bbdev_log_debug(...) \
rte_bbdev_log(DEBUG, __VA_ARGS__)
#else
-#define rte_bbdev_log_debug(...)
+#define rte_bbdev_log_debug(...) do { } while (0)
#endif
/* VRB1 PF and VF driver names */
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 06/21] drivers/bus: use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (4 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 05/21] drivers/baseband: ensure code structure does not change Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 07/21] drivers/common: " Andre Muezerie
` (16 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Nipun Gupta, Nikhil Agarwal, Hemant Agrawal, Sachin Saxena,
Rosen Xu, Chengwen Feng
Cc: dev, Andre Muezerie
1) Use portable variadic macros
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
2) Add "do { } while (0)" to macros used to remove logging calls, to
ensure there's no code structure change when enabling/disabling
logging.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/bus/cdx/cdx_logs.h | 12 ++++++------
drivers/bus/dpaa/include/fman.h | 4 ++--
drivers/bus/dpaa/rte_dpaa_logs.h | 18 +++++++++---------
drivers/bus/fslmc/fslmc_logs.h | 12 ++++++------
drivers/bus/fslmc/qbman/include/compat.h | 18 +++++++++---------
drivers/bus/ifpga/ifpga_logs.h | 16 ++++++++--------
drivers/bus/uacce/uacce.c | 8 ++++----
7 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/drivers/bus/cdx/cdx_logs.h b/drivers/bus/cdx/cdx_logs.h
index 18b4010746..2d5c213417 100644
--- a/drivers/bus/cdx/cdx_logs.h
+++ b/drivers/bus/cdx/cdx_logs.h
@@ -15,11 +15,11 @@ extern int cdx_logtype_bus;
#define CDX_BUS_DEBUG(...) \
RTE_LOG_LINE_PREFIX(DEBUG, CDX_BUS, "%s(): ", __func__, __VA_ARGS__)
-#define CDX_BUS_INFO(fmt, args...) \
- CDX_BUS_LOG(INFO, fmt, ## args)
-#define CDX_BUS_ERR(fmt, args...) \
- CDX_BUS_LOG(ERR, fmt, ## args)
-#define CDX_BUS_WARN(fmt, args...) \
- CDX_BUS_LOG(WARNING, fmt, ## args)
+#define CDX_BUS_INFO(fmt, ...) \
+ CDX_BUS_LOG(INFO, fmt, ## __VA_ARGS__)
+#define CDX_BUS_ERR(fmt, ...) \
+ CDX_BUS_LOG(ERR, fmt, ## __VA_ARGS__)
+#define CDX_BUS_WARN(fmt, ...) \
+ CDX_BUS_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* CDX_LOGS_H */
diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h
index 01ef503117..134f0dc8ff 100644
--- a/drivers/bus/dpaa/include/fman.h
+++ b/drivers/bus/dpaa/include/fman.h
@@ -477,10 +477,10 @@ extern int fman_ccsr_map_fd;
#define fman_if_for_each_bpool(bp, __if) \
list_for_each_entry(bp, &(__if)->bpool_list, node)
-#define FMAN_ERR(rc, fmt, args...) \
+#define FMAN_ERR(rc, fmt, ...) \
do { \
_errno = (rc); \
- RTE_LOG_LINE(ERR, DPAA_BUS, fmt "(%d)", ##args, errno); \
+ RTE_LOG_LINE(ERR, DPAA_BUS, fmt "(%d)", ##__VA_ARGS__, errno); \
} while (0)
#define FMAN_IP_REV_1 0xC30C4
diff --git a/drivers/bus/dpaa/rte_dpaa_logs.h b/drivers/bus/dpaa/rte_dpaa_logs.h
index 1e61b4e76b..235c617edd 100644
--- a/drivers/bus/dpaa/rte_dpaa_logs.h
+++ b/drivers/bus/dpaa/rte_dpaa_logs.h
@@ -16,13 +16,13 @@ extern int dpaa_logtype_bus;
RTE_LOG_LINE(level, DPAA_BUS, __VA_ARGS__)
#ifdef RTE_LIBRTE_DPAA_DEBUG_BUS
-#define DPAA_BUS_HWWARN(cond, fmt, args...) \
+#define DPAA_BUS_HWWARN(cond, fmt, ...) \
do {\
if (cond) \
- DPAA_BUS_LOG(DEBUG, "WARN: " fmt, ##args); \
+ DPAA_BUS_LOG(DEBUG, "WARN: " fmt, ##__VA_ARGS__); \
} while (0)
#else
-#define DPAA_BUS_HWWARN(cond, fmt, args...) do { } while (0)
+#define DPAA_BUS_HWWARN(cond, fmt, ...) do { } while (0)
#endif
#define DPAA_BUS_DEBUG(...) \
@@ -30,11 +30,11 @@ extern int dpaa_logtype_bus;
#define BUS_INIT_FUNC_TRACE() DPAA_BUS_DEBUG(" >>")
-#define DPAA_BUS_INFO(fmt, args...) \
- DPAA_BUS_LOG(INFO, fmt, ## args)
-#define DPAA_BUS_ERR(fmt, args...) \
- DPAA_BUS_LOG(ERR, fmt, ## args)
-#define DPAA_BUS_WARN(fmt, args...) \
- DPAA_BUS_LOG(WARNING, fmt, ## args)
+#define DPAA_BUS_INFO(fmt, ...) \
+ DPAA_BUS_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_BUS_ERR(fmt, ...) \
+ DPAA_BUS_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA_BUS_WARN(fmt, ...) \
+ DPAA_BUS_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _DPAA_LOGS_H_ */
diff --git a/drivers/bus/fslmc/fslmc_logs.h b/drivers/bus/fslmc/fslmc_logs.h
index ac0cd3dc29..412d160d11 100644
--- a/drivers/bus/fslmc/fslmc_logs.h
+++ b/drivers/bus/fslmc/fslmc_logs.h
@@ -17,11 +17,11 @@ extern int dpaa2_logtype_bus;
#define DPAA2_BUS_DEBUG(...) \
RTE_LOG_LINE_PREFIX(DEBUG, DPAA2_BUS, "%s(): ", __func__, __VA_ARGS__)
-#define DPAA2_BUS_INFO(fmt, args...) \
- DPAA2_BUS_LOG(INFO, fmt, ## args)
-#define DPAA2_BUS_ERR(fmt, args...) \
- DPAA2_BUS_LOG(ERR, fmt, ## args)
-#define DPAA2_BUS_WARN(fmt, args...) \
- DPAA2_BUS_LOG(WARNING, fmt, ## args)
+#define DPAA2_BUS_INFO(fmt, ...) \
+ DPAA2_BUS_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_BUS_ERR(fmt, ...) \
+ DPAA2_BUS_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA2_BUS_WARN(fmt, ...) \
+ DPAA2_BUS_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _FSLMC_LOGS_H_ */
diff --git a/drivers/bus/fslmc/qbman/include/compat.h b/drivers/bus/fslmc/qbman/include/compat.h
index 4ac3254bc7..842b6c6b0a 100644
--- a/drivers/bus/fslmc/qbman/include/compat.h
+++ b/drivers/bus/fslmc/qbman/include/compat.h
@@ -30,15 +30,15 @@
typedef uint64_t dma_addr_t;
/* Debugging */
-#define prflush(fmt, args...) \
+#define prflush(fmt, ...) \
do { \
- printf(fmt, ##args); \
+ printf(fmt, ##__VA_ARGS__); \
fflush(stdout); \
} while (0)
-#define pr_crit(fmt, args...) prflush("CRIT:" fmt, ##args)
-#define pr_err(fmt, args...) prflush("ERR:" fmt, ##args)
-#define pr_warn(fmt, args...) prflush("WARN:" fmt, ##args)
-#define pr_info(fmt, args...) prflush(fmt, ##args)
+#define pr_crit(fmt, ...) prflush("CRIT:" fmt, ##__VA_ARGS__)
+#define pr_err(fmt, ...) prflush("ERR:" fmt, ##__VA_ARGS__)
+#define pr_warn(fmt, ...) prflush("WARN:" fmt, ##__VA_ARGS__)
+#define pr_info(fmt, ...) prflush(fmt, ##__VA_ARGS__)
#ifdef RTE_LIBRTE_DPAA2_DEBUG_BUS
@@ -54,7 +54,7 @@ typedef uint64_t dma_addr_t;
#ifdef pr_debug
#undef pr_debug
#endif
-#define pr_debug(fmt, args...) printf(fmt, ##args)
+#define pr_debug(fmt, ...) printf(fmt, ##__VA_ARGS__)
#define QBMAN_BUG_ON(c) \
do { \
static int warned_##__LINE__; \
@@ -64,8 +64,8 @@ do { \
} \
} while (0)
#else
-#define QBMAN_BUG_ON(c) {}
-#define pr_debug(fmt, args...) {}
+#define QBMAN_BUG_ON(c) do { } while (0)
+#define pr_debug(...) do { } while (0)
#endif
/* Other miscellaneous interfaces our APIs depend on; */
diff --git a/drivers/bus/ifpga/ifpga_logs.h b/drivers/bus/ifpga/ifpga_logs.h
index 154405a590..4289d9774b 100644
--- a/drivers/bus/ifpga/ifpga_logs.h
+++ b/drivers/bus/ifpga/ifpga_logs.h
@@ -15,13 +15,13 @@ extern int ifpga_bus_logtype;
#define IFPGA_BUS_FUNC_TRACE() IFPGA_BUS_LOG(DEBUG, ">>")
-#define IFPGA_BUS_DEBUG(fmt, args...) \
- IFPGA_BUS_LOG(DEBUG, fmt, ## args)
-#define IFPGA_BUS_INFO(fmt, args...) \
- IFPGA_BUS_LOG(INFO, fmt, ## args)
-#define IFPGA_BUS_ERR(fmt, args...) \
- IFPGA_BUS_LOG(ERR, fmt, ## args)
-#define IFPGA_BUS_WARN(fmt, args...) \
- IFPGA_BUS_LOG(WARNING, fmt, ## args)
+#define IFPGA_BUS_DEBUG(fmt, ...) \
+ IFPGA_BUS_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define IFPGA_BUS_INFO(fmt, ...) \
+ IFPGA_BUS_LOG(INFO, fmt, ## __VA_ARGS__)
+#define IFPGA_BUS_ERR(fmt, ...) \
+ IFPGA_BUS_LOG(ERR, fmt, ## __VA_ARGS__)
+#define IFPGA_BUS_WARN(fmt, ...) \
+ IFPGA_BUS_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _IFPGA_BUS_LOGS_H_ */
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index c1529c38c0..9ca048122d 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -62,10 +62,10 @@ extern int uacce_bus_logtype;
#define RTE_LOGTYPE_UACCE_BUS uacce_bus_logtype
#define UACCE_BUS_LOG(level, ...) \
RTE_LOG_LINE(level, UACCE_BUS, __VA_ARGS__)
-#define UACCE_BUS_ERR(fmt, args...) UACCE_BUS_LOG(ERR, fmt, ##args)
-#define UACCE_BUS_WARN(fmt, args...) UACCE_BUS_LOG(WARNING, fmt, ##args)
-#define UACCE_BUS_INFO(fmt, args...) UACCE_BUS_LOG(INFO, fmt, ##args)
-#define UACCE_BUS_DEBUG(fmt, args...) UACCE_BUS_LOG(DEBUG, fmt, ##args)
+#define UACCE_BUS_ERR(fmt, ...) UACCE_BUS_LOG(ERR, fmt, ##__VA_ARGS__)
+#define UACCE_BUS_WARN(fmt, ...) UACCE_BUS_LOG(WARNING, fmt, ##__VA_ARGS__)
+#define UACCE_BUS_INFO(fmt, ...) UACCE_BUS_LOG(INFO, fmt, ##__VA_ARGS__)
+#define UACCE_BUS_DEBUG(fmt, ...) UACCE_BUS_LOG(DEBUG, fmt, ##__VA_ARGS__)
static struct rte_devargs *
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 07/21] drivers/common: use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (5 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 06/21] drivers/bus: use portable variadic macros Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 08/21] drivers/compress: " Andre Muezerie
` (15 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Hemant Agrawal, Sachin Saxena, Jingjing Wu, Praveen Shetty
Cc: dev, Andre Muezerie
1) Use portable variadic macros
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
2) Add "do { } while (0)" to macros used to remove logging calls, to
ensure there's no code structure change when enabling/disabling
logging.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/common/dpaax/compat.h | 16 ++++++++--------
drivers/common/dpaax/dpaax_logs.h | 18 +++++++++---------
drivers/common/idpf/base/idpf_osdep.h | 8 +++++---
3 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/drivers/common/dpaax/compat.h b/drivers/common/dpaax/compat.h
index 7c8d82c2b2..1b80ba6cef 100644
--- a/drivers/common/dpaax/compat.h
+++ b/drivers/common/dpaax/compat.h
@@ -70,28 +70,28 @@
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
/* Debugging */
-#define prflush(fmt, args...) \
+#define prflush(fmt, ...) \
do { \
- printf(fmt, ##args); \
+ printf(fmt, ##__VA_ARGS__); \
fflush(stdout); \
} while (0)
#ifndef pr_crit
-#define pr_crit(fmt, args...) prflush("CRIT:" fmt, ##args)
+#define pr_crit(fmt, ...) prflush("CRIT:" fmt, ##__VA_ARGS__)
#endif
#ifndef pr_err
-#define pr_err(fmt, args...) prflush("ERR:" fmt, ##args)
+#define pr_err(fmt, ...) prflush("ERR:" fmt, ##__VA_ARGS__)
#endif
#ifndef pr_warn
-#define pr_warn(fmt, args...) prflush("WARN:" fmt, ##args)
+#define pr_warn(fmt, ...) prflush("WARN:" fmt, ##__VA_ARGS__)
#endif
#ifndef pr_info
-#define pr_info(fmt, args...) prflush(fmt, ##args)
+#define pr_info(fmt, ...) prflush(fmt, ##__VA_ARGS__)
#endif
#ifndef pr_debug
#ifdef RTE_LIBRTE_DPAA_DEBUG_BUS
-#define pr_debug(fmt, args...) printf(fmt, ##args)
+#define pr_debug(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
-#define pr_debug(fmt, args...) {}
+#define pr_debug(fmt, ...) do { } while (0)
#endif
#endif
diff --git a/drivers/common/dpaax/dpaax_logs.h b/drivers/common/dpaax/dpaax_logs.h
index 6ed29fb2ea..90f0c98863 100644
--- a/drivers/common/dpaax/dpaax_logs.h
+++ b/drivers/common/dpaax/dpaax_logs.h
@@ -11,13 +11,13 @@ extern int dpaax_logger;
#define RTE_LOGTYPE_DPAAX_LOGGER dpaax_logger
#ifdef RTE_LIBRTE_DPAAX_DEBUG
-#define DPAAX_HWWARN(cond, fmt, args...) \
+#define DPAAX_HWWARN(cond, fmt, ...) \
do {\
if (cond) \
- DPAAX_LOG(DEBUG, "WARN: " fmt, ##args); \
+ DPAAX_LOG(DEBUG, "WARN: " fmt, ##__VA_ARGS__); \
} while (0)
#else
-#define DPAAX_HWWARN(cond, fmt, args...) do { } while (0)
+#define DPAAX_HWWARN(cond, fmt, ...) do { } while (0)
#endif
#define DPAAX_LOG(level, ...) \
@@ -27,11 +27,11 @@ extern int dpaax_logger;
#define DPAAX_DEBUG(...) \
RTE_LOG_LINE_PREFIX(DEBUG, DPAAX_LOGGER, "%s(): ", __func__, __VA_ARGS__)
-#define DPAAX_INFO(fmt, args...) \
- DPAAX_LOG(INFO, fmt, ## args)
-#define DPAAX_ERR(fmt, args...) \
- DPAAX_LOG(ERR, fmt, ## args)
-#define DPAAX_WARN(fmt, args...) \
- DPAAX_LOG(WARNING, fmt, ## args)
+#define DPAAX_INFO(fmt, ...) \
+ DPAAX_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAAX_ERR(fmt, ...) \
+ DPAAX_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAAX_WARN(fmt, ...) \
+ DPAAX_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _DPAAX_LOGS_H_ */
diff --git a/drivers/common/idpf/base/idpf_osdep.h b/drivers/common/idpf/base/idpf_osdep.h
index cf9e553906..250f0ec500 100644
--- a/drivers/common/idpf/base/idpf_osdep.h
+++ b/drivers/common/idpf/base/idpf_osdep.h
@@ -42,7 +42,7 @@ typedef uint64_t s64;
typedef struct idpf_lock idpf_lock;
#define __iomem
-#define hw_dbg(hw, S, A...) do {} while (0)
+#define hw_dbg(hw, S, ...) do {} while (0)
#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
#define lower_32_bits(n) ((u32)(n))
#define low_16_bits(x) ((x) & 0xFFFF)
@@ -122,8 +122,10 @@ typedef struct idpf_lock idpf_lock;
##__VA_ARGS__); \
} while (0)
-#define idpf_info(hw, fmt, args...) idpf_debug(hw, IDPF_DBG_ALL, fmt, ##args)
-#define idpf_warn(hw, fmt, args...) idpf_debug(hw, IDPF_DBG_ALL, fmt, ##args)
+#define idpf_info(hw, fmt, ...) \
+ idpf_debug(hw, IDPF_DBG_ALL, fmt, ##__VA_ARGS__)
+#define idpf_warn(hw, fmt, ...) \
+ idpf_debug(hw, IDPF_DBG_ALL, fmt, ##__VA_ARGS__)
#define idpf_debug_array(hw, type, rowsize, groupsize, buf, len) \
do { \
struct idpf_hw *hw_l = hw; \
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 08/21] drivers/compress: use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (6 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 07/21] drivers/common: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 09/21] drivers/crypto: " Andre Muezerie
` (14 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Ashish Gupta, Fan Zhang, Sunila Sahu; +Cc: dev, Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/compress/octeontx/otx_zip.h | 8 ++++----
drivers/compress/zlib/zlib_pmd_private.h | 12 ++++++------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/compress/octeontx/otx_zip.h b/drivers/compress/octeontx/otx_zip.h
index bf09e2f58c..6265664ead 100644
--- a/drivers/compress/octeontx/otx_zip.h
+++ b/drivers/compress/octeontx/otx_zip.h
@@ -80,10 +80,10 @@ extern int octtx_zip_logtype_driver;
#define ZIP_PMD_LOG(level, ...) \
RTE_LOG_LINE_PREFIX(level, OCTTX_ZIP_DRIVER, "%s(): ", __func__, __VA_ARGS__)
-#define ZIP_PMD_INFO(fmt, args...) \
- ZIP_PMD_LOG(INFO, fmt, ## args)
-#define ZIP_PMD_ERR(fmt, args...) \
- ZIP_PMD_LOG(ERR, fmt, ## args)
+#define ZIP_PMD_INFO(fmt, ...) \
+ ZIP_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define ZIP_PMD_ERR(fmt, ...) \
+ ZIP_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
/* resources required to process stream */
enum NUM_BUFS_PER_STREAM {
diff --git a/drivers/compress/zlib/zlib_pmd_private.h b/drivers/compress/zlib/zlib_pmd_private.h
index 7f6a57c6c5..fd8c4c55a4 100644
--- a/drivers/compress/zlib/zlib_pmd_private.h
+++ b/drivers/compress/zlib/zlib_pmd_private.h
@@ -19,12 +19,12 @@ extern int zlib_logtype_driver;
#define ZLIB_PMD_LOG(level, ...) \
RTE_LOG_LINE_PREFIX(level, ZLIB_DRIVER, "%s(): ", __func__, __VA_ARGS__)
-#define ZLIB_PMD_INFO(fmt, args...) \
- ZLIB_PMD_LOG(INFO, fmt, ## args)
-#define ZLIB_PMD_ERR(fmt, args...) \
- ZLIB_PMD_LOG(ERR, fmt, ## args)
-#define ZLIB_PMD_WARN(fmt, args...) \
- ZLIB_PMD_LOG(WARNING, fmt, ## args)
+#define ZLIB_PMD_INFO(fmt, ...) \
+ ZLIB_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define ZLIB_PMD_ERR(fmt, ...) \
+ ZLIB_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define ZLIB_PMD_WARN(fmt, ...) \
+ ZLIB_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
struct zlib_private {
struct rte_mempool *mp;
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 09/21] drivers/crypto: use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (7 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 08/21] drivers/compress: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 10/21] drivers/dma: " Andre Muezerie
` (13 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Gagandeep Singh, Hemant Agrawal, Sunil Uttarwar, Jay Zhou
Cc: dev, Andre Muezerie
1) Use portable variadic macros
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
2) Add "do { } while (0)" to macros used to remove logging calls, to
ensure there's no code structure change when enabling/disabling
logging.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/crypto/caam_jr/caam_jr_log.h | 28 +++++------
drivers/crypto/ccp/ccp_pmd_private.h | 4 +-
drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h | 28 +++++------
drivers/crypto/dpaa_sec/dpaa_sec_log.h | 28 +++++------
drivers/crypto/virtio/virtio_logs.h | 60 +++++++++++------------
5 files changed, 74 insertions(+), 74 deletions(-)
diff --git a/drivers/crypto/caam_jr/caam_jr_log.h b/drivers/crypto/caam_jr/caam_jr_log.h
index 7c50119106..18de668e10 100644
--- a/drivers/crypto/caam_jr/caam_jr_log.h
+++ b/drivers/crypto/caam_jr/caam_jr_log.h
@@ -18,24 +18,24 @@ extern int caam_jr_logtype;
#define PMD_INIT_FUNC_TRACE() CAAM_JR_DEBUG(" >>")
-#define CAAM_JR_INFO(fmt, args...) \
- CAAM_JR_LOG(INFO, fmt, ## args)
-#define CAAM_JR_ERR(fmt, args...) \
- CAAM_JR_LOG(ERR, fmt, ## args)
-#define CAAM_JR_WARN(fmt, args...) \
- CAAM_JR_LOG(WARNING, fmt, ## args)
+#define CAAM_JR_INFO(fmt, ...) \
+ CAAM_JR_LOG(INFO, fmt, ## __VA_ARGS__)
+#define CAAM_JR_ERR(fmt, ...) \
+ CAAM_JR_LOG(ERR, fmt, ## __VA_ARGS__)
+#define CAAM_JR_WARN(fmt, ...) \
+ CAAM_JR_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define CAAM_JR_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, CAAM_JR, __VA_ARGS__)
-#define CAAM_JR_DP_DEBUG(fmt, args...) \
- CAAM_JR_DP_LOG(DEBUG, fmt, ## args)
-#define CAAM_JR_DP_INFO(fmt, args...) \
- CAAM_JR_DP_LOG(INFO, fmt, ## args)
-#define CAAM_JR_DP_WARN(fmt, args...) \
- CAAM_JR_DP_LOG(WARNING, fmt, ## args)
-#define CAAM_JR_DP_ERR(fmt, args...) \
- CAAM_JR_DP_LOG(ERR, fmt, ## args)
+#define CAAM_JR_DP_DEBUG(fmt, ...) \
+ CAAM_JR_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define CAAM_JR_DP_INFO(fmt, ...) \
+ CAAM_JR_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define CAAM_JR_DP_WARN(fmt, ...) \
+ CAAM_JR_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
+#define CAAM_JR_DP_ERR(fmt, ...) \
+ CAAM_JR_DP_LOG(ERR, fmt, ## __VA_ARGS__)
#endif /* _CAAM_JR_LOG_H_ */
diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h
index 361a20fa3e..4795b88f9d 100644
--- a/drivers/crypto/ccp/ccp_pmd_private.h
+++ b/drivers/crypto/ccp/ccp_pmd_private.h
@@ -24,8 +24,8 @@ extern int crypto_ccp_logtype;
RTE_LOG_LINE_PREFIX(DEBUG, CRYPTO_CCP, "%s() line %u: ", \
__func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
#else
-#define CCP_LOG_INFO(...)
-#define CCP_LOG_DBG(...)
+#define CCP_LOG_INFO(...) do { } while (0)
+#define CCP_LOG_DBG(...) do { } while (0)
#endif
/**< Maximum queue pairs supported by CCP PMD */
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h b/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h
index 53a5ebc760..5f2a0bf8e1 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h
@@ -19,25 +19,25 @@ extern int dpaa2_logtype_sec;
#define PMD_INIT_FUNC_TRACE() DPAA2_SEC_DEBUG(">>")
-#define DPAA2_SEC_INFO(fmt, args...) \
- DPAA2_SEC_LOG(INFO, fmt, ## args)
-#define DPAA2_SEC_ERR(fmt, args...) \
- DPAA2_SEC_LOG(ERR, fmt, ## args)
-#define DPAA2_SEC_WARN(fmt, args...) \
- DPAA2_SEC_LOG(WARNING, fmt, ## args)
+#define DPAA2_SEC_INFO(fmt, ...) \
+ DPAA2_SEC_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_SEC_ERR(fmt, ...) \
+ DPAA2_SEC_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA2_SEC_WARN(fmt, ...) \
+ DPAA2_SEC_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define DPAA2_SEC_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, DPAA2_SEC, __VA_ARGS__)
-#define DPAA2_SEC_DP_DEBUG(fmt, args...) \
- DPAA2_SEC_DP_LOG(DEBUG, fmt, ## args)
-#define DPAA2_SEC_DP_INFO(fmt, args...) \
- DPAA2_SEC_DP_LOG(INFO, fmt, ## args)
-#define DPAA2_SEC_DP_WARN(fmt, args...) \
- DPAA2_SEC_DP_LOG(WARNING, fmt, ## args)
-#define DPAA2_SEC_DP_ERR(fmt, args...) \
- DPAA2_SEC_DP_LOG(ERR, fmt, ## args)
+#define DPAA2_SEC_DP_DEBUG(fmt, ...) \
+ DPAA2_SEC_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA2_SEC_DP_INFO(fmt, ...) \
+ DPAA2_SEC_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_SEC_DP_WARN(fmt, ...) \
+ DPAA2_SEC_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
+#define DPAA2_SEC_DP_ERR(fmt, ...) \
+ DPAA2_SEC_DP_LOG(ERR, fmt, ## __VA_ARGS__)
#endif /* _DPAA2_SEC_LOGS_H_ */
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_log.h b/drivers/crypto/dpaa_sec/dpaa_sec_log.h
index 6ac02d07e1..0413bcd6d3 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_log.h
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_log.h
@@ -19,24 +19,24 @@ extern int dpaa_logtype_sec;
#define PMD_INIT_FUNC_TRACE() DPAA_SEC_DEBUG(" >>")
-#define DPAA_SEC_INFO(fmt, args...) \
- DPAA_SEC_LOG(INFO, fmt, ## args)
-#define DPAA_SEC_ERR(fmt, args...) \
- DPAA_SEC_LOG(ERR, fmt, ## args)
-#define DPAA_SEC_WARN(fmt, args...) \
- DPAA_SEC_LOG(WARNING, fmt, ## args)
+#define DPAA_SEC_INFO(fmt, ...) \
+ DPAA_SEC_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_SEC_ERR(fmt, ...) \
+ DPAA_SEC_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA_SEC_WARN(fmt, ...) \
+ DPAA_SEC_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define DPAA_SEC_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, DPAA_SEC, __VA_ARGS__)
-#define DPAA_SEC_DP_DEBUG(fmt, args...) \
- DPAA_SEC_DP_LOG(DEBUG, fmt, ## args)
-#define DPAA_SEC_DP_INFO(fmt, args...) \
- DPAA_SEC_DP_LOG(INFO, fmt, ## args)
-#define DPAA_SEC_DP_WARN(fmt, args...) \
- DPAA_SEC_DP_LOG(WARNING, fmt, ## args)
-#define DPAA_SEC_DP_ERR(fmt, args...) \
- DPAA_SEC_DP_LOG(ERR, fmt, ## args)
+#define DPAA_SEC_DP_DEBUG(fmt, ...) \
+ DPAA_SEC_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA_SEC_DP_INFO(fmt, ...) \
+ DPAA_SEC_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_SEC_DP_WARN(fmt, ...) \
+ DPAA_SEC_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
+#define DPAA_SEC_DP_ERR(fmt, ...) \
+ DPAA_SEC_DP_LOG(ERR, fmt, ## __VA_ARGS__)
#endif /* _DPAA_SEC_LOG_H_ */
diff --git a/drivers/crypto/virtio/virtio_logs.h b/drivers/crypto/virtio/virtio_logs.h
index a1afb90a98..988514919f 100644
--- a/drivers/crypto/virtio/virtio_logs.h
+++ b/drivers/crypto/virtio/virtio_logs.h
@@ -21,14 +21,14 @@ extern int virtio_crypto_logtype_init;
#define VIRTIO_CRYPTO_INIT_LOG_IMPL(level, ...) \
RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_INIT, "%s(): ", __func__, __VA_ARGS__)
-#define VIRTIO_CRYPTO_INIT_LOG_INFO(fmt, args...) \
- VIRTIO_CRYPTO_INIT_LOG_IMPL(INFO, fmt, ## args)
+#define VIRTIO_CRYPTO_INIT_LOG_INFO(fmt, ...) \
+ VIRTIO_CRYPTO_INIT_LOG_IMPL(INFO, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_INIT_LOG_DBG(fmt, args...) \
- VIRTIO_CRYPTO_INIT_LOG_IMPL(DEBUG, fmt, ## args)
+#define VIRTIO_CRYPTO_INIT_LOG_DBG(fmt, ...) \
+ VIRTIO_CRYPTO_INIT_LOG_IMPL(DEBUG, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_INIT_LOG_ERR(fmt, args...) \
- VIRTIO_CRYPTO_INIT_LOG_IMPL(ERR, fmt, ## args)
+#define VIRTIO_CRYPTO_INIT_LOG_ERR(fmt, ...) \
+ VIRTIO_CRYPTO_INIT_LOG_IMPL(ERR, fmt, ## __VA_ARGS__)
extern int virtio_crypto_logtype_session;
#define RTE_LOGTYPE_VIRTIO_CRYPTO_SESSION virtio_crypto_logtype_session
@@ -36,14 +36,14 @@ extern int virtio_crypto_logtype_session;
#define VIRTIO_CRYPTO_SESSION_LOG_IMPL(level, ...) \
RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_SESSION, "%s(): ", __func__, __VA_ARGS__)
-#define VIRTIO_CRYPTO_SESSION_LOG_INFO(fmt, args...) \
- VIRTIO_CRYPTO_SESSION_LOG_IMPL(INFO, fmt, ## args)
+#define VIRTIO_CRYPTO_SESSION_LOG_INFO(fmt, ...) \
+ VIRTIO_CRYPTO_SESSION_LOG_IMPL(INFO, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_SESSION_LOG_DBG(fmt, args...) \
- VIRTIO_CRYPTO_SESSION_LOG_IMPL(DEBUG, fmt, ## args)
+#define VIRTIO_CRYPTO_SESSION_LOG_DBG(fmt, ...) \
+ VIRTIO_CRYPTO_SESSION_LOG_IMPL(DEBUG, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_SESSION_LOG_ERR(fmt, args...) \
- VIRTIO_CRYPTO_SESSION_LOG_IMPL(ERR, fmt, ## args)
+#define VIRTIO_CRYPTO_SESSION_LOG_ERR(fmt, ...) \
+ VIRTIO_CRYPTO_SESSION_LOG_IMPL(ERR, fmt, ## __VA_ARGS__)
extern int virtio_crypto_logtype_rx;
#define RTE_LOGTYPE_VIRTIO_CRYPTO_RX virtio_crypto_logtype_rx
@@ -51,14 +51,14 @@ extern int virtio_crypto_logtype_rx;
#define VIRTIO_CRYPTO_RX_LOG_IMPL(level, ...) \
RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_RX, "%s(): ", __func__, __VA_ARGS__)
-#define VIRTIO_CRYPTO_RX_LOG_INFO(fmt, args...) \
- VIRTIO_CRYPTO_RX_LOG_IMPL(INFO, fmt, ## args)
+#define VIRTIO_CRYPTO_RX_LOG_INFO(fmt, ...) \
+ VIRTIO_CRYPTO_RX_LOG_IMPL(INFO, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_RX_LOG_DBG(fmt, args...) \
- VIRTIO_CRYPTO_RX_LOG_IMPL(DEBUG, fmt, ## args)
+#define VIRTIO_CRYPTO_RX_LOG_DBG(fmt, ...) \
+ VIRTIO_CRYPTO_RX_LOG_IMPL(DEBUG, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_RX_LOG_ERR(fmt, args...) \
- VIRTIO_CRYPTO_RX_LOG_IMPL(ERR, fmt, ## args)
+#define VIRTIO_CRYPTO_RX_LOG_ERR(fmt, ...) \
+ VIRTIO_CRYPTO_RX_LOG_IMPL(ERR, fmt, ## __VA_ARGS__)
extern int virtio_crypto_logtype_tx;
#define RTE_LOGTYPE_VIRTIO_CRYPTO_TX virtio_crypto_logtype_tx
@@ -66,14 +66,14 @@ extern int virtio_crypto_logtype_tx;
#define VIRTIO_CRYPTO_TX_LOG_IMPL(level, ...) \
RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_TX, "%s(): ", __func__, __VA_ARGS__)
-#define VIRTIO_CRYPTO_TX_LOG_INFO(fmt, args...) \
- VIRTIO_CRYPTO_TX_LOG_IMPL(INFO, fmt, ## args)
+#define VIRTIO_CRYPTO_TX_LOG_INFO(fmt, ...) \
+ VIRTIO_CRYPTO_TX_LOG_IMPL(INFO, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_TX_LOG_DBG(fmt, args...) \
- VIRTIO_CRYPTO_TX_LOG_IMPL(DEBUG, fmt, ## args)
+#define VIRTIO_CRYPTO_TX_LOG_DBG(fmt, ...) \
+ VIRTIO_CRYPTO_TX_LOG_IMPL(DEBUG, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_TX_LOG_ERR(fmt, args...) \
- VIRTIO_CRYPTO_TX_LOG_IMPL(ERR, fmt, ## args)
+#define VIRTIO_CRYPTO_TX_LOG_ERR(fmt, ...) \
+ VIRTIO_CRYPTO_TX_LOG_IMPL(ERR, fmt, ## __VA_ARGS__)
extern int virtio_crypto_logtype_driver;
#define RTE_LOGTYPE_VIRTIO_CRYPTO_DRIVER virtio_crypto_logtype_driver
@@ -81,13 +81,13 @@ extern int virtio_crypto_logtype_driver;
#define VIRTIO_CRYPTO_DRV_LOG_IMPL(level, ...) \
RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_DRIVER, "%s(): ", __func__, __VA_ARGS__)
-#define VIRTIO_CRYPTO_DRV_LOG_INFO(fmt, args...) \
- VIRTIO_CRYPTO_DRV_LOG_IMPL(INFO, fmt, ## args)
+#define VIRTIO_CRYPTO_DRV_LOG_INFO(fmt, ...) \
+ VIRTIO_CRYPTO_DRV_LOG_IMPL(INFO, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_DRV_LOG_DBG(fmt, args...) \
- VIRTIO_CRYPTO_DRV_LOG_IMPL(DEBUG, fmt, ## args)
+#define VIRTIO_CRYPTO_DRV_LOG_DBG(fmt, ...) \
+ VIRTIO_CRYPTO_DRV_LOG_IMPL(DEBUG, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_DRV_LOG_ERR(fmt, args...) \
- VIRTIO_CRYPTO_DRV_LOG_IMPL(ERR, fmt, ## args)
+#define VIRTIO_CRYPTO_DRV_LOG_ERR(fmt, ...) \
+ VIRTIO_CRYPTO_DRV_LOG_IMPL(ERR, fmt, ## __VA_ARGS__)
#endif /* _VIRTIO_LOGS_H_ */
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 10/21] drivers/dma: use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (8 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 09/21] drivers/crypto: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 11/21] drivers/event: " Andre Muezerie
` (12 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Gagandeep Singh, Sachin Saxena, Hemant Agrawal, Bruce Richardson,
Kevin Laatz, Conor Walsh
Cc: dev, Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/dma/dpaa/dpaa_qdma_logs.h | 24 ++++++++++++------------
drivers/dma/dpaa2/dpaa2_qdma_logs.h | 24 ++++++++++++------------
drivers/dma/idxd/idxd_internal.h | 8 ++++----
drivers/dma/ioat/ioat_internal.h | 8 ++++----
4 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/drivers/dma/dpaa/dpaa_qdma_logs.h b/drivers/dma/dpaa/dpaa_qdma_logs.h
index 2d77255fd8..cbed89485f 100644
--- a/drivers/dma/dpaa/dpaa_qdma_logs.h
+++ b/drivers/dma/dpaa/dpaa_qdma_logs.h
@@ -16,22 +16,22 @@ extern int dpaa_qdma_logtype;
#define DPAA_QDMA_FUNC_TRACE() DPAA_QDMA_DEBUG(">>")
-#define DPAA_QDMA_INFO(fmt, args...) \
- DPAA_QDMA_LOG(INFO, fmt, ## args)
-#define DPAA_QDMA_ERR(fmt, args...) \
- DPAA_QDMA_LOG(ERR, fmt, ## args)
-#define DPAA_QDMA_WARN(fmt, args...) \
- DPAA_QDMA_LOG(WARNING, fmt, ## args)
+#define DPAA_QDMA_INFO(fmt, ...) \
+ DPAA_QDMA_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_QDMA_ERR(fmt, ...) \
+ DPAA_QDMA_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA_QDMA_WARN(fmt, ...) \
+ DPAA_QDMA_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define DPAA_QDMA_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, DPAA_QDMA, __VA_ARGS__)
-#define DPAA_QDMA_DP_DEBUG(fmt, args...) \
- DPAA_QDMA_DP_LOG(DEBUG, fmt, ## args)
-#define DPAA_QDMA_DP_INFO(fmt, args...) \
- DPAA_QDMA_DP_LOG(INFO, fmt, ## args)
-#define DPAA_QDMA_DP_WARN(fmt, args...) \
- DPAA_QDMA_DP_LOG(WARNING, fmt, ## args)
+#define DPAA_QDMA_DP_DEBUG(fmt, ...) \
+ DPAA_QDMA_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA_QDMA_DP_INFO(fmt, ...) \
+ DPAA_QDMA_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_QDMA_DP_WARN(fmt, ...) \
+ DPAA_QDMA_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* __DPAA_QDMA_LOGS_H__ */
diff --git a/drivers/dma/dpaa2/dpaa2_qdma_logs.h b/drivers/dma/dpaa2/dpaa2_qdma_logs.h
index 62ef60bcf2..50a865a56a 100644
--- a/drivers/dma/dpaa2/dpaa2_qdma_logs.h
+++ b/drivers/dma/dpaa2/dpaa2_qdma_logs.h
@@ -20,23 +20,23 @@ extern int dpaa2_qdma_logtype;
#define DPAA2_QDMA_FUNC_TRACE() DPAA2_QDMA_DEBUG(">>")
-#define DPAA2_QDMA_INFO(fmt, args...) \
- DPAA2_QDMA_LOG(INFO, fmt, ## args)
-#define DPAA2_QDMA_ERR(fmt, args...) \
- DPAA2_QDMA_LOG(ERR, fmt, ## args)
-#define DPAA2_QDMA_WARN(fmt, args...) \
- DPAA2_QDMA_LOG(WARNING, fmt, ## args)
+#define DPAA2_QDMA_INFO(fmt, ...) \
+ DPAA2_QDMA_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_QDMA_ERR(fmt, ...) \
+ DPAA2_QDMA_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA2_QDMA_WARN(fmt, ...) \
+ DPAA2_QDMA_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define DPAA2_QDMA_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, DPAA2_QDMA, __VA_ARGS__)
-#define DPAA2_QDMA_DP_DEBUG(fmt, args...) \
- DPAA2_QDMA_DP_LOG(DEBUG, fmt, ## args)
-#define DPAA2_QDMA_DP_INFO(fmt, args...) \
- DPAA2_QDMA_DP_LOG(INFO, fmt, ## args)
-#define DPAA2_QDMA_DP_WARN(fmt, args...) \
- DPAA2_QDMA_DP_LOG(WARNING, fmt, ## args)
+#define DPAA2_QDMA_DP_DEBUG(fmt, ...) \
+ DPAA2_QDMA_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA2_QDMA_DP_INFO(fmt, ...) \
+ DPAA2_QDMA_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_QDMA_DP_WARN(fmt, ...) \
+ DPAA2_QDMA_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
#ifdef __cplusplus
}
diff --git a/drivers/dma/idxd/idxd_internal.h b/drivers/dma/idxd/idxd_internal.h
index 99dc2b367e..b80a113455 100644
--- a/drivers/dma/idxd/idxd_internal.h
+++ b/drivers/dma/idxd/idxd_internal.h
@@ -25,10 +25,10 @@ extern int idxd_pmd_logtype;
#define IDXD_PMD_LOG(level, ...) \
RTE_LOG_LINE_PREFIX(level, IDXD_PMD, "%s(): ", __func__, __VA_ARGS__)
-#define IDXD_PMD_DEBUG(fmt, args...) IDXD_PMD_LOG(DEBUG, fmt, ## args)
-#define IDXD_PMD_INFO(fmt, args...) IDXD_PMD_LOG(INFO, fmt, ## args)
-#define IDXD_PMD_ERR(fmt, args...) IDXD_PMD_LOG(ERR, fmt, ## args)
-#define IDXD_PMD_WARN(fmt, args...) IDXD_PMD_LOG(WARNING, fmt, ## args)
+#define IDXD_PMD_DEBUG(fmt, ...) IDXD_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define IDXD_PMD_INFO(fmt, ...) IDXD_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define IDXD_PMD_ERR(fmt, ...) IDXD_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define IDXD_PMD_WARN(fmt, ...) IDXD_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
struct idxd_pci_common {
rte_spinlock_t lk;
diff --git a/drivers/dma/ioat/ioat_internal.h b/drivers/dma/ioat/ioat_internal.h
index 2da26b616f..a5b25701a4 100644
--- a/drivers/dma/ioat/ioat_internal.h
+++ b/drivers/dma/ioat/ioat_internal.h
@@ -40,9 +40,9 @@ extern int ioat_pmd_logtype;
#define IOAT_PMD_LOG(level, ...) \
RTE_LOG_LINE_PREFIX(level, IOAT_PMD, "%s(): ", __func__, __VA_ARGS__)
-#define IOAT_PMD_DEBUG(fmt, args...) IOAT_PMD_LOG(DEBUG, fmt, ## args)
-#define IOAT_PMD_INFO(fmt, args...) IOAT_PMD_LOG(INFO, fmt, ## args)
-#define IOAT_PMD_ERR(fmt, args...) IOAT_PMD_LOG(ERR, fmt, ## args)
-#define IOAT_PMD_WARN(fmt, args...) IOAT_PMD_LOG(WARNING, fmt, ## args)
+#define IOAT_PMD_DEBUG(fmt, ...) IOAT_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define IOAT_PMD_INFO(fmt, ...) IOAT_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define IOAT_PMD_ERR(fmt, ...) IOAT_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define IOAT_PMD_WARN(fmt, ...) IOAT_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _IOAT_INTERNAL_H_ */
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 11/21] drivers/event: use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (9 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 10/21] drivers/dma: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 12/21] drivers/mempool: " Andre Muezerie
` (11 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Abdullah Sevincer, Hemant Agrawal, Sachin Saxena,
Mattias Rönnblom, Harry van Haaren
Cc: dev, Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/event/dlb2/dlb2_log.h | 8 ++++----
drivers/event/dlb2/pf/base/dlb2_osdep.h | 12 ++++++------
drivers/event/dpaa/dpaa_eventdev.h | 16 ++++++++--------
drivers/event/dpaa2/dpaa2_eventdev_logs.h | 12 ++++++------
drivers/event/dsw/dsw_evdev.h | 8 ++++----
drivers/event/sw/sw_evdev_log.h | 12 ++++++------
6 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/drivers/event/dlb2/dlb2_log.h b/drivers/event/dlb2/dlb2_log.h
index c9ce87681c..321ecdfd05 100644
--- a/drivers/event/dlb2/dlb2_log.h
+++ b/drivers/event/dlb2/dlb2_log.h
@@ -12,11 +12,11 @@ extern int eventdev_dlb2_log_level;
#define DLB2_LOG_IMPL(level, ...) \
RTE_LOG_LINE_PREFIX(level, EVENTDEV_DLB2, "%s", __func__, __VA_ARGS__)
-#define DLB2_LOG_INFO(fmt, args...) \
- DLB2_LOG_IMPL(INFO, fmt, ## args)
+#define DLB2_LOG_INFO(fmt, ...) \
+ DLB2_LOG_IMPL(INFO, fmt, ## __VA_ARGS__)
-#define DLB2_LOG_ERR(fmt, args...) \
- DLB2_LOG_IMPL(ERR, fmt, ## args)
+#define DLB2_LOG_ERR(fmt, ...) \
+ DLB2_LOG_IMPL(ERR, fmt, ## __VA_ARGS__)
/* remove debug logs at compile time unless actually debugging */
#define DLB2_LOG_LINE_DBG(...) \
diff --git a/drivers/event/dlb2/pf/base/dlb2_osdep.h b/drivers/event/dlb2/pf/base/dlb2_osdep.h
index 16c5e3b797..382a49090a 100644
--- a/drivers/event/dlb2/pf/base/dlb2_osdep.h
+++ b/drivers/event/dlb2/pf/base/dlb2_osdep.h
@@ -40,14 +40,14 @@
DLB2_PCI_REG_WRITE(DLB2_FUNC_REG_ADDR((hw), (reg)), (value))
/* Map to PMDs logging interface */
-#define DLB2_ERR(dev, fmt, args...) \
- RTE_LOG(ERR, EVENTDEV_DLB2, "%s" fmt, __func__, ## args)
+#define DLB2_ERR(dev, fmt, ...) \
+ RTE_LOG(ERR, EVENTDEV_DLB2, "%s" fmt, __func__, ## __VA_ARGS__)
-#define DLB2_INFO(dev, fmt, args...) \
- RTE_LOG(INFO, EVENTDEV_DLB2, "%s" fmt, __func__, ## args)
+#define DLB2_INFO(dev, fmt, ...) \
+ RTE_LOG(INFO, EVENTDEV_DLB2, "%s" fmt, __func__, ## __VA_ARGS__)
-#define DLB2_DEBUG(dev, fmt, args...) \
- RTE_LOG_DP(DEBUG, EVENTDEV_DLB2, fmt, ## args)
+#define DLB2_DEBUG(dev, fmt, ...) \
+ RTE_LOG_DP(DEBUG, EVENTDEV_DLB2, fmt, ## __VA_ARGS__)
/**
* os_udelay() - busy-wait for a number of microseconds
diff --git a/drivers/event/dpaa/dpaa_eventdev.h b/drivers/event/dpaa/dpaa_eventdev.h
index 5831ccb4e8..047c9781bd 100644
--- a/drivers/event/dpaa/dpaa_eventdev.h
+++ b/drivers/event/dpaa/dpaa_eventdev.h
@@ -82,13 +82,13 @@ struct dpaa_eventdev {
#define EVENTDEV_INIT_FUNC_TRACE() DPAA_EVENTDEV_LOG(DEBUG, " >>")
-#define DPAA_EVENTDEV_DEBUG(fmt, args...) \
- DPAA_EVENTDEV_LOG(DEBUG, fmt, ## args)
-#define DPAA_EVENTDEV_ERR(fmt, args...) \
- DPAA_EVENTDEV_LOG(ERR, fmt, ## args)
-#define DPAA_EVENTDEV_INFO(fmt, args...) \
- DPAA_EVENTDEV_LOG(INFO, fmt, ## args)
-#define DPAA_EVENTDEV_WARN(fmt, args...) \
- DPAA_EVENTDEV_LOG(WARNING, fmt, ## args)
+#define DPAA_EVENTDEV_DEBUG(fmt, ...) \
+ DPAA_EVENTDEV_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA_EVENTDEV_ERR(fmt, ...) \
+ DPAA_EVENTDEV_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA_EVENTDEV_INFO(fmt, ...) \
+ DPAA_EVENTDEV_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_EVENTDEV_WARN(fmt, ...) \
+ DPAA_EVENTDEV_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* __DPAA_EVENTDEV_H__ */
diff --git a/drivers/event/dpaa2/dpaa2_eventdev_logs.h b/drivers/event/dpaa2/dpaa2_eventdev_logs.h
index 12317ae39f..7145ac30b9 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev_logs.h
+++ b/drivers/event/dpaa2/dpaa2_eventdev_logs.h
@@ -16,12 +16,12 @@ extern int dpaa2_logtype_event;
#define EVENTDEV_INIT_FUNC_TRACE() DPAA2_EVENTDEV_DEBUG(" >>")
-#define DPAA2_EVENTDEV_INFO(fmt, args...) \
- DPAA2_EVENTDEV_LOG(INFO, fmt, ## args)
-#define DPAA2_EVENTDEV_ERR(fmt, args...) \
- DPAA2_EVENTDEV_LOG(ERR, fmt, ## args)
-#define DPAA2_EVENTDEV_WARN(fmt, args...) \
- DPAA2_EVENTDEV_LOG(WARNING, fmt, ## args)
+#define DPAA2_EVENTDEV_INFO(fmt, ...) \
+ DPAA2_EVENTDEV_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_EVENTDEV_ERR(fmt, ...) \
+ DPAA2_EVENTDEV_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA2_EVENTDEV_WARN(fmt, ...) \
+ DPAA2_EVENTDEV_LOG(WARNING, fmt, ## __VA_ARGS__)
#define dpaa2_evdev_info(fmt, ...) DPAA2_EVENTDEV_LOG(INFO, fmt, ##__VA_ARGS__)
#define dpaa2_evdev_dbg(fmt, ...) DPAA2_EVENTDEV_LOG(DEBUG, fmt, ##__VA_ARGS__)
diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h
index ce52498435..6b75bb13e3 100644
--- a/drivers/event/dsw/dsw_evdev.h
+++ b/drivers/event/dsw/dsw_evdev.h
@@ -303,11 +303,11 @@ dsw_pmd_priv(const struct rte_eventdev *eventdev)
extern int event_dsw_logtype;
#define RTE_LOGTYPE_EVENT_DSW event_dsw_logtype
-#define DSW_LOG_DP_LINE(level, fmt, args...) \
+#define DSW_LOG_DP_LINE(level, fmt, ...) \
RTE_LOG_DP_LINE(level, EVENT_DSW, "%s() line %u: " fmt, \
- __func__, __LINE__, ## args)
+ __func__, __LINE__, ## __VA_ARGS__)
-#define DSW_LOG_DP_PORT_LINE(level, port_id, fmt, args...) \
- DSW_LOG_DP_LINE(level, "<Port %d> " fmt, port_id, ## args)
+#define DSW_LOG_DP_PORT_LINE(level, port_id, fmt, ...) \
+ DSW_LOG_DP_LINE(level, "<Port %d> " fmt, port_id, ## __VA_ARGS__)
#endif
diff --git a/drivers/event/sw/sw_evdev_log.h b/drivers/event/sw/sw_evdev_log.h
index 50a707939c..68c18b3d07 100644
--- a/drivers/event/sw/sw_evdev_log.h
+++ b/drivers/event/sw/sw_evdev_log.h
@@ -11,13 +11,13 @@ extern int eventdev_sw_log_level;
#define SW_LOG_IMPL(level, ...) \
RTE_LOG_LINE_PREFIX(level, EVENT_SW, "%s", __func__, __VA_ARGS__)
-#define SW_LOG_INFO(fmt, args...) \
- SW_LOG_IMPL(INFO, fmt, ## args)
+#define SW_LOG_INFO(fmt, ...) \
+ SW_LOG_IMPL(INFO, fmt, ## __VA_ARGS__)
-#define SW_LOG_DBG(fmt, args...) \
- SW_LOG_IMPL(DEBUG, fmt, ## args)
+#define SW_LOG_DBG(fmt, ...) \
+ SW_LOG_IMPL(DEBUG, fmt, ## __VA_ARGS__)
-#define SW_LOG_ERR(fmt, args...) \
- SW_LOG_IMPL(ERR, fmt, ## args)
+#define SW_LOG_ERR(fmt, ...) \
+ SW_LOG_IMPL(ERR, fmt, ## __VA_ARGS__)
#endif /* _SW_EVDEV_LOG_H_ */
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 12/21] drivers/mempool: use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (10 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 11/21] drivers/event: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 13/21] drivers/net: " Andre Muezerie
` (10 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Hemant Agrawal, Sachin Saxena; +Cc: dev, Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/mempool/dpaa/dpaa_mempool.h | 20 ++++++-------
drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h | 30 +++++++++----------
2 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/drivers/mempool/dpaa/dpaa_mempool.h b/drivers/mempool/dpaa/dpaa_mempool.h
index 135520922f..0877068fdd 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.h
+++ b/drivers/mempool/dpaa/dpaa_mempool.h
@@ -65,15 +65,15 @@ extern struct dpaa_bp_info *rte_dpaa_bpid_info;
#define MEMPOOL_INIT_FUNC_TRACE() DPAA_MEMPOOL_LOG(DEBUG, " >>")
-#define DPAA_MEMPOOL_DPDEBUG(fmt, args...) \
- RTE_LOG_DP(DEBUG, DPAA_MEMPOOL, fmt, ## args)
-#define DPAA_MEMPOOL_DEBUG(fmt, args...) \
- DPAA_MEMPOOL_LOG(DEBUG, fmt, ## args)
-#define DPAA_MEMPOOL_ERR(fmt, args...) \
- DPAA_MEMPOOL_LOG(ERR, fmt, ## args)
-#define DPAA_MEMPOOL_INFO(fmt, args...) \
- DPAA_MEMPOOL_LOG(INFO, fmt, ## args)
-#define DPAA_MEMPOOL_WARN(fmt, args...) \
- DPAA_MEMPOOL_LOG(WARNING, fmt, ## args)
+#define DPAA_MEMPOOL_DPDEBUG(fmt, ...) \
+ RTE_LOG_DP(DEBUG, DPAA_MEMPOOL, fmt, ## __VA_ARGS__)
+#define DPAA_MEMPOOL_DEBUG(fmt, ...) \
+ DPAA_MEMPOOL_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA_MEMPOOL_ERR(fmt, ...) \
+ DPAA_MEMPOOL_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA_MEMPOOL_INFO(fmt, ...) \
+ DPAA_MEMPOOL_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_MEMPOOL_WARN(fmt, ...) \
+ DPAA_MEMPOOL_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h b/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h
index d69ef17a04..1ba7983206 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h
@@ -15,22 +15,22 @@ extern int dpaa2_logtype_mempool;
#define DPAA2_MEMPOOL_DEBUG(...) \
RTE_LOG_LINE_PREFIX(DEBUG, DPAA2_MEMPOOL, "%s(): ", __func__, __VA_ARGS__)
-#define DPAA2_MEMPOOL_INFO(fmt, args...) \
- DPAA2_MEMPOOL_LOG(INFO, fmt, ## args)
-#define DPAA2_MEMPOOL_ERR(fmt, args...) \
- DPAA2_MEMPOOL_LOG(ERR, fmt, ## args)
-#define DPAA2_MEMPOOL_WARN(fmt, args...) \
- DPAA2_MEMPOOL_LOG(WARNING, fmt, ## args)
+#define DPAA2_MEMPOOL_INFO(fmt, ...) \
+ DPAA2_MEMPOOL_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_MEMPOOL_ERR(fmt, ...) \
+ DPAA2_MEMPOOL_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA2_MEMPOOL_WARN(fmt, ...) \
+ DPAA2_MEMPOOL_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
-#define DPAA2_MEMPOOL_DP_LOG(level, fmt, args...) \
- RTE_LOG_DP(level, DPAA2_MEMPOOL, fmt, ## args)
-
-#define DPAA2_MEMPOOL_DP_DEBUG(fmt, args...) \
- DPAA2_MEMPOOL_DP_LOG(DEBUG, fmt, ## args)
-#define DPAA2_MEMPOOL_DP_INFO(fmt, args...) \
- DPAA2_MEMPOOL_DP_LOG(INFO, fmt, ## args)
-#define DPAA2_MEMPOOL_DP_WARN(fmt, args...) \
- DPAA2_MEMPOOL_DP_LOG(WARNING, fmt, ## args)
+#define DPAA2_MEMPOOL_DP_LOG(level, fmt, ...) \
+ RTE_LOG_DP(level, DPAA2_MEMPOOL, fmt, ## __VA_ARGS__)
+
+#define DPAA2_MEMPOOL_DP_DEBUG(fmt, ...) \
+ DPAA2_MEMPOOL_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA2_MEMPOOL_DP_INFO(fmt, ...) \
+ DPAA2_MEMPOOL_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_MEMPOOL_DP_WARN(fmt, ...) \
+ DPAA2_MEMPOOL_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _DPAA2_HW_MEMPOOL_LOGS_H_ */
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 13/21] drivers/net: use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (11 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 12/21] drivers/mempool: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-16 9:02 ` Andrew Rybchenko
2024-12-11 2:05 ` [PATCH 14/21] drivers/raw: " Andre Muezerie
` (9 subsequent siblings)
22 siblings, 1 reply; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Shepard Siegel, Ed Czeck, John Miller, Ajit Khaparde,
Somnath Kotur, Hemant Agrawal, Sachin Saxena, Shai Brandes,
Evgeny Schemeilin, Ron Beider, Amit Bernstein, Wajeeh Atrash,
Gagandeep Singh, Apeksha Gupta, John Daley, Hyong Youb Kim,
Jie Hai, Bruce Richardson, Anatoly Burakov, Rosen Xu,
Vladimir Medvedkin, Jiawen Wu, Devendra Singh Rawat, Alok Prasad,
Andrew Rybchenko, Jian Wang
Cc: dev, Andre Muezerie
1) Use portable variadic macros
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
2) Add "do { } while (0)" to macros used to remove logging calls, to
ensure there's no code structure change when enabling/disabling
logging.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/net/ark/ark_logs.h | 4 +--
.../net/bnxt/hcapi/cfa_v3/include/cfa_trace.h | 12 +++----
drivers/net/bnxt/tf_core/cfa_tcam_mgr.h | 12 +++----
drivers/net/bnxt/tf_core/tfp.h | 8 ++---
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h | 4 +--
drivers/net/dpaa/dpaa_ethdev.h | 16 +++++-----
drivers/net/dpaa/fmlib/fm_ext.h | 4 +--
drivers/net/dpaa2/dpaa2_pmd_logs.h | 28 ++++++++--------
drivers/net/e1000/base/e1000_osdep.h | 10 +++---
drivers/net/ena/base/ena_plat_dpdk.h | 16 +++++-----
drivers/net/enetc/enetc_logs.h | 32 +++++++++----------
drivers/net/enetfec/enet_pmd_logs.h | 18 +++++------
drivers/net/enic/enic_compat.h | 16 +++++-----
drivers/net/fm10k/base/fm10k_osdep.h | 10 +++---
drivers/net/hns3/hns3_logs.h | 20 ++++++------
drivers/net/ice/base/ice_osdep.h | 4 +--
drivers/net/igc/base/igc_osdep.h | 10 +++---
drivers/net/ipn3ke/ipn3ke_logs.h | 16 +++++-----
drivers/net/ixgbe/base/ixgbe_osdep.h | 30 ++++++++---------
drivers/net/ngbe/base/ngbe_osdep.h | 2 +-
drivers/net/ngbe/ngbe_logs.h | 2 +-
drivers/net/pfe/pfe_logs.h | 18 +++++------
drivers/net/qede/qede_ethdev.h | 4 +--
drivers/net/qede/qede_logs.h | 16 +++++-----
drivers/net/sfc/sfc_debug.h | 4 +--
drivers/net/txgbe/base/txgbe_osdep.h | 2 +-
drivers/net/txgbe/txgbe_logs.h | 2 +-
27 files changed, 160 insertions(+), 160 deletions(-)
diff --git a/drivers/net/ark/ark_logs.h b/drivers/net/ark/ark_logs.h
index ca46d86c99..fb0f3eee5f 100644
--- a/drivers/net/ark/ark_logs.h
+++ b/drivers/net/ark/ark_logs.h
@@ -20,8 +20,8 @@
extern int ark_logtype;
-#define ARK_PMD_LOG(level, fmt, args...) \
- rte_log(RTE_LOG_ ##level, ark_logtype, "ARK: " fmt, ## args)
+#define ARK_PMD_LOG(level, fmt, ...) \
+ rte_log(RTE_LOG_ ##level, ark_logtype, "ARK: " fmt, ## __VA_ARGS__)
/* Debug macro to enable core debug code */
diff --git a/drivers/net/bnxt/hcapi/cfa_v3/include/cfa_trace.h b/drivers/net/bnxt/hcapi/cfa_v3/include/cfa_trace.h
index f9e051f046..a177c616a3 100644
--- a/drivers/net/bnxt/hcapi/cfa_v3/include/cfa_trace.h
+++ b/drivers/net/bnxt/hcapi/cfa_v3/include/cfa_trace.h
@@ -91,8 +91,8 @@
#define CFA_TRACE_DBG_FL(function, line, format, ...) \
CFA_LOG_FL(function, line, CFA_DEBUG_LEVEL_DBG, format, ##__VA_ARGS__)
#else
-#define CFA_TRACE_DBG(format, ...)
-#define CFA_TRACE_DBG_FL(format, ...)
+#define CFA_TRACE_DBG(format, ...) do { } while (0)
+#define CFA_TRACE_DBG_FL(format, ...) do { } while (0)
#endif
#if CFA_COMP_DBG_LEVEL(COMP_ID) <= CFA_DEBUG_LEVEL_INFO
#define CFA_TRACE_INFO(format, ...) \
@@ -100,8 +100,8 @@
#define CFA_TRACE_INFO_FL(function, line, format, ...) \
CFA_LOG_FL(function, line, CFA_DEBUG_LEVEL_INFO, format, ##__VA_ARGS__)
#else
-#define CFA_TRACE_INFO(format, ...)
-#define CFA_TRACE_INFO_FL(function, line, format, ...)
+#define CFA_TRACE_INFO(format, ...) do { } while (0)
+#define CFA_TRACE_INFO_FL(function, line, format, ...) do { } while (0)
#endif
#if CFA_COMP_DBG_LEVEL(COMP_ID) <= CFA_DEBUG_LEVEL_WARN
#define CFA_TRACE_WARN(format, ...) \
@@ -119,8 +119,8 @@
CFA_LOG_FL(function, line, CFA_DEBUG_LEVEL_CRITICAL, format, \
##__VA_ARGS__)
#else
-#define CFA_TRACE_ERR(format, ...)
-#define CFA_TRACE_ERR_FL(function, line, format, ...)
+#define CFA_TRACE_ERR(format, ...) do { } while (0)
+#define CFA_TRACE_ERR_FL(function, line, format, ...) do { } while (0)
#endif
#define CFA_TRACE_FATAL(format, ...) \
CFA_LOG(CFA_DEBUG_LEVEL_FATAL, format, ##__VA_ARGS__)
diff --git a/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h b/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h
index 6ac1156fbf..5801bf89eb 100644
--- a/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h
+++ b/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h
@@ -25,13 +25,13 @@
#endif
/* Use TFP_DRV_LOG definition in tfp.h */
-#define CFA_TCAM_MGR_LOG(level, fmt, args...) \
- TFP_DRV_LOG(level, fmt, ## args)
-#define CFA_TCAM_MGR_LOG_DIR(level, dir, fmt, args...) \
- TFP_DRV_LOG(level, "%s: " fmt, tf_dir_2_str(dir), ## args)
-#define CFA_TCAM_MGR_LOG_DIR_TYPE(level, dir, type, fmt, args...) \
+#define CFA_TCAM_MGR_LOG(level, fmt, ...) \
+ TFP_DRV_LOG(level, fmt, ## __VA_ARGS__)
+#define CFA_TCAM_MGR_LOG_DIR(level, dir, fmt, ...) \
+ TFP_DRV_LOG(level, "%s: " fmt, tf_dir_2_str(dir), ## __VA_ARGS__)
+#define CFA_TCAM_MGR_LOG_DIR_TYPE(level, dir, type, fmt, ...) \
TFP_DRV_LOG(level, "%s: %s " fmt, tf_dir_2_str(dir), \
- cfa_tcam_mgr_tbl_2_str(type), ## args)
+ cfa_tcam_mgr_tbl_2_str(type), ## __VA_ARGS__)
#define CFA_TCAM_MGR_LOG_0(level, fmt) \
TFP_DRV_LOG(level, fmt)
diff --git a/drivers/net/bnxt/tf_core/tfp.h b/drivers/net/bnxt/tf_core/tfp.h
index 92f76004da..2103552d88 100644
--- a/drivers/net/bnxt/tf_core/tfp.h
+++ b/drivers/net/bnxt/tf_core/tfp.h
@@ -28,12 +28,12 @@ struct tfp_spinlock_parms {
rte_spinlock_t slock;
};
-#define TFP_DRV_LOG_RAW(level, fmt, args...) \
+#define TFP_DRV_LOG_RAW(level, fmt, ...) \
rte_log(RTE_LOG_ ## level, bnxt_logtype_driver, "%s(): " fmt, \
- __func__, ## args)
+ __func__, ## __VA_ARGS__)
-#define TFP_DRV_LOG(level, fmt, args...) \
- TFP_DRV_LOG_RAW(level, fmt, ## args)
+#define TFP_DRV_LOG(level, fmt, ...) \
+ TFP_DRV_LOG_RAW(level, fmt, ## __VA_ARGS__)
/**
* @file
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_tf_common.h b/drivers/net/bnxt/tf_ulp/bnxt_tf_common.h
index 4d9a1a7790..414a9895c7 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_tf_common.h
+++ b/drivers/net/bnxt/tf_ulp/bnxt_tf_common.h
@@ -15,9 +15,9 @@
RTE_LOG(lvl, BNXT, "%s(): " fmt, __func__, ## __VA_ARGS__)
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
-#define BNXT_DRV_INF(fmt, args...) RTE_LOG(INFO, fmt, ## args)
+#define BNXT_DRV_INF(fmt, ...) RTE_LOG(INFO, fmt, ## __VA_ARGS__)
#else
-#define BNXT_DRV_INF(fmt, args...)
+#define BNXT_DRV_INF(fmt, ...) do { } while (0)
#endif
#define BNXT_ULP_EM_FLOWS 8192
diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h
index 00f4fde571..be9398004f 100644
--- a/drivers/net/dpaa/dpaa_ethdev.h
+++ b/drivers/net/dpaa/dpaa_ethdev.h
@@ -281,14 +281,14 @@ extern int dpaa_logtype_pmd;
#define PMD_INIT_FUNC_TRACE() DPAA_PMD_LOG(DEBUG, " >>")
-#define DPAA_PMD_DEBUG(fmt, args...) \
- DPAA_PMD_LOG(DEBUG, fmt, ## args)
-#define DPAA_PMD_ERR(fmt, args...) \
- DPAA_PMD_LOG(ERR, fmt, ## args)
-#define DPAA_PMD_INFO(fmt, args...) \
- DPAA_PMD_LOG(INFO, fmt, ## args)
-#define DPAA_PMD_WARN(fmt, args...) \
- DPAA_PMD_LOG(WARNING, fmt, ## args)
+#define DPAA_PMD_DEBUG(fmt, ...) \
+ DPAA_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA_PMD_ERR(fmt, ...) \
+ DPAA_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA_PMD_INFO(fmt, ...) \
+ DPAA_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_PMD_WARN(fmt, ...) \
+ DPAA_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define DPAA_DP_LOG(level, ...) \
diff --git a/drivers/net/dpaa/fmlib/fm_ext.h b/drivers/net/dpaa/fmlib/fm_ext.h
index 9a3193674e..5576f9278c 100644
--- a/drivers/net/dpaa/fmlib/fm_ext.h
+++ b/drivers/net/dpaa/fmlib/fm_ext.h
@@ -21,7 +21,7 @@
#define _fml_dbg(...) \
RTE_LOG_LINE_PREFIX(DEBUG, DPAA_PMD, "%s: ", __func__, __VA_ARGS__)
#else
- #define _fml_dbg(arg...)
+ #define _fml_dbg(...) do { } while (0)
#endif
/*#define FM_IOCTL_DBG*/
@@ -30,7 +30,7 @@
#define _fm_ioctl_dbg(...) \
RTE_LOG_LINE_PREFIX(DEBUG, DPAA_PMD, "%s: ", __func__, __VA_ARGS__)
#else
- #define _fm_ioctl_dbg(arg...)
+ #define _fm_ioctl_dbg(...) do { } while (0)
#endif
/*
diff --git a/drivers/net/dpaa2/dpaa2_pmd_logs.h b/drivers/net/dpaa2/dpaa2_pmd_logs.h
index a9317b27eb..28c9bed1ae 100644
--- a/drivers/net/dpaa2/dpaa2_pmd_logs.h
+++ b/drivers/net/dpaa2/dpaa2_pmd_logs.h
@@ -16,24 +16,24 @@ extern int dpaa2_logtype_pmd;
#define PMD_INIT_FUNC_TRACE() DPAA2_PMD_DEBUG(">>")
-#define DPAA2_PMD_CRIT(fmt, args...) \
- DPAA2_PMD_LOG(CRIT, fmt, ## args)
-#define DPAA2_PMD_INFO(fmt, args...) \
- DPAA2_PMD_LOG(INFO, fmt, ## args)
-#define DPAA2_PMD_ERR(fmt, args...) \
- DPAA2_PMD_LOG(ERR, fmt, ## args)
-#define DPAA2_PMD_WARN(fmt, args...) \
- DPAA2_PMD_LOG(WARNING, fmt, ## args)
+#define DPAA2_PMD_CRIT(fmt, ...) \
+ DPAA2_PMD_LOG(CRIT, fmt, ## __VA_ARGS__)
+#define DPAA2_PMD_INFO(fmt, ...) \
+ DPAA2_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_PMD_ERR(fmt, ...) \
+ DPAA2_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA2_PMD_WARN(fmt, ...) \
+ DPAA2_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define DPAA2_PMD_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, DPAA2_NET, __VA_ARGS__)
-#define DPAA2_PMD_DP_DEBUG(fmt, args...) \
- DPAA2_PMD_DP_LOG(DEBUG, fmt, ## args)
-#define DPAA2_PMD_DP_INFO(fmt, args...) \
- DPAA2_PMD_DP_LOG(INFO, fmt, ## args)
-#define DPAA2_PMD_DP_WARN(fmt, args...) \
- DPAA2_PMD_DP_LOG(WARNING, fmt, ## args)
+#define DPAA2_PMD_DP_DEBUG(fmt, ...) \
+ DPAA2_PMD_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA2_PMD_DP_INFO(fmt, ...) \
+ DPAA2_PMD_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_PMD_DP_WARN(fmt, ...) \
+ DPAA2_PMD_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _DPAA2_PMD_LOGS_H_ */
diff --git a/drivers/net/e1000/base/e1000_osdep.h b/drivers/net/e1000/base/e1000_osdep.h
index 6b5d58950f..7cf36ed25a 100644
--- a/drivers/net/e1000/base/e1000_osdep.h
+++ b/drivers/net/e1000/base/e1000_osdep.h
@@ -28,11 +28,11 @@
#define DEBUGFUNC(F) DEBUGOUT(F "\n");
#define DEBUGOUT(S, ...) RTE_LOG(DEBUG, E1000_DRIVER, "%s(): " S, __func__, ## __VA_ARGS__)
-#define DEBUGOUT1(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT2(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT3(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT6(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT7(S, args...) DEBUGOUT(S, ##args)
+#define DEBUGOUT1(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT2(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT3(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT6(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT7(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
#ifndef UNREFERENCED_PARAMETER
#define UNREFERENCED_PARAMETER(_p)
diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h
index 1121460470..aed60860c7 100644
--- a/drivers/net/ena/base/ena_plat_dpdk.h
+++ b/drivers/net/ena/base/ena_plat_dpdk.h
@@ -106,28 +106,28 @@ extern int ena_logtype_com;
#define GENMASK_ULL(h, l) (((~0ULL) - (1ULL << (l)) + 1) & \
(~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
-#define ena_trc_log(dev, level, fmt, arg...) \
+#define ena_trc_log(dev, level, fmt, ...) \
( \
ENA_TOUCH(dev), \
rte_log(RTE_LOG_ ## level, ena_logtype_com, \
- "[ENA_COM: %s]" fmt, __func__, ##arg) \
+ "[ENA_COM: %s]" fmt, __func__, ##__VA_ARGS__) \
)
#if (defined RTE_ETHDEV_DEBUG_TX) || (defined RTE_ETHDEV_DEBUG_RX)
#define ena_trc_dbg(dev, format, ...) ena_trc_log(dev, DEBUG, format, ##__VA_ARGS__)
#else
-#define ena_trc_dbg(dev, format, ...)
+#define ena_trc_dbg(dev, format, ...) do { } while (0)
#endif
-#define ena_trc_info(dev, format, arg...) ena_trc_log(dev, INFO, format, ##arg)
-#define ena_trc_warn(dev, format, arg...) ena_trc_log(dev, WARNING, format, ##arg)
-#define ena_trc_err(dev, format, arg...) ena_trc_log(dev, ERR, format, ##arg)
+#define ena_trc_info(dev, format, ...) ena_trc_log(dev, INFO, format, ##__VA_ARGS__)
+#define ena_trc_warn(dev, format, ...) ena_trc_log(dev, WARNING, format, ##__VA_ARGS__)
+#define ena_trc_err(dev, format, ...) ena_trc_log(dev, ERR, format, ##__VA_ARGS__)
-#define ENA_WARN(cond, dev, format, arg...) \
+#define ENA_WARN(cond, dev, format, ...) \
do { \
if (unlikely(cond)) { \
ena_trc_err(dev, \
"Warn failed on %s:%s:%d:" format, \
- __FILE__, __func__, __LINE__, ##arg); \
+ __FILE__, __func__, __LINE__, ##__VA_ARGS__); \
} \
} while (0)
diff --git a/drivers/net/enetc/enetc_logs.h b/drivers/net/enetc/enetc_logs.h
index 57bddcf683..e9855a41b4 100644
--- a/drivers/net/enetc/enetc_logs.h
+++ b/drivers/net/enetc/enetc_logs.h
@@ -16,26 +16,26 @@ extern int enetc_logtype_pmd;
#define PMD_INIT_FUNC_TRACE() ENETC_PMD_DEBUG(">>")
-#define ENETC_PMD_CRIT(fmt, args...) \
- ENETC_PMD_LOG(CRIT, fmt, ## args)
-#define ENETC_PMD_INFO(fmt, args...) \
- ENETC_PMD_LOG(INFO, fmt, ## args)
-#define ENETC_PMD_NOTICE(fmt, args...) \
- ENETC_PMD_LOG(NOTICE, fmt, ## args)
-#define ENETC_PMD_ERR(fmt, args...) \
- ENETC_PMD_LOG(ERR, fmt, ## args)
-#define ENETC_PMD_WARN(fmt, args...) \
- ENETC_PMD_LOG(WARNING, fmt, ## args)
+#define ENETC_PMD_CRIT(fmt, ...) \
+ ENETC_PMD_LOG(CRIT, fmt, ## __VA_ARGS__)
+#define ENETC_PMD_INFO(fmt, ...) \
+ ENETC_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define ENETC_PMD_NOTICE(fmt, ...) \
+ ENETC_PMD_LOG(NOTICE, fmt, ## __VA_ARGS__)
+#define ENETC_PMD_ERR(fmt, ...) \
+ ENETC_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define ENETC_PMD_WARN(fmt, ...) \
+ ENETC_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define ENETC_PMD_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, ENETC_NET, __VA_ARGS__)
-#define ENETC_PMD_DP_DEBUG(fmt, args...) \
- ENETC_PMD_DP_LOG(DEBUG, fmt, ## args)
-#define ENETC_PMD_DP_INFO(fmt, args...) \
- ENETC_PMD_DP_LOG(INFO, fmt, ## args)
-#define ENETC_PMD_DP_WARN(fmt, args...) \
- ENETC_PMD_DP_LOG(WARNING, fmt, ## args)
+#define ENETC_PMD_DP_DEBUG(fmt, ...) \
+ ENETC_PMD_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define ENETC_PMD_DP_INFO(fmt, ...) \
+ ENETC_PMD_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define ENETC_PMD_DP_WARN(fmt, ...) \
+ ENETC_PMD_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _ENETC_LOGS_H_*/
diff --git a/drivers/net/enetfec/enet_pmd_logs.h b/drivers/net/enetfec/enet_pmd_logs.h
index 7580b5c8cc..65498f62f4 100644
--- a/drivers/net/enetfec/enet_pmd_logs.h
+++ b/drivers/net/enetfec/enet_pmd_logs.h
@@ -16,15 +16,15 @@ extern int enetfec_logtype_pmd;
#define PMD_INIT_FUNC_TRACE() ENET_PMD_LOG(DEBUG, " >>")
-#define ENETFEC_PMD_DEBUG(fmt, args...) \
- ENETFEC_PMD_LOG(DEBUG, fmt, ## args)
-#define ENETFEC_PMD_ERR(fmt, args...) \
- ENETFEC_PMD_LOG(ERR, fmt, ## args)
-#define ENETFEC_PMD_INFO(fmt, args...) \
- ENETFEC_PMD_LOG(INFO, fmt, ## args)
-
-#define ENETFEC_PMD_WARN(fmt, args...) \
- ENETFEC_PMD_LOG(WARNING, fmt, ## args)
+#define ENETFEC_PMD_DEBUG(fmt, ...) \
+ ENETFEC_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define ENETFEC_PMD_ERR(fmt, ...) \
+ ENETFEC_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define ENETFEC_PMD_INFO(fmt, ...) \
+ ENETFEC_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+
+#define ENETFEC_PMD_WARN(fmt, ...) \
+ ENETFEC_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define ENETFEC_DP_LOG(level, ...) \
diff --git a/drivers/net/enic/enic_compat.h b/drivers/net/enic/enic_compat.h
index 6d766bcd14..7cff6831b9 100644
--- a/drivers/net/enic/enic_compat.h
+++ b/drivers/net/enic/enic_compat.h
@@ -18,8 +18,8 @@
#define __iomem
-#define pr_err(y, args...) dev_err(0, y, ##args)
-#define pr_warn(y, args...) dev_warning(0, y, ##args)
+#define pr_err(y, ...) dev_err(0, y, ##__VA_ARGS__)
+#define pr_warn(y, ...) dev_warning(0, y, ##__VA_ARGS__)
#define BUG() pr_err("BUG at %s:%d", __func__, __LINE__)
#define VNIC_ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1)
@@ -28,14 +28,14 @@
extern int enic_pmd_logtype;
#define RTE_LOGTYPE_ENIC_PMD enic_pmd_logtype
-#define dev_printk(level, fmt, args...) \
+#define dev_printk(level, fmt, ...) \
rte_log(RTE_LOG_ ## level, enic_pmd_logtype, \
- "PMD: rte_enic_pmd: " fmt, ##args)
+ "PMD: rte_enic_pmd: " fmt, ##__VA_ARGS__)
-#define dev_err(x, args...) dev_printk(ERR, args)
-#define dev_info(x, args...) dev_printk(INFO, args)
-#define dev_warning(x, args...) dev_printk(WARNING, args)
-#define dev_debug(x, args...) dev_printk(DEBUG, args)
+#define dev_err(x, ...) dev_printk(ERR, __VA_ARGS__)
+#define dev_info(x, ...) dev_printk(INFO, __VA_ARGS__)
+#define dev_warning(x, ...) dev_printk(WARNING, __VA_ARGS__)
+#define dev_debug(x, ...) dev_printk(DEBUG, __VA_ARGS__)
#define ENICPMD_LOG(level, ...) \
RTE_LOG_LINE_PREFIX(level, ENIC_PMD, "%s ", __func__, __VA_ARGS__)
diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h
index d3e5528575..837010770a 100644
--- a/drivers/net/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/fm10k/base/fm10k_osdep.h
@@ -25,11 +25,11 @@
#define STATIC static
#define DEBUGFUNC(F) DEBUGOUT(F "\n");
#define DEBUGOUT(S, ...) RTE_LOG(DEBUG, FM10K_DRIVER, "%s(): " S, __func__, ## __VA_ARGS__)
-#define DEBUGOUT1(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT2(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT3(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT6(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT7(S, args...) DEBUGOUT(S, ##args)
+#define DEBUGOUT1(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT2(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT3(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT6(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT7(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
#define FALSE 0
#define TRUE 1
diff --git a/drivers/net/hns3/hns3_logs.h b/drivers/net/hns3/hns3_logs.h
index d468c353fa..c2652cc17a 100644
--- a/drivers/net/hns3/hns3_logs.h
+++ b/drivers/net/hns3/hns3_logs.h
@@ -17,20 +17,20 @@ extern int hns3_logtype_driver;
RTE_LOG_LINE_PREFIX(level, HNS3_DRIVER, "%s %s(): ", \
(hw)->data->name RTE_LOG_COMMA __func__, __VA_ARGS__)
-#define hns3_err(hw, fmt, args...) \
- PMD_DRV_LOG(hw, ERR, fmt, ## args)
+#define hns3_err(hw, fmt, ...) \
+ PMD_DRV_LOG(hw, ERR, fmt, ## __VA_ARGS__)
-#define hns3_warn(hw, fmt, args...) \
- PMD_DRV_LOG(hw, WARNING, fmt, ## args)
+#define hns3_warn(hw, fmt, ...) \
+ PMD_DRV_LOG(hw, WARNING, fmt, ## __VA_ARGS__)
-#define hns3_notice(hw, fmt, args...) \
- PMD_DRV_LOG(hw, NOTICE, fmt, ## args)
+#define hns3_notice(hw, fmt, ...) \
+ PMD_DRV_LOG(hw, NOTICE, fmt, ## __VA_ARGS__)
-#define hns3_info(hw, fmt, args...) \
- PMD_DRV_LOG(hw, INFO, fmt, ## args)
+#define hns3_info(hw, fmt, ...) \
+ PMD_DRV_LOG(hw, INFO, fmt, ## __VA_ARGS__)
-#define hns3_dbg(hw, fmt, args...) \
- PMD_DRV_LOG(hw, DEBUG, fmt, ## args)
+#define hns3_dbg(hw, fmt, ...) \
+ PMD_DRV_LOG(hw, DEBUG, fmt, ## __VA_ARGS__)
#ifdef RTE_ETHDEV_DEBUG_RX
extern int hns3_logtype_rx;
diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h
index 5f7347023f..64e4779878 100644
--- a/drivers/net/ice/base/ice_osdep.h
+++ b/drivers/net/ice/base/ice_osdep.h
@@ -154,8 +154,8 @@ do { \
##__VA_ARGS__); \
} while (0)
-#define ice_info(hw, fmt, args...) ice_debug(hw, ICE_DBG_ALL, fmt, ##args)
-#define ice_warn(hw, fmt, args...) ice_debug(hw, ICE_DBG_ALL, fmt, ##args)
+#define ice_info(hw, fmt, ...) ice_debug(hw, ICE_DBG_ALL, fmt, ##__VA_ARGS__)
+#define ice_warn(hw, fmt, ...) ice_debug(hw, ICE_DBG_ALL, fmt, ##__VA_ARGS__)
#define ice_debug_array(hw, type, rowsize, groupsize, buf, len) \
do { \
struct ice_hw *hw_l = hw; \
diff --git a/drivers/net/igc/base/igc_osdep.h b/drivers/net/igc/base/igc_osdep.h
index 4e479eb500..b938dfd2b5 100644
--- a/drivers/net/igc/base/igc_osdep.h
+++ b/drivers/net/igc/base/igc_osdep.h
@@ -28,11 +28,11 @@
#define DEBUGFUNC(F) DEBUGOUT(F "\n")
#define DEBUGOUT(S, ...) RTE_LOG(DEBUG, IGC_DRIVER, "%s(): " S, __func__, ## __VA_ARGS__)
-#define DEBUGOUT1(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT2(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT3(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT6(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT7(S, args...) DEBUGOUT(S, ##args)
+#define DEBUGOUT1(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT2(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT3(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT6(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT7(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
#define UNREFERENCED_PARAMETER(_p) (void)(_p)
#define UNREFERENCED_1PARAMETER(_p) (void)(_p)
diff --git a/drivers/net/ipn3ke/ipn3ke_logs.h b/drivers/net/ipn3ke/ipn3ke_logs.h
index 42dceeeab1..ff283b2b19 100644
--- a/drivers/net/ipn3ke/ipn3ke_logs.h
+++ b/drivers/net/ipn3ke/ipn3ke_logs.h
@@ -15,16 +15,16 @@ extern int ipn3ke_afu_logtype;
#define IPN3KE_AFU_PMD_FUNC_TRACE() IPN3KE_AFU_PMD_LOG(DEBUG, ">>")
-#define IPN3KE_AFU_PMD_DEBUG(fmt, args...) \
- IPN3KE_AFU_PMD_LOG(DEBUG, fmt, ## args)
+#define IPN3KE_AFU_PMD_DEBUG(fmt, ...) \
+ IPN3KE_AFU_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
-#define IPN3KE_AFU_PMD_INFO(fmt, args...) \
- IPN3KE_AFU_PMD_LOG(INFO, fmt, ## args)
+#define IPN3KE_AFU_PMD_INFO(fmt, ...) \
+ IPN3KE_AFU_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
-#define IPN3KE_AFU_PMD_ERR(fmt, args...) \
- IPN3KE_AFU_PMD_LOG(ERR, fmt, ## args)
+#define IPN3KE_AFU_PMD_ERR(fmt, ...) \
+ IPN3KE_AFU_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
-#define IPN3KE_AFU_PMD_WARN(fmt, args...) \
- IPN3KE_AFU_PMD_LOG(WARNING, fmt, ## args)
+#define IPN3KE_AFU_PMD_WARN(fmt, ...) \
+ IPN3KE_AFU_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _IPN3KE_LOGS_H_ */
diff --git a/drivers/net/ixgbe/base/ixgbe_osdep.h b/drivers/net/ixgbe/base/ixgbe_osdep.h
index 502f386b56..30d952f047 100644
--- a/drivers/net/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/ixgbe/base/ixgbe_osdep.h
@@ -34,15 +34,15 @@
#define DEBUGFUNC(F) DEBUGOUT(F "\n");
#define DEBUGOUT(S, ...) RTE_LOG(DEBUG, IXGBE_DRIVER, "%s(): " S, __func__, ## __VA_ARGS__)
-#define DEBUGOUT1(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT2(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT3(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT6(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT7(S, args...) DEBUGOUT(S, ##args)
+#define DEBUGOUT1(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT2(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT3(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT6(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT7(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
-#define ERROR_REPORT1(e, S, args...) DEBUGOUT(S, ##args)
-#define ERROR_REPORT2(e, S, args...) DEBUGOUT(S, ##args)
-#define ERROR_REPORT3(e, S, args...) DEBUGOUT(S, ##args)
+#define ERROR_REPORT1(e, S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define ERROR_REPORT2(e, S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define ERROR_REPORT3(e, S, ...) DEBUGOUT(S, ##__VA_ARGS__)
#define FALSE 0
#define TRUE 1
@@ -50,19 +50,19 @@
#define false 0
#define true 1
#ifndef RTE_EXEC_ENV_WINDOWS
-#define min(a,b) RTE_MIN(a,b)
+#define min(a, b) RTE_MIN(a, b)
#endif
-#define EWARN(hw, S, args...) DEBUGOUT1(S, ##args)
+#define EWARN(hw, S, ...) DEBUGOUT1(S, ##__VA_ARGS__)
/* Bunch of defines for shared code bogosity */
#ifndef UNREFERENCED_PARAMETER
-#define UNREFERENCED_PARAMETER(_p)
+#define UNREFERENCED_PARAMETER(_p)
#endif
-#define UNREFERENCED_1PARAMETER(_p)
+#define UNREFERENCED_1PARAMETER(_p)
#define UNREFERENCED_2PARAMETER(_p, _q)
-#define UNREFERENCED_3PARAMETER(_p, _q, _r)
-#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s)
+#define UNREFERENCED_3PARAMETER(_p, _q, _r)
+#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s)
#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t)
/* Shared code error reporting */
@@ -130,7 +130,7 @@ static inline uint32_t ixgbe_read_addr(volatile void* addr)
IXGBE_PCI_REG_ADDR((hw), (reg) + ((index) << 2))
/* Not implemented !! */
-#define IXGBE_READ_PCIE_WORD(hw, reg) 0
+#define IXGBE_READ_PCIE_WORD(hw, reg) 0
#define IXGBE_WRITE_PCIE_WORD(hw, reg, value) do { } while(0)
#define IXGBE_WRITE_FLUSH(a) IXGBE_READ_REG(a, IXGBE_STATUS)
diff --git a/drivers/net/ngbe/base/ngbe_osdep.h b/drivers/net/ngbe/base/ngbe_osdep.h
index 30598a240a..ca50455ab2 100644
--- a/drivers/net/ngbe/base/ngbe_osdep.h
+++ b/drivers/net/ngbe/base/ngbe_osdep.h
@@ -55,7 +55,7 @@
/* Bunch of defines for shared code bogosity */
static inline void UNREFERENCED(const char *a __rte_unused, ...) {}
-#define UNREFERENCED_PARAMETER(args...) UNREFERENCED("", ##args)
+#define UNREFERENCED_PARAMETER(...) UNREFERENCED("", ##__VA_ARGS__)
#define STATIC static
diff --git a/drivers/net/ngbe/ngbe_logs.h b/drivers/net/ngbe/ngbe_logs.h
index f6c1ee66d9..7abf979648 100644
--- a/drivers/net/ngbe/ngbe_logs.h
+++ b/drivers/net/ngbe/ngbe_logs.h
@@ -37,7 +37,7 @@ extern int ngbe_logtype_tx;
#define PMD_TX_LOG(...) do { } while (0)
#endif
-#define DEBUGOUT(fmt, args...) PMD_DRV_LOG(DEBUG, fmt, ##args)
+#define DEBUGOUT(fmt, ...) PMD_DRV_LOG(DEBUG, fmt, ##__VA_ARGS__)
#define PMD_INIT_FUNC_TRACE() PMD_DRV_LOG(DEBUG, ">>")
#endif /* _NGBE_LOGS_H_ */
diff --git a/drivers/net/pfe/pfe_logs.h b/drivers/net/pfe/pfe_logs.h
index d0b6943a26..1453e8284b 100644
--- a/drivers/net/pfe/pfe_logs.h
+++ b/drivers/net/pfe/pfe_logs.h
@@ -14,15 +14,15 @@ extern int pfe_logtype_pmd;
#define PMD_INIT_FUNC_TRACE() PFE_PMD_LOG(DEBUG, " >>")
-#define PFE_PMD_DEBUG(fmt, args...) \
- PFE_PMD_LOG(DEBUG, fmt, ## args)
-#define PFE_PMD_ERR(fmt, args...) \
- PFE_PMD_LOG(ERR, fmt, ## args)
-#define PFE_PMD_INFO(fmt, args...) \
- PFE_PMD_LOG(INFO, fmt, ## args)
-
-#define PFE_PMD_WARN(fmt, args...) \
- PFE_PMD_LOG(WARNING, fmt, ## args)
+#define PFE_PMD_DEBUG(fmt, ...) \
+ PFE_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define PFE_PMD_ERR(fmt, ...) \
+ PFE_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define PFE_PMD_INFO(fmt, ...) \
+ PFE_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+
+#define PFE_PMD_WARN(fmt, ...) \
+ PFE_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define PFE_DP_LOG(level, ...) \
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index b781bcdcfd..80a59c46c8 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -39,8 +39,8 @@
#include "qede_if.h"
#include "qede_rxtx.h"
-#define qede_stringify1(x...) #x
-#define qede_stringify(x...) qede_stringify1(x)
+#define qede_stringify1(...) #__VA_ARGS__
+#define qede_stringify(...) qede_stringify1(__VA_ARGS__)
/* Driver versions */
#define QEDE_PMD_DRV_VER_STR_SIZE NAME_SIZE /* 128 */
diff --git a/drivers/net/qede/qede_logs.h b/drivers/net/qede/qede_logs.h
index f67052d106..afaef60984 100644
--- a/drivers/net/qede/qede_logs.h
+++ b/drivers/net/qede/qede_logs.h
@@ -51,27 +51,27 @@ do { \
} while (0)
extern int qede_logtype_init;
-#define PMD_INIT_LOG(level, edev, fmt, args...) \
+#define PMD_INIT_LOG(level, edev, fmt, ...) \
rte_log(RTE_LOG_ ## level, qede_logtype_init, \
"[qede_pmd: %s] %s() " fmt "\n", \
- (edev)->name, __func__, ##args)
+ (edev)->name, __func__, ## __VA_ARGS__)
#define PMD_INIT_FUNC_TRACE(edev) PMD_INIT_LOG(DEBUG, edev, " >>")
#ifdef RTE_LIBRTE_QEDE_DEBUG_TX
-#define PMD_TX_LOG(level, q, fmt, args...) \
+#define PMD_TX_LOG(level, q, fmt, ...) \
RTE_LOG(level, QEDE_DRIVER, "%s(): port=%u queue=%u " fmt "\n", \
- __func__, q->port_id, q->queue_id, ## args)
+ __func__, (q)->port_id, (q)->queue_id, ## __VA_ARGS__)
#else
-#define PMD_TX_LOG(level, fmt, args...) do { } while (0)
+#define PMD_TX_LOG(level, fmt, ...) do { } while (0)
#endif
#ifdef RTE_LIBRTE_QEDE_DEBUG_RX
-#define PMD_RX_LOG(level, q, fmt, args...) \
+#define PMD_RX_LOG(level, q, fmt, ...) \
RTE_LOG(level, QEDE_DRIVER, "%s(): port=%u queue=%u " fmt "\n", \
- __func__, q->port_id, q->queue_id, ## args)
+ __func__, (q)->port_id, (q)->queue_id, ## __VA_ARGS__)
#else
-#define PMD_RX_LOG(level, q, fmt, args...) do { } while (0)
+#define PMD_RX_LOG(level, q, fmt, ...) do { } while (0)
#endif
#endif /* _QEDE_LOGS_H_ */
diff --git a/drivers/net/sfc/sfc_debug.h b/drivers/net/sfc/sfc_debug.h
index f63fb02c83..7088a41a65 100644
--- a/drivers/net/sfc/sfc_debug.h
+++ b/drivers/net/sfc/sfc_debug.h
@@ -23,7 +23,7 @@
#endif
/* Log PMD message, automatically add prefix and \n */
-#define sfc_panic(sa, fmt, args...) \
+#define sfc_panic(sa, fmt, ...) \
do { \
const struct sfc_adapter_shared *_sas; \
\
@@ -32,7 +32,7 @@
" #%" PRIu16 ": " fmt "\n", \
_sas->pci_addr.domain, _sas->pci_addr.bus, \
_sas->pci_addr.devid, _sas->pci_addr.function,\
- _sas->port_id, ##args); \
+ _sas->port_id, ##__VA_ARGS__); \
} while (0)
#endif /* _SFC_DEBUG_H_ */
diff --git a/drivers/net/txgbe/base/txgbe_osdep.h b/drivers/net/txgbe/base/txgbe_osdep.h
index 91c8abf12e..a1477653e2 100644
--- a/drivers/net/txgbe/base/txgbe_osdep.h
+++ b/drivers/net/txgbe/base/txgbe_osdep.h
@@ -60,7 +60,7 @@ extern int txgbe_logtype_bp;
/* Bunch of defines for shared code bogosity */
static inline void UNREFERENCED(const char *a __rte_unused, ...) {}
-#define UNREFERENCED_PARAMETER(args...) UNREFERENCED("", ##args)
+#define UNREFERENCED_PARAMETER(...) UNREFERENCED("", ##__VA_ARGS__)
#define STATIC static
diff --git a/drivers/net/txgbe/txgbe_logs.h b/drivers/net/txgbe/txgbe_logs.h
index e6e570734c..3c9ace6daf 100644
--- a/drivers/net/txgbe/txgbe_logs.h
+++ b/drivers/net/txgbe/txgbe_logs.h
@@ -49,7 +49,7 @@ extern int txgbe_logtype_tx_free;
#define PMD_TX_FREE_LOG(...) do { } while (0)
#endif
-#define DEBUGOUT(fmt, args...) PMD_DRV_LOG(DEBUG, fmt, ##args)
+#define DEBUGOUT(fmt, ...) PMD_DRV_LOG(DEBUG, fmt, ##__VA_ARGS__)
#define PMD_INIT_FUNC_TRACE() PMD_DRV_LOG(DEBUG, ">>")
#endif /* _TXGBE_LOGS_H_ */
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 14/21] drivers/raw: use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (12 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 13/21] drivers/net: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 15/21] drivers/vdpa: " Andre Muezerie
` (8 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Gagandeep Singh, Rosen Xu, Sachin Saxena, Hemant Agrawal
Cc: dev, Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 24 +++++++++----------
drivers/raw/ifpga/base/opae_debug.h | 4 ++--
drivers/raw/ifpga/base/opae_osdep.h | 20 ++++++++--------
.../raw/ifpga/base/osdep_rte/osdep_generic.h | 4 ++--
drivers/raw/ifpga/ifpga_rawdev.h | 16 ++++++-------
drivers/raw/skeleton/skeleton_rawdev.h | 16 ++++++-------
drivers/raw/skeleton/skeleton_rawdev_test.c | 8 +++----
7 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h
index 66108e0667..d223895e1c 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h
@@ -20,23 +20,23 @@ extern int dpaa2_cmdif_logtype;
#define DPAA2_CMDIF_FUNC_TRACE() DPAA2_CMDIF_DEBUG(">>")
-#define DPAA2_CMDIF_INFO(fmt, args...) \
- DPAA2_CMDIF_LOG(INFO, fmt, ## args)
-#define DPAA2_CMDIF_ERR(fmt, args...) \
- DPAA2_CMDIF_LOG(ERR, fmt, ## args)
-#define DPAA2_CMDIF_WARN(fmt, args...) \
- DPAA2_CMDIF_LOG(WARNING, fmt, ## args)
+#define DPAA2_CMDIF_INFO(fmt, ...) \
+ DPAA2_CMDIF_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_CMDIF_ERR(fmt, ...) \
+ DPAA2_CMDIF_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA2_CMDIF_WARN(fmt, ...) \
+ DPAA2_CMDIF_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define DPAA2_CMDIF_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, DPAA2_CMDIF, __VA_ARGS__)
-#define DPAA2_CMDIF_DP_DEBUG(fmt, args...) \
- DPAA2_CMDIF_DP_LOG(DEBUG, fmt, ## args)
-#define DPAA2_CMDIF_DP_INFO(fmt, args...) \
- DPAA2_CMDIF_DP_LOG(INFO, fmt, ## args)
-#define DPAA2_CMDIF_DP_WARN(fmt, args...) \
- DPAA2_CMDIF_DP_LOG(WARNING, fmt, ## args)
+#define DPAA2_CMDIF_DP_DEBUG(fmt, ...) \
+ DPAA2_CMDIF_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA2_CMDIF_DP_INFO(fmt, ...) \
+ DPAA2_CMDIF_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_CMDIF_DP_WARN(fmt, ...) \
+ DPAA2_CMDIF_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
#ifdef __cplusplus
}
diff --git a/drivers/raw/ifpga/base/opae_debug.h b/drivers/raw/ifpga/base/opae_debug.h
index a03dff926a..a802897fea 100644
--- a/drivers/raw/ifpga/base/opae_debug.h
+++ b/drivers/raw/ifpga/base/opae_debug.h
@@ -6,9 +6,9 @@
#define _OPAE_DEBUG_H_
#ifdef OPAE_HW_DEBUG
-#define opae_log(fmt, args...) printf(fmt, ## args)
+#define opae_log(fmt, ...) printf(fmt, ## __VA_ARGS__)
#else
-#define opae_log(fme, args...) do {} while (0)
+#define opae_log(fme, ...) do {} while (0)
#endif
void opae_manager_dump(struct opae_manager *mgr);
diff --git a/drivers/raw/ifpga/base/opae_osdep.h b/drivers/raw/ifpga/base/opae_osdep.h
index cb780b1fed..10329ecf18 100644
--- a/drivers/raw/ifpga/base/opae_osdep.h
+++ b/drivers/raw/ifpga/base/opae_osdep.h
@@ -54,14 +54,14 @@ struct uuid {
#define SET_FIELD(m, v) (((v) << (__builtin_ffsll(m) - 1)) & (m))
#define GET_FIELD(m, v) (((v) & (m)) >> (__builtin_ffsll(m) - 1))
-#define dev_err(x, args...) dev_printf(ERR, args)
-#define dev_info(x, args...) dev_printf(INFO, args)
-#define dev_warn(x, args...) dev_printf(WARNING, args)
-#define dev_debug(x, args...) dev_printf(DEBUG, args)
+#define dev_err(x, ...) dev_printf(ERR, __VA_ARGS__)
+#define dev_info(x, ...) dev_printf(INFO, __VA_ARGS__)
+#define dev_warn(x, ...) dev_printf(WARNING, __VA_ARGS__)
+#define dev_debug(x, ...) dev_printf(DEBUG, __VA_ARGS__)
-#define pr_err(y, args...) dev_err(0, y, ##args)
-#define pr_warn(y, args...) dev_warn(0, y, ##args)
-#define pr_info(y, args...) dev_info(0, y, ##args)
+#define pr_err(y, ...) dev_err(0, y, ##__VA_ARGS__)
+#define pr_warn(y, ...) dev_warn(0, y, ##__VA_ARGS__)
+#define pr_info(y, ...) dev_info(0, y, ##__VA_ARGS__)
#ifndef WARN_ON
#define WARN_ON(x) do { \
@@ -80,13 +80,13 @@ struct uuid {
#define time_before(a, b) time_after(b, a)
#define opae_memset(a, b, c) memset((a), (b), (c))
-#define readx_poll_timeout(op, val, cond, invl, timeout, args...) \
-__extension__ ({ \
+#define readx_poll_timeout(op, val, cond, invl, timeout, ...) \
+__extension__ ({ \
unsigned long __wait = 0; \
unsigned long __invl = (invl); \
unsigned long __timeout = (timeout); \
for (; __wait <= __timeout; __wait += __invl) { \
- (val) = op(args); \
+ (val) = op(__VA_ARGS__); \
if (cond) \
break; \
udelay(__invl); \
diff --git a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
index 427793a578..d4e634c9d2 100644
--- a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
+++ b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
@@ -19,8 +19,8 @@
extern int ifpga_rawdev_logtype;
#define RTE_LOGTYPE_IFPGA_RAWDEV ifpga_rawdev_logtype
-#define dev_printf(level, fmt, args...) \
- RTE_LOG(level, IFPGA_RAWDEV, "osdep_rte: " fmt, ## args)
+#define dev_printf(level, fmt, ...) \
+ RTE_LOG(level, IFPGA_RAWDEV, "osdep_rte: " fmt, ## __VA_ARGS__)
#define osdep_panic(...) rte_panic(...)
diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h
index c733ffcb41..06700f479d 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.h
+++ b/drivers/raw/ifpga/ifpga_rawdev.h
@@ -15,14 +15,14 @@ extern int ifpga_rawdev_logtype;
#define IFPGA_RAWDEV_PMD_FUNC_TRACE() IFPGA_RAWDEV_PMD_LOG(DEBUG, ">>")
-#define IFPGA_RAWDEV_PMD_DEBUG(fmt, args...) \
- IFPGA_RAWDEV_PMD_LOG(DEBUG, fmt, ## args)
-#define IFPGA_RAWDEV_PMD_INFO(fmt, args...) \
- IFPGA_RAWDEV_PMD_LOG(INFO, fmt, ## args)
-#define IFPGA_RAWDEV_PMD_ERR(fmt, args...) \
- IFPGA_RAWDEV_PMD_LOG(ERR, fmt, ## args)
-#define IFPGA_RAWDEV_PMD_WARN(fmt, args...) \
- IFPGA_RAWDEV_PMD_LOG(WARNING, fmt, ## args)
+#define IFPGA_RAWDEV_PMD_DEBUG(fmt, ...) \
+ IFPGA_RAWDEV_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define IFPGA_RAWDEV_PMD_INFO(fmt, ...) \
+ IFPGA_RAWDEV_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define IFPGA_RAWDEV_PMD_ERR(fmt, ...) \
+ IFPGA_RAWDEV_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define IFPGA_RAWDEV_PMD_WARN(fmt, ...) \
+ IFPGA_RAWDEV_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
enum ifpga_rawdev_device_state {
IFPGA_IDLE,
diff --git a/drivers/raw/skeleton/skeleton_rawdev.h b/drivers/raw/skeleton/skeleton_rawdev.h
index 53f21212a2..85f8017a7e 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.h
+++ b/drivers/raw/skeleton/skeleton_rawdev.h
@@ -15,14 +15,14 @@ extern int skeleton_pmd_logtype;
#define SKELETON_PMD_FUNC_TRACE() SKELETON_PMD_LOG(DEBUG, ">>")
-#define SKELETON_PMD_DEBUG(fmt, args...) \
- SKELETON_PMD_LOG(DEBUG, fmt, ## args)
-#define SKELETON_PMD_INFO(fmt, args...) \
- SKELETON_PMD_LOG(INFO, fmt, ## args)
-#define SKELETON_PMD_ERR(fmt, args...) \
- SKELETON_PMD_LOG(ERR, fmt, ## args)
-#define SKELETON_PMD_WARN(fmt, args...) \
- SKELETON_PMD_LOG(WARNING, fmt, ## args)
+#define SKELETON_PMD_DEBUG(fmt, ...) \
+ SKELETON_PMD_LOG(DEBUG, fmt, ##__VA_ARGS__)
+#define SKELETON_PMD_INFO(fmt, ...) \
+ SKELETON_PMD_LOG(INFO, fmt, ##__VA_ARGS__)
+#define SKELETON_PMD_ERR(fmt, ...) \
+ SKELETON_PMD_LOG(ERR, fmt, ##__VA_ARGS__)
+#define SKELETON_PMD_WARN(fmt, ...) \
+ SKELETON_PMD_LOG(WARNING, fmt, ##__VA_ARGS__)
/* Macros for self test application */
#define SKELETON_TEST_INFO SKELETON_PMD_INFO
#define SKELETON_TEST_DEBUG SKELETON_PMD_DEBUG
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index ebbaabff4d..99765feb41 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -21,10 +21,10 @@
#define SKELDEV_LOGS(level, ...) \
RTE_LOG_LINE(level, SKELETON_PMD, __VA_ARGS__)
-#define SKELDEV_TEST_INFO(fmt, args...) \
- SKELDEV_LOGS(INFO, fmt, ## args)
-#define SKELDEV_TEST_DEBUG(fmt, args...) \
- SKELDEV_LOGS(DEBUG, fmt, ## args)
+#define SKELDEV_TEST_INFO(fmt, ...) \
+ SKELDEV_LOGS(INFO, fmt, ## __VA_ARGS__)
+#define SKELDEV_TEST_DEBUG(fmt, ...) \
+ SKELDEV_LOGS(DEBUG, fmt, ## __VA_ARGS__)
#define SKELDEV_TEST_RUN(setup, teardown, test) \
skeldev_test_run(setup, teardown, test, #test)
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 15/21] drivers/vdpa: use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (13 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 14/21] drivers/raw: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 16/21] lib/log: ensure code structure does not change Andre Muezerie
` (7 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
Cc: dev, Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/vdpa/ifc/base/ifcvf_osdep.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/vdpa/ifc/base/ifcvf_osdep.h b/drivers/vdpa/ifc/base/ifcvf_osdep.h
index ba7d684c25..bbbde153ee 100644
--- a/drivers/vdpa/ifc/base/ifcvf_osdep.h
+++ b/drivers/vdpa/ifc/base/ifcvf_osdep.h
@@ -16,8 +16,8 @@
extern int ifcvf_vdpa_logtype;
#define RTE_LOGTYPE_IFCVF_VDPA ifcvf_vdpa_logtype
-#define WARNINGOUT(S, args...) RTE_LOG(WARNING, IFCVF_VDPA, S, ##args)
-#define DEBUGOUT(S, args...) RTE_LOG(DEBUG, IFCVF_VDPA, S, ##args)
+#define WARNINGOUT(S, ...) RTE_LOG(WARNING, IFCVF_VDPA, S, ##__VA_ARGS__)
+#define DEBUGOUT(S, ...) RTE_LOG(DEBUG, IFCVF_VDPA, S, ##__VA_ARGS__)
#define STATIC static
#define msec_delay(x) rte_delay_us_sleep(1000 * (x))
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 16/21] lib/log: ensure code structure does not change
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (14 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 15/21] drivers/vdpa: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 3:13 ` Stephen Hemminger
2024-12-11 2:05 ` [PATCH 17/21] lib/pipeline: " Andre Muezerie
` (6 subsequent siblings)
22 siblings, 1 reply; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, Andre Muezerie
Add "do { } while (0)" to macros used to remove logging calls, to
ensure there's no code structure change when enabling/disabling
logging.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
lib/log/rte_log.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 3735137150..6b00caab88 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -364,7 +364,7 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
static_assert(!__builtin_strchr(fmt, '\n'), \
"This log format string contains a \\n")
#else
-#define RTE_LOG_CHECK_NO_NEWLINE(...)
+#define RTE_LOG_CHECK_NO_NEWLINE(...) do { } while (0)
#endif
/**
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 17/21] lib/pipeline: ensure code structure does not change
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (15 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 16/21] lib/log: ensure code structure does not change Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 18/21] lib/port: " Andre Muezerie
` (5 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Cristian Dumitrescu; +Cc: dev, Andre Muezerie
Add "do { } while (0)" to macros used to remove logging calls, to
ensure there's no code structure change when enabling/disabling
logging.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
lib/pipeline/rte_swx_pipeline_internal.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h
index df864ea066..d6213bbe16 100644
--- a/lib/pipeline/rte_swx_pipeline_internal.h
+++ b/lib/pipeline/rte_swx_pipeline_internal.h
@@ -27,7 +27,7 @@
#if TRACE_LEVEL
#define TRACE(...) printf(__VA_ARGS__)
#else
-#define TRACE(...)
+#define TRACE(...) do { } while (0)
#endif
/*
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 18/21] lib/port: ensure code structure does not change
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (16 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 17/21] lib/pipeline: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 19/21] lib/power: " Andre Muezerie
` (4 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Cristian Dumitrescu; +Cc: dev, Andre Muezerie
Add "do { } while (0)" to macros used to remove logging calls, to
ensure there's no code structure change when enabling/disabling
logging.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
lib/port/rte_swx_port_ethdev.c | 2 +-
lib/port/rte_swx_port_fd.c | 2 +-
lib/port/rte_swx_port_ring.c | 2 +-
lib/port/rte_swx_port_source_sink.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/port/rte_swx_port_ethdev.c b/lib/port/rte_swx_port_ethdev.c
index 7cb3c4dfb1..71dabae826 100644
--- a/lib/port/rte_swx_port_ethdev.c
+++ b/lib/port/rte_swx_port_ethdev.c
@@ -25,7 +25,7 @@ do { \
#if TRACE_LEVEL
#define TRACE(...) printf(__VA_ARGS__)
#else
-#define TRACE(...)
+#define TRACE(...) do { } while (0)
#endif
/*
diff --git a/lib/port/rte_swx_port_fd.c b/lib/port/rte_swx_port_fd.c
index 4bbad2eaa7..f315db285f 100644
--- a/lib/port/rte_swx_port_fd.c
+++ b/lib/port/rte_swx_port_fd.c
@@ -18,7 +18,7 @@
#if TRACE_LEVEL
#define TRACE(...) printf(__VA_ARGS__)
#else
-#define TRACE(...)
+#define TRACE(...) do { } while (0)
#endif
/*
diff --git a/lib/port/rte_swx_port_ring.c b/lib/port/rte_swx_port_ring.c
index af541a2fa2..1f7abc0584 100644
--- a/lib/port/rte_swx_port_ring.c
+++ b/lib/port/rte_swx_port_ring.c
@@ -18,7 +18,7 @@
#if TRACE_LEVEL
#define TRACE(...) printf(__VA_ARGS__)
#else
-#define TRACE(...)
+#define TRACE(...) do { } while (0)
#endif
/*
diff --git a/lib/port/rte_swx_port_source_sink.c b/lib/port/rte_swx_port_source_sink.c
index 757a2c4a2e..9f080f2e93 100644
--- a/lib/port/rte_swx_port_source_sink.c
+++ b/lib/port/rte_swx_port_source_sink.c
@@ -28,7 +28,7 @@ do { \
#if TRACE_LEVEL
#define TRACE(...) printf(__VA_ARGS__)
#else
-#define TRACE(...)
+#define TRACE(...) do { } while (0)
#endif
/*
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 19/21] lib/power: ensure code structure does not change
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (17 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 18/21] lib/port: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 20/21] lib/rcu: " Andre Muezerie
` (3 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Anatoly Burakov, David Hunt, Sivaprasad Tummala; +Cc: dev, Andre Muezerie
Add "do { } while (0)" to macros used to remove logging calls, to
ensure there's no code structure change when enabling/disabling
logging.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
lib/power/power_common.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/power/power_common.h b/lib/power/power_common.h
index 3f56b1103d..83a30858fe 100644
--- a/lib/power/power_common.h
+++ b/lib/power/power_common.h
@@ -20,7 +20,7 @@ extern int rte_power_logtype;
#define POWER_DEBUG_LOG(...) \
RTE_LOG_LINE_PREFIX(ERR, POWER, "%s: ", __func__, __VA_ARGS__)
#else
-#define POWER_DEBUG_LOG(...)
+#define POWER_DEBUG_LOG(...) do { } while (0)
#endif
/* check if scaling driver matches one we want */
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 20/21] lib/rcu: ensure code structure does not change
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (18 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 19/21] lib/power: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 21/21] lib/vhost: " Andre Muezerie
` (2 subsequent siblings)
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Honnappa Nagarahalli; +Cc: dev, Andre Muezerie
Add "do { } while (0)" to macros used to remove logging calls, to
ensure there's no code structure change when enabling/disabling
logging.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
lib/rcu/rte_rcu_qsbr.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/rcu/rte_rcu_qsbr.h b/lib/rcu/rte_rcu_qsbr.h
index 550fadf56a..040bb273e9 100644
--- a/lib/rcu/rte_rcu_qsbr.h
+++ b/lib/rcu/rte_rcu_qsbr.h
@@ -52,7 +52,7 @@ extern int rte_rcu_log_type;
RTE_LOG_LINE_PREFIX(level, RCU, "%s(): ", __func__, __VA_ARGS__); \
} while (0)
#else
-#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, ...)
+#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, ...) do { } while (0)
#endif
/* Registered thread IDs are stored as a bitmap of 64b element array.
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 21/21] lib/vhost: ensure code structure does not change
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (19 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 20/21] lib/rcu: " Andre Muezerie
@ 2024-12-11 2:05 ` Andre Muezerie
2024-12-11 3:14 ` [PATCH 00/21] use portable variadic macros Stephen Hemminger
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
22 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 2:05 UTC (permalink / raw)
To: Maxime Coquelin, Chenbo Xia; +Cc: dev, Andre Muezerie
Add "do { } while (0)" to macros used to remove logging calls, to
ensure there's no code structure change when enabling/disabling
logging.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
lib/vhost/vhost_crypto.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 7caf6d9afa..b5679380f5 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -33,7 +33,7 @@ RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
RTE_LOG_LINE_PREFIX(DEBUG, VHOST_CRYPTO, "%s() line %u: ", \
__func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
#else
-#define VC_LOG_DBG(...)
+#define VC_LOG_DBG(...) do { } while (0)
#endif
#define VIRTIO_CRYPTO_FEATURES ((1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | \
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 16/21] lib/log: ensure code structure does not change
2024-12-11 2:05 ` [PATCH 16/21] lib/log: ensure code structure does not change Andre Muezerie
@ 2024-12-11 3:13 ` Stephen Hemminger
2024-12-11 16:16 ` Andre Muezerie
0 siblings, 1 reply; 42+ messages in thread
From: Stephen Hemminger @ 2024-12-11 3:13 UTC (permalink / raw)
To: Andre Muezerie; +Cc: dev
On Tue, 10 Dec 2024 18:05:46 -0800
Andre Muezerie <andremue@linux.microsoft.com> wrote:
> Add "do { } while (0)" to macros used to remove logging calls, to
> ensure there's no code structure change when enabling/disabling
> logging.
>
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
> ---
> lib/log/rte_log.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
> index 3735137150..6b00caab88 100644
> --- a/lib/log/rte_log.h
> +++ b/lib/log/rte_log.h
> @@ -364,7 +364,7 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
> static_assert(!__builtin_strchr(fmt, '\n'), \
> "This log format string contains a \\n")
> #else
> -#define RTE_LOG_CHECK_NO_NEWLINE(...)
> +#define RTE_LOG_CHECK_NO_NEWLINE(...) do { } while (0)
> #endif
>
> /**
NAK
this is a change since static_assert() can be put anywhere like outside
of code blocks. This patch is not needed.
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 00/21] use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (20 preceding siblings ...)
2024-12-11 2:05 ` [PATCH 21/21] lib/vhost: " Andre Muezerie
@ 2024-12-11 3:14 ` Stephen Hemminger
2024-12-11 21:35 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
22 siblings, 1 reply; 42+ messages in thread
From: Stephen Hemminger @ 2024-12-11 3:14 UTC (permalink / raw)
To: Andre Muezerie; +Cc: dev
On Tue, 10 Dec 2024 18:05:30 -0800
Andre Muezerie <andremue@linux.microsoft.com> wrote:
> 1) Use portable variadic macros
>
> Many places are using a GCC extension related to variadic macros,
> where a name prepends the ellipsis. This results in a warning like
> the one below when compiling the code with MSVC:
>
> app\test-pmd\testpmd.h(1314): error C2608:
> invalid token '...' in macro parameter list
>
> Variadic macros became a standard part of the C language with C99.
> GCC, Clang and MSVC handle them properly.
>
> The fix is to remove the prefix name (args... becomes ...) and use
> __VA_ARGS__.
Could you add a coccinelle script and/or a checkpatch check to
make sure that there are no new usages of ellipsis arg to deal with?
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 16/21] lib/log: ensure code structure does not change
2024-12-11 3:13 ` Stephen Hemminger
@ 2024-12-11 16:16 ` Andre Muezerie
0 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 16:16 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
On Tue, Dec 10, 2024 at 07:13:21PM -0800, Stephen Hemminger wrote:
> On Tue, 10 Dec 2024 18:05:46 -0800
> Andre Muezerie <andremue@linux.microsoft.com> wrote:
>
> > Add "do { } while (0)" to macros used to remove logging calls, to
> > ensure there's no code structure change when enabling/disabling
> > logging.
> >
> > Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
> > ---
> > lib/log/rte_log.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
> > index 3735137150..6b00caab88 100644
> > --- a/lib/log/rte_log.h
> > +++ b/lib/log/rte_log.h
> > @@ -364,7 +364,7 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
> > static_assert(!__builtin_strchr(fmt, '\n'), \
> > "This log format string contains a \\n")
> > #else
> > -#define RTE_LOG_CHECK_NO_NEWLINE(...)
> > +#define RTE_LOG_CHECK_NO_NEWLINE(...) do { } while (0)
> > #endif
> >
> > /**
>
> NAK
> this is a change since static_assert() can be put anywhere like outside
> of code blocks. This patch is not needed.
Understood. I'll remove these changes from the series then.
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 00/21] use portable variadic macros
2024-12-11 3:14 ` [PATCH 00/21] use portable variadic macros Stephen Hemminger
@ 2024-12-11 21:35 ` Andre Muezerie
0 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 21:35 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
On Tue, Dec 10, 2024 at 07:14:56PM -0800, Stephen Hemminger wrote:
> On Tue, 10 Dec 2024 18:05:30 -0800
> Andre Muezerie <andremue@linux.microsoft.com> wrote:
>
> > 1) Use portable variadic macros
> >
> > Many places are using a GCC extension related to variadic macros,
> > where a name prepends the ellipsis. This results in a warning like
> > the one below when compiling the code with MSVC:
> >
> > app\test-pmd\testpmd.h(1314): error C2608:
> > invalid token '...' in macro parameter list
> >
> > Variadic macros became a standard part of the C language with C99.
> > GCC, Clang and MSVC handle them properly.
> >
> > The fix is to remove the prefix name (args... becomes ...) and use
> > __VA_ARGS__.
>
> Could you add a coccinelle script and/or a checkpatch check to
> make sure that there are no new usages of ellipsis arg to deal with?
There is already a test for this in checkpatches.sh. Its message is:
MESSAGE='Do not use variadic argument pack in macros'
This test was probably added after these instances were written.
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 00/14] use portable variadic macros
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
` (21 preceding siblings ...)
2024-12-11 3:14 ` [PATCH 00/21] use portable variadic macros Stephen Hemminger
@ 2024-12-11 22:07 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 01/14] app/test-acl: " Andre Muezerie
` (13 more replies)
22 siblings, 14 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 22:07 UTC (permalink / raw)
To: dev; +Cc: Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
v2:
* Removed "do { } while (0)" that was added to macros in v1. As a
result, the patchset is now smaller.
Andre Muezerie (14):
app/test-acl: use portable variadic macros
app/test-eventdev: use portable variadic macros
app/test-mldev: use portable variadic macros
app/test-pmd: use portable variadic macros
drivers/bus: use portable variadic macros
drivers/common: use portable variadic macros
drivers/compress: use portable variadic macros
drivers/crypto: use portable variadic macros
drivers/dma: use portable variadic macros
drivers/event: use portable variadic macros
drivers/mempool: use portable variadic macros
drivers/net: use portable variadic macros
drivers/raw: use portable variadic macros
drivers/vdpa: use portable variadic macros
app/test-acl/main.c | 4 +-
app/test-eventdev/evt_common.h | 12 ++--
app/test-mldev/ml_common.h | 7 ++-
app/test-pmd/testpmd.h | 4 +-
drivers/bus/cdx/cdx_logs.h | 12 ++--
drivers/bus/dpaa/include/fman.h | 4 +-
drivers/bus/dpaa/rte_dpaa_logs.h | 18 +++---
drivers/bus/fslmc/fslmc_logs.h | 12 ++--
drivers/bus/fslmc/qbman/include/compat.h | 14 ++---
drivers/bus/ifpga/ifpga_logs.h | 16 ++---
drivers/bus/uacce/uacce.c | 8 +--
drivers/common/dpaax/compat.h | 16 ++---
drivers/common/dpaax/dpaax_logs.h | 18 +++---
drivers/common/idpf/base/idpf_osdep.h | 8 ++-
drivers/compress/octeontx/otx_zip.h | 8 +--
drivers/compress/zlib/zlib_pmd_private.h | 12 ++--
drivers/crypto/caam_jr/caam_jr_log.h | 28 ++++-----
drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h | 28 ++++-----
drivers/crypto/dpaa_sec/dpaa_sec_log.h | 28 ++++-----
drivers/crypto/virtio/virtio_logs.h | 60 +++++++++----------
drivers/dma/dpaa/dpaa_qdma_logs.h | 24 ++++----
drivers/dma/dpaa2/dpaa2_qdma_logs.h | 24 ++++----
drivers/dma/idxd/idxd_internal.h | 8 +--
drivers/dma/ioat/ioat_internal.h | 8 +--
drivers/event/dlb2/dlb2_log.h | 8 +--
drivers/event/dlb2/pf/base/dlb2_osdep.h | 12 ++--
drivers/event/dpaa/dpaa_eventdev.h | 16 ++---
drivers/event/dpaa2/dpaa2_eventdev_logs.h | 12 ++--
drivers/event/dsw/dsw_evdev.h | 8 +--
drivers/event/sw/sw_evdev_log.h | 12 ++--
drivers/mempool/dpaa/dpaa_mempool.h | 20 +++----
drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h | 30 +++++-----
drivers/net/ark/ark_logs.h | 4 +-
drivers/net/bnxt/tf_core/cfa_tcam_mgr.h | 12 ++--
drivers/net/bnxt/tf_core/tfp.h | 8 +--
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h | 4 +-
drivers/net/dpaa/dpaa_ethdev.h | 16 ++---
drivers/net/dpaa/fmlib/fm_ext.h | 4 +-
drivers/net/dpaa2/dpaa2_pmd_logs.h | 28 ++++-----
drivers/net/e1000/base/e1000_osdep.h | 10 ++--
drivers/net/ena/base/ena_plat_dpdk.h | 14 ++---
drivers/net/enetc/enetc_logs.h | 32 +++++-----
drivers/net/enetfec/enet_pmd_logs.h | 18 +++---
drivers/net/enic/enic_compat.h | 16 ++---
drivers/net/fm10k/base/fm10k_osdep.h | 10 ++--
drivers/net/hns3/hns3_logs.h | 20 +++----
drivers/net/i40e/base/i40e_osdep.h | 2 +-
drivers/net/ice/base/ice_osdep.h | 4 +-
drivers/net/igc/base/igc_osdep.h | 10 ++--
drivers/net/ipn3ke/ipn3ke_logs.h | 16 ++---
drivers/net/ixgbe/base/ixgbe_osdep.h | 30 +++++-----
drivers/net/ngbe/base/ngbe_osdep.h | 2 +-
drivers/net/ngbe/ngbe_logs.h | 2 +-
drivers/net/pfe/pfe_logs.h | 18 +++---
drivers/net/qede/qede_ethdev.h | 4 +-
drivers/net/qede/qede_logs.h | 16 ++---
drivers/net/sfc/sfc_debug.h | 4 +-
drivers/net/txgbe/base/txgbe_osdep.h | 2 +-
drivers/net/txgbe/txgbe_logs.h | 2 +-
drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 24 ++++----
drivers/raw/ifpga/base/opae_debug.h | 4 +-
drivers/raw/ifpga/base/opae_osdep.h | 20 +++----
.../raw/ifpga/base/osdep_rte/osdep_generic.h | 4 +-
drivers/raw/ifpga/ifpga_rawdev.h | 16 ++---
drivers/raw/skeleton/skeleton_rawdev.h | 16 ++---
drivers/raw/skeleton/skeleton_rawdev_test.c | 8 +--
drivers/vdpa/ifc/base/ifcvf_osdep.h | 4 +-
67 files changed, 453 insertions(+), 450 deletions(-)
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 01/14] app/test-acl: use portable variadic macros
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
@ 2024-12-11 22:07 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 02/14] app/test-eventdev: " Andre Muezerie
` (12 subsequent siblings)
13 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 22:07 UTC (permalink / raw)
To: dev; +Cc: Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
app/test-acl/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/test-acl/main.c b/app/test-acl/main.c
index 41ce83db08..3a791b3ccf 100644
--- a/app/test-acl/main.c
+++ b/app/test-acl/main.c
@@ -423,9 +423,9 @@ static const char cb_port_delim[] = ":";
static char line[LINE_MAX];
-#define dump_verbose(lvl, fh, fmt, args...) do { \
+#define dump_verbose(lvl, fh, fmt, ...) do { \
if ((lvl) <= (int32_t)config.verbose) \
- fprintf(fh, fmt, ##args); \
+ fprintf(fh, fmt, ##__VA_ARGS__); \
} while (0)
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 02/14] app/test-eventdev: use portable variadic macros
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 01/14] app/test-acl: " Andre Muezerie
@ 2024-12-11 22:07 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 03/14] app/test-mldev: " Andre Muezerie
` (11 subsequent siblings)
13 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 22:07 UTC (permalink / raw)
To: dev; +Cc: Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
app/test-eventdev/evt_common.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/test-eventdev/evt_common.h b/app/test-eventdev/evt_common.h
index 901b8ba55d..63b782f11a 100644
--- a/app/test-eventdev/evt_common.h
+++ b/app/test-eventdev/evt_common.h
@@ -18,16 +18,16 @@
#define CLGRN "\x1b[32m"
#define CLYEL "\x1b[33m"
-#define evt_err(fmt, args...) \
- fprintf(stderr, CLRED"error: %s() "fmt CLNRM "\n", __func__, ## args)
+#define evt_err(fmt, ...) \
+ fprintf(stderr, CLRED"error: %s() "fmt CLNRM "\n", __func__, ## __VA_ARGS__)
-#define evt_info(fmt, args...) \
- fprintf(stdout, CLYEL""fmt CLNRM "\n", ## args)
+#define evt_info(fmt, ...) \
+ fprintf(stdout, CLYEL""fmt CLNRM "\n", ## __VA_ARGS__)
#define EVT_STR_FMT 20
-#define evt_dump(str, fmt, val...) \
- printf("\t%-*s : "fmt"\n", EVT_STR_FMT, str, ## val)
+#define evt_dump(str, fmt, ...) \
+ printf("\t%-*s : "fmt"\n", EVT_STR_FMT, str, ## __VA_ARGS__)
#define evt_dump_begin(str) printf("\t%-*s : {", EVT_STR_FMT, str)
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 03/14] app/test-mldev: use portable variadic macros
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 01/14] app/test-acl: " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 02/14] app/test-eventdev: " Andre Muezerie
@ 2024-12-11 22:07 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 04/14] app/test-pmd: " Andre Muezerie
` (10 subsequent siblings)
13 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 22:07 UTC (permalink / raw)
To: dev; +Cc: Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
app/test-mldev/ml_common.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/test-mldev/ml_common.h b/app/test-mldev/ml_common.h
index 8d7cc9eeb7..45faed352c 100644
--- a/app/test-mldev/ml_common.h
+++ b/app/test-mldev/ml_common.h
@@ -14,11 +14,12 @@
#define ML_STR_FMT 20
-#define ml_err(fmt, args...) fprintf(stderr, CLRED "error: %s() " fmt CLNRM "\n", __func__, ##args)
+#define ml_err(fmt, ...) \
+ fprintf(stderr, CLRED "error: %s() " fmt CLNRM "\n", __func__, ##__VA_ARGS__)
-#define ml_info(fmt, args...) fprintf(stdout, CLYEL "" fmt CLNRM "\n", ##args)
+#define ml_info(fmt, ...) fprintf(stdout, CLYEL "" fmt CLNRM "\n", ##__VA_ARGS__)
-#define ml_dump(str, fmt, val...) printf("\t%-*s : " fmt "\n", ML_STR_FMT, str, ##val)
+#define ml_dump(str, fmt, ...) printf("\t%-*s : " fmt "\n", ML_STR_FMT, str, ##__VA_ARGS__)
#define ml_dump_begin(str) printf("\t%-*s :\n\t{\n", ML_STR_FMT, str)
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 04/14] app/test-pmd: use portable variadic macros
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
` (2 preceding siblings ...)
2024-12-11 22:07 ` [PATCH v2 03/14] app/test-mldev: " Andre Muezerie
@ 2024-12-11 22:07 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 05/14] drivers/bus: " Andre Muezerie
` (9 subsequent siblings)
13 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 22:07 UTC (permalink / raw)
To: dev; +Cc: Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
app/test-pmd/testpmd.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 314482e69c..260e4761bd 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1311,7 +1311,7 @@ RTE_INIT(__##c) \
#endif
#endif /* __GCC__ */
-#define TESTPMD_LOG(level, fmt, args...) \
- rte_log(RTE_LOG_ ## level, testpmd_logtype, "testpmd: " fmt, ## args)
+#define TESTPMD_LOG(level, fmt, ...) \
+ rte_log(RTE_LOG_ ## level, testpmd_logtype, "testpmd: " fmt, ## __VA_ARGS__)
#endif /* _TESTPMD_H_ */
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 05/14] drivers/bus: use portable variadic macros
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
` (3 preceding siblings ...)
2024-12-11 22:07 ` [PATCH v2 04/14] app/test-pmd: " Andre Muezerie
@ 2024-12-11 22:07 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 06/14] drivers/common: " Andre Muezerie
` (8 subsequent siblings)
13 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 22:07 UTC (permalink / raw)
To: dev; +Cc: Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/bus/cdx/cdx_logs.h | 12 ++++++------
drivers/bus/dpaa/include/fman.h | 4 ++--
drivers/bus/dpaa/rte_dpaa_logs.h | 18 +++++++++---------
drivers/bus/fslmc/fslmc_logs.h | 12 ++++++------
drivers/bus/fslmc/qbman/include/compat.h | 14 +++++++-------
drivers/bus/ifpga/ifpga_logs.h | 16 ++++++++--------
drivers/bus/uacce/uacce.c | 8 ++++----
7 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/drivers/bus/cdx/cdx_logs.h b/drivers/bus/cdx/cdx_logs.h
index 18b4010746..2d5c213417 100644
--- a/drivers/bus/cdx/cdx_logs.h
+++ b/drivers/bus/cdx/cdx_logs.h
@@ -15,11 +15,11 @@ extern int cdx_logtype_bus;
#define CDX_BUS_DEBUG(...) \
RTE_LOG_LINE_PREFIX(DEBUG, CDX_BUS, "%s(): ", __func__, __VA_ARGS__)
-#define CDX_BUS_INFO(fmt, args...) \
- CDX_BUS_LOG(INFO, fmt, ## args)
-#define CDX_BUS_ERR(fmt, args...) \
- CDX_BUS_LOG(ERR, fmt, ## args)
-#define CDX_BUS_WARN(fmt, args...) \
- CDX_BUS_LOG(WARNING, fmt, ## args)
+#define CDX_BUS_INFO(fmt, ...) \
+ CDX_BUS_LOG(INFO, fmt, ## __VA_ARGS__)
+#define CDX_BUS_ERR(fmt, ...) \
+ CDX_BUS_LOG(ERR, fmt, ## __VA_ARGS__)
+#define CDX_BUS_WARN(fmt, ...) \
+ CDX_BUS_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* CDX_LOGS_H */
diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h
index 01ef503117..134f0dc8ff 100644
--- a/drivers/bus/dpaa/include/fman.h
+++ b/drivers/bus/dpaa/include/fman.h
@@ -477,10 +477,10 @@ extern int fman_ccsr_map_fd;
#define fman_if_for_each_bpool(bp, __if) \
list_for_each_entry(bp, &(__if)->bpool_list, node)
-#define FMAN_ERR(rc, fmt, args...) \
+#define FMAN_ERR(rc, fmt, ...) \
do { \
_errno = (rc); \
- RTE_LOG_LINE(ERR, DPAA_BUS, fmt "(%d)", ##args, errno); \
+ RTE_LOG_LINE(ERR, DPAA_BUS, fmt "(%d)", ##__VA_ARGS__, errno); \
} while (0)
#define FMAN_IP_REV_1 0xC30C4
diff --git a/drivers/bus/dpaa/rte_dpaa_logs.h b/drivers/bus/dpaa/rte_dpaa_logs.h
index 1e61b4e76b..235c617edd 100644
--- a/drivers/bus/dpaa/rte_dpaa_logs.h
+++ b/drivers/bus/dpaa/rte_dpaa_logs.h
@@ -16,13 +16,13 @@ extern int dpaa_logtype_bus;
RTE_LOG_LINE(level, DPAA_BUS, __VA_ARGS__)
#ifdef RTE_LIBRTE_DPAA_DEBUG_BUS
-#define DPAA_BUS_HWWARN(cond, fmt, args...) \
+#define DPAA_BUS_HWWARN(cond, fmt, ...) \
do {\
if (cond) \
- DPAA_BUS_LOG(DEBUG, "WARN: " fmt, ##args); \
+ DPAA_BUS_LOG(DEBUG, "WARN: " fmt, ##__VA_ARGS__); \
} while (0)
#else
-#define DPAA_BUS_HWWARN(cond, fmt, args...) do { } while (0)
+#define DPAA_BUS_HWWARN(cond, fmt, ...) do { } while (0)
#endif
#define DPAA_BUS_DEBUG(...) \
@@ -30,11 +30,11 @@ extern int dpaa_logtype_bus;
#define BUS_INIT_FUNC_TRACE() DPAA_BUS_DEBUG(" >>")
-#define DPAA_BUS_INFO(fmt, args...) \
- DPAA_BUS_LOG(INFO, fmt, ## args)
-#define DPAA_BUS_ERR(fmt, args...) \
- DPAA_BUS_LOG(ERR, fmt, ## args)
-#define DPAA_BUS_WARN(fmt, args...) \
- DPAA_BUS_LOG(WARNING, fmt, ## args)
+#define DPAA_BUS_INFO(fmt, ...) \
+ DPAA_BUS_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_BUS_ERR(fmt, ...) \
+ DPAA_BUS_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA_BUS_WARN(fmt, ...) \
+ DPAA_BUS_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _DPAA_LOGS_H_ */
diff --git a/drivers/bus/fslmc/fslmc_logs.h b/drivers/bus/fslmc/fslmc_logs.h
index ac0cd3dc29..412d160d11 100644
--- a/drivers/bus/fslmc/fslmc_logs.h
+++ b/drivers/bus/fslmc/fslmc_logs.h
@@ -17,11 +17,11 @@ extern int dpaa2_logtype_bus;
#define DPAA2_BUS_DEBUG(...) \
RTE_LOG_LINE_PREFIX(DEBUG, DPAA2_BUS, "%s(): ", __func__, __VA_ARGS__)
-#define DPAA2_BUS_INFO(fmt, args...) \
- DPAA2_BUS_LOG(INFO, fmt, ## args)
-#define DPAA2_BUS_ERR(fmt, args...) \
- DPAA2_BUS_LOG(ERR, fmt, ## args)
-#define DPAA2_BUS_WARN(fmt, args...) \
- DPAA2_BUS_LOG(WARNING, fmt, ## args)
+#define DPAA2_BUS_INFO(fmt, ...) \
+ DPAA2_BUS_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_BUS_ERR(fmt, ...) \
+ DPAA2_BUS_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA2_BUS_WARN(fmt, ...) \
+ DPAA2_BUS_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _FSLMC_LOGS_H_ */
diff --git a/drivers/bus/fslmc/qbman/include/compat.h b/drivers/bus/fslmc/qbman/include/compat.h
index 4ac3254bc7..f3d61bb4a0 100644
--- a/drivers/bus/fslmc/qbman/include/compat.h
+++ b/drivers/bus/fslmc/qbman/include/compat.h
@@ -30,15 +30,15 @@
typedef uint64_t dma_addr_t;
/* Debugging */
-#define prflush(fmt, args...) \
+#define prflush(fmt, ...) \
do { \
- printf(fmt, ##args); \
+ printf(fmt, ##__VA_ARGS__); \
fflush(stdout); \
} while (0)
-#define pr_crit(fmt, args...) prflush("CRIT:" fmt, ##args)
-#define pr_err(fmt, args...) prflush("ERR:" fmt, ##args)
-#define pr_warn(fmt, args...) prflush("WARN:" fmt, ##args)
-#define pr_info(fmt, args...) prflush(fmt, ##args)
+#define pr_crit(fmt, ...) prflush("CRIT:" fmt, ##__VA_ARGS__)
+#define pr_err(fmt, ...) prflush("ERR:" fmt, ##__VA_ARGS__)
+#define pr_warn(fmt, ...) prflush("WARN:" fmt, ##__VA_ARGS__)
+#define pr_info(fmt, ...) prflush(fmt, ##__VA_ARGS__)
#ifdef RTE_LIBRTE_DPAA2_DEBUG_BUS
@@ -54,7 +54,7 @@ typedef uint64_t dma_addr_t;
#ifdef pr_debug
#undef pr_debug
#endif
-#define pr_debug(fmt, args...) printf(fmt, ##args)
+#define pr_debug(fmt, ...) printf(fmt, ##__VA_ARGS__)
#define QBMAN_BUG_ON(c) \
do { \
static int warned_##__LINE__; \
diff --git a/drivers/bus/ifpga/ifpga_logs.h b/drivers/bus/ifpga/ifpga_logs.h
index 154405a590..4289d9774b 100644
--- a/drivers/bus/ifpga/ifpga_logs.h
+++ b/drivers/bus/ifpga/ifpga_logs.h
@@ -15,13 +15,13 @@ extern int ifpga_bus_logtype;
#define IFPGA_BUS_FUNC_TRACE() IFPGA_BUS_LOG(DEBUG, ">>")
-#define IFPGA_BUS_DEBUG(fmt, args...) \
- IFPGA_BUS_LOG(DEBUG, fmt, ## args)
-#define IFPGA_BUS_INFO(fmt, args...) \
- IFPGA_BUS_LOG(INFO, fmt, ## args)
-#define IFPGA_BUS_ERR(fmt, args...) \
- IFPGA_BUS_LOG(ERR, fmt, ## args)
-#define IFPGA_BUS_WARN(fmt, args...) \
- IFPGA_BUS_LOG(WARNING, fmt, ## args)
+#define IFPGA_BUS_DEBUG(fmt, ...) \
+ IFPGA_BUS_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define IFPGA_BUS_INFO(fmt, ...) \
+ IFPGA_BUS_LOG(INFO, fmt, ## __VA_ARGS__)
+#define IFPGA_BUS_ERR(fmt, ...) \
+ IFPGA_BUS_LOG(ERR, fmt, ## __VA_ARGS__)
+#define IFPGA_BUS_WARN(fmt, ...) \
+ IFPGA_BUS_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _IFPGA_BUS_LOGS_H_ */
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index c1529c38c0..9ca048122d 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -62,10 +62,10 @@ extern int uacce_bus_logtype;
#define RTE_LOGTYPE_UACCE_BUS uacce_bus_logtype
#define UACCE_BUS_LOG(level, ...) \
RTE_LOG_LINE(level, UACCE_BUS, __VA_ARGS__)
-#define UACCE_BUS_ERR(fmt, args...) UACCE_BUS_LOG(ERR, fmt, ##args)
-#define UACCE_BUS_WARN(fmt, args...) UACCE_BUS_LOG(WARNING, fmt, ##args)
-#define UACCE_BUS_INFO(fmt, args...) UACCE_BUS_LOG(INFO, fmt, ##args)
-#define UACCE_BUS_DEBUG(fmt, args...) UACCE_BUS_LOG(DEBUG, fmt, ##args)
+#define UACCE_BUS_ERR(fmt, ...) UACCE_BUS_LOG(ERR, fmt, ##__VA_ARGS__)
+#define UACCE_BUS_WARN(fmt, ...) UACCE_BUS_LOG(WARNING, fmt, ##__VA_ARGS__)
+#define UACCE_BUS_INFO(fmt, ...) UACCE_BUS_LOG(INFO, fmt, ##__VA_ARGS__)
+#define UACCE_BUS_DEBUG(fmt, ...) UACCE_BUS_LOG(DEBUG, fmt, ##__VA_ARGS__)
static struct rte_devargs *
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 06/14] drivers/common: use portable variadic macros
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
` (4 preceding siblings ...)
2024-12-11 22:07 ` [PATCH v2 05/14] drivers/bus: " Andre Muezerie
@ 2024-12-11 22:07 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 07/14] drivers/compress: " Andre Muezerie
` (7 subsequent siblings)
13 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 22:07 UTC (permalink / raw)
To: dev; +Cc: Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/common/dpaax/compat.h | 16 ++++++++--------
drivers/common/dpaax/dpaax_logs.h | 18 +++++++++---------
drivers/common/idpf/base/idpf_osdep.h | 8 +++++---
3 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/drivers/common/dpaax/compat.h b/drivers/common/dpaax/compat.h
index 7c8d82c2b2..a7df70d5e6 100644
--- a/drivers/common/dpaax/compat.h
+++ b/drivers/common/dpaax/compat.h
@@ -70,28 +70,28 @@
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
/* Debugging */
-#define prflush(fmt, args...) \
+#define prflush(fmt, ...) \
do { \
- printf(fmt, ##args); \
+ printf(fmt, ##__VA_ARGS__); \
fflush(stdout); \
} while (0)
#ifndef pr_crit
-#define pr_crit(fmt, args...) prflush("CRIT:" fmt, ##args)
+#define pr_crit(fmt, ...) prflush("CRIT:" fmt, ##__VA_ARGS__)
#endif
#ifndef pr_err
-#define pr_err(fmt, args...) prflush("ERR:" fmt, ##args)
+#define pr_err(fmt, ...) prflush("ERR:" fmt, ##__VA_ARGS__)
#endif
#ifndef pr_warn
-#define pr_warn(fmt, args...) prflush("WARN:" fmt, ##args)
+#define pr_warn(fmt, ...) prflush("WARN:" fmt, ##__VA_ARGS__)
#endif
#ifndef pr_info
-#define pr_info(fmt, args...) prflush(fmt, ##args)
+#define pr_info(fmt, ...) prflush(fmt, ##__VA_ARGS__)
#endif
#ifndef pr_debug
#ifdef RTE_LIBRTE_DPAA_DEBUG_BUS
-#define pr_debug(fmt, args...) printf(fmt, ##args)
+#define pr_debug(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
-#define pr_debug(fmt, args...) {}
+#define pr_debug(fmt, ...) {}
#endif
#endif
diff --git a/drivers/common/dpaax/dpaax_logs.h b/drivers/common/dpaax/dpaax_logs.h
index 6ed29fb2ea..90f0c98863 100644
--- a/drivers/common/dpaax/dpaax_logs.h
+++ b/drivers/common/dpaax/dpaax_logs.h
@@ -11,13 +11,13 @@ extern int dpaax_logger;
#define RTE_LOGTYPE_DPAAX_LOGGER dpaax_logger
#ifdef RTE_LIBRTE_DPAAX_DEBUG
-#define DPAAX_HWWARN(cond, fmt, args...) \
+#define DPAAX_HWWARN(cond, fmt, ...) \
do {\
if (cond) \
- DPAAX_LOG(DEBUG, "WARN: " fmt, ##args); \
+ DPAAX_LOG(DEBUG, "WARN: " fmt, ##__VA_ARGS__); \
} while (0)
#else
-#define DPAAX_HWWARN(cond, fmt, args...) do { } while (0)
+#define DPAAX_HWWARN(cond, fmt, ...) do { } while (0)
#endif
#define DPAAX_LOG(level, ...) \
@@ -27,11 +27,11 @@ extern int dpaax_logger;
#define DPAAX_DEBUG(...) \
RTE_LOG_LINE_PREFIX(DEBUG, DPAAX_LOGGER, "%s(): ", __func__, __VA_ARGS__)
-#define DPAAX_INFO(fmt, args...) \
- DPAAX_LOG(INFO, fmt, ## args)
-#define DPAAX_ERR(fmt, args...) \
- DPAAX_LOG(ERR, fmt, ## args)
-#define DPAAX_WARN(fmt, args...) \
- DPAAX_LOG(WARNING, fmt, ## args)
+#define DPAAX_INFO(fmt, ...) \
+ DPAAX_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAAX_ERR(fmt, ...) \
+ DPAAX_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAAX_WARN(fmt, ...) \
+ DPAAX_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _DPAAX_LOGS_H_ */
diff --git a/drivers/common/idpf/base/idpf_osdep.h b/drivers/common/idpf/base/idpf_osdep.h
index cf9e553906..250f0ec500 100644
--- a/drivers/common/idpf/base/idpf_osdep.h
+++ b/drivers/common/idpf/base/idpf_osdep.h
@@ -42,7 +42,7 @@ typedef uint64_t s64;
typedef struct idpf_lock idpf_lock;
#define __iomem
-#define hw_dbg(hw, S, A...) do {} while (0)
+#define hw_dbg(hw, S, ...) do {} while (0)
#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
#define lower_32_bits(n) ((u32)(n))
#define low_16_bits(x) ((x) & 0xFFFF)
@@ -122,8 +122,10 @@ typedef struct idpf_lock idpf_lock;
##__VA_ARGS__); \
} while (0)
-#define idpf_info(hw, fmt, args...) idpf_debug(hw, IDPF_DBG_ALL, fmt, ##args)
-#define idpf_warn(hw, fmt, args...) idpf_debug(hw, IDPF_DBG_ALL, fmt, ##args)
+#define idpf_info(hw, fmt, ...) \
+ idpf_debug(hw, IDPF_DBG_ALL, fmt, ##__VA_ARGS__)
+#define idpf_warn(hw, fmt, ...) \
+ idpf_debug(hw, IDPF_DBG_ALL, fmt, ##__VA_ARGS__)
#define idpf_debug_array(hw, type, rowsize, groupsize, buf, len) \
do { \
struct idpf_hw *hw_l = hw; \
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 07/14] drivers/compress: use portable variadic macros
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
` (5 preceding siblings ...)
2024-12-11 22:07 ` [PATCH v2 06/14] drivers/common: " Andre Muezerie
@ 2024-12-11 22:07 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 08/14] drivers/crypto: " Andre Muezerie
` (6 subsequent siblings)
13 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 22:07 UTC (permalink / raw)
To: dev; +Cc: Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/compress/octeontx/otx_zip.h | 8 ++++----
drivers/compress/zlib/zlib_pmd_private.h | 12 ++++++------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/compress/octeontx/otx_zip.h b/drivers/compress/octeontx/otx_zip.h
index bf09e2f58c..6265664ead 100644
--- a/drivers/compress/octeontx/otx_zip.h
+++ b/drivers/compress/octeontx/otx_zip.h
@@ -80,10 +80,10 @@ extern int octtx_zip_logtype_driver;
#define ZIP_PMD_LOG(level, ...) \
RTE_LOG_LINE_PREFIX(level, OCTTX_ZIP_DRIVER, "%s(): ", __func__, __VA_ARGS__)
-#define ZIP_PMD_INFO(fmt, args...) \
- ZIP_PMD_LOG(INFO, fmt, ## args)
-#define ZIP_PMD_ERR(fmt, args...) \
- ZIP_PMD_LOG(ERR, fmt, ## args)
+#define ZIP_PMD_INFO(fmt, ...) \
+ ZIP_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define ZIP_PMD_ERR(fmt, ...) \
+ ZIP_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
/* resources required to process stream */
enum NUM_BUFS_PER_STREAM {
diff --git a/drivers/compress/zlib/zlib_pmd_private.h b/drivers/compress/zlib/zlib_pmd_private.h
index 7f6a57c6c5..fd8c4c55a4 100644
--- a/drivers/compress/zlib/zlib_pmd_private.h
+++ b/drivers/compress/zlib/zlib_pmd_private.h
@@ -19,12 +19,12 @@ extern int zlib_logtype_driver;
#define ZLIB_PMD_LOG(level, ...) \
RTE_LOG_LINE_PREFIX(level, ZLIB_DRIVER, "%s(): ", __func__, __VA_ARGS__)
-#define ZLIB_PMD_INFO(fmt, args...) \
- ZLIB_PMD_LOG(INFO, fmt, ## args)
-#define ZLIB_PMD_ERR(fmt, args...) \
- ZLIB_PMD_LOG(ERR, fmt, ## args)
-#define ZLIB_PMD_WARN(fmt, args...) \
- ZLIB_PMD_LOG(WARNING, fmt, ## args)
+#define ZLIB_PMD_INFO(fmt, ...) \
+ ZLIB_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define ZLIB_PMD_ERR(fmt, ...) \
+ ZLIB_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define ZLIB_PMD_WARN(fmt, ...) \
+ ZLIB_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
struct zlib_private {
struct rte_mempool *mp;
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 08/14] drivers/crypto: use portable variadic macros
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
` (6 preceding siblings ...)
2024-12-11 22:07 ` [PATCH v2 07/14] drivers/compress: " Andre Muezerie
@ 2024-12-11 22:07 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 09/14] drivers/dma: " Andre Muezerie
` (5 subsequent siblings)
13 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 22:07 UTC (permalink / raw)
To: dev; +Cc: Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/crypto/caam_jr/caam_jr_log.h | 28 +++++------
drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h | 28 +++++------
drivers/crypto/dpaa_sec/dpaa_sec_log.h | 28 +++++------
drivers/crypto/virtio/virtio_logs.h | 60 +++++++++++------------
4 files changed, 72 insertions(+), 72 deletions(-)
diff --git a/drivers/crypto/caam_jr/caam_jr_log.h b/drivers/crypto/caam_jr/caam_jr_log.h
index 7c50119106..18de668e10 100644
--- a/drivers/crypto/caam_jr/caam_jr_log.h
+++ b/drivers/crypto/caam_jr/caam_jr_log.h
@@ -18,24 +18,24 @@ extern int caam_jr_logtype;
#define PMD_INIT_FUNC_TRACE() CAAM_JR_DEBUG(" >>")
-#define CAAM_JR_INFO(fmt, args...) \
- CAAM_JR_LOG(INFO, fmt, ## args)
-#define CAAM_JR_ERR(fmt, args...) \
- CAAM_JR_LOG(ERR, fmt, ## args)
-#define CAAM_JR_WARN(fmt, args...) \
- CAAM_JR_LOG(WARNING, fmt, ## args)
+#define CAAM_JR_INFO(fmt, ...) \
+ CAAM_JR_LOG(INFO, fmt, ## __VA_ARGS__)
+#define CAAM_JR_ERR(fmt, ...) \
+ CAAM_JR_LOG(ERR, fmt, ## __VA_ARGS__)
+#define CAAM_JR_WARN(fmt, ...) \
+ CAAM_JR_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define CAAM_JR_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, CAAM_JR, __VA_ARGS__)
-#define CAAM_JR_DP_DEBUG(fmt, args...) \
- CAAM_JR_DP_LOG(DEBUG, fmt, ## args)
-#define CAAM_JR_DP_INFO(fmt, args...) \
- CAAM_JR_DP_LOG(INFO, fmt, ## args)
-#define CAAM_JR_DP_WARN(fmt, args...) \
- CAAM_JR_DP_LOG(WARNING, fmt, ## args)
-#define CAAM_JR_DP_ERR(fmt, args...) \
- CAAM_JR_DP_LOG(ERR, fmt, ## args)
+#define CAAM_JR_DP_DEBUG(fmt, ...) \
+ CAAM_JR_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define CAAM_JR_DP_INFO(fmt, ...) \
+ CAAM_JR_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define CAAM_JR_DP_WARN(fmt, ...) \
+ CAAM_JR_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
+#define CAAM_JR_DP_ERR(fmt, ...) \
+ CAAM_JR_DP_LOG(ERR, fmt, ## __VA_ARGS__)
#endif /* _CAAM_JR_LOG_H_ */
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h b/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h
index 53a5ebc760..5f2a0bf8e1 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h
@@ -19,25 +19,25 @@ extern int dpaa2_logtype_sec;
#define PMD_INIT_FUNC_TRACE() DPAA2_SEC_DEBUG(">>")
-#define DPAA2_SEC_INFO(fmt, args...) \
- DPAA2_SEC_LOG(INFO, fmt, ## args)
-#define DPAA2_SEC_ERR(fmt, args...) \
- DPAA2_SEC_LOG(ERR, fmt, ## args)
-#define DPAA2_SEC_WARN(fmt, args...) \
- DPAA2_SEC_LOG(WARNING, fmt, ## args)
+#define DPAA2_SEC_INFO(fmt, ...) \
+ DPAA2_SEC_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_SEC_ERR(fmt, ...) \
+ DPAA2_SEC_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA2_SEC_WARN(fmt, ...) \
+ DPAA2_SEC_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define DPAA2_SEC_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, DPAA2_SEC, __VA_ARGS__)
-#define DPAA2_SEC_DP_DEBUG(fmt, args...) \
- DPAA2_SEC_DP_LOG(DEBUG, fmt, ## args)
-#define DPAA2_SEC_DP_INFO(fmt, args...) \
- DPAA2_SEC_DP_LOG(INFO, fmt, ## args)
-#define DPAA2_SEC_DP_WARN(fmt, args...) \
- DPAA2_SEC_DP_LOG(WARNING, fmt, ## args)
-#define DPAA2_SEC_DP_ERR(fmt, args...) \
- DPAA2_SEC_DP_LOG(ERR, fmt, ## args)
+#define DPAA2_SEC_DP_DEBUG(fmt, ...) \
+ DPAA2_SEC_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA2_SEC_DP_INFO(fmt, ...) \
+ DPAA2_SEC_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_SEC_DP_WARN(fmt, ...) \
+ DPAA2_SEC_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
+#define DPAA2_SEC_DP_ERR(fmt, ...) \
+ DPAA2_SEC_DP_LOG(ERR, fmt, ## __VA_ARGS__)
#endif /* _DPAA2_SEC_LOGS_H_ */
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_log.h b/drivers/crypto/dpaa_sec/dpaa_sec_log.h
index 6ac02d07e1..0413bcd6d3 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_log.h
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_log.h
@@ -19,24 +19,24 @@ extern int dpaa_logtype_sec;
#define PMD_INIT_FUNC_TRACE() DPAA_SEC_DEBUG(" >>")
-#define DPAA_SEC_INFO(fmt, args...) \
- DPAA_SEC_LOG(INFO, fmt, ## args)
-#define DPAA_SEC_ERR(fmt, args...) \
- DPAA_SEC_LOG(ERR, fmt, ## args)
-#define DPAA_SEC_WARN(fmt, args...) \
- DPAA_SEC_LOG(WARNING, fmt, ## args)
+#define DPAA_SEC_INFO(fmt, ...) \
+ DPAA_SEC_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_SEC_ERR(fmt, ...) \
+ DPAA_SEC_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA_SEC_WARN(fmt, ...) \
+ DPAA_SEC_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define DPAA_SEC_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, DPAA_SEC, __VA_ARGS__)
-#define DPAA_SEC_DP_DEBUG(fmt, args...) \
- DPAA_SEC_DP_LOG(DEBUG, fmt, ## args)
-#define DPAA_SEC_DP_INFO(fmt, args...) \
- DPAA_SEC_DP_LOG(INFO, fmt, ## args)
-#define DPAA_SEC_DP_WARN(fmt, args...) \
- DPAA_SEC_DP_LOG(WARNING, fmt, ## args)
-#define DPAA_SEC_DP_ERR(fmt, args...) \
- DPAA_SEC_DP_LOG(ERR, fmt, ## args)
+#define DPAA_SEC_DP_DEBUG(fmt, ...) \
+ DPAA_SEC_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA_SEC_DP_INFO(fmt, ...) \
+ DPAA_SEC_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_SEC_DP_WARN(fmt, ...) \
+ DPAA_SEC_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
+#define DPAA_SEC_DP_ERR(fmt, ...) \
+ DPAA_SEC_DP_LOG(ERR, fmt, ## __VA_ARGS__)
#endif /* _DPAA_SEC_LOG_H_ */
diff --git a/drivers/crypto/virtio/virtio_logs.h b/drivers/crypto/virtio/virtio_logs.h
index a1afb90a98..988514919f 100644
--- a/drivers/crypto/virtio/virtio_logs.h
+++ b/drivers/crypto/virtio/virtio_logs.h
@@ -21,14 +21,14 @@ extern int virtio_crypto_logtype_init;
#define VIRTIO_CRYPTO_INIT_LOG_IMPL(level, ...) \
RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_INIT, "%s(): ", __func__, __VA_ARGS__)
-#define VIRTIO_CRYPTO_INIT_LOG_INFO(fmt, args...) \
- VIRTIO_CRYPTO_INIT_LOG_IMPL(INFO, fmt, ## args)
+#define VIRTIO_CRYPTO_INIT_LOG_INFO(fmt, ...) \
+ VIRTIO_CRYPTO_INIT_LOG_IMPL(INFO, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_INIT_LOG_DBG(fmt, args...) \
- VIRTIO_CRYPTO_INIT_LOG_IMPL(DEBUG, fmt, ## args)
+#define VIRTIO_CRYPTO_INIT_LOG_DBG(fmt, ...) \
+ VIRTIO_CRYPTO_INIT_LOG_IMPL(DEBUG, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_INIT_LOG_ERR(fmt, args...) \
- VIRTIO_CRYPTO_INIT_LOG_IMPL(ERR, fmt, ## args)
+#define VIRTIO_CRYPTO_INIT_LOG_ERR(fmt, ...) \
+ VIRTIO_CRYPTO_INIT_LOG_IMPL(ERR, fmt, ## __VA_ARGS__)
extern int virtio_crypto_logtype_session;
#define RTE_LOGTYPE_VIRTIO_CRYPTO_SESSION virtio_crypto_logtype_session
@@ -36,14 +36,14 @@ extern int virtio_crypto_logtype_session;
#define VIRTIO_CRYPTO_SESSION_LOG_IMPL(level, ...) \
RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_SESSION, "%s(): ", __func__, __VA_ARGS__)
-#define VIRTIO_CRYPTO_SESSION_LOG_INFO(fmt, args...) \
- VIRTIO_CRYPTO_SESSION_LOG_IMPL(INFO, fmt, ## args)
+#define VIRTIO_CRYPTO_SESSION_LOG_INFO(fmt, ...) \
+ VIRTIO_CRYPTO_SESSION_LOG_IMPL(INFO, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_SESSION_LOG_DBG(fmt, args...) \
- VIRTIO_CRYPTO_SESSION_LOG_IMPL(DEBUG, fmt, ## args)
+#define VIRTIO_CRYPTO_SESSION_LOG_DBG(fmt, ...) \
+ VIRTIO_CRYPTO_SESSION_LOG_IMPL(DEBUG, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_SESSION_LOG_ERR(fmt, args...) \
- VIRTIO_CRYPTO_SESSION_LOG_IMPL(ERR, fmt, ## args)
+#define VIRTIO_CRYPTO_SESSION_LOG_ERR(fmt, ...) \
+ VIRTIO_CRYPTO_SESSION_LOG_IMPL(ERR, fmt, ## __VA_ARGS__)
extern int virtio_crypto_logtype_rx;
#define RTE_LOGTYPE_VIRTIO_CRYPTO_RX virtio_crypto_logtype_rx
@@ -51,14 +51,14 @@ extern int virtio_crypto_logtype_rx;
#define VIRTIO_CRYPTO_RX_LOG_IMPL(level, ...) \
RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_RX, "%s(): ", __func__, __VA_ARGS__)
-#define VIRTIO_CRYPTO_RX_LOG_INFO(fmt, args...) \
- VIRTIO_CRYPTO_RX_LOG_IMPL(INFO, fmt, ## args)
+#define VIRTIO_CRYPTO_RX_LOG_INFO(fmt, ...) \
+ VIRTIO_CRYPTO_RX_LOG_IMPL(INFO, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_RX_LOG_DBG(fmt, args...) \
- VIRTIO_CRYPTO_RX_LOG_IMPL(DEBUG, fmt, ## args)
+#define VIRTIO_CRYPTO_RX_LOG_DBG(fmt, ...) \
+ VIRTIO_CRYPTO_RX_LOG_IMPL(DEBUG, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_RX_LOG_ERR(fmt, args...) \
- VIRTIO_CRYPTO_RX_LOG_IMPL(ERR, fmt, ## args)
+#define VIRTIO_CRYPTO_RX_LOG_ERR(fmt, ...) \
+ VIRTIO_CRYPTO_RX_LOG_IMPL(ERR, fmt, ## __VA_ARGS__)
extern int virtio_crypto_logtype_tx;
#define RTE_LOGTYPE_VIRTIO_CRYPTO_TX virtio_crypto_logtype_tx
@@ -66,14 +66,14 @@ extern int virtio_crypto_logtype_tx;
#define VIRTIO_CRYPTO_TX_LOG_IMPL(level, ...) \
RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_TX, "%s(): ", __func__, __VA_ARGS__)
-#define VIRTIO_CRYPTO_TX_LOG_INFO(fmt, args...) \
- VIRTIO_CRYPTO_TX_LOG_IMPL(INFO, fmt, ## args)
+#define VIRTIO_CRYPTO_TX_LOG_INFO(fmt, ...) \
+ VIRTIO_CRYPTO_TX_LOG_IMPL(INFO, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_TX_LOG_DBG(fmt, args...) \
- VIRTIO_CRYPTO_TX_LOG_IMPL(DEBUG, fmt, ## args)
+#define VIRTIO_CRYPTO_TX_LOG_DBG(fmt, ...) \
+ VIRTIO_CRYPTO_TX_LOG_IMPL(DEBUG, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_TX_LOG_ERR(fmt, args...) \
- VIRTIO_CRYPTO_TX_LOG_IMPL(ERR, fmt, ## args)
+#define VIRTIO_CRYPTO_TX_LOG_ERR(fmt, ...) \
+ VIRTIO_CRYPTO_TX_LOG_IMPL(ERR, fmt, ## __VA_ARGS__)
extern int virtio_crypto_logtype_driver;
#define RTE_LOGTYPE_VIRTIO_CRYPTO_DRIVER virtio_crypto_logtype_driver
@@ -81,13 +81,13 @@ extern int virtio_crypto_logtype_driver;
#define VIRTIO_CRYPTO_DRV_LOG_IMPL(level, ...) \
RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_DRIVER, "%s(): ", __func__, __VA_ARGS__)
-#define VIRTIO_CRYPTO_DRV_LOG_INFO(fmt, args...) \
- VIRTIO_CRYPTO_DRV_LOG_IMPL(INFO, fmt, ## args)
+#define VIRTIO_CRYPTO_DRV_LOG_INFO(fmt, ...) \
+ VIRTIO_CRYPTO_DRV_LOG_IMPL(INFO, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_DRV_LOG_DBG(fmt, args...) \
- VIRTIO_CRYPTO_DRV_LOG_IMPL(DEBUG, fmt, ## args)
+#define VIRTIO_CRYPTO_DRV_LOG_DBG(fmt, ...) \
+ VIRTIO_CRYPTO_DRV_LOG_IMPL(DEBUG, fmt, ## __VA_ARGS__)
-#define VIRTIO_CRYPTO_DRV_LOG_ERR(fmt, args...) \
- VIRTIO_CRYPTO_DRV_LOG_IMPL(ERR, fmt, ## args)
+#define VIRTIO_CRYPTO_DRV_LOG_ERR(fmt, ...) \
+ VIRTIO_CRYPTO_DRV_LOG_IMPL(ERR, fmt, ## __VA_ARGS__)
#endif /* _VIRTIO_LOGS_H_ */
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 09/14] drivers/dma: use portable variadic macros
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
` (7 preceding siblings ...)
2024-12-11 22:07 ` [PATCH v2 08/14] drivers/crypto: " Andre Muezerie
@ 2024-12-11 22:07 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 10/14] drivers/event: " Andre Muezerie
` (4 subsequent siblings)
13 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 22:07 UTC (permalink / raw)
To: dev; +Cc: Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/dma/dpaa/dpaa_qdma_logs.h | 24 ++++++++++++------------
drivers/dma/dpaa2/dpaa2_qdma_logs.h | 24 ++++++++++++------------
drivers/dma/idxd/idxd_internal.h | 8 ++++----
drivers/dma/ioat/ioat_internal.h | 8 ++++----
4 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/drivers/dma/dpaa/dpaa_qdma_logs.h b/drivers/dma/dpaa/dpaa_qdma_logs.h
index 2d77255fd8..cbed89485f 100644
--- a/drivers/dma/dpaa/dpaa_qdma_logs.h
+++ b/drivers/dma/dpaa/dpaa_qdma_logs.h
@@ -16,22 +16,22 @@ extern int dpaa_qdma_logtype;
#define DPAA_QDMA_FUNC_TRACE() DPAA_QDMA_DEBUG(">>")
-#define DPAA_QDMA_INFO(fmt, args...) \
- DPAA_QDMA_LOG(INFO, fmt, ## args)
-#define DPAA_QDMA_ERR(fmt, args...) \
- DPAA_QDMA_LOG(ERR, fmt, ## args)
-#define DPAA_QDMA_WARN(fmt, args...) \
- DPAA_QDMA_LOG(WARNING, fmt, ## args)
+#define DPAA_QDMA_INFO(fmt, ...) \
+ DPAA_QDMA_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_QDMA_ERR(fmt, ...) \
+ DPAA_QDMA_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA_QDMA_WARN(fmt, ...) \
+ DPAA_QDMA_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define DPAA_QDMA_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, DPAA_QDMA, __VA_ARGS__)
-#define DPAA_QDMA_DP_DEBUG(fmt, args...) \
- DPAA_QDMA_DP_LOG(DEBUG, fmt, ## args)
-#define DPAA_QDMA_DP_INFO(fmt, args...) \
- DPAA_QDMA_DP_LOG(INFO, fmt, ## args)
-#define DPAA_QDMA_DP_WARN(fmt, args...) \
- DPAA_QDMA_DP_LOG(WARNING, fmt, ## args)
+#define DPAA_QDMA_DP_DEBUG(fmt, ...) \
+ DPAA_QDMA_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA_QDMA_DP_INFO(fmt, ...) \
+ DPAA_QDMA_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_QDMA_DP_WARN(fmt, ...) \
+ DPAA_QDMA_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* __DPAA_QDMA_LOGS_H__ */
diff --git a/drivers/dma/dpaa2/dpaa2_qdma_logs.h b/drivers/dma/dpaa2/dpaa2_qdma_logs.h
index 62ef60bcf2..50a865a56a 100644
--- a/drivers/dma/dpaa2/dpaa2_qdma_logs.h
+++ b/drivers/dma/dpaa2/dpaa2_qdma_logs.h
@@ -20,23 +20,23 @@ extern int dpaa2_qdma_logtype;
#define DPAA2_QDMA_FUNC_TRACE() DPAA2_QDMA_DEBUG(">>")
-#define DPAA2_QDMA_INFO(fmt, args...) \
- DPAA2_QDMA_LOG(INFO, fmt, ## args)
-#define DPAA2_QDMA_ERR(fmt, args...) \
- DPAA2_QDMA_LOG(ERR, fmt, ## args)
-#define DPAA2_QDMA_WARN(fmt, args...) \
- DPAA2_QDMA_LOG(WARNING, fmt, ## args)
+#define DPAA2_QDMA_INFO(fmt, ...) \
+ DPAA2_QDMA_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_QDMA_ERR(fmt, ...) \
+ DPAA2_QDMA_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA2_QDMA_WARN(fmt, ...) \
+ DPAA2_QDMA_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define DPAA2_QDMA_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, DPAA2_QDMA, __VA_ARGS__)
-#define DPAA2_QDMA_DP_DEBUG(fmt, args...) \
- DPAA2_QDMA_DP_LOG(DEBUG, fmt, ## args)
-#define DPAA2_QDMA_DP_INFO(fmt, args...) \
- DPAA2_QDMA_DP_LOG(INFO, fmt, ## args)
-#define DPAA2_QDMA_DP_WARN(fmt, args...) \
- DPAA2_QDMA_DP_LOG(WARNING, fmt, ## args)
+#define DPAA2_QDMA_DP_DEBUG(fmt, ...) \
+ DPAA2_QDMA_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA2_QDMA_DP_INFO(fmt, ...) \
+ DPAA2_QDMA_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_QDMA_DP_WARN(fmt, ...) \
+ DPAA2_QDMA_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
#ifdef __cplusplus
}
diff --git a/drivers/dma/idxd/idxd_internal.h b/drivers/dma/idxd/idxd_internal.h
index 99dc2b367e..b80a113455 100644
--- a/drivers/dma/idxd/idxd_internal.h
+++ b/drivers/dma/idxd/idxd_internal.h
@@ -25,10 +25,10 @@ extern int idxd_pmd_logtype;
#define IDXD_PMD_LOG(level, ...) \
RTE_LOG_LINE_PREFIX(level, IDXD_PMD, "%s(): ", __func__, __VA_ARGS__)
-#define IDXD_PMD_DEBUG(fmt, args...) IDXD_PMD_LOG(DEBUG, fmt, ## args)
-#define IDXD_PMD_INFO(fmt, args...) IDXD_PMD_LOG(INFO, fmt, ## args)
-#define IDXD_PMD_ERR(fmt, args...) IDXD_PMD_LOG(ERR, fmt, ## args)
-#define IDXD_PMD_WARN(fmt, args...) IDXD_PMD_LOG(WARNING, fmt, ## args)
+#define IDXD_PMD_DEBUG(fmt, ...) IDXD_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define IDXD_PMD_INFO(fmt, ...) IDXD_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define IDXD_PMD_ERR(fmt, ...) IDXD_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define IDXD_PMD_WARN(fmt, ...) IDXD_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
struct idxd_pci_common {
rte_spinlock_t lk;
diff --git a/drivers/dma/ioat/ioat_internal.h b/drivers/dma/ioat/ioat_internal.h
index 2da26b616f..a5b25701a4 100644
--- a/drivers/dma/ioat/ioat_internal.h
+++ b/drivers/dma/ioat/ioat_internal.h
@@ -40,9 +40,9 @@ extern int ioat_pmd_logtype;
#define IOAT_PMD_LOG(level, ...) \
RTE_LOG_LINE_PREFIX(level, IOAT_PMD, "%s(): ", __func__, __VA_ARGS__)
-#define IOAT_PMD_DEBUG(fmt, args...) IOAT_PMD_LOG(DEBUG, fmt, ## args)
-#define IOAT_PMD_INFO(fmt, args...) IOAT_PMD_LOG(INFO, fmt, ## args)
-#define IOAT_PMD_ERR(fmt, args...) IOAT_PMD_LOG(ERR, fmt, ## args)
-#define IOAT_PMD_WARN(fmt, args...) IOAT_PMD_LOG(WARNING, fmt, ## args)
+#define IOAT_PMD_DEBUG(fmt, ...) IOAT_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define IOAT_PMD_INFO(fmt, ...) IOAT_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define IOAT_PMD_ERR(fmt, ...) IOAT_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define IOAT_PMD_WARN(fmt, ...) IOAT_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _IOAT_INTERNAL_H_ */
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 10/14] drivers/event: use portable variadic macros
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
` (8 preceding siblings ...)
2024-12-11 22:07 ` [PATCH v2 09/14] drivers/dma: " Andre Muezerie
@ 2024-12-11 22:07 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 11/14] drivers/mempool: " Andre Muezerie
` (3 subsequent siblings)
13 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 22:07 UTC (permalink / raw)
To: dev; +Cc: Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/event/dlb2/dlb2_log.h | 8 ++++----
drivers/event/dlb2/pf/base/dlb2_osdep.h | 12 ++++++------
drivers/event/dpaa/dpaa_eventdev.h | 16 ++++++++--------
drivers/event/dpaa2/dpaa2_eventdev_logs.h | 12 ++++++------
drivers/event/dsw/dsw_evdev.h | 8 ++++----
drivers/event/sw/sw_evdev_log.h | 12 ++++++------
6 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/drivers/event/dlb2/dlb2_log.h b/drivers/event/dlb2/dlb2_log.h
index c9ce87681c..321ecdfd05 100644
--- a/drivers/event/dlb2/dlb2_log.h
+++ b/drivers/event/dlb2/dlb2_log.h
@@ -12,11 +12,11 @@ extern int eventdev_dlb2_log_level;
#define DLB2_LOG_IMPL(level, ...) \
RTE_LOG_LINE_PREFIX(level, EVENTDEV_DLB2, "%s", __func__, __VA_ARGS__)
-#define DLB2_LOG_INFO(fmt, args...) \
- DLB2_LOG_IMPL(INFO, fmt, ## args)
+#define DLB2_LOG_INFO(fmt, ...) \
+ DLB2_LOG_IMPL(INFO, fmt, ## __VA_ARGS__)
-#define DLB2_LOG_ERR(fmt, args...) \
- DLB2_LOG_IMPL(ERR, fmt, ## args)
+#define DLB2_LOG_ERR(fmt, ...) \
+ DLB2_LOG_IMPL(ERR, fmt, ## __VA_ARGS__)
/* remove debug logs at compile time unless actually debugging */
#define DLB2_LOG_LINE_DBG(...) \
diff --git a/drivers/event/dlb2/pf/base/dlb2_osdep.h b/drivers/event/dlb2/pf/base/dlb2_osdep.h
index 16c5e3b797..382a49090a 100644
--- a/drivers/event/dlb2/pf/base/dlb2_osdep.h
+++ b/drivers/event/dlb2/pf/base/dlb2_osdep.h
@@ -40,14 +40,14 @@
DLB2_PCI_REG_WRITE(DLB2_FUNC_REG_ADDR((hw), (reg)), (value))
/* Map to PMDs logging interface */
-#define DLB2_ERR(dev, fmt, args...) \
- RTE_LOG(ERR, EVENTDEV_DLB2, "%s" fmt, __func__, ## args)
+#define DLB2_ERR(dev, fmt, ...) \
+ RTE_LOG(ERR, EVENTDEV_DLB2, "%s" fmt, __func__, ## __VA_ARGS__)
-#define DLB2_INFO(dev, fmt, args...) \
- RTE_LOG(INFO, EVENTDEV_DLB2, "%s" fmt, __func__, ## args)
+#define DLB2_INFO(dev, fmt, ...) \
+ RTE_LOG(INFO, EVENTDEV_DLB2, "%s" fmt, __func__, ## __VA_ARGS__)
-#define DLB2_DEBUG(dev, fmt, args...) \
- RTE_LOG_DP(DEBUG, EVENTDEV_DLB2, fmt, ## args)
+#define DLB2_DEBUG(dev, fmt, ...) \
+ RTE_LOG_DP(DEBUG, EVENTDEV_DLB2, fmt, ## __VA_ARGS__)
/**
* os_udelay() - busy-wait for a number of microseconds
diff --git a/drivers/event/dpaa/dpaa_eventdev.h b/drivers/event/dpaa/dpaa_eventdev.h
index 5831ccb4e8..047c9781bd 100644
--- a/drivers/event/dpaa/dpaa_eventdev.h
+++ b/drivers/event/dpaa/dpaa_eventdev.h
@@ -82,13 +82,13 @@ struct dpaa_eventdev {
#define EVENTDEV_INIT_FUNC_TRACE() DPAA_EVENTDEV_LOG(DEBUG, " >>")
-#define DPAA_EVENTDEV_DEBUG(fmt, args...) \
- DPAA_EVENTDEV_LOG(DEBUG, fmt, ## args)
-#define DPAA_EVENTDEV_ERR(fmt, args...) \
- DPAA_EVENTDEV_LOG(ERR, fmt, ## args)
-#define DPAA_EVENTDEV_INFO(fmt, args...) \
- DPAA_EVENTDEV_LOG(INFO, fmt, ## args)
-#define DPAA_EVENTDEV_WARN(fmt, args...) \
- DPAA_EVENTDEV_LOG(WARNING, fmt, ## args)
+#define DPAA_EVENTDEV_DEBUG(fmt, ...) \
+ DPAA_EVENTDEV_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA_EVENTDEV_ERR(fmt, ...) \
+ DPAA_EVENTDEV_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA_EVENTDEV_INFO(fmt, ...) \
+ DPAA_EVENTDEV_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_EVENTDEV_WARN(fmt, ...) \
+ DPAA_EVENTDEV_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* __DPAA_EVENTDEV_H__ */
diff --git a/drivers/event/dpaa2/dpaa2_eventdev_logs.h b/drivers/event/dpaa2/dpaa2_eventdev_logs.h
index 12317ae39f..7145ac30b9 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev_logs.h
+++ b/drivers/event/dpaa2/dpaa2_eventdev_logs.h
@@ -16,12 +16,12 @@ extern int dpaa2_logtype_event;
#define EVENTDEV_INIT_FUNC_TRACE() DPAA2_EVENTDEV_DEBUG(" >>")
-#define DPAA2_EVENTDEV_INFO(fmt, args...) \
- DPAA2_EVENTDEV_LOG(INFO, fmt, ## args)
-#define DPAA2_EVENTDEV_ERR(fmt, args...) \
- DPAA2_EVENTDEV_LOG(ERR, fmt, ## args)
-#define DPAA2_EVENTDEV_WARN(fmt, args...) \
- DPAA2_EVENTDEV_LOG(WARNING, fmt, ## args)
+#define DPAA2_EVENTDEV_INFO(fmt, ...) \
+ DPAA2_EVENTDEV_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_EVENTDEV_ERR(fmt, ...) \
+ DPAA2_EVENTDEV_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA2_EVENTDEV_WARN(fmt, ...) \
+ DPAA2_EVENTDEV_LOG(WARNING, fmt, ## __VA_ARGS__)
#define dpaa2_evdev_info(fmt, ...) DPAA2_EVENTDEV_LOG(INFO, fmt, ##__VA_ARGS__)
#define dpaa2_evdev_dbg(fmt, ...) DPAA2_EVENTDEV_LOG(DEBUG, fmt, ##__VA_ARGS__)
diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h
index ce52498435..6b75bb13e3 100644
--- a/drivers/event/dsw/dsw_evdev.h
+++ b/drivers/event/dsw/dsw_evdev.h
@@ -303,11 +303,11 @@ dsw_pmd_priv(const struct rte_eventdev *eventdev)
extern int event_dsw_logtype;
#define RTE_LOGTYPE_EVENT_DSW event_dsw_logtype
-#define DSW_LOG_DP_LINE(level, fmt, args...) \
+#define DSW_LOG_DP_LINE(level, fmt, ...) \
RTE_LOG_DP_LINE(level, EVENT_DSW, "%s() line %u: " fmt, \
- __func__, __LINE__, ## args)
+ __func__, __LINE__, ## __VA_ARGS__)
-#define DSW_LOG_DP_PORT_LINE(level, port_id, fmt, args...) \
- DSW_LOG_DP_LINE(level, "<Port %d> " fmt, port_id, ## args)
+#define DSW_LOG_DP_PORT_LINE(level, port_id, fmt, ...) \
+ DSW_LOG_DP_LINE(level, "<Port %d> " fmt, port_id, ## __VA_ARGS__)
#endif
diff --git a/drivers/event/sw/sw_evdev_log.h b/drivers/event/sw/sw_evdev_log.h
index 50a707939c..68c18b3d07 100644
--- a/drivers/event/sw/sw_evdev_log.h
+++ b/drivers/event/sw/sw_evdev_log.h
@@ -11,13 +11,13 @@ extern int eventdev_sw_log_level;
#define SW_LOG_IMPL(level, ...) \
RTE_LOG_LINE_PREFIX(level, EVENT_SW, "%s", __func__, __VA_ARGS__)
-#define SW_LOG_INFO(fmt, args...) \
- SW_LOG_IMPL(INFO, fmt, ## args)
+#define SW_LOG_INFO(fmt, ...) \
+ SW_LOG_IMPL(INFO, fmt, ## __VA_ARGS__)
-#define SW_LOG_DBG(fmt, args...) \
- SW_LOG_IMPL(DEBUG, fmt, ## args)
+#define SW_LOG_DBG(fmt, ...) \
+ SW_LOG_IMPL(DEBUG, fmt, ## __VA_ARGS__)
-#define SW_LOG_ERR(fmt, args...) \
- SW_LOG_IMPL(ERR, fmt, ## args)
+#define SW_LOG_ERR(fmt, ...) \
+ SW_LOG_IMPL(ERR, fmt, ## __VA_ARGS__)
#endif /* _SW_EVDEV_LOG_H_ */
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 11/14] drivers/mempool: use portable variadic macros
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
` (9 preceding siblings ...)
2024-12-11 22:07 ` [PATCH v2 10/14] drivers/event: " Andre Muezerie
@ 2024-12-11 22:07 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 12/14] drivers/net: " Andre Muezerie
` (2 subsequent siblings)
13 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 22:07 UTC (permalink / raw)
To: dev; +Cc: Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/mempool/dpaa/dpaa_mempool.h | 20 ++++++-------
drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h | 30 +++++++++----------
2 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/drivers/mempool/dpaa/dpaa_mempool.h b/drivers/mempool/dpaa/dpaa_mempool.h
index 135520922f..0877068fdd 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.h
+++ b/drivers/mempool/dpaa/dpaa_mempool.h
@@ -65,15 +65,15 @@ extern struct dpaa_bp_info *rte_dpaa_bpid_info;
#define MEMPOOL_INIT_FUNC_TRACE() DPAA_MEMPOOL_LOG(DEBUG, " >>")
-#define DPAA_MEMPOOL_DPDEBUG(fmt, args...) \
- RTE_LOG_DP(DEBUG, DPAA_MEMPOOL, fmt, ## args)
-#define DPAA_MEMPOOL_DEBUG(fmt, args...) \
- DPAA_MEMPOOL_LOG(DEBUG, fmt, ## args)
-#define DPAA_MEMPOOL_ERR(fmt, args...) \
- DPAA_MEMPOOL_LOG(ERR, fmt, ## args)
-#define DPAA_MEMPOOL_INFO(fmt, args...) \
- DPAA_MEMPOOL_LOG(INFO, fmt, ## args)
-#define DPAA_MEMPOOL_WARN(fmt, args...) \
- DPAA_MEMPOOL_LOG(WARNING, fmt, ## args)
+#define DPAA_MEMPOOL_DPDEBUG(fmt, ...) \
+ RTE_LOG_DP(DEBUG, DPAA_MEMPOOL, fmt, ## __VA_ARGS__)
+#define DPAA_MEMPOOL_DEBUG(fmt, ...) \
+ DPAA_MEMPOOL_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA_MEMPOOL_ERR(fmt, ...) \
+ DPAA_MEMPOOL_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA_MEMPOOL_INFO(fmt, ...) \
+ DPAA_MEMPOOL_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_MEMPOOL_WARN(fmt, ...) \
+ DPAA_MEMPOOL_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h b/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h
index d69ef17a04..1ba7983206 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h
@@ -15,22 +15,22 @@ extern int dpaa2_logtype_mempool;
#define DPAA2_MEMPOOL_DEBUG(...) \
RTE_LOG_LINE_PREFIX(DEBUG, DPAA2_MEMPOOL, "%s(): ", __func__, __VA_ARGS__)
-#define DPAA2_MEMPOOL_INFO(fmt, args...) \
- DPAA2_MEMPOOL_LOG(INFO, fmt, ## args)
-#define DPAA2_MEMPOOL_ERR(fmt, args...) \
- DPAA2_MEMPOOL_LOG(ERR, fmt, ## args)
-#define DPAA2_MEMPOOL_WARN(fmt, args...) \
- DPAA2_MEMPOOL_LOG(WARNING, fmt, ## args)
+#define DPAA2_MEMPOOL_INFO(fmt, ...) \
+ DPAA2_MEMPOOL_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_MEMPOOL_ERR(fmt, ...) \
+ DPAA2_MEMPOOL_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA2_MEMPOOL_WARN(fmt, ...) \
+ DPAA2_MEMPOOL_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
-#define DPAA2_MEMPOOL_DP_LOG(level, fmt, args...) \
- RTE_LOG_DP(level, DPAA2_MEMPOOL, fmt, ## args)
-
-#define DPAA2_MEMPOOL_DP_DEBUG(fmt, args...) \
- DPAA2_MEMPOOL_DP_LOG(DEBUG, fmt, ## args)
-#define DPAA2_MEMPOOL_DP_INFO(fmt, args...) \
- DPAA2_MEMPOOL_DP_LOG(INFO, fmt, ## args)
-#define DPAA2_MEMPOOL_DP_WARN(fmt, args...) \
- DPAA2_MEMPOOL_DP_LOG(WARNING, fmt, ## args)
+#define DPAA2_MEMPOOL_DP_LOG(level, fmt, ...) \
+ RTE_LOG_DP(level, DPAA2_MEMPOOL, fmt, ## __VA_ARGS__)
+
+#define DPAA2_MEMPOOL_DP_DEBUG(fmt, ...) \
+ DPAA2_MEMPOOL_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA2_MEMPOOL_DP_INFO(fmt, ...) \
+ DPAA2_MEMPOOL_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_MEMPOOL_DP_WARN(fmt, ...) \
+ DPAA2_MEMPOOL_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _DPAA2_HW_MEMPOOL_LOGS_H_ */
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 12/14] drivers/net: use portable variadic macros
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
` (10 preceding siblings ...)
2024-12-11 22:07 ` [PATCH v2 11/14] drivers/mempool: " Andre Muezerie
@ 2024-12-11 22:07 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 13/14] drivers/raw: " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 14/14] drivers/vdpa: " Andre Muezerie
13 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 22:07 UTC (permalink / raw)
To: dev; +Cc: Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/net/ark/ark_logs.h | 4 +--
drivers/net/bnxt/tf_core/cfa_tcam_mgr.h | 12 ++++-----
drivers/net/bnxt/tf_core/tfp.h | 8 +++---
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h | 4 +--
drivers/net/dpaa/dpaa_ethdev.h | 16 ++++++------
drivers/net/dpaa/fmlib/fm_ext.h | 4 +--
drivers/net/dpaa2/dpaa2_pmd_logs.h | 28 ++++++++++-----------
drivers/net/e1000/base/e1000_osdep.h | 10 ++++----
drivers/net/ena/base/ena_plat_dpdk.h | 14 +++++------
drivers/net/enetc/enetc_logs.h | 32 ++++++++++++------------
drivers/net/enetfec/enet_pmd_logs.h | 18 ++++++-------
drivers/net/enic/enic_compat.h | 16 ++++++------
drivers/net/fm10k/base/fm10k_osdep.h | 10 ++++----
drivers/net/hns3/hns3_logs.h | 20 +++++++--------
drivers/net/i40e/base/i40e_osdep.h | 2 +-
drivers/net/ice/base/ice_osdep.h | 4 +--
drivers/net/igc/base/igc_osdep.h | 10 ++++----
drivers/net/ipn3ke/ipn3ke_logs.h | 16 ++++++------
drivers/net/ixgbe/base/ixgbe_osdep.h | 30 +++++++++++-----------
drivers/net/ngbe/base/ngbe_osdep.h | 2 +-
drivers/net/ngbe/ngbe_logs.h | 2 +-
drivers/net/pfe/pfe_logs.h | 18 ++++++-------
drivers/net/qede/qede_ethdev.h | 4 +--
drivers/net/qede/qede_logs.h | 16 ++++++------
drivers/net/sfc/sfc_debug.h | 4 +--
drivers/net/txgbe/base/txgbe_osdep.h | 2 +-
drivers/net/txgbe/txgbe_logs.h | 2 +-
27 files changed, 154 insertions(+), 154 deletions(-)
diff --git a/drivers/net/ark/ark_logs.h b/drivers/net/ark/ark_logs.h
index ca46d86c99..fb0f3eee5f 100644
--- a/drivers/net/ark/ark_logs.h
+++ b/drivers/net/ark/ark_logs.h
@@ -20,8 +20,8 @@
extern int ark_logtype;
-#define ARK_PMD_LOG(level, fmt, args...) \
- rte_log(RTE_LOG_ ##level, ark_logtype, "ARK: " fmt, ## args)
+#define ARK_PMD_LOG(level, fmt, ...) \
+ rte_log(RTE_LOG_ ##level, ark_logtype, "ARK: " fmt, ## __VA_ARGS__)
/* Debug macro to enable core debug code */
diff --git a/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h b/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h
index 6ac1156fbf..5801bf89eb 100644
--- a/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h
+++ b/drivers/net/bnxt/tf_core/cfa_tcam_mgr.h
@@ -25,13 +25,13 @@
#endif
/* Use TFP_DRV_LOG definition in tfp.h */
-#define CFA_TCAM_MGR_LOG(level, fmt, args...) \
- TFP_DRV_LOG(level, fmt, ## args)
-#define CFA_TCAM_MGR_LOG_DIR(level, dir, fmt, args...) \
- TFP_DRV_LOG(level, "%s: " fmt, tf_dir_2_str(dir), ## args)
-#define CFA_TCAM_MGR_LOG_DIR_TYPE(level, dir, type, fmt, args...) \
+#define CFA_TCAM_MGR_LOG(level, fmt, ...) \
+ TFP_DRV_LOG(level, fmt, ## __VA_ARGS__)
+#define CFA_TCAM_MGR_LOG_DIR(level, dir, fmt, ...) \
+ TFP_DRV_LOG(level, "%s: " fmt, tf_dir_2_str(dir), ## __VA_ARGS__)
+#define CFA_TCAM_MGR_LOG_DIR_TYPE(level, dir, type, fmt, ...) \
TFP_DRV_LOG(level, "%s: %s " fmt, tf_dir_2_str(dir), \
- cfa_tcam_mgr_tbl_2_str(type), ## args)
+ cfa_tcam_mgr_tbl_2_str(type), ## __VA_ARGS__)
#define CFA_TCAM_MGR_LOG_0(level, fmt) \
TFP_DRV_LOG(level, fmt)
diff --git a/drivers/net/bnxt/tf_core/tfp.h b/drivers/net/bnxt/tf_core/tfp.h
index 92f76004da..2103552d88 100644
--- a/drivers/net/bnxt/tf_core/tfp.h
+++ b/drivers/net/bnxt/tf_core/tfp.h
@@ -28,12 +28,12 @@ struct tfp_spinlock_parms {
rte_spinlock_t slock;
};
-#define TFP_DRV_LOG_RAW(level, fmt, args...) \
+#define TFP_DRV_LOG_RAW(level, fmt, ...) \
rte_log(RTE_LOG_ ## level, bnxt_logtype_driver, "%s(): " fmt, \
- __func__, ## args)
+ __func__, ## __VA_ARGS__)
-#define TFP_DRV_LOG(level, fmt, args...) \
- TFP_DRV_LOG_RAW(level, fmt, ## args)
+#define TFP_DRV_LOG(level, fmt, ...) \
+ TFP_DRV_LOG_RAW(level, fmt, ## __VA_ARGS__)
/**
* @file
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_tf_common.h b/drivers/net/bnxt/tf_ulp/bnxt_tf_common.h
index 4d9a1a7790..7fc70a3603 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_tf_common.h
+++ b/drivers/net/bnxt/tf_ulp/bnxt_tf_common.h
@@ -15,9 +15,9 @@
RTE_LOG(lvl, BNXT, "%s(): " fmt, __func__, ## __VA_ARGS__)
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
-#define BNXT_DRV_INF(fmt, args...) RTE_LOG(INFO, fmt, ## args)
+#define BNXT_DRV_INF(fmt, ...) RTE_LOG(INFO, fmt, ## __VA_ARGS__)
#else
-#define BNXT_DRV_INF(fmt, args...)
+#define BNXT_DRV_INF(fmt, ...)
#endif
#define BNXT_ULP_EM_FLOWS 8192
diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h
index 00f4fde571..be9398004f 100644
--- a/drivers/net/dpaa/dpaa_ethdev.h
+++ b/drivers/net/dpaa/dpaa_ethdev.h
@@ -281,14 +281,14 @@ extern int dpaa_logtype_pmd;
#define PMD_INIT_FUNC_TRACE() DPAA_PMD_LOG(DEBUG, " >>")
-#define DPAA_PMD_DEBUG(fmt, args...) \
- DPAA_PMD_LOG(DEBUG, fmt, ## args)
-#define DPAA_PMD_ERR(fmt, args...) \
- DPAA_PMD_LOG(ERR, fmt, ## args)
-#define DPAA_PMD_INFO(fmt, args...) \
- DPAA_PMD_LOG(INFO, fmt, ## args)
-#define DPAA_PMD_WARN(fmt, args...) \
- DPAA_PMD_LOG(WARNING, fmt, ## args)
+#define DPAA_PMD_DEBUG(fmt, ...) \
+ DPAA_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA_PMD_ERR(fmt, ...) \
+ DPAA_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA_PMD_INFO(fmt, ...) \
+ DPAA_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA_PMD_WARN(fmt, ...) \
+ DPAA_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define DPAA_DP_LOG(level, ...) \
diff --git a/drivers/net/dpaa/fmlib/fm_ext.h b/drivers/net/dpaa/fmlib/fm_ext.h
index 9a3193674e..7b8d85cc71 100644
--- a/drivers/net/dpaa/fmlib/fm_ext.h
+++ b/drivers/net/dpaa/fmlib/fm_ext.h
@@ -21,7 +21,7 @@
#define _fml_dbg(...) \
RTE_LOG_LINE_PREFIX(DEBUG, DPAA_PMD, "%s: ", __func__, __VA_ARGS__)
#else
- #define _fml_dbg(arg...)
+ #define _fml_dbg(...)
#endif
/*#define FM_IOCTL_DBG*/
@@ -30,7 +30,7 @@
#define _fm_ioctl_dbg(...) \
RTE_LOG_LINE_PREFIX(DEBUG, DPAA_PMD, "%s: ", __func__, __VA_ARGS__)
#else
- #define _fm_ioctl_dbg(arg...)
+ #define _fm_ioctl_dbg(...)
#endif
/*
diff --git a/drivers/net/dpaa2/dpaa2_pmd_logs.h b/drivers/net/dpaa2/dpaa2_pmd_logs.h
index a9317b27eb..28c9bed1ae 100644
--- a/drivers/net/dpaa2/dpaa2_pmd_logs.h
+++ b/drivers/net/dpaa2/dpaa2_pmd_logs.h
@@ -16,24 +16,24 @@ extern int dpaa2_logtype_pmd;
#define PMD_INIT_FUNC_TRACE() DPAA2_PMD_DEBUG(">>")
-#define DPAA2_PMD_CRIT(fmt, args...) \
- DPAA2_PMD_LOG(CRIT, fmt, ## args)
-#define DPAA2_PMD_INFO(fmt, args...) \
- DPAA2_PMD_LOG(INFO, fmt, ## args)
-#define DPAA2_PMD_ERR(fmt, args...) \
- DPAA2_PMD_LOG(ERR, fmt, ## args)
-#define DPAA2_PMD_WARN(fmt, args...) \
- DPAA2_PMD_LOG(WARNING, fmt, ## args)
+#define DPAA2_PMD_CRIT(fmt, ...) \
+ DPAA2_PMD_LOG(CRIT, fmt, ## __VA_ARGS__)
+#define DPAA2_PMD_INFO(fmt, ...) \
+ DPAA2_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_PMD_ERR(fmt, ...) \
+ DPAA2_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA2_PMD_WARN(fmt, ...) \
+ DPAA2_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define DPAA2_PMD_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, DPAA2_NET, __VA_ARGS__)
-#define DPAA2_PMD_DP_DEBUG(fmt, args...) \
- DPAA2_PMD_DP_LOG(DEBUG, fmt, ## args)
-#define DPAA2_PMD_DP_INFO(fmt, args...) \
- DPAA2_PMD_DP_LOG(INFO, fmt, ## args)
-#define DPAA2_PMD_DP_WARN(fmt, args...) \
- DPAA2_PMD_DP_LOG(WARNING, fmt, ## args)
+#define DPAA2_PMD_DP_DEBUG(fmt, ...) \
+ DPAA2_PMD_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA2_PMD_DP_INFO(fmt, ...) \
+ DPAA2_PMD_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_PMD_DP_WARN(fmt, ...) \
+ DPAA2_PMD_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _DPAA2_PMD_LOGS_H_ */
diff --git a/drivers/net/e1000/base/e1000_osdep.h b/drivers/net/e1000/base/e1000_osdep.h
index 6b5d58950f..7cf36ed25a 100644
--- a/drivers/net/e1000/base/e1000_osdep.h
+++ b/drivers/net/e1000/base/e1000_osdep.h
@@ -28,11 +28,11 @@
#define DEBUGFUNC(F) DEBUGOUT(F "\n");
#define DEBUGOUT(S, ...) RTE_LOG(DEBUG, E1000_DRIVER, "%s(): " S, __func__, ## __VA_ARGS__)
-#define DEBUGOUT1(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT2(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT3(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT6(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT7(S, args...) DEBUGOUT(S, ##args)
+#define DEBUGOUT1(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT2(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT3(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT6(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT7(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
#ifndef UNREFERENCED_PARAMETER
#define UNREFERENCED_PARAMETER(_p)
diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h
index 1121460470..fb5e6da08d 100644
--- a/drivers/net/ena/base/ena_plat_dpdk.h
+++ b/drivers/net/ena/base/ena_plat_dpdk.h
@@ -106,11 +106,11 @@ extern int ena_logtype_com;
#define GENMASK_ULL(h, l) (((~0ULL) - (1ULL << (l)) + 1) & \
(~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
-#define ena_trc_log(dev, level, fmt, arg...) \
+#define ena_trc_log(dev, level, fmt, ...) \
( \
ENA_TOUCH(dev), \
rte_log(RTE_LOG_ ## level, ena_logtype_com, \
- "[ENA_COM: %s]" fmt, __func__, ##arg) \
+ "[ENA_COM: %s]" fmt, __func__, ##__VA_ARGS__) \
)
#if (defined RTE_ETHDEV_DEBUG_TX) || (defined RTE_ETHDEV_DEBUG_RX)
@@ -118,16 +118,16 @@ extern int ena_logtype_com;
#else
#define ena_trc_dbg(dev, format, ...)
#endif
-#define ena_trc_info(dev, format, arg...) ena_trc_log(dev, INFO, format, ##arg)
-#define ena_trc_warn(dev, format, arg...) ena_trc_log(dev, WARNING, format, ##arg)
-#define ena_trc_err(dev, format, arg...) ena_trc_log(dev, ERR, format, ##arg)
+#define ena_trc_info(dev, format, ...) ena_trc_log(dev, INFO, format, ##__VA_ARGS__)
+#define ena_trc_warn(dev, format, ...) ena_trc_log(dev, WARNING, format, ##__VA_ARGS__)
+#define ena_trc_err(dev, format, ...) ena_trc_log(dev, ERR, format, ##__VA_ARGS__)
-#define ENA_WARN(cond, dev, format, arg...) \
+#define ENA_WARN(cond, dev, format, ...) \
do { \
if (unlikely(cond)) { \
ena_trc_err(dev, \
"Warn failed on %s:%s:%d:" format, \
- __FILE__, __func__, __LINE__, ##arg); \
+ __FILE__, __func__, __LINE__, ##__VA_ARGS__); \
} \
} while (0)
diff --git a/drivers/net/enetc/enetc_logs.h b/drivers/net/enetc/enetc_logs.h
index 57bddcf683..e9855a41b4 100644
--- a/drivers/net/enetc/enetc_logs.h
+++ b/drivers/net/enetc/enetc_logs.h
@@ -16,26 +16,26 @@ extern int enetc_logtype_pmd;
#define PMD_INIT_FUNC_TRACE() ENETC_PMD_DEBUG(">>")
-#define ENETC_PMD_CRIT(fmt, args...) \
- ENETC_PMD_LOG(CRIT, fmt, ## args)
-#define ENETC_PMD_INFO(fmt, args...) \
- ENETC_PMD_LOG(INFO, fmt, ## args)
-#define ENETC_PMD_NOTICE(fmt, args...) \
- ENETC_PMD_LOG(NOTICE, fmt, ## args)
-#define ENETC_PMD_ERR(fmt, args...) \
- ENETC_PMD_LOG(ERR, fmt, ## args)
-#define ENETC_PMD_WARN(fmt, args...) \
- ENETC_PMD_LOG(WARNING, fmt, ## args)
+#define ENETC_PMD_CRIT(fmt, ...) \
+ ENETC_PMD_LOG(CRIT, fmt, ## __VA_ARGS__)
+#define ENETC_PMD_INFO(fmt, ...) \
+ ENETC_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define ENETC_PMD_NOTICE(fmt, ...) \
+ ENETC_PMD_LOG(NOTICE, fmt, ## __VA_ARGS__)
+#define ENETC_PMD_ERR(fmt, ...) \
+ ENETC_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define ENETC_PMD_WARN(fmt, ...) \
+ ENETC_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define ENETC_PMD_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, ENETC_NET, __VA_ARGS__)
-#define ENETC_PMD_DP_DEBUG(fmt, args...) \
- ENETC_PMD_DP_LOG(DEBUG, fmt, ## args)
-#define ENETC_PMD_DP_INFO(fmt, args...) \
- ENETC_PMD_DP_LOG(INFO, fmt, ## args)
-#define ENETC_PMD_DP_WARN(fmt, args...) \
- ENETC_PMD_DP_LOG(WARNING, fmt, ## args)
+#define ENETC_PMD_DP_DEBUG(fmt, ...) \
+ ENETC_PMD_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define ENETC_PMD_DP_INFO(fmt, ...) \
+ ENETC_PMD_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define ENETC_PMD_DP_WARN(fmt, ...) \
+ ENETC_PMD_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _ENETC_LOGS_H_*/
diff --git a/drivers/net/enetfec/enet_pmd_logs.h b/drivers/net/enetfec/enet_pmd_logs.h
index 7580b5c8cc..65498f62f4 100644
--- a/drivers/net/enetfec/enet_pmd_logs.h
+++ b/drivers/net/enetfec/enet_pmd_logs.h
@@ -16,15 +16,15 @@ extern int enetfec_logtype_pmd;
#define PMD_INIT_FUNC_TRACE() ENET_PMD_LOG(DEBUG, " >>")
-#define ENETFEC_PMD_DEBUG(fmt, args...) \
- ENETFEC_PMD_LOG(DEBUG, fmt, ## args)
-#define ENETFEC_PMD_ERR(fmt, args...) \
- ENETFEC_PMD_LOG(ERR, fmt, ## args)
-#define ENETFEC_PMD_INFO(fmt, args...) \
- ENETFEC_PMD_LOG(INFO, fmt, ## args)
-
-#define ENETFEC_PMD_WARN(fmt, args...) \
- ENETFEC_PMD_LOG(WARNING, fmt, ## args)
+#define ENETFEC_PMD_DEBUG(fmt, ...) \
+ ENETFEC_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define ENETFEC_PMD_ERR(fmt, ...) \
+ ENETFEC_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define ENETFEC_PMD_INFO(fmt, ...) \
+ ENETFEC_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+
+#define ENETFEC_PMD_WARN(fmt, ...) \
+ ENETFEC_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define ENETFEC_DP_LOG(level, ...) \
diff --git a/drivers/net/enic/enic_compat.h b/drivers/net/enic/enic_compat.h
index 6d766bcd14..7cff6831b9 100644
--- a/drivers/net/enic/enic_compat.h
+++ b/drivers/net/enic/enic_compat.h
@@ -18,8 +18,8 @@
#define __iomem
-#define pr_err(y, args...) dev_err(0, y, ##args)
-#define pr_warn(y, args...) dev_warning(0, y, ##args)
+#define pr_err(y, ...) dev_err(0, y, ##__VA_ARGS__)
+#define pr_warn(y, ...) dev_warning(0, y, ##__VA_ARGS__)
#define BUG() pr_err("BUG at %s:%d", __func__, __LINE__)
#define VNIC_ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1)
@@ -28,14 +28,14 @@
extern int enic_pmd_logtype;
#define RTE_LOGTYPE_ENIC_PMD enic_pmd_logtype
-#define dev_printk(level, fmt, args...) \
+#define dev_printk(level, fmt, ...) \
rte_log(RTE_LOG_ ## level, enic_pmd_logtype, \
- "PMD: rte_enic_pmd: " fmt, ##args)
+ "PMD: rte_enic_pmd: " fmt, ##__VA_ARGS__)
-#define dev_err(x, args...) dev_printk(ERR, args)
-#define dev_info(x, args...) dev_printk(INFO, args)
-#define dev_warning(x, args...) dev_printk(WARNING, args)
-#define dev_debug(x, args...) dev_printk(DEBUG, args)
+#define dev_err(x, ...) dev_printk(ERR, __VA_ARGS__)
+#define dev_info(x, ...) dev_printk(INFO, __VA_ARGS__)
+#define dev_warning(x, ...) dev_printk(WARNING, __VA_ARGS__)
+#define dev_debug(x, ...) dev_printk(DEBUG, __VA_ARGS__)
#define ENICPMD_LOG(level, ...) \
RTE_LOG_LINE_PREFIX(level, ENIC_PMD, "%s ", __func__, __VA_ARGS__)
diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h
index d3e5528575..837010770a 100644
--- a/drivers/net/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/fm10k/base/fm10k_osdep.h
@@ -25,11 +25,11 @@
#define STATIC static
#define DEBUGFUNC(F) DEBUGOUT(F "\n");
#define DEBUGOUT(S, ...) RTE_LOG(DEBUG, FM10K_DRIVER, "%s(): " S, __func__, ## __VA_ARGS__)
-#define DEBUGOUT1(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT2(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT3(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT6(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT7(S, args...) DEBUGOUT(S, ##args)
+#define DEBUGOUT1(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT2(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT3(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT6(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT7(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
#define FALSE 0
#define TRUE 1
diff --git a/drivers/net/hns3/hns3_logs.h b/drivers/net/hns3/hns3_logs.h
index d468c353fa..c2652cc17a 100644
--- a/drivers/net/hns3/hns3_logs.h
+++ b/drivers/net/hns3/hns3_logs.h
@@ -17,20 +17,20 @@ extern int hns3_logtype_driver;
RTE_LOG_LINE_PREFIX(level, HNS3_DRIVER, "%s %s(): ", \
(hw)->data->name RTE_LOG_COMMA __func__, __VA_ARGS__)
-#define hns3_err(hw, fmt, args...) \
- PMD_DRV_LOG(hw, ERR, fmt, ## args)
+#define hns3_err(hw, fmt, ...) \
+ PMD_DRV_LOG(hw, ERR, fmt, ## __VA_ARGS__)
-#define hns3_warn(hw, fmt, args...) \
- PMD_DRV_LOG(hw, WARNING, fmt, ## args)
+#define hns3_warn(hw, fmt, ...) \
+ PMD_DRV_LOG(hw, WARNING, fmt, ## __VA_ARGS__)
-#define hns3_notice(hw, fmt, args...) \
- PMD_DRV_LOG(hw, NOTICE, fmt, ## args)
+#define hns3_notice(hw, fmt, ...) \
+ PMD_DRV_LOG(hw, NOTICE, fmt, ## __VA_ARGS__)
-#define hns3_info(hw, fmt, args...) \
- PMD_DRV_LOG(hw, INFO, fmt, ## args)
+#define hns3_info(hw, fmt, ...) \
+ PMD_DRV_LOG(hw, INFO, fmt, ## __VA_ARGS__)
-#define hns3_dbg(hw, fmt, args...) \
- PMD_DRV_LOG(hw, DEBUG, fmt, ## args)
+#define hns3_dbg(hw, fmt, ...) \
+ PMD_DRV_LOG(hw, DEBUG, fmt, ## __VA_ARGS__)
#ifdef RTE_ETHDEV_DEBUG_RX
extern int hns3_logtype_rx;
diff --git a/drivers/net/i40e/base/i40e_osdep.h b/drivers/net/i40e/base/i40e_osdep.h
index 8960206d8b..302841dba8 100644
--- a/drivers/net/i40e/base/i40e_osdep.h
+++ b/drivers/net/i40e/base/i40e_osdep.h
@@ -34,7 +34,7 @@ typedef uint64_t u64;
typedef enum i40e_status_code i40e_status;
#define __iomem
-#define hw_dbg(hw, S, A...) do {} while (0)
+#define hw_dbg(hw, S, ...) do {} while (0)
#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
#define lower_32_bits(n) ((u32)(n))
#define low_16_bits(x) ((x) & 0xFFFF)
diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h
index 5f7347023f..64e4779878 100644
--- a/drivers/net/ice/base/ice_osdep.h
+++ b/drivers/net/ice/base/ice_osdep.h
@@ -154,8 +154,8 @@ do { \
##__VA_ARGS__); \
} while (0)
-#define ice_info(hw, fmt, args...) ice_debug(hw, ICE_DBG_ALL, fmt, ##args)
-#define ice_warn(hw, fmt, args...) ice_debug(hw, ICE_DBG_ALL, fmt, ##args)
+#define ice_info(hw, fmt, ...) ice_debug(hw, ICE_DBG_ALL, fmt, ##__VA_ARGS__)
+#define ice_warn(hw, fmt, ...) ice_debug(hw, ICE_DBG_ALL, fmt, ##__VA_ARGS__)
#define ice_debug_array(hw, type, rowsize, groupsize, buf, len) \
do { \
struct ice_hw *hw_l = hw; \
diff --git a/drivers/net/igc/base/igc_osdep.h b/drivers/net/igc/base/igc_osdep.h
index 4e479eb500..b938dfd2b5 100644
--- a/drivers/net/igc/base/igc_osdep.h
+++ b/drivers/net/igc/base/igc_osdep.h
@@ -28,11 +28,11 @@
#define DEBUGFUNC(F) DEBUGOUT(F "\n")
#define DEBUGOUT(S, ...) RTE_LOG(DEBUG, IGC_DRIVER, "%s(): " S, __func__, ## __VA_ARGS__)
-#define DEBUGOUT1(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT2(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT3(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT6(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT7(S, args...) DEBUGOUT(S, ##args)
+#define DEBUGOUT1(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT2(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT3(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT6(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT7(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
#define UNREFERENCED_PARAMETER(_p) (void)(_p)
#define UNREFERENCED_1PARAMETER(_p) (void)(_p)
diff --git a/drivers/net/ipn3ke/ipn3ke_logs.h b/drivers/net/ipn3ke/ipn3ke_logs.h
index 42dceeeab1..ff283b2b19 100644
--- a/drivers/net/ipn3ke/ipn3ke_logs.h
+++ b/drivers/net/ipn3ke/ipn3ke_logs.h
@@ -15,16 +15,16 @@ extern int ipn3ke_afu_logtype;
#define IPN3KE_AFU_PMD_FUNC_TRACE() IPN3KE_AFU_PMD_LOG(DEBUG, ">>")
-#define IPN3KE_AFU_PMD_DEBUG(fmt, args...) \
- IPN3KE_AFU_PMD_LOG(DEBUG, fmt, ## args)
+#define IPN3KE_AFU_PMD_DEBUG(fmt, ...) \
+ IPN3KE_AFU_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
-#define IPN3KE_AFU_PMD_INFO(fmt, args...) \
- IPN3KE_AFU_PMD_LOG(INFO, fmt, ## args)
+#define IPN3KE_AFU_PMD_INFO(fmt, ...) \
+ IPN3KE_AFU_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
-#define IPN3KE_AFU_PMD_ERR(fmt, args...) \
- IPN3KE_AFU_PMD_LOG(ERR, fmt, ## args)
+#define IPN3KE_AFU_PMD_ERR(fmt, ...) \
+ IPN3KE_AFU_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
-#define IPN3KE_AFU_PMD_WARN(fmt, args...) \
- IPN3KE_AFU_PMD_LOG(WARNING, fmt, ## args)
+#define IPN3KE_AFU_PMD_WARN(fmt, ...) \
+ IPN3KE_AFU_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
#endif /* _IPN3KE_LOGS_H_ */
diff --git a/drivers/net/ixgbe/base/ixgbe_osdep.h b/drivers/net/ixgbe/base/ixgbe_osdep.h
index 502f386b56..30d952f047 100644
--- a/drivers/net/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/ixgbe/base/ixgbe_osdep.h
@@ -34,15 +34,15 @@
#define DEBUGFUNC(F) DEBUGOUT(F "\n");
#define DEBUGOUT(S, ...) RTE_LOG(DEBUG, IXGBE_DRIVER, "%s(): " S, __func__, ## __VA_ARGS__)
-#define DEBUGOUT1(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT2(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT3(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT6(S, args...) DEBUGOUT(S, ##args)
-#define DEBUGOUT7(S, args...) DEBUGOUT(S, ##args)
+#define DEBUGOUT1(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT2(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT3(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT6(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define DEBUGOUT7(S, ...) DEBUGOUT(S, ##__VA_ARGS__)
-#define ERROR_REPORT1(e, S, args...) DEBUGOUT(S, ##args)
-#define ERROR_REPORT2(e, S, args...) DEBUGOUT(S, ##args)
-#define ERROR_REPORT3(e, S, args...) DEBUGOUT(S, ##args)
+#define ERROR_REPORT1(e, S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define ERROR_REPORT2(e, S, ...) DEBUGOUT(S, ##__VA_ARGS__)
+#define ERROR_REPORT3(e, S, ...) DEBUGOUT(S, ##__VA_ARGS__)
#define FALSE 0
#define TRUE 1
@@ -50,19 +50,19 @@
#define false 0
#define true 1
#ifndef RTE_EXEC_ENV_WINDOWS
-#define min(a,b) RTE_MIN(a,b)
+#define min(a, b) RTE_MIN(a, b)
#endif
-#define EWARN(hw, S, args...) DEBUGOUT1(S, ##args)
+#define EWARN(hw, S, ...) DEBUGOUT1(S, ##__VA_ARGS__)
/* Bunch of defines for shared code bogosity */
#ifndef UNREFERENCED_PARAMETER
-#define UNREFERENCED_PARAMETER(_p)
+#define UNREFERENCED_PARAMETER(_p)
#endif
-#define UNREFERENCED_1PARAMETER(_p)
+#define UNREFERENCED_1PARAMETER(_p)
#define UNREFERENCED_2PARAMETER(_p, _q)
-#define UNREFERENCED_3PARAMETER(_p, _q, _r)
-#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s)
+#define UNREFERENCED_3PARAMETER(_p, _q, _r)
+#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s)
#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t)
/* Shared code error reporting */
@@ -130,7 +130,7 @@ static inline uint32_t ixgbe_read_addr(volatile void* addr)
IXGBE_PCI_REG_ADDR((hw), (reg) + ((index) << 2))
/* Not implemented !! */
-#define IXGBE_READ_PCIE_WORD(hw, reg) 0
+#define IXGBE_READ_PCIE_WORD(hw, reg) 0
#define IXGBE_WRITE_PCIE_WORD(hw, reg, value) do { } while(0)
#define IXGBE_WRITE_FLUSH(a) IXGBE_READ_REG(a, IXGBE_STATUS)
diff --git a/drivers/net/ngbe/base/ngbe_osdep.h b/drivers/net/ngbe/base/ngbe_osdep.h
index 30598a240a..ca50455ab2 100644
--- a/drivers/net/ngbe/base/ngbe_osdep.h
+++ b/drivers/net/ngbe/base/ngbe_osdep.h
@@ -55,7 +55,7 @@
/* Bunch of defines for shared code bogosity */
static inline void UNREFERENCED(const char *a __rte_unused, ...) {}
-#define UNREFERENCED_PARAMETER(args...) UNREFERENCED("", ##args)
+#define UNREFERENCED_PARAMETER(...) UNREFERENCED("", ##__VA_ARGS__)
#define STATIC static
diff --git a/drivers/net/ngbe/ngbe_logs.h b/drivers/net/ngbe/ngbe_logs.h
index f6c1ee66d9..7abf979648 100644
--- a/drivers/net/ngbe/ngbe_logs.h
+++ b/drivers/net/ngbe/ngbe_logs.h
@@ -37,7 +37,7 @@ extern int ngbe_logtype_tx;
#define PMD_TX_LOG(...) do { } while (0)
#endif
-#define DEBUGOUT(fmt, args...) PMD_DRV_LOG(DEBUG, fmt, ##args)
+#define DEBUGOUT(fmt, ...) PMD_DRV_LOG(DEBUG, fmt, ##__VA_ARGS__)
#define PMD_INIT_FUNC_TRACE() PMD_DRV_LOG(DEBUG, ">>")
#endif /* _NGBE_LOGS_H_ */
diff --git a/drivers/net/pfe/pfe_logs.h b/drivers/net/pfe/pfe_logs.h
index d0b6943a26..1453e8284b 100644
--- a/drivers/net/pfe/pfe_logs.h
+++ b/drivers/net/pfe/pfe_logs.h
@@ -14,15 +14,15 @@ extern int pfe_logtype_pmd;
#define PMD_INIT_FUNC_TRACE() PFE_PMD_LOG(DEBUG, " >>")
-#define PFE_PMD_DEBUG(fmt, args...) \
- PFE_PMD_LOG(DEBUG, fmt, ## args)
-#define PFE_PMD_ERR(fmt, args...) \
- PFE_PMD_LOG(ERR, fmt, ## args)
-#define PFE_PMD_INFO(fmt, args...) \
- PFE_PMD_LOG(INFO, fmt, ## args)
-
-#define PFE_PMD_WARN(fmt, args...) \
- PFE_PMD_LOG(WARNING, fmt, ## args)
+#define PFE_PMD_DEBUG(fmt, ...) \
+ PFE_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define PFE_PMD_ERR(fmt, ...) \
+ PFE_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define PFE_PMD_INFO(fmt, ...) \
+ PFE_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+
+#define PFE_PMD_WARN(fmt, ...) \
+ PFE_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define PFE_DP_LOG(level, ...) \
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index b781bcdcfd..80a59c46c8 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -39,8 +39,8 @@
#include "qede_if.h"
#include "qede_rxtx.h"
-#define qede_stringify1(x...) #x
-#define qede_stringify(x...) qede_stringify1(x)
+#define qede_stringify1(...) #__VA_ARGS__
+#define qede_stringify(...) qede_stringify1(__VA_ARGS__)
/* Driver versions */
#define QEDE_PMD_DRV_VER_STR_SIZE NAME_SIZE /* 128 */
diff --git a/drivers/net/qede/qede_logs.h b/drivers/net/qede/qede_logs.h
index f67052d106..afaef60984 100644
--- a/drivers/net/qede/qede_logs.h
+++ b/drivers/net/qede/qede_logs.h
@@ -51,27 +51,27 @@ do { \
} while (0)
extern int qede_logtype_init;
-#define PMD_INIT_LOG(level, edev, fmt, args...) \
+#define PMD_INIT_LOG(level, edev, fmt, ...) \
rte_log(RTE_LOG_ ## level, qede_logtype_init, \
"[qede_pmd: %s] %s() " fmt "\n", \
- (edev)->name, __func__, ##args)
+ (edev)->name, __func__, ## __VA_ARGS__)
#define PMD_INIT_FUNC_TRACE(edev) PMD_INIT_LOG(DEBUG, edev, " >>")
#ifdef RTE_LIBRTE_QEDE_DEBUG_TX
-#define PMD_TX_LOG(level, q, fmt, args...) \
+#define PMD_TX_LOG(level, q, fmt, ...) \
RTE_LOG(level, QEDE_DRIVER, "%s(): port=%u queue=%u " fmt "\n", \
- __func__, q->port_id, q->queue_id, ## args)
+ __func__, (q)->port_id, (q)->queue_id, ## __VA_ARGS__)
#else
-#define PMD_TX_LOG(level, fmt, args...) do { } while (0)
+#define PMD_TX_LOG(level, fmt, ...) do { } while (0)
#endif
#ifdef RTE_LIBRTE_QEDE_DEBUG_RX
-#define PMD_RX_LOG(level, q, fmt, args...) \
+#define PMD_RX_LOG(level, q, fmt, ...) \
RTE_LOG(level, QEDE_DRIVER, "%s(): port=%u queue=%u " fmt "\n", \
- __func__, q->port_id, q->queue_id, ## args)
+ __func__, (q)->port_id, (q)->queue_id, ## __VA_ARGS__)
#else
-#define PMD_RX_LOG(level, q, fmt, args...) do { } while (0)
+#define PMD_RX_LOG(level, q, fmt, ...) do { } while (0)
#endif
#endif /* _QEDE_LOGS_H_ */
diff --git a/drivers/net/sfc/sfc_debug.h b/drivers/net/sfc/sfc_debug.h
index f63fb02c83..7088a41a65 100644
--- a/drivers/net/sfc/sfc_debug.h
+++ b/drivers/net/sfc/sfc_debug.h
@@ -23,7 +23,7 @@
#endif
/* Log PMD message, automatically add prefix and \n */
-#define sfc_panic(sa, fmt, args...) \
+#define sfc_panic(sa, fmt, ...) \
do { \
const struct sfc_adapter_shared *_sas; \
\
@@ -32,7 +32,7 @@
" #%" PRIu16 ": " fmt "\n", \
_sas->pci_addr.domain, _sas->pci_addr.bus, \
_sas->pci_addr.devid, _sas->pci_addr.function,\
- _sas->port_id, ##args); \
+ _sas->port_id, ##__VA_ARGS__); \
} while (0)
#endif /* _SFC_DEBUG_H_ */
diff --git a/drivers/net/txgbe/base/txgbe_osdep.h b/drivers/net/txgbe/base/txgbe_osdep.h
index 91c8abf12e..a1477653e2 100644
--- a/drivers/net/txgbe/base/txgbe_osdep.h
+++ b/drivers/net/txgbe/base/txgbe_osdep.h
@@ -60,7 +60,7 @@ extern int txgbe_logtype_bp;
/* Bunch of defines for shared code bogosity */
static inline void UNREFERENCED(const char *a __rte_unused, ...) {}
-#define UNREFERENCED_PARAMETER(args...) UNREFERENCED("", ##args)
+#define UNREFERENCED_PARAMETER(...) UNREFERENCED("", ##__VA_ARGS__)
#define STATIC static
diff --git a/drivers/net/txgbe/txgbe_logs.h b/drivers/net/txgbe/txgbe_logs.h
index e6e570734c..3c9ace6daf 100644
--- a/drivers/net/txgbe/txgbe_logs.h
+++ b/drivers/net/txgbe/txgbe_logs.h
@@ -49,7 +49,7 @@ extern int txgbe_logtype_tx_free;
#define PMD_TX_FREE_LOG(...) do { } while (0)
#endif
-#define DEBUGOUT(fmt, args...) PMD_DRV_LOG(DEBUG, fmt, ##args)
+#define DEBUGOUT(fmt, ...) PMD_DRV_LOG(DEBUG, fmt, ##__VA_ARGS__)
#define PMD_INIT_FUNC_TRACE() PMD_DRV_LOG(DEBUG, ">>")
#endif /* _TXGBE_LOGS_H_ */
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 13/14] drivers/raw: use portable variadic macros
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
` (11 preceding siblings ...)
2024-12-11 22:07 ` [PATCH v2 12/14] drivers/net: " Andre Muezerie
@ 2024-12-11 22:07 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 14/14] drivers/vdpa: " Andre Muezerie
13 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 22:07 UTC (permalink / raw)
To: dev; +Cc: Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 24 +++++++++----------
drivers/raw/ifpga/base/opae_debug.h | 4 ++--
drivers/raw/ifpga/base/opae_osdep.h | 20 ++++++++--------
.../raw/ifpga/base/osdep_rte/osdep_generic.h | 4 ++--
drivers/raw/ifpga/ifpga_rawdev.h | 16 ++++++-------
drivers/raw/skeleton/skeleton_rawdev.h | 16 ++++++-------
drivers/raw/skeleton/skeleton_rawdev_test.c | 8 +++----
7 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h
index 66108e0667..d223895e1c 100644
--- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h
+++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h
@@ -20,23 +20,23 @@ extern int dpaa2_cmdif_logtype;
#define DPAA2_CMDIF_FUNC_TRACE() DPAA2_CMDIF_DEBUG(">>")
-#define DPAA2_CMDIF_INFO(fmt, args...) \
- DPAA2_CMDIF_LOG(INFO, fmt, ## args)
-#define DPAA2_CMDIF_ERR(fmt, args...) \
- DPAA2_CMDIF_LOG(ERR, fmt, ## args)
-#define DPAA2_CMDIF_WARN(fmt, args...) \
- DPAA2_CMDIF_LOG(WARNING, fmt, ## args)
+#define DPAA2_CMDIF_INFO(fmt, ...) \
+ DPAA2_CMDIF_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_CMDIF_ERR(fmt, ...) \
+ DPAA2_CMDIF_LOG(ERR, fmt, ## __VA_ARGS__)
+#define DPAA2_CMDIF_WARN(fmt, ...) \
+ DPAA2_CMDIF_LOG(WARNING, fmt, ## __VA_ARGS__)
/* DP Logs, toggled out at compile time if level lower than current level */
#define DPAA2_CMDIF_DP_LOG(level, ...) \
RTE_LOG_DP_LINE(level, DPAA2_CMDIF, __VA_ARGS__)
-#define DPAA2_CMDIF_DP_DEBUG(fmt, args...) \
- DPAA2_CMDIF_DP_LOG(DEBUG, fmt, ## args)
-#define DPAA2_CMDIF_DP_INFO(fmt, args...) \
- DPAA2_CMDIF_DP_LOG(INFO, fmt, ## args)
-#define DPAA2_CMDIF_DP_WARN(fmt, args...) \
- DPAA2_CMDIF_DP_LOG(WARNING, fmt, ## args)
+#define DPAA2_CMDIF_DP_DEBUG(fmt, ...) \
+ DPAA2_CMDIF_DP_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define DPAA2_CMDIF_DP_INFO(fmt, ...) \
+ DPAA2_CMDIF_DP_LOG(INFO, fmt, ## __VA_ARGS__)
+#define DPAA2_CMDIF_DP_WARN(fmt, ...) \
+ DPAA2_CMDIF_DP_LOG(WARNING, fmt, ## __VA_ARGS__)
#ifdef __cplusplus
}
diff --git a/drivers/raw/ifpga/base/opae_debug.h b/drivers/raw/ifpga/base/opae_debug.h
index a03dff926a..a802897fea 100644
--- a/drivers/raw/ifpga/base/opae_debug.h
+++ b/drivers/raw/ifpga/base/opae_debug.h
@@ -6,9 +6,9 @@
#define _OPAE_DEBUG_H_
#ifdef OPAE_HW_DEBUG
-#define opae_log(fmt, args...) printf(fmt, ## args)
+#define opae_log(fmt, ...) printf(fmt, ## __VA_ARGS__)
#else
-#define opae_log(fme, args...) do {} while (0)
+#define opae_log(fme, ...) do {} while (0)
#endif
void opae_manager_dump(struct opae_manager *mgr);
diff --git a/drivers/raw/ifpga/base/opae_osdep.h b/drivers/raw/ifpga/base/opae_osdep.h
index cb780b1fed..10329ecf18 100644
--- a/drivers/raw/ifpga/base/opae_osdep.h
+++ b/drivers/raw/ifpga/base/opae_osdep.h
@@ -54,14 +54,14 @@ struct uuid {
#define SET_FIELD(m, v) (((v) << (__builtin_ffsll(m) - 1)) & (m))
#define GET_FIELD(m, v) (((v) & (m)) >> (__builtin_ffsll(m) - 1))
-#define dev_err(x, args...) dev_printf(ERR, args)
-#define dev_info(x, args...) dev_printf(INFO, args)
-#define dev_warn(x, args...) dev_printf(WARNING, args)
-#define dev_debug(x, args...) dev_printf(DEBUG, args)
+#define dev_err(x, ...) dev_printf(ERR, __VA_ARGS__)
+#define dev_info(x, ...) dev_printf(INFO, __VA_ARGS__)
+#define dev_warn(x, ...) dev_printf(WARNING, __VA_ARGS__)
+#define dev_debug(x, ...) dev_printf(DEBUG, __VA_ARGS__)
-#define pr_err(y, args...) dev_err(0, y, ##args)
-#define pr_warn(y, args...) dev_warn(0, y, ##args)
-#define pr_info(y, args...) dev_info(0, y, ##args)
+#define pr_err(y, ...) dev_err(0, y, ##__VA_ARGS__)
+#define pr_warn(y, ...) dev_warn(0, y, ##__VA_ARGS__)
+#define pr_info(y, ...) dev_info(0, y, ##__VA_ARGS__)
#ifndef WARN_ON
#define WARN_ON(x) do { \
@@ -80,13 +80,13 @@ struct uuid {
#define time_before(a, b) time_after(b, a)
#define opae_memset(a, b, c) memset((a), (b), (c))
-#define readx_poll_timeout(op, val, cond, invl, timeout, args...) \
-__extension__ ({ \
+#define readx_poll_timeout(op, val, cond, invl, timeout, ...) \
+__extension__ ({ \
unsigned long __wait = 0; \
unsigned long __invl = (invl); \
unsigned long __timeout = (timeout); \
for (; __wait <= __timeout; __wait += __invl) { \
- (val) = op(args); \
+ (val) = op(__VA_ARGS__); \
if (cond) \
break; \
udelay(__invl); \
diff --git a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
index 427793a578..d4e634c9d2 100644
--- a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
+++ b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
@@ -19,8 +19,8 @@
extern int ifpga_rawdev_logtype;
#define RTE_LOGTYPE_IFPGA_RAWDEV ifpga_rawdev_logtype
-#define dev_printf(level, fmt, args...) \
- RTE_LOG(level, IFPGA_RAWDEV, "osdep_rte: " fmt, ## args)
+#define dev_printf(level, fmt, ...) \
+ RTE_LOG(level, IFPGA_RAWDEV, "osdep_rte: " fmt, ## __VA_ARGS__)
#define osdep_panic(...) rte_panic(...)
diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h
index c733ffcb41..06700f479d 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.h
+++ b/drivers/raw/ifpga/ifpga_rawdev.h
@@ -15,14 +15,14 @@ extern int ifpga_rawdev_logtype;
#define IFPGA_RAWDEV_PMD_FUNC_TRACE() IFPGA_RAWDEV_PMD_LOG(DEBUG, ">>")
-#define IFPGA_RAWDEV_PMD_DEBUG(fmt, args...) \
- IFPGA_RAWDEV_PMD_LOG(DEBUG, fmt, ## args)
-#define IFPGA_RAWDEV_PMD_INFO(fmt, args...) \
- IFPGA_RAWDEV_PMD_LOG(INFO, fmt, ## args)
-#define IFPGA_RAWDEV_PMD_ERR(fmt, args...) \
- IFPGA_RAWDEV_PMD_LOG(ERR, fmt, ## args)
-#define IFPGA_RAWDEV_PMD_WARN(fmt, args...) \
- IFPGA_RAWDEV_PMD_LOG(WARNING, fmt, ## args)
+#define IFPGA_RAWDEV_PMD_DEBUG(fmt, ...) \
+ IFPGA_RAWDEV_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define IFPGA_RAWDEV_PMD_INFO(fmt, ...) \
+ IFPGA_RAWDEV_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
+#define IFPGA_RAWDEV_PMD_ERR(fmt, ...) \
+ IFPGA_RAWDEV_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
+#define IFPGA_RAWDEV_PMD_WARN(fmt, ...) \
+ IFPGA_RAWDEV_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
enum ifpga_rawdev_device_state {
IFPGA_IDLE,
diff --git a/drivers/raw/skeleton/skeleton_rawdev.h b/drivers/raw/skeleton/skeleton_rawdev.h
index 53f21212a2..85f8017a7e 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.h
+++ b/drivers/raw/skeleton/skeleton_rawdev.h
@@ -15,14 +15,14 @@ extern int skeleton_pmd_logtype;
#define SKELETON_PMD_FUNC_TRACE() SKELETON_PMD_LOG(DEBUG, ">>")
-#define SKELETON_PMD_DEBUG(fmt, args...) \
- SKELETON_PMD_LOG(DEBUG, fmt, ## args)
-#define SKELETON_PMD_INFO(fmt, args...) \
- SKELETON_PMD_LOG(INFO, fmt, ## args)
-#define SKELETON_PMD_ERR(fmt, args...) \
- SKELETON_PMD_LOG(ERR, fmt, ## args)
-#define SKELETON_PMD_WARN(fmt, args...) \
- SKELETON_PMD_LOG(WARNING, fmt, ## args)
+#define SKELETON_PMD_DEBUG(fmt, ...) \
+ SKELETON_PMD_LOG(DEBUG, fmt, ##__VA_ARGS__)
+#define SKELETON_PMD_INFO(fmt, ...) \
+ SKELETON_PMD_LOG(INFO, fmt, ##__VA_ARGS__)
+#define SKELETON_PMD_ERR(fmt, ...) \
+ SKELETON_PMD_LOG(ERR, fmt, ##__VA_ARGS__)
+#define SKELETON_PMD_WARN(fmt, ...) \
+ SKELETON_PMD_LOG(WARNING, fmt, ##__VA_ARGS__)
/* Macros for self test application */
#define SKELETON_TEST_INFO SKELETON_PMD_INFO
#define SKELETON_TEST_DEBUG SKELETON_PMD_DEBUG
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index ebbaabff4d..99765feb41 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -21,10 +21,10 @@
#define SKELDEV_LOGS(level, ...) \
RTE_LOG_LINE(level, SKELETON_PMD, __VA_ARGS__)
-#define SKELDEV_TEST_INFO(fmt, args...) \
- SKELDEV_LOGS(INFO, fmt, ## args)
-#define SKELDEV_TEST_DEBUG(fmt, args...) \
- SKELDEV_LOGS(DEBUG, fmt, ## args)
+#define SKELDEV_TEST_INFO(fmt, ...) \
+ SKELDEV_LOGS(INFO, fmt, ## __VA_ARGS__)
+#define SKELDEV_TEST_DEBUG(fmt, ...) \
+ SKELDEV_LOGS(DEBUG, fmt, ## __VA_ARGS__)
#define SKELDEV_TEST_RUN(setup, teardown, test) \
skeldev_test_run(setup, teardown, test, #test)
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 14/14] drivers/vdpa: use portable variadic macros
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
` (12 preceding siblings ...)
2024-12-11 22:07 ` [PATCH v2 13/14] drivers/raw: " Andre Muezerie
@ 2024-12-11 22:07 ` Andre Muezerie
13 siblings, 0 replies; 42+ messages in thread
From: Andre Muezerie @ 2024-12-11 22:07 UTC (permalink / raw)
To: dev; +Cc: Andre Muezerie
Many places are using a GCC extension related to variadic macros,
where a name prepends the ellipsis. This results in a warning like
the one below when compiling the code with MSVC:
app\test-pmd\testpmd.h(1314): error C2608:
invalid token '...' in macro parameter list
Variadic macros became a standard part of the C language with C99.
GCC, Clang and MSVC handle them properly.
The fix is to remove the prefix name (args... becomes ...) and use
__VA_ARGS__.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/vdpa/ifc/base/ifcvf_osdep.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/vdpa/ifc/base/ifcvf_osdep.h b/drivers/vdpa/ifc/base/ifcvf_osdep.h
index ba7d684c25..bbbde153ee 100644
--- a/drivers/vdpa/ifc/base/ifcvf_osdep.h
+++ b/drivers/vdpa/ifc/base/ifcvf_osdep.h
@@ -16,8 +16,8 @@
extern int ifcvf_vdpa_logtype;
#define RTE_LOGTYPE_IFCVF_VDPA ifcvf_vdpa_logtype
-#define WARNINGOUT(S, args...) RTE_LOG(WARNING, IFCVF_VDPA, S, ##args)
-#define DEBUGOUT(S, args...) RTE_LOG(DEBUG, IFCVF_VDPA, S, ##args)
+#define WARNINGOUT(S, ...) RTE_LOG(WARNING, IFCVF_VDPA, S, ##__VA_ARGS__)
+#define DEBUGOUT(S, ...) RTE_LOG(DEBUG, IFCVF_VDPA, S, ##__VA_ARGS__)
#define STATIC static
#define msec_delay(x) rte_delay_us_sleep(1000 * (x))
--
2.47.0.vfs.0.3
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 13/21] drivers/net: use portable variadic macros
2024-12-11 2:05 ` [PATCH 13/21] drivers/net: " Andre Muezerie
@ 2024-12-16 9:02 ` Andrew Rybchenko
0 siblings, 0 replies; 42+ messages in thread
From: Andrew Rybchenko @ 2024-12-16 9:02 UTC (permalink / raw)
To: Andre Muezerie, Shepard Siegel, Ed Czeck, John Miller,
Ajit Khaparde, Somnath Kotur, Hemant Agrawal, Sachin Saxena,
Shai Brandes, Evgeny Schemeilin, Ron Beider, Amit Bernstein,
Wajeeh Atrash, Gagandeep Singh, Apeksha Gupta, John Daley,
Hyong Youb Kim, Jie Hai, Bruce Richardson, Anatoly Burakov,
Rosen Xu, Vladimir Medvedkin, Jiawen Wu, Devendra Singh Rawat,
Alok Prasad, Jian Wang
Cc: dev
On 12/11/24 05:05, Andre Muezerie wrote:
> 1) Use portable variadic macros
>
> Many places are using a GCC extension related to variadic macros,
> where a name prepends the ellipsis. This results in a warning like
> the one below when compiling the code with MSVC:
>
> app\test-pmd\testpmd.h(1314): error C2608:
> invalid token '...' in macro parameter list
>
> Variadic macros became a standard part of the C language with C99.
> GCC, Clang and MSVC handle them properly.
>
> The fix is to remove the prefix name (args... becomes ...) and use
> __VA_ARGS__.
>
> 2) Add "do { } while (0)" to macros used to remove logging calls, to
> ensure there's no code structure change when enabling/disabling
> logging.
>
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
For sfc,
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
^ permalink raw reply [flat|nested] 42+ messages in thread
end of thread, other threads:[~2024-12-16 9:02 UTC | newest]
Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-11 2:05 [PATCH 00/21] use portable variadic macros Andre Muezerie
2024-12-11 2:05 ` [PATCH 01/21] app/test-acl: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 02/21] app/test-eventdev: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 03/21] app/test-mldev: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 04/21] app/test-pmd: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 05/21] drivers/baseband: ensure code structure does not change Andre Muezerie
2024-12-11 2:05 ` [PATCH 06/21] drivers/bus: use portable variadic macros Andre Muezerie
2024-12-11 2:05 ` [PATCH 07/21] drivers/common: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 08/21] drivers/compress: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 09/21] drivers/crypto: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 10/21] drivers/dma: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 11/21] drivers/event: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 12/21] drivers/mempool: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 13/21] drivers/net: " Andre Muezerie
2024-12-16 9:02 ` Andrew Rybchenko
2024-12-11 2:05 ` [PATCH 14/21] drivers/raw: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 15/21] drivers/vdpa: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 16/21] lib/log: ensure code structure does not change Andre Muezerie
2024-12-11 3:13 ` Stephen Hemminger
2024-12-11 16:16 ` Andre Muezerie
2024-12-11 2:05 ` [PATCH 17/21] lib/pipeline: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 18/21] lib/port: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 19/21] lib/power: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 20/21] lib/rcu: " Andre Muezerie
2024-12-11 2:05 ` [PATCH 21/21] lib/vhost: " Andre Muezerie
2024-12-11 3:14 ` [PATCH 00/21] use portable variadic macros Stephen Hemminger
2024-12-11 21:35 ` Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 00/14] " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 01/14] app/test-acl: " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 02/14] app/test-eventdev: " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 03/14] app/test-mldev: " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 04/14] app/test-pmd: " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 05/14] drivers/bus: " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 06/14] drivers/common: " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 07/14] drivers/compress: " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 08/14] drivers/crypto: " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 09/14] drivers/dma: " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 10/14] drivers/event: " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 11/14] drivers/mempool: " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 12/14] drivers/net: " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 13/14] drivers/raw: " Andre Muezerie
2024-12-11 22:07 ` [PATCH v2 14/14] drivers/vdpa: " 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).