[15/15] vhost: use GCC and MSVC common VA ARGS extension

Message ID 1707774557-16012-16-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series use GCC/MSVC compatible __VA_ARGS__ |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

Tyler Retzlaff Feb. 12, 2024, 9:49 p.m. UTC
  Use ... and forward with __VA_ARGS__ instead of args... and args.
Neither mechanism is conformant with the standard but the former works
with both GCC and MSVC.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/vhost/vhost.h        |  8 ++++----
 lib/vhost/vhost_crypto.c | 14 +++++++-------
 2 files changed, 11 insertions(+), 11 deletions(-)
  

Patch

diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h
index 0b13374..b539d6c 100644
--- a/lib/vhost/vhost.h
+++ b/lib/vhost/vhost.h
@@ -677,11 +677,11 @@  void __vhost_log_write_iova(struct virtio_net *dev, struct vhost_virtqueue *vq,
 extern int vhost_data_log_level;
 #define RTE_LOGTYPE_VHOST_DATA vhost_data_log_level
 
-#define VHOST_CONFIG_LOG(prefix, level, fmt, args...)		\
-	RTE_LOG_LINE(level, VHOST_CONFIG, "(%s) " fmt, prefix, ##args)
+#define VHOST_CONFIG_LOG(prefix, level, fmt, ...)		\
+	RTE_LOG_LINE(level, VHOST_CONFIG, "(%s) " fmt, prefix, ## __VA_ARGS__)
 
-#define VHOST_DATA_LOG(prefix, level, fmt, args...)		\
-	RTE_LOG_DP_LINE(level, VHOST_DATA, "(%s) " fmt, prefix, ##args)
+#define VHOST_DATA_LOG(prefix, level, fmt, ...)		\
+	RTE_LOG_DP_LINE(level, VHOST_DATA, "(%s) " fmt, prefix, ## __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_VHOST_DEBUG
 #define VHOST_MAX_PRINT_BUFF 6072
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 3704fbb..86983c1 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -20,19 +20,19 @@ 
 RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
 #define RTE_LOGTYPE_VHOST_CRYPTO	vhost_crypto_logtype
 
-#define VC_LOG_ERR(fmt, args...)				\
+#define VC_LOG_ERR(fmt, ...)				\
 	RTE_LOG_LINE(ERR, VHOST_CRYPTO, "%s() line %u: " fmt,	\
-		__func__, __LINE__, ## args)
-#define VC_LOG_INFO(fmt, args...)				\
+		__func__, __LINE__, ## __VA_ARGS__)
+#define VC_LOG_INFO(fmt, ...)				\
 	RTE_LOG_LINE(INFO, VHOST_CRYPTO, "%s() line %u: " fmt,	\
-		__func__, __LINE__, ## args)
+		__func__, __LINE__, ## __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_VHOST_DEBUG
-#define VC_LOG_DBG(fmt, args...)				\
+#define VC_LOG_DBG(fmt, ...)				\
 	RTE_LOG_LINE(DEBUG, VHOST_CRYPTO, "%s() line %u: " fmt,	\
-		__func__, __LINE__, ## args)
+		__func__, __LINE__, ## __VA_ARGS__)
 #else
-#define VC_LOG_DBG(fmt, args...)
+#define VC_LOG_DBG(fmt, ...)
 #endif
 
 #define VIRTIO_CRYPTO_FEATURES ((1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) |	\