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 <andre...@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