Use RTE_LOG_LINE_PREFIX instead of RTE_LOG_LINE in macro expansions which allow a prefix and arguments to be inserted into the log line without the need to use the ## args variadic argument pack extension.
Signed-off-by: Tyler Retzlaff <roret...@linux.microsoft.com> --- lib/vhost/vhost.h | 8 ++++---- lib/vhost/vhost_crypto.c | 21 +++++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h index f163ff7..08e4ab9 100644 --- a/lib/vhost/vhost.h +++ b/lib/vhost/vhost.h @@ -679,11 +679,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, ...) \ + RTE_LOG_LINE_PREFIX(level, VHOST_CONFIG, "(%s) ", 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, ...) \ + RTE_LOG_DP_LINE_PREFIX(level, VHOST_DATA, "(%s) ", 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..3409cdf 100644 --- a/lib/vhost/vhost_crypto.c +++ b/lib/vhost/vhost_crypto.c @@ -20,19 +20,20 @@ RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO); #define RTE_LOGTYPE_VHOST_CRYPTO vhost_crypto_logtype -#define VC_LOG_ERR(fmt, args...) \ - RTE_LOG_LINE(ERR, VHOST_CRYPTO, "%s() line %u: " fmt, \ - __func__, __LINE__, ## args) -#define VC_LOG_INFO(fmt, args...) \ - RTE_LOG_LINE(INFO, VHOST_CRYPTO, "%s() line %u: " fmt, \ - __func__, __LINE__, ## args) +#define VC_LOG_ERR(...) \ + RTE_LOG_LINE_PREFIX(ERR, VHOST_CRYPTO, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) + +#define VC_LOG_INFO(...) \ + RTE_LOG_LINE_PREFIX(INFO, VHOST_CRYPTO, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) #ifdef RTE_LIBRTE_VHOST_DEBUG -#define VC_LOG_DBG(fmt, args...) \ - RTE_LOG_LINE(DEBUG, VHOST_CRYPTO, "%s() line %u: " fmt, \ - __func__, __LINE__, ## args) +#define VC_LOG_DBG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, VHOST_CRYPTO, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __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) | \ -- 1.8.3.1