[PATCH v2 01/14] app/test-acl: use portable variadic macros

Andre Muezerie andremue at linux.microsoft.com
Wed Dec 11 23:07:11 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-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



More information about the dev mailing list