[PATCH v2 03/14] app/test-mldev: use portable variadic macros
Andre Muezerie
andremue at linux.microsoft.com
Wed Dec 11 23:07:13 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-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
More information about the dev
mailing list