[PATCH 13/15] rcu: use GCC and MSVC common VA ARGS extension
Tyler Retzlaff
roretzla at linux.microsoft.com
Mon Feb 12 22:49:15 CET 2024
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 at linux.microsoft.com>
---
lib/rcu/rte_rcu_qsbr.c | 4 ++--
lib/rcu/rte_rcu_qsbr.h | 12 ++++++------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/rcu/rte_rcu_qsbr.c b/lib/rcu/rte_rcu_qsbr.c
index bd0b83b..4aff573 100644
--- a/lib/rcu/rte_rcu_qsbr.c
+++ b/lib/rcu/rte_rcu_qsbr.c
@@ -19,8 +19,8 @@
#include "rte_rcu_qsbr.h"
#include "rcu_qsbr_pvt.h"
-#define RCU_LOG(level, fmt, args...) \
- RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args)
+#define RCU_LOG(level, fmt, ...) \
+ RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## __VA_ARGS__)
/* Get the memory size of QSBR variable */
size_t
diff --git a/lib/rcu/rte_rcu_qsbr.h b/lib/rcu/rte_rcu_qsbr.h
index 23c9f89..f55e53a 100644
--- a/lib/rcu/rte_rcu_qsbr.h
+++ b/lib/rcu/rte_rcu_qsbr.h
@@ -39,19 +39,19 @@
#define RTE_LOGTYPE_RCU rte_rcu_log_type
#if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG
-#define __RTE_RCU_DP_LOG(level, fmt, args...) \
- RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args)
+#define __RTE_RCU_DP_LOG(level, fmt, ...) \
+ RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## __VA_ARGS__)
#else
-#define __RTE_RCU_DP_LOG(level, fmt, args...)
+#define __RTE_RCU_DP_LOG(level, fmt, ...)
#endif
#if defined(RTE_LIBRTE_RCU_DEBUG)
-#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, args...) do { \
+#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, ...) do { \
if (v->qsbr_cnt[thread_id].lock_cnt) \
- RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args); \
+ RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## __VA_ARGS__); \
} while (0)
#else
-#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, args...)
+#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, ...)
#endif
/* Registered thread IDs are stored as a bitmap of 64b element array.
--
1.8.3.1
More information about the dev
mailing list