[PATCH 02/21] app/test-eventdev: use portable variadic macros
Andre Muezerie
andremue at linux.microsoft.com
Wed Dec 11 03:05:32 CET 2024
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 at 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
More information about the dev
mailing list