DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__
@ 2024-02-12 21:49 Tyler Retzlaff
  2024-02-12 21:49 ` [PATCH 01/15] eal: use GCC and MSVC common VA ARGS extension Tyler Retzlaff
                   ` (21 more replies)
  0 siblings, 22 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

MSVC does not support GCC args... forwarding of args replace
with ... and __VA_ARGS__ when forwarding.  Both forms of
forwarding are a compiler extension but the latter is supported
by both MSVC and GCC.

I have not been able to exhaustively test all versions of GCC so
please provide feedback as appropriate.

Tyler Retzlaff (15):
  eal: use GCC and MSVC common VA ARGS extension
  bpf: use GCC and MSVC common VA ARGS extension
  cfgfile: use GCC and MSVC common VA ARGS extension
  cmdline: use GCC and MSVC common VA ARGS extension
  ip_frag: use GCC and MSVC common VA ARGS extension
  compressdev: use GCC and MSVC common VA ARGS extension
  metrics: use GCC and MSVC common VA ARGS extension
  mldev: use GCC and MSVC common VA ARGS extension
  net: use GCC and MSVC common VA ARGS extension
  pdump: use GCC and MSVC common VA ARGS extension
  power: use GCC and MSVC common VA ARGS extension
  rawdev: use GCC and MSVC common VA ARGS extension
  rcu: use GCC and MSVC common VA ARGS extension
  stack: use GCC and MSVC common VA ARGS extension
  vhost: use GCC and MSVC common VA ARGS extension

 lib/bpf/bpf_impl.h                         |  4 ++--
 lib/cfgfile/rte_cfgfile.c                  |  4 ++--
 lib/cmdline/cmdline_parse.c                |  2 +-
 lib/cmdline/cmdline_parse_num.c            |  4 ++--
 lib/compressdev/rte_compressdev_internal.h |  4 ++--
 lib/eal/common/eal_trace.h                 |  8 ++++----
 lib/ip_frag/ip_frag_common.h               |  4 ++--
 lib/metrics/rte_metrics_telemetry.c        | 12 ++++++------
 lib/mldev/rte_mldev.h                      |  4 ++--
 lib/net/rte_net_crc.c                      |  4 ++--
 lib/pdump/rte_pdump.c                      |  4 ++--
 lib/power/power_common.h                   |  6 +++---
 lib/rawdev/rte_rawdev_pmd.h                | 18 +++++++++---------
 lib/rcu/rte_rcu_qsbr.c                     |  4 ++--
 lib/rcu/rte_rcu_qsbr.h                     | 12 ++++++------
 lib/stack/stack_pvt.h                      | 16 ++++++++--------
 lib/vhost/vhost.h                          |  8 ++++----
 lib/vhost/vhost_crypto.c                   | 14 +++++++-------
 18 files changed, 66 insertions(+), 66 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH 01/15] eal: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
@ 2024-02-12 21:49 ` Tyler Retzlaff
  2024-02-12 21:49 ` [PATCH 02/15] bpf: " Tyler Retzlaff
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

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/eal/common/eal_trace.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/eal/common/eal_trace.h b/lib/eal/common/eal_trace.h
index bd082a0..79487a0 100644
--- a/lib/eal/common/eal_trace.h
+++ b/lib/eal/common/eal_trace.h
@@ -16,11 +16,11 @@
 #include "eal_private.h"
 #include "eal_thread.h"
 
-#define trace_err(fmt, args...) \
-	EAL_LOG(ERR, "%s():%u " fmt, __func__, __LINE__, ## args)
+#define trace_err(fmt, ...) \
+	EAL_LOG(ERR, "%s():%u " fmt, __func__, __LINE__, ## __VA_ARGS__)
 
-#define trace_crit(fmt, args...) \
-	EAL_LOG(CRIT, "%s():%u " fmt, __func__, __LINE__, ## args)
+#define trace_crit(fmt, ...) \
+	EAL_LOG(CRIT, "%s():%u " fmt, __func__, __LINE__, ## __VA_ARGS__)
 
 #define TRACE_CTF_MAGIC 0xC1FC1FC1
 #define TRACE_MAX_ARGS	32
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH 02/15] bpf: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
  2024-02-12 21:49 ` [PATCH 01/15] eal: use GCC and MSVC common VA ARGS extension Tyler Retzlaff
@ 2024-02-12 21:49 ` Tyler Retzlaff
  2024-02-12 21:49 ` [PATCH 03/15] cfgfile: " Tyler Retzlaff
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

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/bpf/bpf_impl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h
index 1a3d97d..e4871bc 100644
--- a/lib/bpf/bpf_impl.h
+++ b/lib/bpf/bpf_impl.h
@@ -29,8 +29,8 @@ struct rte_bpf {
 extern int rte_bpf_logtype;
 #define RTE_LOGTYPE_BPF rte_bpf_logtype
 
-#define	RTE_BPF_LOG_LINE(lvl, fmt, args...) \
-	RTE_LOG_LINE(lvl, BPF, fmt, ##args)
+#define	RTE_BPF_LOG_LINE(lvl, fmt, ...) \
+	RTE_LOG_LINE(lvl, BPF, fmt, ## __VA_ARGS__)
 
 static inline size_t
 bpf_size(uint32_t bpf_op_sz)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH 03/15] cfgfile: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
  2024-02-12 21:49 ` [PATCH 01/15] eal: use GCC and MSVC common VA ARGS extension Tyler Retzlaff
  2024-02-12 21:49 ` [PATCH 02/15] bpf: " Tyler Retzlaff
@ 2024-02-12 21:49 ` Tyler Retzlaff
  2024-02-13  9:03   ` Bruce Richardson
  2024-02-12 21:49 ` [PATCH 04/15] cmdline: " Tyler Retzlaff
                   ` (18 subsequent siblings)
  21 siblings, 1 reply; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

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/cfgfile/rte_cfgfile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/cfgfile/rte_cfgfile.c b/lib/cfgfile/rte_cfgfile.c
index 6a5e4fd..e006508 100644
--- a/lib/cfgfile/rte_cfgfile.c
+++ b/lib/cfgfile/rte_cfgfile.c
@@ -31,8 +31,8 @@ struct rte_cfgfile {
 RTE_LOG_REGISTER_DEFAULT(cfgfile_logtype, INFO);
 #define RTE_LOGTYPE_CFGFILE cfgfile_logtype
 
-#define CFG_LOG(level, fmt, args...)					\
-	RTE_LOG_LINE(level, CFGFILE, "%s(): " fmt, __func__, ## args)
+#define CFG_LOG(level, fmt, ...)					\
+	RTE_LOG_LINE(level, CFGFILE, "%s(): " fmt, __func__, ## __VA_ARGS__)
 /* >8 End of setting up dynamic logging */
 
 /** when we resize a file structure, how many extra entries
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH 04/15] cmdline: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (2 preceding siblings ...)
  2024-02-12 21:49 ` [PATCH 03/15] cfgfile: " Tyler Retzlaff
@ 2024-02-12 21:49 ` Tyler Retzlaff
  2024-02-13  9:04   ` Bruce Richardson
  2024-02-12 21:49 ` [PATCH 05/15] ip_frag: " Tyler Retzlaff
                   ` (17 subsequent siblings)
  21 siblings, 1 reply; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

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.

Fix checkpatches warning about style while(0) -> while (0)

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/cmdline/cmdline_parse.c     | 2 +-
 lib/cmdline/cmdline_parse_num.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/cmdline/cmdline_parse.c b/lib/cmdline/cmdline_parse.c
index b6d6dac..76a212d 100644
--- a/lib/cmdline/cmdline_parse.c
+++ b/lib/cmdline/cmdline_parse.c
@@ -16,7 +16,7 @@
 #ifdef RTE_LIBRTE_CMDLINE_DEBUG
 #define debug_printf printf
 #else
-#define debug_printf(args...) do {} while(0)
+#define debug_printf(...) do {} while (0)
 #endif
 
 #define CMDLINE_BUFFER_SIZE 64
diff --git a/lib/cmdline/cmdline_parse_num.c b/lib/cmdline/cmdline_parse_num.c
index 820af07..e849878 100644
--- a/lib/cmdline/cmdline_parse_num.c
+++ b/lib/cmdline/cmdline_parse_num.c
@@ -14,9 +14,9 @@
 #include "cmdline_parse_num.h"
 
 #ifdef RTE_LIBRTE_CMDLINE_DEBUG
-#define debug_printf(args...) printf(args)
+#define debug_printf(...) printf(__VA_ARGS__)
 #else
-#define debug_printf(args...) do {} while(0)
+#define debug_printf(...) do {} while (0)
 #endif
 
 struct cmdline_token_ops cmdline_token_num_ops = {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH 05/15] ip_frag: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (3 preceding siblings ...)
  2024-02-12 21:49 ` [PATCH 04/15] cmdline: " Tyler Retzlaff
@ 2024-02-12 21:49 ` Tyler Retzlaff
  2024-02-12 21:49 ` [PATCH 06/15] compressdev: " Tyler Retzlaff
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

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.

Fix checkpatches warning about style while(0) -> while (0)

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/ip_frag/ip_frag_common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h
index c766154..8926dc6 100644
--- a/lib/ip_frag/ip_frag_common.h
+++ b/lib/ip_frag/ip_frag_common.h
@@ -26,9 +26,9 @@
 	RTE_LOG_LINE(level, IPFRAG, "" __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_IP_FRAG_DEBUG
-#define	IP_FRAG_LOG(lvl, fmt, args...)	RTE_LOG(lvl, IPFRAG, fmt, ##args)
+#define	IP_FRAG_LOG(lvl, fmt, ...)	RTE_LOG(lvl, IPFRAG, fmt, ## __VA_ARGS__)
 #else
-#define	IP_FRAG_LOG(lvl, fmt, args...)	do {} while(0)
+#define	IP_FRAG_LOG(lvl, fmt, ...)	do {} while (0)
 #endif /* IP_FRAG_DEBUG */
 
 #define IPV4_KEYLEN 1
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH 06/15] compressdev: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (4 preceding siblings ...)
  2024-02-12 21:49 ` [PATCH 05/15] ip_frag: " Tyler Retzlaff
@ 2024-02-12 21:49 ` Tyler Retzlaff
  2024-02-12 21:49 ` [PATCH 07/15] metrics: " Tyler Retzlaff
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

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/compressdev/rte_compressdev_internal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/compressdev/rte_compressdev_internal.h b/lib/compressdev/rte_compressdev_internal.h
index 01b7764..6c90aa5 100644
--- a/lib/compressdev/rte_compressdev_internal.h
+++ b/lib/compressdev/rte_compressdev_internal.h
@@ -23,8 +23,8 @@
 extern int compressdev_logtype;
 #define RTE_LOGTYPE_COMPRESSDEV compressdev_logtype
 
-#define COMPRESSDEV_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, COMPRESSDEV, "%s(): " fmt, __func__, ## args)
+#define COMPRESSDEV_LOG(level, fmt, ...) \
+	RTE_LOG_LINE(level, COMPRESSDEV, "%s(): " fmt, __func__, ## __VA_ARGS__)
 
 /**
  * Dequeue processed packets from queue pair of a device.
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH 07/15] metrics: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (5 preceding siblings ...)
  2024-02-12 21:49 ` [PATCH 06/15] compressdev: " Tyler Retzlaff
@ 2024-02-12 21:49 ` Tyler Retzlaff
  2024-02-12 21:49 ` [PATCH 08/15] mldev: " Tyler Retzlaff
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

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/metrics/rte_metrics_telemetry.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/metrics/rte_metrics_telemetry.c b/lib/metrics/rte_metrics_telemetry.c
index b8c9d75..0f26726 100644
--- a/lib/metrics/rte_metrics_telemetry.c
+++ b/lib/metrics/rte_metrics_telemetry.c
@@ -19,14 +19,14 @@
 #define RTE_LOGTYPE_METRICS metrics_log_level
 
 /* Logging Macros */
-#define METRICS_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, METRICS, "%s(): "fmt, __func__, ## args)
+#define METRICS_LOG(level, fmt, ...) \
+	RTE_LOG_LINE(level, METRICS, "%s(): "fmt, __func__, ## __VA_ARGS__)
 
-#define METRICS_LOG_ERR(fmt, args...) \
-	METRICS_LOG(ERR, fmt, ## args)
+#define METRICS_LOG_ERR(fmt, ...) \
+	METRICS_LOG(ERR, fmt, ## __VA_ARGS__)
 
-#define METRICS_LOG_WARN(fmt, args...) \
-	METRICS_LOG(WARNING, fmt, ## args)
+#define METRICS_LOG_WARN(fmt, ...) \
+	METRICS_LOG(WARNING, fmt, ## __VA_ARGS__)
 
 static int32_t
 rte_metrics_tel_reg_port_ethdev_to_metrics(uint16_t port_id)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH 08/15] mldev: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (6 preceding siblings ...)
  2024-02-12 21:49 ` [PATCH 07/15] metrics: " Tyler Retzlaff
@ 2024-02-12 21:49 ` Tyler Retzlaff
  2024-02-12 21:49 ` [PATCH 09/15] net: " Tyler Retzlaff
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

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/mldev/rte_mldev.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/mldev/rte_mldev.h b/lib/mldev/rte_mldev.h
index 5cf6f05..e3ec889 100644
--- a/lib/mldev/rte_mldev.h
+++ b/lib/mldev/rte_mldev.h
@@ -146,8 +146,8 @@
 extern int rte_ml_dev_logtype;
 #define RTE_LOGTYPE_MLDEV rte_ml_dev_logtype
 
-#define RTE_MLDEV_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, MLDEV, "%s(): " fmt, __func__, ##args)
+#define RTE_MLDEV_LOG(level, fmt, ...) \
+	RTE_LOG_LINE(level, MLDEV, "%s(): " fmt, __func__, ## __VA_ARGS__)
 
 #define RTE_ML_STR_MAX 128
 /**< Maximum length of name string */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH 09/15] net: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (7 preceding siblings ...)
  2024-02-12 21:49 ` [PATCH 08/15] mldev: " Tyler Retzlaff
@ 2024-02-12 21:49 ` Tyler Retzlaff
  2024-02-12 21:49 ` [PATCH 10/15] pdump: " Tyler Retzlaff
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

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/net/rte_net_crc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/net/rte_net_crc.c b/lib/net/rte_net_crc.c
index b401ea3..241155e 100644
--- a/lib/net/rte_net_crc.c
+++ b/lib/net/rte_net_crc.c
@@ -73,8 +73,8 @@
 RTE_LOG_REGISTER_DEFAULT(libnet_logtype, INFO);
 #define RTE_LOGTYPE_NET libnet_logtype
 
-#define NET_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, NET, "%s(): " fmt, __func__, ## args)
+#define NET_LOG(level, fmt, ...) \
+	RTE_LOG_LINE(level, NET, "%s(): " fmt, __func__, ## __VA_ARGS__)
 
 /* Scalar handling */
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH 10/15] pdump: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (8 preceding siblings ...)
  2024-02-12 21:49 ` [PATCH 09/15] net: " Tyler Retzlaff
@ 2024-02-12 21:49 ` Tyler Retzlaff
  2024-02-12 21:49 ` [PATCH 11/15] power: " Tyler Retzlaff
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

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/pdump/rte_pdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index f6160f9..7717b54 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -18,8 +18,8 @@
 RTE_LOG_REGISTER_DEFAULT(pdump_logtype, NOTICE);
 #define RTE_LOGTYPE_PDUMP pdump_logtype
 
-#define PDUMP_LOG_LINE(level, fmt, args...) \
-	RTE_LOG_LINE(level, PDUMP, "%s(): " fmt, __func__, ## args)
+#define PDUMP_LOG_LINE(level, fmt, ...) \
+	RTE_LOG_LINE(level, PDUMP, "%s(): " fmt, __func__, ## __VA_ARGS__)
 
 /* Used for the multi-process communication */
 #define PDUMP_MP	"mp_pdump"
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH 11/15] power: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (9 preceding siblings ...)
  2024-02-12 21:49 ` [PATCH 10/15] pdump: " Tyler Retzlaff
@ 2024-02-12 21:49 ` Tyler Retzlaff
  2024-02-12 21:49 ` [PATCH 12/15] rawdev: " Tyler Retzlaff
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

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/power/power_common.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/power/power_common.h b/lib/power/power_common.h
index 3096640..ba17e74 100644
--- a/lib/power/power_common.h
+++ b/lib/power/power_common.h
@@ -16,10 +16,10 @@
 	RTE_LOG_LINE(level, POWER, "" __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
-#define POWER_DEBUG_LOG(fmt, args...) \
-	RTE_LOG_LINE(ERR, POWER, "%s: " fmt, __func__, ## args)
+#define POWER_DEBUG_LOG(fmt, ...) \
+	RTE_LOG_LINE(ERR, POWER, "%s: " fmt, __func__, ## __VA_ARGS__)
 #else
-#define POWER_DEBUG_LOG(fmt, args...)
+#define POWER_DEBUG_LOG(fmt, ...)
 #endif
 
 /* check if scaling driver matches one we want */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH 12/15] rawdev: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (10 preceding siblings ...)
  2024-02-12 21:49 ` [PATCH 11/15] power: " Tyler Retzlaff
@ 2024-02-12 21:49 ` Tyler Retzlaff
  2024-02-13 12:46   ` Hemant Agrawal
  2024-02-12 21:49 ` [PATCH 13/15] rcu: " Tyler Retzlaff
                   ` (9 subsequent siblings)
  21 siblings, 1 reply; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

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/rawdev/rte_rawdev_pmd.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
index 7173282..d66f438 100644
--- a/lib/rawdev/rte_rawdev_pmd.h
+++ b/lib/rawdev/rte_rawdev_pmd.h
@@ -30,15 +30,15 @@
 #define RTE_LOGTYPE_RAWDEV librawdev_logtype
 
 /* Logging Macros */
-#define RTE_RDEV_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, RAWDEV, "%s(): " fmt, __func__, ##args)
-
-#define RTE_RDEV_ERR(fmt, args...) \
-	RTE_RDEV_LOG(ERR, fmt, ## args)
-#define RTE_RDEV_DEBUG(fmt, args...) \
-	RTE_RDEV_LOG(DEBUG, fmt, ## args)
-#define RTE_RDEV_INFO(fmt, args...) \
-	RTE_RDEV_LOG(INFO, fmt, ## args)
+#define RTE_RDEV_LOG(level, fmt, ...) \
+	RTE_LOG_LINE(level, RAWDEV, "%s(): " fmt, __func__, ## __VA_ARGS__)
+
+#define RTE_RDEV_ERR(fmt, ...) \
+	RTE_RDEV_LOG(ERR, fmt, ## __VA_ARGS__)
+#define RTE_RDEV_DEBUG(fmt, ...) \
+	RTE_RDEV_LOG(DEBUG, fmt, ## __VA_ARGS__)
+#define RTE_RDEV_INFO(fmt, ...) \
+	RTE_RDEV_LOG(INFO, fmt, ## __VA_ARGS__)
 
 
 /* Macros to check for valid device */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH 13/15] rcu: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (11 preceding siblings ...)
  2024-02-12 21:49 ` [PATCH 12/15] rawdev: " Tyler Retzlaff
@ 2024-02-12 21:49 ` Tyler Retzlaff
  2024-02-12 21:49 ` [PATCH 14/15] stack: " Tyler Retzlaff
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

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/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


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH 14/15] stack: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (12 preceding siblings ...)
  2024-02-12 21:49 ` [PATCH 13/15] rcu: " Tyler Retzlaff
@ 2024-02-12 21:49 ` Tyler Retzlaff
  2024-02-12 21:49 ` [PATCH 15/15] vhost: " Tyler Retzlaff
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

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/stack/stack_pvt.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/stack/stack_pvt.h b/lib/stack/stack_pvt.h
index 2dce42a..f38808b 100644
--- a/lib/stack/stack_pvt.h
+++ b/lib/stack/stack_pvt.h
@@ -10,16 +10,16 @@
 extern int stack_logtype;
 #define RTE_LOGTYPE_STACK stack_logtype
 
-#define STACK_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, STACK, "%s(): "fmt, __func__, ##args)
+#define STACK_LOG(level, fmt, ...) \
+	RTE_LOG_LINE(level, STACK, "%s(): "fmt, __func__, ## __VA_ARGS__)
 
-#define STACK_LOG_ERR(fmt, args...) \
-	STACK_LOG(ERR, fmt, ## args)
+#define STACK_LOG_ERR(fmt, ...) \
+	STACK_LOG(ERR, fmt, ## __VA_ARGS__)
 
-#define STACK_LOG_WARN(fmt, args...) \
-	STACK_LOG(WARNING, fmt, ## args)
+#define STACK_LOG_WARN(fmt, ...) \
+	STACK_LOG(WARNING, fmt, ## __VA_ARGS__)
 
-#define STACK_LOG_INFO(fmt, args...) \
-	STACK_LOG(INFO, fmt, ## args)
+#define STACK_LOG_INFO(fmt, ...) \
+	STACK_LOG(INFO, fmt, ## __VA_ARGS__)
 
 #endif /* _STACK_PVT_H_ */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH 15/15] vhost: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (13 preceding siblings ...)
  2024-02-12 21:49 ` [PATCH 14/15] stack: " Tyler Retzlaff
@ 2024-02-12 21:49 ` Tyler Retzlaff
  2024-02-13  9:00 ` [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Bruce Richardson
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-12 21:49 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, Tyler Retzlaff

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(-)

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) |	\
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (14 preceding siblings ...)
  2024-02-12 21:49 ` [PATCH 15/15] vhost: " Tyler Retzlaff
@ 2024-02-13  9:00 ` Bruce Richardson
  2024-02-13  9:09 ` Morten Brørup
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Bruce Richardson @ 2024-02-13  9:00 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Anatoly Burakov, Ashish Gupta, Chenbo Xia,
	Cristian Dumitrescu, David Hunt, Fan Zhang, Hemant Agrawal,
	Honnappa Nagarahalli, Jasvinder Singh, Jerin Jacob,
	Konstantin Ananyev, Maxime Coquelin, Reshma Pattan,
	Sachin Saxena, Sivaprasad Tummala, Srikanth Yalavarthi,
	Stephen Hemminger, Sunil Kumar Kori

On Mon, Feb 12, 2024 at 01:49:02PM -0800, Tyler Retzlaff wrote:
> MSVC does not support GCC args... forwarding of args replace
> with ... and __VA_ARGS__ when forwarding.  Both forms of
> forwarding are a compiler extension but the latter is supported
> by both MSVC and GCC.
> 
> I have not been able to exhaustively test all versions of GCC so
> please provide feedback as appropriate.
> 
> Tyler Retzlaff (15):
>   eal: use GCC and MSVC common VA ARGS extension
>   bpf: use GCC and MSVC common VA ARGS extension
>   cfgfile: use GCC and MSVC common VA ARGS extension
>   cmdline: use GCC and MSVC common VA ARGS extension
>   ip_frag: use GCC and MSVC common VA ARGS extension
>   compressdev: use GCC and MSVC common VA ARGS extension
>   metrics: use GCC and MSVC common VA ARGS extension
>   mldev: use GCC and MSVC common VA ARGS extension
>   net: use GCC and MSVC common VA ARGS extension
>   pdump: use GCC and MSVC common VA ARGS extension
>   power: use GCC and MSVC common VA ARGS extension
>   rawdev: use GCC and MSVC common VA ARGS extension
>   rcu: use GCC and MSVC common VA ARGS extension
>   stack: use GCC and MSVC common VA ARGS extension
>   vhost: use GCC and MSVC common VA ARGS extension
> 
Series-acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH 03/15] cfgfile: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 ` [PATCH 03/15] cfgfile: " Tyler Retzlaff
@ 2024-02-13  9:03   ` Bruce Richardson
  0 siblings, 0 replies; 120+ messages in thread
From: Bruce Richardson @ 2024-02-13  9:03 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Anatoly Burakov, Ashish Gupta, Chenbo Xia,
	Cristian Dumitrescu, David Hunt, Fan Zhang, Hemant Agrawal,
	Honnappa Nagarahalli, Jasvinder Singh, Jerin Jacob,
	Konstantin Ananyev, Maxime Coquelin, Reshma Pattan,
	Sachin Saxena, Sivaprasad Tummala, Srikanth Yalavarthi,
	Stephen Hemminger, Sunil Kumar Kori

On Mon, Feb 12, 2024 at 01:49:05PM -0800, Tyler Retzlaff wrote:
> 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/cfgfile/rte_cfgfile.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/cfgfile/rte_cfgfile.c b/lib/cfgfile/rte_cfgfile.c
> index 6a5e4fd..e006508 100644
> --- a/lib/cfgfile/rte_cfgfile.c
> +++ b/lib/cfgfile/rte_cfgfile.c
> @@ -31,8 +31,8 @@ struct rte_cfgfile {
>  RTE_LOG_REGISTER_DEFAULT(cfgfile_logtype, INFO);
>  #define RTE_LOGTYPE_CFGFILE cfgfile_logtype
>  
> -#define CFG_LOG(level, fmt, args...)					\
> -	RTE_LOG_LINE(level, CFGFILE, "%s(): " fmt, __func__, ## args)
> +#define CFG_LOG(level, fmt, ...)					\
> +	RTE_LOG_LINE(level, CFGFILE, "%s(): " fmt, __func__, ## __VA_ARGS__)
>  /* >8 End of setting up dynamic logging */
>  

Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH 04/15] cmdline: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 ` [PATCH 04/15] cmdline: " Tyler Retzlaff
@ 2024-02-13  9:04   ` Bruce Richardson
  0 siblings, 0 replies; 120+ messages in thread
From: Bruce Richardson @ 2024-02-13  9:04 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Anatoly Burakov, Ashish Gupta, Chenbo Xia,
	Cristian Dumitrescu, David Hunt, Fan Zhang, Hemant Agrawal,
	Honnappa Nagarahalli, Jasvinder Singh, Jerin Jacob,
	Konstantin Ananyev, Maxime Coquelin, Reshma Pattan,
	Sachin Saxena, Sivaprasad Tummala, Srikanth Yalavarthi,
	Stephen Hemminger, Sunil Kumar Kori

On Mon, Feb 12, 2024 at 01:49:06PM -0800, Tyler Retzlaff wrote:
> 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.
> 
> Fix checkpatches warning about style while(0) -> while (0)
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 120+ messages in thread

* RE: [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (15 preceding siblings ...)
  2024-02-13  9:00 ` [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Bruce Richardson
@ 2024-02-13  9:09 ` Morten Brørup
  2024-02-18 13:38 ` Thomas Monjalon
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Morten Brørup @ 2024-02-13  9:09 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Monday, 12 February 2024 22.49
> 
> MSVC does not support GCC args... forwarding of args replace
> with ... and __VA_ARGS__ when forwarding.  Both forms of
> forwarding are a compiler extension but the latter is supported
> by both MSVC and GCC.

Series-acked-by: Morten Brørup <mb@smartsharesystems.com>


^ permalink raw reply	[flat|nested] 120+ messages in thread

* RE: [PATCH 12/15] rawdev: use GCC and MSVC common VA ARGS extension
  2024-02-12 21:49 ` [PATCH 12/15] rawdev: " Tyler Retzlaff
@ 2024-02-13 12:46   ` Hemant Agrawal
  0 siblings, 0 replies; 120+ messages in thread
From: Hemant Agrawal @ 2024-02-13 12:46 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Honnappa Nagarahalli, Jasvinder Singh,
	Jerin Jacob, Konstantin Ananyev, Maxime Coquelin, Reshma Pattan,
	Sachin Saxena, Sivaprasad Tummala, Srikanth Yalavarthi,
	Stephen Hemminger, Sunil Kumar Kori

[-- Attachment #1: Type: text/plain, Size: 51 bytes --]


Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 9818 bytes --]

^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (16 preceding siblings ...)
  2024-02-13  9:09 ` Morten Brørup
@ 2024-02-18 13:38 ` Thomas Monjalon
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Thomas Monjalon @ 2024-02-18 13:38 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Anatoly Burakov, Ashish Gupta, Chenbo Xia,
	Cristian Dumitrescu, David Hunt, Fan Zhang, Hemant Agrawal,
	Honnappa Nagarahalli, Jasvinder Singh, Jerin Jacob,
	Konstantin Ananyev, Maxime Coquelin, Reshma Pattan,
	Sachin Saxena, Sivaprasad Tummala, Srikanth Yalavarthi,
	Stephen Hemminger, Sunil Kumar Kori

12/02/2024 22:49, Tyler Retzlaff:
> MSVC does not support GCC args... forwarding of args replace
> with ... and __VA_ARGS__ when forwarding.  Both forms of
> forwarding are a compiler extension but the latter is supported
> by both MSVC and GCC.

You use the non-standard ", ## __VA_ARGS__"
which would not compile in pedantic modes,
and possibly with other compilers.

I remember a private chat where I recommended you to use this:

lib/eal/include/rte_common.h
/**
 * ISO C helpers to modify format strings using variadic macros.
 * This is a replacement for the ", ## __VA_ARGS__" GNU extension.
 * An empty %s argument is appended to avoid a dangling comma.
 */
#define RTE_FMT(fmt, ...) fmt "%.0s", __VA_ARGS__ ""
#define RTE_FMT_HEAD(fmt, ...) fmt
#define RTE_FMT_TAIL(fmt, ...) __VA_ARGS__

Why not using it?




^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 00/17] stop using variadic argument pack extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (17 preceding siblings ...)
  2024-02-18 13:38 ` Thomas Monjalon
@ 2024-02-22 23:46 ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 01/17] log: add a per line log helper with parameterized prefix Tyler Retzlaff
                     ` (17 more replies)
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                   ` (2 subsequent siblings)
  21 siblings, 18 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

RTE_LOG_LINE cannot be augmented with a prefix format and arguments
without the user of RTE_LOG_LINE using the args... and ## args compiler
extension to conditionally remove trailing comma when the macro receives
only a single argument.

Provide a new/similar macro RTE_LOG_LINE_PREFIX that accepts the prefix
format and arguments as separate parameters allowing them to be expanded
at the correct locations inside of RTE_FMT() allowing the rest of the
non-prefix format string and arguments to be collapsed to the argument
pack which can be directly forwarded with __VA_ARGS__ avoiding the need
for conditional comma removal.

I've done my best to manually check expansions (preprocessed) and compiled
printf of the logs to validate correct output.

note: due to drastic change in series i have not carried any series acks
      forward.

v2:
    * revamp entire series to be ISO C99 compliant, stop using variadic
      argument pack extension.

Tyler Retzlaff (17):
  log: add a per line log helper with parameterized prefix
  bpf: stop using variadic argument pack extension
  cfgfile: stop using variadic argument pack extension
  cmdline: stop using variadic argument pack extension
  compressdev: stop using variadic argument pack extension
  metrics: stop using variadic argument pack extension
  mldev: stop using variadic argument pack extension
  net: stop using variadic argument pack extension
  pdump: stop using variadic argument pack extension
  power: stop using variadic argument pack extension
  rawdev: stop using variadic argument pack extension
  rcu: stop using variadic argument pack extension
  stack: stop using variadic argument pack extension
  eal: stop using variadic argument pack extension
  vhost: stop using variadic argument pack extension
  vhost: stop using variadic argument pack extension
  ip_frag: stop using variadic argument pack extension

 lib/bpf/bpf_impl.h                         |  4 ++--
 lib/cfgfile/rte_cfgfile.c                  |  5 +++--
 lib/cmdline/cmdline_parse.c                |  2 +-
 lib/cmdline/cmdline_parse_num.c            |  4 ++--
 lib/compressdev/rte_compressdev_internal.h |  4 ++--
 lib/eal/common/eal_trace.h                 |  8 ++++----
 lib/ip_frag/ip_frag_common.h               |  4 ++--
 lib/log/rte_log.h                          | 14 ++++++++++++++
 lib/metrics/rte_metrics_telemetry.c        | 12 ++++++------
 lib/mldev/rte_mldev.h                      |  4 ++--
 lib/net/rte_net_crc.c                      |  4 ++--
 lib/pdump/rte_pdump.c                      |  4 ++--
 lib/power/power_common.h                   |  6 +++---
 lib/rawdev/rte_rawdev_pmd.h                | 17 +++++++++--------
 lib/rcu/rte_rcu_qsbr.c                     |  4 ++--
 lib/rcu/rte_rcu_qsbr.h                     | 12 ++++++------
 lib/stack/stack_pvt.h                      | 16 ++++++++--------
 lib/vhost/vhost.h                          |  8 ++++----
 lib/vhost/vhost_crypto.c                   | 21 +++++++++++----------
 19 files changed, 85 insertions(+), 68 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 01/17] log: add a per line log helper with parameterized prefix
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-26 18:04     ` Thomas Monjalon
  2024-02-22 23:46   ` [PATCH v2 02/17] bpf: stop using variadic argument pack extension Tyler Retzlaff
                     ` (16 subsequent siblings)
  17 siblings, 1 reply; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Providing a custom prefix when logging is common for components. Lift
ISO C99 compliant helper macros from mlx5_common.h and provide
RTE_LOG_LINE_PREFIX macro that can expand similar to RTE_LOG_LINE with
a custom prefix and argument list.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/log/rte_log.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index fbc0df7..a0fee24 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -379,6 +379,20 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
 		RTE_FMT_TAIL(__VA_ARGS__ ,))); \
 } while (0)
 
+#define _RTE_LOG_COMMA ,
+
+#define RTE_LOG_LINE_PREFIX(l, t, prefix, args, ...) do { \
+	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(prefix __VA_ARGS__ ,)); \
+	RTE_LOG(l, t, RTE_FMT(prefix RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+	    args _RTE_LOG_COMMA RTE_FMT_TAIL(__VA_ARGS__ ,))); \
+} while (0)
+
+#define RTE_LOG_DP_LINE_PREFIX(l, t, prefix, args, ...) do { \
+	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(prefix __VA_ARGS__ ,)); \
+	RTE_LOG_DP(l, t, RTE_FMT(prefix RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+	    args _RTE_LOG_COMMA RTE_FMT_TAIL(__VA_ARGS__ ,))); \
+} while (0)
+
 #define RTE_LOG_REGISTER_IMPL(type, name, level)			    \
 int type;								    \
 RTE_INIT(__##type)							    \
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 02/17] bpf: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 01/17] log: add a per line log helper with parameterized prefix Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 03/17] cfgfile: " Tyler Retzlaff
                     ` (15 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/bpf/bpf_impl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h
index 1a3d97d..680b1e5 100644
--- a/lib/bpf/bpf_impl.h
+++ b/lib/bpf/bpf_impl.h
@@ -29,8 +29,8 @@ struct rte_bpf {
 extern int rte_bpf_logtype;
 #define RTE_LOGTYPE_BPF rte_bpf_logtype
 
-#define	RTE_BPF_LOG_LINE(lvl, fmt, args...) \
-	RTE_LOG_LINE(lvl, BPF, fmt, ##args)
+#define RTE_BPF_LOG_LINE(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, BPF, "%s(): ", __func__, __VA_ARGS__)
 
 static inline size_t
 bpf_size(uint32_t bpf_op_sz)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 03/17] cfgfile: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 01/17] log: add a per line log helper with parameterized prefix Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 02/17] bpf: stop using variadic argument pack extension Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 04/17] cmdline: " Tyler Retzlaff
                     ` (14 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/cfgfile/rte_cfgfile.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/cfgfile/rte_cfgfile.c b/lib/cfgfile/rte_cfgfile.c
index 6a5e4fd..e7e690f 100644
--- a/lib/cfgfile/rte_cfgfile.c
+++ b/lib/cfgfile/rte_cfgfile.c
@@ -31,8 +31,9 @@ struct rte_cfgfile {
 RTE_LOG_REGISTER_DEFAULT(cfgfile_logtype, INFO);
 #define RTE_LOGTYPE_CFGFILE cfgfile_logtype
 
-#define CFG_LOG(level, fmt, args...)					\
-	RTE_LOG_LINE(level, CFGFILE, "%s(): " fmt, __func__, ## args)
+#define CFG_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, CFGFILE, "%s(): ", __func__, __VA_ARGS__)
+
 /* >8 End of setting up dynamic logging */
 
 /** when we resize a file structure, how many extra entries
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 04/17] cmdline: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-02-22 23:46   ` [PATCH v2 03/17] cfgfile: " Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 05/17] compressdev: " Tyler Retzlaff
                     ` (13 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Remove use of args... and just use __VA_ARGS__. The macros expanding
the argument pack do not require args extension to remove trailing comma.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/cmdline/cmdline_parse.c     | 2 +-
 lib/cmdline/cmdline_parse_num.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/cmdline/cmdline_parse.c b/lib/cmdline/cmdline_parse.c
index b6d6dac..76a212d 100644
--- a/lib/cmdline/cmdline_parse.c
+++ b/lib/cmdline/cmdline_parse.c
@@ -16,7 +16,7 @@
 #ifdef RTE_LIBRTE_CMDLINE_DEBUG
 #define debug_printf printf
 #else
-#define debug_printf(args...) do {} while(0)
+#define debug_printf(...) do {} while (0)
 #endif
 
 #define CMDLINE_BUFFER_SIZE 64
diff --git a/lib/cmdline/cmdline_parse_num.c b/lib/cmdline/cmdline_parse_num.c
index 820af07..e849878 100644
--- a/lib/cmdline/cmdline_parse_num.c
+++ b/lib/cmdline/cmdline_parse_num.c
@@ -14,9 +14,9 @@
 #include "cmdline_parse_num.h"
 
 #ifdef RTE_LIBRTE_CMDLINE_DEBUG
-#define debug_printf(args...) printf(args)
+#define debug_printf(...) printf(__VA_ARGS__)
 #else
-#define debug_printf(args...) do {} while(0)
+#define debug_printf(...) do {} while (0)
 #endif
 
 struct cmdline_token_ops cmdline_token_num_ops = {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 05/17] compressdev: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                     ` (3 preceding siblings ...)
  2024-02-22 23:46   ` [PATCH v2 04/17] cmdline: " Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 06/17] metrics: " Tyler Retzlaff
                     ` (12 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/compressdev/rte_compressdev_internal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/compressdev/rte_compressdev_internal.h b/lib/compressdev/rte_compressdev_internal.h
index 01b7764..0bc8c87 100644
--- a/lib/compressdev/rte_compressdev_internal.h
+++ b/lib/compressdev/rte_compressdev_internal.h
@@ -23,8 +23,8 @@
 extern int compressdev_logtype;
 #define RTE_LOGTYPE_COMPRESSDEV compressdev_logtype
 
-#define COMPRESSDEV_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, COMPRESSDEV, "%s(): " fmt, __func__, ## args)
+#define COMPRESSDEV_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, COMPRESSDEV, "%s(): ", __func__, __VA_ARGS__)
 
 /**
  * Dequeue processed packets from queue pair of a device.
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 06/17] metrics: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                     ` (4 preceding siblings ...)
  2024-02-22 23:46   ` [PATCH v2 05/17] compressdev: " Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 07/17] mldev: " Tyler Retzlaff
                     ` (11 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/metrics/rte_metrics_telemetry.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/metrics/rte_metrics_telemetry.c b/lib/metrics/rte_metrics_telemetry.c
index b8c9d75..dc43611 100644
--- a/lib/metrics/rte_metrics_telemetry.c
+++ b/lib/metrics/rte_metrics_telemetry.c
@@ -19,14 +19,14 @@
 #define RTE_LOGTYPE_METRICS metrics_log_level
 
 /* Logging Macros */
-#define METRICS_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, METRICS, "%s(): "fmt, __func__, ## args)
+#define METRICS_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, METRICS, "%s(): ", __func__, __VA_ARGS__)
 
-#define METRICS_LOG_ERR(fmt, args...) \
-	METRICS_LOG(ERR, fmt, ## args)
+#define METRICS_LOG_ERR(...) \
+	METRICS_LOG(ERR, __VA_ARGS__)
 
-#define METRICS_LOG_WARN(fmt, args...) \
-	METRICS_LOG(WARNING, fmt, ## args)
+#define METRICS_LOG_WARN(...) \
+	METRICS_LOG(WARNING, __VA_ARGS__)
 
 static int32_t
 rte_metrics_tel_reg_port_ethdev_to_metrics(uint16_t port_id)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 07/17] mldev: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                     ` (5 preceding siblings ...)
  2024-02-22 23:46   ` [PATCH v2 06/17] metrics: " Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 08/17] net: " Tyler Retzlaff
                     ` (10 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/mldev/rte_mldev.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/mldev/rte_mldev.h b/lib/mldev/rte_mldev.h
index 27e372f..01577bd 100644
--- a/lib/mldev/rte_mldev.h
+++ b/lib/mldev/rte_mldev.h
@@ -146,8 +146,8 @@
 extern int rte_ml_dev_logtype;
 #define RTE_LOGTYPE_MLDEV rte_ml_dev_logtype
 
-#define RTE_MLDEV_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, MLDEV, "%s(): " fmt, __func__, ##args)
+#define RTE_MLDEV_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, MLDEV, "%s(): ", __func__, __VA_ARGS__)
 
 #define RTE_ML_STR_MAX 128
 /**< Maximum length of name string */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 08/17] net: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                     ` (6 preceding siblings ...)
  2024-02-22 23:46   ` [PATCH v2 07/17] mldev: " Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 09/17] pdump: " Tyler Retzlaff
                     ` (9 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/net/rte_net_crc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/net/rte_net_crc.c b/lib/net/rte_net_crc.c
index b401ea3..346c285 100644
--- a/lib/net/rte_net_crc.c
+++ b/lib/net/rte_net_crc.c
@@ -73,8 +73,8 @@
 RTE_LOG_REGISTER_DEFAULT(libnet_logtype, INFO);
 #define RTE_LOGTYPE_NET libnet_logtype
 
-#define NET_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, NET, "%s(): " fmt, __func__, ## args)
+#define NET_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, NET, "%s(): ", __func__, __VA_ARGS__)
 
 /* Scalar handling */
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 09/17] pdump: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                     ` (7 preceding siblings ...)
  2024-02-22 23:46   ` [PATCH v2 08/17] net: " Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 10/17] power: " Tyler Retzlaff
                     ` (8 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/pdump/rte_pdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index f6160f9..679c3dd 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -18,8 +18,8 @@
 RTE_LOG_REGISTER_DEFAULT(pdump_logtype, NOTICE);
 #define RTE_LOGTYPE_PDUMP pdump_logtype
 
-#define PDUMP_LOG_LINE(level, fmt, args...) \
-	RTE_LOG_LINE(level, PDUMP, "%s(): " fmt, __func__, ## args)
+#define PDUMP_LOG_LINE(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, PDUMP, "%s(): ", __func__, __VA_ARGS__)
 
 /* Used for the multi-process communication */
 #define PDUMP_MP	"mp_pdump"
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 10/17] power: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                     ` (8 preceding siblings ...)
  2024-02-22 23:46   ` [PATCH v2 09/17] pdump: " Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 11/17] rawdev: " Tyler Retzlaff
                     ` (7 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/power/power_common.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/power/power_common.h b/lib/power/power_common.h
index 3096640..77bc593 100644
--- a/lib/power/power_common.h
+++ b/lib/power/power_common.h
@@ -16,10 +16,10 @@
 	RTE_LOG_LINE(level, POWER, "" __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
-#define POWER_DEBUG_LOG(fmt, args...) \
-	RTE_LOG_LINE(ERR, POWER, "%s: " fmt, __func__, ## args)
+#define POWER_DEBUG_LOG(...) \
+	RTE_LOG_LINE_PREFIX(ERR, POWER, "%s(): ", __func__, __VA_ARGS__)
 #else
-#define POWER_DEBUG_LOG(fmt, args...)
+#define POWER_DEBUG_LOG(fmt, ...)
 #endif
 
 /* check if scaling driver matches one we want */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 11/17] rawdev: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                     ` (9 preceding siblings ...)
  2024-02-22 23:46   ` [PATCH v2 10/17] power: " Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 12/17] rcu: " Tyler Retzlaff
                     ` (6 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/rawdev/rte_rawdev_pmd.h | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
index 7173282..22b4064 100644
--- a/lib/rawdev/rte_rawdev_pmd.h
+++ b/lib/rawdev/rte_rawdev_pmd.h
@@ -30,16 +30,17 @@
 #define RTE_LOGTYPE_RAWDEV librawdev_logtype
 
 /* Logging Macros */
-#define RTE_RDEV_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, RAWDEV, "%s(): " fmt, __func__, ##args)
+#define RTE_RDEV_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, RAWDEV, "%s(): ", __func__, __VA_ARGS__)
 
-#define RTE_RDEV_ERR(fmt, args...) \
-	RTE_RDEV_LOG(ERR, fmt, ## args)
-#define RTE_RDEV_DEBUG(fmt, args...) \
-	RTE_RDEV_LOG(DEBUG, fmt, ## args)
-#define RTE_RDEV_INFO(fmt, args...) \
-	RTE_RDEV_LOG(INFO, fmt, ## args)
+#define RTE_RDEV_ERR(...) \
+	RTE_RDEV_LOG(ERR, __VA_ARGS__)
 
+#define RTE_RDEV_DEBUG(...) \
+	RTE_RDEV_LOG(DEBUG, __VA_ARGS__)
+
+#define RTE_RDEV_INFO(...) \
+	RTE_RDEV_LOG(INFO, __VA_ARGS__)
 
 /* Macros to check for valid device */
 #define RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, retval) do { \
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 12/17] rcu: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                     ` (10 preceding siblings ...)
  2024-02-22 23:46   ` [PATCH v2 11/17] rawdev: " Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 13/17] stack: " Tyler Retzlaff
                     ` (5 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@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..f08d974 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, ...) \
+	RTE_LOG_LINE_PREFIX(level, RCU, "%s(): ", __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 e7ef788..e4119cc 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, ...) \
+	RTE_LOG_DP_LINE_PREFIX(level, RCU, "%s(): ", __func__, __VA_ARGS__)
 #else
-#define __RTE_RCU_DP_LOG(level, fmt, args...)
+#define __RTE_RCU_DP_LOG(level, ...)
 #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, ...) do { \
 	if (v->qsbr_cnt[thread_id].lock_cnt) \
-		RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args); \
+		RTE_LOG_LINE_PREFIX(level, RCU, "%s(): ", __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


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 13/17] stack: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                     ` (11 preceding siblings ...)
  2024-02-22 23:46   ` [PATCH v2 12/17] rcu: " Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 14/17] eal: " Tyler Retzlaff
                     ` (4 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/stack/stack_pvt.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/stack/stack_pvt.h b/lib/stack/stack_pvt.h
index 2dce42a..fc95796 100644
--- a/lib/stack/stack_pvt.h
+++ b/lib/stack/stack_pvt.h
@@ -10,16 +10,16 @@
 extern int stack_logtype;
 #define RTE_LOGTYPE_STACK stack_logtype
 
-#define STACK_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, STACK, "%s(): "fmt, __func__, ##args)
+#define STACK_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, STACK, "%s(): ", __func__, __VA_ARGS__)
 
-#define STACK_LOG_ERR(fmt, args...) \
-	STACK_LOG(ERR, fmt, ## args)
+#define STACK_LOG_ERR(...) \
+	STACK_LOG(ERR, __VA_ARGS__)
 
-#define STACK_LOG_WARN(fmt, args...) \
-	STACK_LOG(WARNING, fmt, ## args)
+#define STACK_LOG_WARN(...) \
+	STACK_LOG(WARNING, __VA_ARGS__)
 
-#define STACK_LOG_INFO(fmt, args...) \
-	STACK_LOG(INFO, fmt, ## args)
+#define STACK_LOG_INFO(fmt, ...) \
+	STACK_LOG(INFO, __VA_ARGS__)
 
 #endif /* _STACK_PVT_H_ */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 14/17] eal: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                     ` (12 preceding siblings ...)
  2024-02-22 23:46   ` [PATCH v2 13/17] stack: " Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 15/17] vhost: " Tyler Retzlaff
                     ` (3 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Use RTE_LOG_LINE_PREFIX instead of EAL_LOG 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 <roretzla@linux.microsoft.com>
---
 lib/eal/common/eal_trace.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/eal/common/eal_trace.h b/lib/eal/common/eal_trace.h
index bd082a0..bd24fcd 100644
--- a/lib/eal/common/eal_trace.h
+++ b/lib/eal/common/eal_trace.h
@@ -16,11 +16,11 @@
 #include "eal_private.h"
 #include "eal_thread.h"
 
-#define trace_err(fmt, args...) \
-	EAL_LOG(ERR, "%s():%u " fmt, __func__, __LINE__, ## args)
+#define trace_err(...) \
+	RTE_LOG_LINE_PREFIX(ERR, EAL, "%s():%u ", __func__ _RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
-#define trace_crit(fmt, args...) \
-	EAL_LOG(CRIT, "%s():%u " fmt, __func__, __LINE__, ## args)
+#define trace_crit(...) \
+	RTE_LOG_LINE_PREFIX(CRIT, EAL, "%s():%u ", __func__ _RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #define TRACE_CTF_MAGIC 0xC1FC1FC1
 #define TRACE_MAX_ARGS	32
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 15/17] vhost: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                     ` (13 preceding siblings ...)
  2024-02-22 23:46   ` [PATCH v2 14/17] eal: " Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 16/17] " Tyler Retzlaff
                     ` (2 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/vhost/vhost.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 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
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 16/17] vhost: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                     ` (14 preceding siblings ...)
  2024-02-22 23:46   ` [PATCH v2 15/17] vhost: " Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-22 23:46   ` [PATCH v2 17/17] ip_frag: " Tyler Retzlaff
  2024-02-23  8:10   ` [PATCH v2 00/17] " Morten Brørup
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/vhost/vhost_crypto.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 3704fbb..68e755b 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


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v2 17/17] ip_frag: stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                     ` (15 preceding siblings ...)
  2024-02-22 23:46   ` [PATCH v2 16/17] " Tyler Retzlaff
@ 2024-02-22 23:46   ` Tyler Retzlaff
  2024-02-23  8:10   ` [PATCH v2 00/17] " Morten Brørup
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-22 23:46 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Remove use of args... and just use __VA_ARGS__. The macros expanding
the argument pack do not require args extension to remove trailing comma.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/ip_frag/ip_frag_common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h
index c766154..f66a963 100644
--- a/lib/ip_frag/ip_frag_common.h
+++ b/lib/ip_frag/ip_frag_common.h
@@ -26,9 +26,9 @@
 	RTE_LOG_LINE(level, IPFRAG, "" __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_IP_FRAG_DEBUG
-#define	IP_FRAG_LOG(lvl, fmt, args...)	RTE_LOG(lvl, IPFRAG, fmt, ##args)
+#define	IP_FRAG_LOG(lvl, ...)	RTE_LOG(lvl, IPFRAG, __VA_ARGS__)
 #else
-#define	IP_FRAG_LOG(lvl, fmt, args...)	do {} while(0)
+#define	IP_FRAG_LOG(lvl, fmt, ...)	do {} while (0)
 #endif /* IP_FRAG_DEBUG */
 
 #define IPV4_KEYLEN 1
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* RE: [PATCH v2 00/17] stop using variadic argument pack extension
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
                     ` (16 preceding siblings ...)
  2024-02-22 23:46   ` [PATCH v2 17/17] ip_frag: " Tyler Retzlaff
@ 2024-02-23  8:10   ` Morten Brørup
  17 siblings, 0 replies; 120+ messages in thread
From: Morten Brørup @ 2024-02-23  8:10 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, thomas

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Friday, 23 February 2024 00.46
> 
> RTE_LOG_LINE cannot be augmented with a prefix format and arguments
> without the user of RTE_LOG_LINE using the args... and ## args compiler
> extension to conditionally remove trailing comma when the macro receives
> only a single argument.
> 
> Provide a new/similar macro RTE_LOG_LINE_PREFIX that accepts the prefix
> format and arguments as separate parameters allowing them to be expanded
> at the correct locations inside of RTE_FMT() allowing the rest of the
> non-prefix format string and arguments to be collapsed to the argument
> pack which can be directly forwarded with __VA_ARGS__ avoiding the need
> for conditional comma removal.
> 
> I've done my best to manually check expansions (preprocessed) and
> compiled printf of the logs to validate correct output.
> 
> note: due to drastic change in series i have not carried any series acks
>       forward.

Series-acked-by: Morten Brørup <mb@smartsharesystems.com>


^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH v2 01/17] log: add a per line log helper with parameterized prefix
  2024-02-22 23:46   ` [PATCH v2 01/17] log: add a per line log helper with parameterized prefix Tyler Retzlaff
@ 2024-02-26 18:04     ` Thomas Monjalon
  0 siblings, 0 replies; 120+ messages in thread
From: Thomas Monjalon @ 2024-02-26 18:04 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Anatoly Burakov, Ashish Gupta, Chenbo Xia,
	Cristian Dumitrescu, David Hunt, Fan Zhang, Hemant Agrawal,
	Honnappa Nagarahalli, Jasvinder Singh, Jerin Jacob,
	Konstantin Ananyev, Maxime Coquelin, Reshma Pattan,
	Sachin Saxena, Sivaprasad Tummala, Srikanth Yalavarthi,
	Stephen Hemminger, Sunil Kumar Kori, bruce.richardson, mb,
	david.marchand

23/02/2024 00:46, Tyler Retzlaff:
> Providing a custom prefix when logging is common for components. Lift
> ISO C99 compliant helper macros from mlx5_common.h and provide
> RTE_LOG_LINE_PREFIX macro that can expand similar to RTE_LOG_LINE with
> a custom prefix and argument list.
[...]
> > +#define _RTE_LOG_COMMA ,

I'm not sure about the underscore at the beginning.
Anyway it is exported in the API.
By the way it should have a Doxygen comment.

> +
> +#define RTE_LOG_LINE_PREFIX(l, t, prefix, args, ...) do { \
> +	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(prefix __VA_ARGS__ ,)); \
> +	RTE_LOG(l, t, RTE_FMT(prefix RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
> +	    args _RTE_LOG_COMMA RTE_FMT_TAIL(__VA_ARGS__ ,))); \
> +} while (0)
> +
> +#define RTE_LOG_DP_LINE_PREFIX(l, t, prefix, args, ...) do { \
> +	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(prefix __VA_ARGS__ ,)); \
> +	RTE_LOG_DP(l, t, RTE_FMT(prefix RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
> +	    args _RTE_LOG_COMMA RTE_FMT_TAIL(__VA_ARGS__ ,))); \
> +} while (0)

Please could you add a Doxygen comment for each RTE_LOG_LINE variations,
including previous ones?
Would be nice to have an idea of the output what DP is doing.




^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 00/16] stop using variadic argument pack extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (18 preceding siblings ...)
  2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
@ 2024-02-26 20:19 ` Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 01/16] log: add a per line log helper with parameterized prefix Tyler Retzlaff
                     ` (17 more replies)
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
  21 siblings, 18 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

RTE_LOG_LINE cannot be augmented with a prefix format and arguments
without the user of RTE_LOG_LINE using the args... and ## args compiler
extension to conditionally remove trailing comma when the macro receives
only a single argument.

Provide a new/similar macro RTE_LOG_LINE_PREFIX that accepts the prefix
format and arguments as separate parameters allowing them to be expanded
at the correct locations inside of RTE_FMT() allowing the rest of the
non-prefix format string and arguments to be collapsed to the argument
pack which can be directly forwarded with __VA_ARGS__ avoiding the need
for conditional comma removal.

I've done my best to manually check expansions (preprocessed) and compiled
printf of the logs to validate correct output.

note: due to drastic change in series i have not carried any series acks
      forward.

v3:
  * remove leading _ from RTE_LOG_COMMA the macro is not internal
  * add doxygen comment for existing RTE_LOG{,DP}_LINE function-like
    macros, based on RTE_LOG{,DP} comments.
  * add doxygen comment for new RTE_LOG{,DP}_LINE_PREFIX function-like
    macros, based on RTE_LOG{,DP} comments.
  * merge 2 vhost patches into a single patch (mistake in previous
    submission)

v2:
  * revamp entire series to be ISO C99 compliant, stop using variadic
    argument pack extension.

Tyler Retzlaff (16):
  log: add a per line log helper with parameterized prefix
  bpf: stop using variadic argument pack extension
  cfgfile: stop using variadic argument pack extension
  cmdline: stop using variadic argument pack extension
  compressdev: stop using variadic argument pack extension
  metrics: stop using variadic argument pack extension
  mldev: stop using variadic argument pack extension
  net: stop using variadic argument pack extension
  pdump: stop using variadic argument pack extension
  power: stop using variadic argument pack extension
  rawdev: stop using variadic argument pack extension
  rcu: stop using variadic argument pack extension
  stack: stop using variadic argument pack extension
  eal: stop using variadic argument pack extension
  vhost: stop using variadic argument pack extension
  ip_frag: stop using variadic argument pack extension

 lib/bpf/bpf_impl.h                         |  4 +-
 lib/cfgfile/rte_cfgfile.c                  |  5 +-
 lib/cmdline/cmdline_parse.c                |  2 +-
 lib/cmdline/cmdline_parse_num.c            |  4 +-
 lib/compressdev/rte_compressdev_internal.h |  4 +-
 lib/eal/common/eal_trace.h                 |  8 +--
 lib/ip_frag/ip_frag_common.h               |  4 +-
 lib/log/rte_log.h                          | 97 ++++++++++++++++++++++++++++++
 lib/metrics/rte_metrics_telemetry.c        | 12 ++--
 lib/mldev/rte_mldev.h                      |  4 +-
 lib/net/rte_net_crc.c                      |  4 +-
 lib/pdump/rte_pdump.c                      |  4 +-
 lib/power/power_common.h                   |  6 +-
 lib/rawdev/rte_rawdev_pmd.h                | 17 +++---
 lib/rcu/rte_rcu_qsbr.c                     |  4 +-
 lib/rcu/rte_rcu_qsbr.h                     | 12 ++--
 lib/stack/stack_pvt.h                      | 16 ++---
 lib/vhost/vhost.h                          |  8 +--
 lib/vhost/vhost_crypto.c                   | 21 ++++---
 19 files changed, 168 insertions(+), 68 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 01/16] log: add a per line log helper with parameterized prefix
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 02/16] bpf: stop using variadic argument pack extension Tyler Retzlaff
                     ` (16 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Providing a custom prefix when logging is common for components. Lift
ISO C99 compliant helper macros from mlx5_common.h and provide
RTE_LOG_LINE_PREFIX macro that can expand similar to RTE_LOG_LINE with
a custom prefix and argument list.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/log/rte_log.h | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)

diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index fbc0df7..8f10e31 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -367,18 +367,115 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
 #define RTE_LOG_CHECK_NO_NEWLINE(...)
 #endif
 
+/**
+ * Generates a log message with a single trailing newline.
+ *
+ * The RTE_LOG_LINE() is a helper that expands logging of a message
+ * with RTE_LOG() appending a single newline to the formatted message.
+ *
+ * @param l
+ *   Log level. A value between EMERG (1) and DEBUG (8). The short name
+ *   is expanded by the macro, so it cannot be an integer value.
+ * @param t
+ *   The log type, for example, EAL. The short name is expanded by the
+ *   macro, so it cannot be an integer value.
+ * @param ...
+ *   The fmt string, as in printf(3), followed by the variable arguments
+ *   required by the format.
+ */
 #define RTE_LOG_LINE(l, t, ...) do { \
 	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \
 	RTE_LOG(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
 		RTE_FMT_TAIL(__VA_ARGS__ ,))); \
 } while (0)
 
+/**
+ * Generates a log message for data path with a single trailing newline.
+ *
+ * Similar to RTE_LOG_LINE(), except that it is removed at compilation
+ * time if the RTE_LOG_DP_LEVEL configuration option is lower than the
+ * log level argument.
+ *
+ * The RTE_LOG_LINE() is a helper that expands logging of a message
+ * with RTE_LOG_DP() appending a single newline to the formatted
+ * message.
+ *
+ * @param l
+ *   Log level. A value between EMERG (1) and DEBUG (8). The short name
+ *   is expanded by the macro, so it cannot be an integer value.
+ * @param t
+ *   The log type, for example, EAL. The short name is expanded by the
+ *   macro, so it cannot be an integer value.
+ * @param ...
+ *   The fmt string, as in printf(3), followed by the variable arguments
+ *   required by the format.
+ */
 #define RTE_LOG_DP_LINE(l, t, ...) do { \
 	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \
 	RTE_LOG_DP(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
 		RTE_FMT_TAIL(__VA_ARGS__ ,))); \
 } while (0)
 
+#define RTE_LOG_COMMA ,
+
+/*
+ * Generates a log message with a supplied prefix and arguments with a
+ * single trailing newline.
+ *
+ * The RTE_LOG_LINE_PREFIX() is a helper that expands logging of a
+ * message with RTE_LOG() prepending the supplied prefix and arguments
+ * appending a single newline to the formatted message.
+ *
+ * @param l
+ *   Log level. A value between EMERG (1) and DEBUG (8). The short name
+ *   is expanded by the macro, so it cannot be an integer value.
+ * @param t
+ *   The log type, for example, EAL. The short name is expanded by the
+ *   macro, so it cannot be an integer value.
+ * @param prefix
+ *   The prefix format string.
+ * @param args
+ *   The arguments for the prefix format string. If args contains
+ *   multiple arguments use RTE_LOG_COMMA to defer expansion.
+ * @param ...
+ *   The fmt string, as in printf(3), followed by the variable arguments
+ *   required by the format.
+ */
+#define RTE_LOG_LINE_PREFIX(l, t, prefix, args, ...) do { \
+	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(prefix __VA_ARGS__ ,)); \
+	RTE_LOG(l, t, RTE_FMT(prefix RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+	    args RTE_LOG_COMMA RTE_FMT_TAIL(__VA_ARGS__ ,))); \
+} while (0)
+
+/*
+ * Generates a log message for the data path with a supplied prefix and
+ * arguments with a single trailing newline.
+ *
+ * The RTE_LOG_DP_LINE_PREFIX() is a helper that expands logging of a
+ * message with RTE_LOG_DP() prepending the supplied prefix and
+ * arguments appending a single newline to the formatted message.
+ *
+ * @param l
+ *   Log level. A value between EMERG (1) and DEBUG (8). The short name
+ *   is expanded by the macro, so it cannot be an integer value.
+ * @param t
+ *   The log type, for example, EAL. The short name is expanded by the
+ *   macro, so it cannot be an integer value.
+ * @param prefix
+ *   The prefix format string.
+ * @param args
+ *   The arguments for the prefix format string. If args contains
+ *   multiple arguments use RTE_LOG_COMMA to defer expansion.
+ * @param ...
+ *   The fmt string, as in printf(3), followed by the variable arguments
+ *   required by the format.
+ */
+#define RTE_LOG_DP_LINE_PREFIX(l, t, prefix, args, ...) do { \
+	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(prefix __VA_ARGS__ ,)); \
+	RTE_LOG_DP(l, t, RTE_FMT(prefix RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+	    args RTE_LOG_COMMA RTE_FMT_TAIL(__VA_ARGS__ ,))); \
+} while (0)
+
 #define RTE_LOG_REGISTER_IMPL(type, name, level)			    \
 int type;								    \
 RTE_INIT(__##type)							    \
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 02/16] bpf: stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 01/16] log: add a per line log helper with parameterized prefix Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-27  9:48     ` Konstantin Ananyev
  2024-02-28 13:16     ` David Marchand
  2024-02-26 20:19   ` [PATCH v3 03/16] cfgfile: " Tyler Retzlaff
                     ` (15 subsequent siblings)
  17 siblings, 2 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/bpf/bpf_impl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h
index 1a3d97d..680b1e5 100644
--- a/lib/bpf/bpf_impl.h
+++ b/lib/bpf/bpf_impl.h
@@ -29,8 +29,8 @@ struct rte_bpf {
 extern int rte_bpf_logtype;
 #define RTE_LOGTYPE_BPF rte_bpf_logtype
 
-#define	RTE_BPF_LOG_LINE(lvl, fmt, args...) \
-	RTE_LOG_LINE(lvl, BPF, fmt, ##args)
+#define RTE_BPF_LOG_LINE(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, BPF, "%s(): ", __func__, __VA_ARGS__)
 
 static inline size_t
 bpf_size(uint32_t bpf_op_sz)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 03/16] cfgfile: stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 01/16] log: add a per line log helper with parameterized prefix Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 02/16] bpf: stop using variadic argument pack extension Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 04/16] cmdline: " Tyler Retzlaff
                     ` (14 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/cfgfile/rte_cfgfile.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/cfgfile/rte_cfgfile.c b/lib/cfgfile/rte_cfgfile.c
index 6a5e4fd..e7e690f 100644
--- a/lib/cfgfile/rte_cfgfile.c
+++ b/lib/cfgfile/rte_cfgfile.c
@@ -31,8 +31,9 @@ struct rte_cfgfile {
 RTE_LOG_REGISTER_DEFAULT(cfgfile_logtype, INFO);
 #define RTE_LOGTYPE_CFGFILE cfgfile_logtype
 
-#define CFG_LOG(level, fmt, args...)					\
-	RTE_LOG_LINE(level, CFGFILE, "%s(): " fmt, __func__, ## args)
+#define CFG_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, CFGFILE, "%s(): ", __func__, __VA_ARGS__)
+
 /* >8 End of setting up dynamic logging */
 
 /** when we resize a file structure, how many extra entries
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 04/16] cmdline: stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-02-26 20:19   ` [PATCH v3 03/16] cfgfile: " Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 05/16] compressdev: " Tyler Retzlaff
                     ` (13 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Remove use of args... and just use __VA_ARGS__. The macros expanding
the argument pack do not require args extension to remove trailing comma.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/cmdline/cmdline_parse.c     | 2 +-
 lib/cmdline/cmdline_parse_num.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/cmdline/cmdline_parse.c b/lib/cmdline/cmdline_parse.c
index b6d6dac..76a212d 100644
--- a/lib/cmdline/cmdline_parse.c
+++ b/lib/cmdline/cmdline_parse.c
@@ -16,7 +16,7 @@
 #ifdef RTE_LIBRTE_CMDLINE_DEBUG
 #define debug_printf printf
 #else
-#define debug_printf(args...) do {} while(0)
+#define debug_printf(...) do {} while (0)
 #endif
 
 #define CMDLINE_BUFFER_SIZE 64
diff --git a/lib/cmdline/cmdline_parse_num.c b/lib/cmdline/cmdline_parse_num.c
index 820af07..e849878 100644
--- a/lib/cmdline/cmdline_parse_num.c
+++ b/lib/cmdline/cmdline_parse_num.c
@@ -14,9 +14,9 @@
 #include "cmdline_parse_num.h"
 
 #ifdef RTE_LIBRTE_CMDLINE_DEBUG
-#define debug_printf(args...) printf(args)
+#define debug_printf(...) printf(__VA_ARGS__)
 #else
-#define debug_printf(args...) do {} while(0)
+#define debug_printf(...) do {} while (0)
 #endif
 
 struct cmdline_token_ops cmdline_token_num_ops = {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 05/16] compressdev: stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                     ` (3 preceding siblings ...)
  2024-02-26 20:19   ` [PATCH v3 04/16] cmdline: " Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 06/16] metrics: " Tyler Retzlaff
                     ` (12 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/compressdev/rte_compressdev_internal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/compressdev/rte_compressdev_internal.h b/lib/compressdev/rte_compressdev_internal.h
index 01b7764..0bc8c87 100644
--- a/lib/compressdev/rte_compressdev_internal.h
+++ b/lib/compressdev/rte_compressdev_internal.h
@@ -23,8 +23,8 @@
 extern int compressdev_logtype;
 #define RTE_LOGTYPE_COMPRESSDEV compressdev_logtype
 
-#define COMPRESSDEV_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, COMPRESSDEV, "%s(): " fmt, __func__, ## args)
+#define COMPRESSDEV_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, COMPRESSDEV, "%s(): ", __func__, __VA_ARGS__)
 
 /**
  * Dequeue processed packets from queue pair of a device.
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 06/16] metrics: stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                     ` (4 preceding siblings ...)
  2024-02-26 20:19   ` [PATCH v3 05/16] compressdev: " Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 07/16] mldev: " Tyler Retzlaff
                     ` (11 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/metrics/rte_metrics_telemetry.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/metrics/rte_metrics_telemetry.c b/lib/metrics/rte_metrics_telemetry.c
index b8c9d75..dc43611 100644
--- a/lib/metrics/rte_metrics_telemetry.c
+++ b/lib/metrics/rte_metrics_telemetry.c
@@ -19,14 +19,14 @@
 #define RTE_LOGTYPE_METRICS metrics_log_level
 
 /* Logging Macros */
-#define METRICS_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, METRICS, "%s(): "fmt, __func__, ## args)
+#define METRICS_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, METRICS, "%s(): ", __func__, __VA_ARGS__)
 
-#define METRICS_LOG_ERR(fmt, args...) \
-	METRICS_LOG(ERR, fmt, ## args)
+#define METRICS_LOG_ERR(...) \
+	METRICS_LOG(ERR, __VA_ARGS__)
 
-#define METRICS_LOG_WARN(fmt, args...) \
-	METRICS_LOG(WARNING, fmt, ## args)
+#define METRICS_LOG_WARN(...) \
+	METRICS_LOG(WARNING, __VA_ARGS__)
 
 static int32_t
 rte_metrics_tel_reg_port_ethdev_to_metrics(uint16_t port_id)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 07/16] mldev: stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                     ` (5 preceding siblings ...)
  2024-02-26 20:19   ` [PATCH v3 06/16] metrics: " Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 08/16] net: " Tyler Retzlaff
                     ` (10 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/mldev/rte_mldev.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/mldev/rte_mldev.h b/lib/mldev/rte_mldev.h
index 27e372f..01577bd 100644
--- a/lib/mldev/rte_mldev.h
+++ b/lib/mldev/rte_mldev.h
@@ -146,8 +146,8 @@
 extern int rte_ml_dev_logtype;
 #define RTE_LOGTYPE_MLDEV rte_ml_dev_logtype
 
-#define RTE_MLDEV_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, MLDEV, "%s(): " fmt, __func__, ##args)
+#define RTE_MLDEV_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, MLDEV, "%s(): ", __func__, __VA_ARGS__)
 
 #define RTE_ML_STR_MAX 128
 /**< Maximum length of name string */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 08/16] net: stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                     ` (6 preceding siblings ...)
  2024-02-26 20:19   ` [PATCH v3 07/16] mldev: " Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 09/16] pdump: " Tyler Retzlaff
                     ` (9 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/net/rte_net_crc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/net/rte_net_crc.c b/lib/net/rte_net_crc.c
index b401ea3..346c285 100644
--- a/lib/net/rte_net_crc.c
+++ b/lib/net/rte_net_crc.c
@@ -73,8 +73,8 @@
 RTE_LOG_REGISTER_DEFAULT(libnet_logtype, INFO);
 #define RTE_LOGTYPE_NET libnet_logtype
 
-#define NET_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, NET, "%s(): " fmt, __func__, ## args)
+#define NET_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, NET, "%s(): ", __func__, __VA_ARGS__)
 
 /* Scalar handling */
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 09/16] pdump: stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                     ` (7 preceding siblings ...)
  2024-02-26 20:19   ` [PATCH v3 08/16] net: " Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 10/16] power: " Tyler Retzlaff
                     ` (8 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/pdump/rte_pdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index f6160f9..679c3dd 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -18,8 +18,8 @@
 RTE_LOG_REGISTER_DEFAULT(pdump_logtype, NOTICE);
 #define RTE_LOGTYPE_PDUMP pdump_logtype
 
-#define PDUMP_LOG_LINE(level, fmt, args...) \
-	RTE_LOG_LINE(level, PDUMP, "%s(): " fmt, __func__, ## args)
+#define PDUMP_LOG_LINE(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, PDUMP, "%s(): ", __func__, __VA_ARGS__)
 
 /* Used for the multi-process communication */
 #define PDUMP_MP	"mp_pdump"
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 10/16] power: stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                     ` (8 preceding siblings ...)
  2024-02-26 20:19   ` [PATCH v3 09/16] pdump: " Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 11/16] rawdev: " Tyler Retzlaff
                     ` (7 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/power/power_common.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/power/power_common.h b/lib/power/power_common.h
index 3096640..77bc593 100644
--- a/lib/power/power_common.h
+++ b/lib/power/power_common.h
@@ -16,10 +16,10 @@
 	RTE_LOG_LINE(level, POWER, "" __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
-#define POWER_DEBUG_LOG(fmt, args...) \
-	RTE_LOG_LINE(ERR, POWER, "%s: " fmt, __func__, ## args)
+#define POWER_DEBUG_LOG(...) \
+	RTE_LOG_LINE_PREFIX(ERR, POWER, "%s(): ", __func__, __VA_ARGS__)
 #else
-#define POWER_DEBUG_LOG(fmt, args...)
+#define POWER_DEBUG_LOG(fmt, ...)
 #endif
 
 /* check if scaling driver matches one we want */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 11/16] rawdev: stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                     ` (9 preceding siblings ...)
  2024-02-26 20:19   ` [PATCH v3 10/16] power: " Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 12/16] rcu: " Tyler Retzlaff
                     ` (6 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/rawdev/rte_rawdev_pmd.h | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
index 7173282..22b4064 100644
--- a/lib/rawdev/rte_rawdev_pmd.h
+++ b/lib/rawdev/rte_rawdev_pmd.h
@@ -30,16 +30,17 @@
 #define RTE_LOGTYPE_RAWDEV librawdev_logtype
 
 /* Logging Macros */
-#define RTE_RDEV_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, RAWDEV, "%s(): " fmt, __func__, ##args)
+#define RTE_RDEV_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, RAWDEV, "%s(): ", __func__, __VA_ARGS__)
 
-#define RTE_RDEV_ERR(fmt, args...) \
-	RTE_RDEV_LOG(ERR, fmt, ## args)
-#define RTE_RDEV_DEBUG(fmt, args...) \
-	RTE_RDEV_LOG(DEBUG, fmt, ## args)
-#define RTE_RDEV_INFO(fmt, args...) \
-	RTE_RDEV_LOG(INFO, fmt, ## args)
+#define RTE_RDEV_ERR(...) \
+	RTE_RDEV_LOG(ERR, __VA_ARGS__)
 
+#define RTE_RDEV_DEBUG(...) \
+	RTE_RDEV_LOG(DEBUG, __VA_ARGS__)
+
+#define RTE_RDEV_INFO(...) \
+	RTE_RDEV_LOG(INFO, __VA_ARGS__)
 
 /* Macros to check for valid device */
 #define RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, retval) do { \
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 12/16] rcu: stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                     ` (10 preceding siblings ...)
  2024-02-26 20:19   ` [PATCH v3 11/16] rawdev: " Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 13/16] stack: " Tyler Retzlaff
                     ` (5 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@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..f08d974 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, ...) \
+	RTE_LOG_LINE_PREFIX(level, RCU, "%s(): ", __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 e7ef788..e4119cc 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, ...) \
+	RTE_LOG_DP_LINE_PREFIX(level, RCU, "%s(): ", __func__, __VA_ARGS__)
 #else
-#define __RTE_RCU_DP_LOG(level, fmt, args...)
+#define __RTE_RCU_DP_LOG(level, ...)
 #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, ...) do { \
 	if (v->qsbr_cnt[thread_id].lock_cnt) \
-		RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args); \
+		RTE_LOG_LINE_PREFIX(level, RCU, "%s(): ", __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


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 13/16] stack: stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                     ` (11 preceding siblings ...)
  2024-02-26 20:19   ` [PATCH v3 12/16] rcu: " Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 14/16] eal: " Tyler Retzlaff
                     ` (4 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/stack/stack_pvt.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/stack/stack_pvt.h b/lib/stack/stack_pvt.h
index 2dce42a..fc95796 100644
--- a/lib/stack/stack_pvt.h
+++ b/lib/stack/stack_pvt.h
@@ -10,16 +10,16 @@
 extern int stack_logtype;
 #define RTE_LOGTYPE_STACK stack_logtype
 
-#define STACK_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, STACK, "%s(): "fmt, __func__, ##args)
+#define STACK_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, STACK, "%s(): ", __func__, __VA_ARGS__)
 
-#define STACK_LOG_ERR(fmt, args...) \
-	STACK_LOG(ERR, fmt, ## args)
+#define STACK_LOG_ERR(...) \
+	STACK_LOG(ERR, __VA_ARGS__)
 
-#define STACK_LOG_WARN(fmt, args...) \
-	STACK_LOG(WARNING, fmt, ## args)
+#define STACK_LOG_WARN(...) \
+	STACK_LOG(WARNING, __VA_ARGS__)
 
-#define STACK_LOG_INFO(fmt, args...) \
-	STACK_LOG(INFO, fmt, ## args)
+#define STACK_LOG_INFO(fmt, ...) \
+	STACK_LOG(INFO, __VA_ARGS__)
 
 #endif /* _STACK_PVT_H_ */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 14/16] eal: stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                     ` (12 preceding siblings ...)
  2024-02-26 20:19   ` [PATCH v3 13/16] stack: " Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 15/16] vhost: " Tyler Retzlaff
                     ` (3 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Use RTE_LOG_LINE_PREFIX instead of EAL_LOG 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 <roretzla@linux.microsoft.com>
---
 lib/eal/common/eal_trace.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/eal/common/eal_trace.h b/lib/eal/common/eal_trace.h
index bd082a0..5526267 100644
--- a/lib/eal/common/eal_trace.h
+++ b/lib/eal/common/eal_trace.h
@@ -16,11 +16,11 @@
 #include "eal_private.h"
 #include "eal_thread.h"
 
-#define trace_err(fmt, args...) \
-	EAL_LOG(ERR, "%s():%u " fmt, __func__, __LINE__, ## args)
+#define trace_err(...) \
+	RTE_LOG_LINE_PREFIX(ERR, EAL, "%s():%u ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
-#define trace_crit(fmt, args...) \
-	EAL_LOG(CRIT, "%s():%u " fmt, __func__, __LINE__, ## args)
+#define trace_crit(...) \
+	RTE_LOG_LINE_PREFIX(CRIT, EAL, "%s():%u ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #define TRACE_CTF_MAGIC 0xC1FC1FC1
 #define TRACE_MAX_ARGS	32
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 15/16] vhost: stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                     ` (13 preceding siblings ...)
  2024-02-26 20:19   ` [PATCH v3 14/16] eal: " Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-26 20:19   ` [PATCH v3 16/16] ip_frag: " Tyler Retzlaff
                     ` (2 subsequent siblings)
  17 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@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


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v3 16/16] ip_frag: stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                     ` (14 preceding siblings ...)
  2024-02-26 20:19   ` [PATCH v3 15/16] vhost: " Tyler Retzlaff
@ 2024-02-26 20:19   ` Tyler Retzlaff
  2024-02-27  9:48     ` Konstantin Ananyev
  2024-02-26 20:54   ` [PATCH v3 00/16] " Stephen Hemminger
  2024-02-28 17:29   ` David Marchand
  17 siblings, 1 reply; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-26 20:19 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Remove use of args... and just use __VA_ARGS__. The macros expanding
the argument pack do not require args extension to remove trailing comma.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/ip_frag/ip_frag_common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h
index c766154..f66a963 100644
--- a/lib/ip_frag/ip_frag_common.h
+++ b/lib/ip_frag/ip_frag_common.h
@@ -26,9 +26,9 @@
 	RTE_LOG_LINE(level, IPFRAG, "" __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_IP_FRAG_DEBUG
-#define	IP_FRAG_LOG(lvl, fmt, args...)	RTE_LOG(lvl, IPFRAG, fmt, ##args)
+#define	IP_FRAG_LOG(lvl, ...)	RTE_LOG(lvl, IPFRAG, __VA_ARGS__)
 #else
-#define	IP_FRAG_LOG(lvl, fmt, args...)	do {} while(0)
+#define	IP_FRAG_LOG(lvl, fmt, ...)	do {} while (0)
 #endif /* IP_FRAG_DEBUG */
 
 #define IPV4_KEYLEN 1
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH v3 00/16] stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                     ` (15 preceding siblings ...)
  2024-02-26 20:19   ` [PATCH v3 16/16] ip_frag: " Tyler Retzlaff
@ 2024-02-26 20:54   ` Stephen Hemminger
  2024-02-27 18:14     ` Tyler Retzlaff
  2024-02-28 17:29   ` David Marchand
  17 siblings, 1 reply; 120+ messages in thread
From: Stephen Hemminger @ 2024-02-26 20:54 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Anatoly Burakov, Ashish Gupta, Chenbo Xia,
	Cristian Dumitrescu, David Hunt, Fan Zhang, Hemant Agrawal,
	Honnappa Nagarahalli, Jasvinder Singh, Jerin Jacob,
	Konstantin Ananyev, Maxime Coquelin, Reshma Pattan,
	Sachin Saxena, Sivaprasad Tummala, Srikanth Yalavarthi,
	Sunil Kumar Kori, bruce.richardson, mb, thomas

On Mon, 26 Feb 2024 12:19:30 -0800
Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:

> RTE_LOG_LINE cannot be augmented with a prefix format and arguments
> without the user of RTE_LOG_LINE using the args... and ## args compiler
> extension to conditionally remove trailing comma when the macro receives
> only a single argument.
> 
> Provide a new/similar macro RTE_LOG_LINE_PREFIX that accepts the prefix
> format and arguments as separate parameters allowing them to be expanded
> at the correct locations inside of RTE_FMT() allowing the rest of the
> non-prefix format string and arguments to be collapsed to the argument
> pack which can be directly forwarded with __VA_ARGS__ avoiding the need
> for conditional comma removal.
> 
> I've done my best to manually check expansions (preprocessed) and compiled
> printf of the logs to validate correct output.
> 
> note: due to drastic change in series i have not carried any series acks
>       forward.

The changes look good, you might want to add release note, update coding
style doc, and/or update checkpatch to discourage re-introduction.

Series-acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 120+ messages in thread

* RE: [PATCH v3 02/16] bpf: stop using variadic argument pack extension
  2024-02-26 20:19   ` [PATCH v3 02/16] bpf: stop using variadic argument pack extension Tyler Retzlaff
@ 2024-02-27  9:48     ` Konstantin Ananyev
  2024-02-28 13:16     ` David Marchand
  1 sibling, 0 replies; 120+ messages in thread
From: Konstantin Ananyev @ 2024-02-27  9:48 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas


> Subject: [PATCH v3 02/16] bpf: stop using variadic argument pack extension
> 
> 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 <roretzla@linux.microsoft.com>
> ---
>  lib/bpf/bpf_impl.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h
> index 1a3d97d..680b1e5 100644
> --- a/lib/bpf/bpf_impl.h
> +++ b/lib/bpf/bpf_impl.h
> @@ -29,8 +29,8 @@ struct rte_bpf {
>  extern int rte_bpf_logtype;
>  #define RTE_LOGTYPE_BPF rte_bpf_logtype
> 
> -#define	RTE_BPF_LOG_LINE(lvl, fmt, args...) \
> -	RTE_LOG_LINE(lvl, BPF, fmt, ##args)
> +#define RTE_BPF_LOG_LINE(level, ...) \
> +	RTE_LOG_LINE_PREFIX(level, BPF, "%s(): ", __func__, __VA_ARGS__)
> 
>  static inline size_t
>  bpf_size(uint32_t bpf_op_sz)
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
 

> 1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* RE: [PATCH v3 16/16] ip_frag: stop using variadic argument pack extension
  2024-02-26 20:19   ` [PATCH v3 16/16] ip_frag: " Tyler Retzlaff
@ 2024-02-27  9:48     ` Konstantin Ananyev
  0 siblings, 0 replies; 120+ messages in thread
From: Konstantin Ananyev @ 2024-02-27  9:48 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas



> Subject: [PATCH v3 16/16] ip_frag: stop using variadic argument pack extension
> 
> Remove use of args... and just use __VA_ARGS__. The macros expanding
> the argument pack do not require args extension to remove trailing comma.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  lib/ip_frag/ip_frag_common.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h
> index c766154..f66a963 100644
> --- a/lib/ip_frag/ip_frag_common.h
> +++ b/lib/ip_frag/ip_frag_common.h
> @@ -26,9 +26,9 @@
>  	RTE_LOG_LINE(level, IPFRAG, "" __VA_ARGS__)
> 
>  #ifdef RTE_LIBRTE_IP_FRAG_DEBUG
> -#define	IP_FRAG_LOG(lvl, fmt, args...)	RTE_LOG(lvl, IPFRAG, fmt, ##args)
> +#define	IP_FRAG_LOG(lvl, ...)	RTE_LOG(lvl, IPFRAG, __VA_ARGS__)
>  #else
> -#define	IP_FRAG_LOG(lvl, fmt, args...)	do {} while(0)
> +#define	IP_FRAG_LOG(lvl, fmt, ...)	do {} while (0)
>  #endif /* IP_FRAG_DEBUG */
> 
>  #define IPV4_KEYLEN 1
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
 

> 1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH v3 00/16] stop using variadic argument pack extension
  2024-02-26 20:54   ` [PATCH v3 00/16] " Stephen Hemminger
@ 2024-02-27 18:14     ` Tyler Retzlaff
  2024-02-28 11:45       ` David Marchand
  0 siblings, 1 reply; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-27 18:14 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: dev, Anatoly Burakov, Ashish Gupta, Chenbo Xia,
	Cristian Dumitrescu, David Hunt, Fan Zhang, Hemant Agrawal,
	Honnappa Nagarahalli, Jasvinder Singh, Jerin Jacob,
	Konstantin Ananyev, Maxime Coquelin, Reshma Pattan,
	Sachin Saxena, Sivaprasad Tummala, Srikanth Yalavarthi,
	Sunil Kumar Kori, bruce.richardson, mb, thomas

On Mon, Feb 26, 2024 at 12:54:36PM -0800, Stephen Hemminger wrote:
> On Mon, 26 Feb 2024 12:19:30 -0800
> Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:
> 
> > RTE_LOG_LINE cannot be augmented with a prefix format and arguments
> > without the user of RTE_LOG_LINE using the args... and ## args compiler
> > extension to conditionally remove trailing comma when the macro receives
> > only a single argument.
> > 
> > Provide a new/similar macro RTE_LOG_LINE_PREFIX that accepts the prefix
> > format and arguments as separate parameters allowing them to be expanded
> > at the correct locations inside of RTE_FMT() allowing the rest of the
> > non-prefix format string and arguments to be collapsed to the argument
> > pack which can be directly forwarded with __VA_ARGS__ avoiding the need
> > for conditional comma removal.
> > 
> > I've done my best to manually check expansions (preprocessed) and compiled
> > printf of the logs to validate correct output.
> > 
> > note: due to drastic change in series i have not carried any series acks
> >       forward.
> 
> The changes look good, you might want to add release note, update coding
> style doc, and/or update checkpatch to discourage re-introduction.

re-introduction should be protected by the CI. i know checkpatch would
be better but i couldn't think of a good way to match an arbitrarily
named pack ... reliably where it could potentially cause noise.

i'll look into style doc in a separate series since i think there are a
couple of things i'd like to propose there now that we are using C11.

thanks for the review!

> 
> Series-acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH v3 00/16] stop using variadic argument pack extension
  2024-02-27 18:14     ` Tyler Retzlaff
@ 2024-02-28 11:45       ` David Marchand
  2024-02-28 17:27         ` Tyler Retzlaff
  0 siblings, 1 reply; 120+ messages in thread
From: David Marchand @ 2024-02-28 11:45 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: Stephen Hemminger, dev, Anatoly Burakov, Ashish Gupta,
	Chenbo Xia, Cristian Dumitrescu, David Hunt, Fan Zhang,
	Hemant Agrawal, Honnappa Nagarahalli, Jasvinder Singh,
	Jerin Jacob, Konstantin Ananyev, Maxime Coquelin, Reshma Pattan,
	Sachin Saxena, Sivaprasad Tummala, Srikanth Yalavarthi,
	Sunil Kumar Kori, bruce.richardson, mb, thomas

On Tue, Feb 27, 2024 at 7:15 PM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> On Mon, Feb 26, 2024 at 12:54:36PM -0800, Stephen Hemminger wrote:
> > On Mon, 26 Feb 2024 12:19:30 -0800
> > Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:
> >
> > > RTE_LOG_LINE cannot be augmented with a prefix format and arguments
> > > without the user of RTE_LOG_LINE using the args... and ## args compiler
> > > extension to conditionally remove trailing comma when the macro receives
> > > only a single argument.
> > >
> > > Provide a new/similar macro RTE_LOG_LINE_PREFIX that accepts the prefix
> > > format and arguments as separate parameters allowing them to be expanded
> > > at the correct locations inside of RTE_FMT() allowing the rest of the
> > > non-prefix format string and arguments to be collapsed to the argument
> > > pack which can be directly forwarded with __VA_ARGS__ avoiding the need
> > > for conditional comma removal.
> > >
> > > I've done my best to manually check expansions (preprocessed) and compiled
> > > printf of the logs to validate correct output.
> > >
> > > note: due to drastic change in series i have not carried any series acks
> > >       forward.
> >
> > The changes look good, you might want to add release note, update coding
> > style doc, and/or update checkpatch to discourage re-introduction.
>
> re-introduction should be protected by the CI. i know checkpatch would
> be better but i couldn't think of a good way to match an arbitrarily
> named pack ... reliably where it could potentially cause noise.

What about a simple:

+       # forbid use of variadic argument pack extension in macros
+       awk -v FOLDERS="lib drivers app examples" \
+               -v
EXPRESSIONS='#[[:space:]]*define.*[^(,[:space:]]\\.\\.\\.[[:space:]]*)'
\
+               -v RET_ON_FAIL=1 \
+               -v MESSAGE='Do not use variadic argument pack in macros' \
+               -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+               "$1" || res=1
+


-- 
David Marchand


^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH v3 02/16] bpf: stop using variadic argument pack extension
  2024-02-26 20:19   ` [PATCH v3 02/16] bpf: stop using variadic argument pack extension Tyler Retzlaff
  2024-02-27  9:48     ` Konstantin Ananyev
@ 2024-02-28 13:16     ` David Marchand
  2024-02-28 13:34       ` Konstantin Ananyev
  1 sibling, 1 reply; 120+ messages in thread
From: David Marchand @ 2024-02-28 13:16 UTC (permalink / raw)
  To: Tyler Retzlaff, Konstantin Ananyev
  Cc: dev, Anatoly Burakov, Ashish Gupta, Chenbo Xia,
	Cristian Dumitrescu, David Hunt, Fan Zhang, Hemant Agrawal,
	Honnappa Nagarahalli, Jasvinder Singh, Jerin Jacob,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas

On Mon, Feb 26, 2024 at 9:20 PM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> 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 <roretzla@linux.microsoft.com>
> ---
>  lib/bpf/bpf_impl.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h
> index 1a3d97d..680b1e5 100644
> --- a/lib/bpf/bpf_impl.h
> +++ b/lib/bpf/bpf_impl.h
> @@ -29,8 +29,8 @@ struct rte_bpf {
>  extern int rte_bpf_logtype;
>  #define RTE_LOGTYPE_BPF rte_bpf_logtype
>
> -#define        RTE_BPF_LOG_LINE(lvl, fmt, args...) \
> -       RTE_LOG_LINE(lvl, BPF, fmt, ##args)
> +#define RTE_BPF_LOG_LINE(level, ...) \
> +       RTE_LOG_LINE_PREFIX(level, BPF, "%s(): ", __func__, __VA_ARGS__)

The patch $topic seems to be removal of variadic argument extension.
So, I would expect a simple:
+#define RTE_BPF_LOG_LINE(level, ...) \
+       RTE_LOG_LINE(level, BPF, __VA_ARGS__)

Konstantin, just to be sure, are you ok with this (debug from my pov)
prefix addition?


-- 
David Marchand


^ permalink raw reply	[flat|nested] 120+ messages in thread

* RE: [PATCH v3 02/16] bpf: stop using variadic argument pack extension
  2024-02-28 13:16     ` David Marchand
@ 2024-02-28 13:34       ` Konstantin Ananyev
  2024-02-28 17:24         ` Tyler Retzlaff
  0 siblings, 1 reply; 120+ messages in thread
From: Konstantin Ananyev @ 2024-02-28 13:34 UTC (permalink / raw)
  To: David Marchand, Tyler Retzlaff, Konstantin Ananyev
  Cc: dev, Anatoly Burakov, Ashish Gupta, Chenbo Xia,
	Cristian Dumitrescu, David Hunt, Fan Zhang, Hemant Agrawal,
	Honnappa Nagarahalli, Jasvinder Singh, Jerin Jacob,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas


> 
> On Mon, Feb 26, 2024 at 9:20 PM Tyler Retzlaff
> <roretzla@linux.microsoft.com> wrote:
> >
> > 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 <roretzla@linux.microsoft.com>
> > ---
> >  lib/bpf/bpf_impl.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h
> > index 1a3d97d..680b1e5 100644
> > --- a/lib/bpf/bpf_impl.h
> > +++ b/lib/bpf/bpf_impl.h
> > @@ -29,8 +29,8 @@ struct rte_bpf {
> >  extern int rte_bpf_logtype;
> >  #define RTE_LOGTYPE_BPF rte_bpf_logtype
> >
> > -#define        RTE_BPF_LOG_LINE(lvl, fmt, args...) \
> > -       RTE_LOG_LINE(lvl, BPF, fmt, ##args)
> > +#define RTE_BPF_LOG_LINE(level, ...) \
> > +       RTE_LOG_LINE_PREFIX(level, BPF, "%s(): ", __func__, __VA_ARGS__)
> 
> The patch $topic seems to be removal of variadic argument extension.
> So, I would expect a simple:
> +#define RTE_BPF_LOG_LINE(level, ...) \
> +       RTE_LOG_LINE(level, BPF, __VA_ARGS__)
> 
> Konstantin, just to be sure, are you ok with this (debug from my pov)
> prefix addition?
> 

Thanks David for spotting it, yes somehow I missed that.
Actually yes, yours variant looks correct to me.
Konstantin.


^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH v3 02/16] bpf: stop using variadic argument pack extension
  2024-02-28 13:34       ` Konstantin Ananyev
@ 2024-02-28 17:24         ` Tyler Retzlaff
  2024-02-28 17:27           ` Konstantin Ananyev
  0 siblings, 1 reply; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-28 17:24 UTC (permalink / raw)
  To: Konstantin Ananyev
  Cc: David Marchand, Konstantin Ananyev, dev, Anatoly Burakov,
	Ashish Gupta, Chenbo Xia, Cristian Dumitrescu, David Hunt,
	Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli, Jasvinder Singh,
	Jerin Jacob, Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas

On Wed, Feb 28, 2024 at 01:34:59PM +0000, Konstantin Ananyev wrote:
> 
> > 
> > On Mon, Feb 26, 2024 at 9:20 PM Tyler Retzlaff
> > <roretzla@linux.microsoft.com> wrote:
> > >
> > > 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 <roretzla@linux.microsoft.com>
> > > ---
> > >  lib/bpf/bpf_impl.h | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h
> > > index 1a3d97d..680b1e5 100644
> > > --- a/lib/bpf/bpf_impl.h
> > > +++ b/lib/bpf/bpf_impl.h
> > > @@ -29,8 +29,8 @@ struct rte_bpf {
> > >  extern int rte_bpf_logtype;
> > >  #define RTE_LOGTYPE_BPF rte_bpf_logtype
> > >
> > > -#define        RTE_BPF_LOG_LINE(lvl, fmt, args...) \
> > > -       RTE_LOG_LINE(lvl, BPF, fmt, ##args)
> > > +#define RTE_BPF_LOG_LINE(level, ...) \
> > > +       RTE_LOG_LINE_PREFIX(level, BPF, "%s(): ", __func__, __VA_ARGS__)
> > 
> > The patch $topic seems to be removal of variadic argument extension.
> > So, I would expect a simple:
> > +#define RTE_BPF_LOG_LINE(level, ...) \
> > +       RTE_LOG_LINE(level, BPF, __VA_ARGS__)
> > 
> > Konstantin, just to be sure, are you ok with this (debug from my pov)
> > prefix addition?
> > 
> 
> Thanks David for spotting it, yes somehow I missed that.
> Actually yes, yours variant looks correct to me.
> Konstantin.

oh, sorry about this. i did not intend to add prefixes where there were
none. would you like me to restore this with David's suggestion or would
you like to keep the prefix with __func__?

let me know i'll make an adjustment to the series if necessary.

> 

^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH v3 00/16] stop using variadic argument pack extension
  2024-02-28 11:45       ` David Marchand
@ 2024-02-28 17:27         ` Tyler Retzlaff
  0 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-28 17:27 UTC (permalink / raw)
  To: David Marchand
  Cc: Stephen Hemminger, dev, Anatoly Burakov, Ashish Gupta,
	Chenbo Xia, Cristian Dumitrescu, David Hunt, Fan Zhang,
	Hemant Agrawal, Honnappa Nagarahalli, Jasvinder Singh,
	Jerin Jacob, Konstantin Ananyev, Maxime Coquelin, Reshma Pattan,
	Sachin Saxena, Sivaprasad Tummala, Srikanth Yalavarthi,
	Sunil Kumar Kori, bruce.richardson, mb, thomas

On Wed, Feb 28, 2024 at 12:45:04PM +0100, David Marchand wrote:
> On Tue, Feb 27, 2024 at 7:15 PM Tyler Retzlaff
> <roretzla@linux.microsoft.com> wrote:
> >
> > On Mon, Feb 26, 2024 at 12:54:36PM -0800, Stephen Hemminger wrote:
> > > On Mon, 26 Feb 2024 12:19:30 -0800
> > > Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:
> > >
> > > > RTE_LOG_LINE cannot be augmented with a prefix format and arguments
> > > > without the user of RTE_LOG_LINE using the args... and ## args compiler
> > > > extension to conditionally remove trailing comma when the macro receives
> > > > only a single argument.
> > > >
> > > > Provide a new/similar macro RTE_LOG_LINE_PREFIX that accepts the prefix
> > > > format and arguments as separate parameters allowing them to be expanded
> > > > at the correct locations inside of RTE_FMT() allowing the rest of the
> > > > non-prefix format string and arguments to be collapsed to the argument
> > > > pack which can be directly forwarded with __VA_ARGS__ avoiding the need
> > > > for conditional comma removal.
> > > >
> > > > I've done my best to manually check expansions (preprocessed) and compiled
> > > > printf of the logs to validate correct output.
> > > >
> > > > note: due to drastic change in series i have not carried any series acks
> > > >       forward.
> > >
> > > The changes look good, you might want to add release note, update coding
> > > style doc, and/or update checkpatch to discourage re-introduction.
> >
> > re-introduction should be protected by the CI. i know checkpatch would
> > be better but i couldn't think of a good way to match an arbitrarily
> > named pack ... reliably where it could potentially cause noise.
> 
> What about a simple:
> 
> +       # forbid use of variadic argument pack extension in macros
> +       awk -v FOLDERS="lib drivers app examples" \
> +               -v
> EXPRESSIONS='#[[:space:]]*define.*[^(,[:space:]]\\.\\.\\.[[:space:]]*)'
> \
> +               -v RET_ON_FAIL=1 \
> +               -v MESSAGE='Do not use variadic argument pack in macros' \
> +               -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
> +               "$1" || res=1
> +

I have no objection, I suppose worst case scenario if it turns out to
catch things we don't want it to catch we can always ignore or remove
it.

I will add the check and submit a new rev.

> 
> 
> -- 
> David Marchand

^ permalink raw reply	[flat|nested] 120+ messages in thread

* RE: [PATCH v3 02/16] bpf: stop using variadic argument pack extension
  2024-02-28 17:24         ` Tyler Retzlaff
@ 2024-02-28 17:27           ` Konstantin Ananyev
  2024-02-28 17:29             ` Tyler Retzlaff
  0 siblings, 1 reply; 120+ messages in thread
From: Konstantin Ananyev @ 2024-02-28 17:27 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: David Marchand, Konstantin Ananyev, dev, Anatoly Burakov,
	Ashish Gupta, Chenbo Xia, Cristian Dumitrescu, David Hunt,
	Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli, Jasvinder Singh,
	Jerin Jacob, Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas



> On Wed, Feb 28, 2024 at 01:34:59PM +0000, Konstantin Ananyev wrote:
> >
> > >
> > > On Mon, Feb 26, 2024 at 9:20 PM Tyler Retzlaff
> > > <roretzla@linux.microsoft.com> wrote:
> > > >
> > > > 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 <roretzla@linux.microsoft.com>
> > > > ---
> > > >  lib/bpf/bpf_impl.h | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h
> > > > index 1a3d97d..680b1e5 100644
> > > > --- a/lib/bpf/bpf_impl.h
> > > > +++ b/lib/bpf/bpf_impl.h
> > > > @@ -29,8 +29,8 @@ struct rte_bpf {
> > > >  extern int rte_bpf_logtype;
> > > >  #define RTE_LOGTYPE_BPF rte_bpf_logtype
> > > >
> > > > -#define        RTE_BPF_LOG_LINE(lvl, fmt, args...) \
> > > > -       RTE_LOG_LINE(lvl, BPF, fmt, ##args)
> > > > +#define RTE_BPF_LOG_LINE(level, ...) \
> > > > +       RTE_LOG_LINE_PREFIX(level, BPF, "%s(): ", __func__, __VA_ARGS__)
> > >
> > > The patch $topic seems to be removal of variadic argument extension.
> > > So, I would expect a simple:
> > > +#define RTE_BPF_LOG_LINE(level, ...) \
> > > +       RTE_LOG_LINE(level, BPF, __VA_ARGS__)
> > >
> > > Konstantin, just to be sure, are you ok with this (debug from my pov)
> > > prefix addition?
> > >
> >
> > Thanks David for spotting it, yes somehow I missed that.
> > Actually yes, yours variant looks correct to me.
> > Konstantin.
> 
> oh, sorry about this. i did not intend to add prefixes where there were
> none. would you like me to restore this with David's suggestion or would
> you like to keep the prefix with __func__?

Please restore as David suggested.
No worries, after all I didn't spot it myself, all kudos goes to David :) 
 

^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH v3 02/16] bpf: stop using variadic argument pack extension
  2024-02-28 17:27           ` Konstantin Ananyev
@ 2024-02-28 17:29             ` Tyler Retzlaff
  0 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-28 17:29 UTC (permalink / raw)
  To: Konstantin Ananyev
  Cc: David Marchand, Konstantin Ananyev, dev, Anatoly Burakov,
	Ashish Gupta, Chenbo Xia, Cristian Dumitrescu, David Hunt,
	Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli, Jasvinder Singh,
	Jerin Jacob, Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas

On Wed, Feb 28, 2024 at 05:27:54PM +0000, Konstantin Ananyev wrote:
> 
> 
> > On Wed, Feb 28, 2024 at 01:34:59PM +0000, Konstantin Ananyev wrote:
> > >
> > > >
> > > > On Mon, Feb 26, 2024 at 9:20 PM Tyler Retzlaff
> > > > <roretzla@linux.microsoft.com> wrote:
> > > > >
> > > > > 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 <roretzla@linux.microsoft.com>
> > > > > ---
> > > > >  lib/bpf/bpf_impl.h | 4 ++--
> > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h
> > > > > index 1a3d97d..680b1e5 100644
> > > > > --- a/lib/bpf/bpf_impl.h
> > > > > +++ b/lib/bpf/bpf_impl.h
> > > > > @@ -29,8 +29,8 @@ struct rte_bpf {
> > > > >  extern int rte_bpf_logtype;
> > > > >  #define RTE_LOGTYPE_BPF rte_bpf_logtype
> > > > >
> > > > > -#define        RTE_BPF_LOG_LINE(lvl, fmt, args...) \
> > > > > -       RTE_LOG_LINE(lvl, BPF, fmt, ##args)
> > > > > +#define RTE_BPF_LOG_LINE(level, ...) \
> > > > > +       RTE_LOG_LINE_PREFIX(level, BPF, "%s(): ", __func__, __VA_ARGS__)
> > > >
> > > > The patch $topic seems to be removal of variadic argument extension.
> > > > So, I would expect a simple:
> > > > +#define RTE_BPF_LOG_LINE(level, ...) \
> > > > +       RTE_LOG_LINE(level, BPF, __VA_ARGS__)
> > > >
> > > > Konstantin, just to be sure, are you ok with this (debug from my pov)
> > > > prefix addition?
> > > >
> > >
> > > Thanks David for spotting it, yes somehow I missed that.
> > > Actually yes, yours variant looks correct to me.
> > > Konstantin.
> > 
> > oh, sorry about this. i did not intend to add prefixes where there were
> > none. would you like me to restore this with David's suggestion or would
> > you like to keep the prefix with __func__?
> 
> Please restore as David suggested.
> No worries, after all I didn't spot it myself, all kudos goes to David :) 

thanks, i'll submit a new rev!

>  

^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH v3 00/16] stop using variadic argument pack extension
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
                     ` (16 preceding siblings ...)
  2024-02-26 20:54   ` [PATCH v3 00/16] " Stephen Hemminger
@ 2024-02-28 17:29   ` David Marchand
  2024-02-28 17:59     ` Tyler Retzlaff
  17 siblings, 1 reply; 120+ messages in thread
From: David Marchand @ 2024-02-28 17:29 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Anatoly Burakov, Ashish Gupta, Chenbo Xia,
	Cristian Dumitrescu, David Hunt, Fan Zhang, Hemant Agrawal,
	Honnappa Nagarahalli, Jasvinder Singh, Jerin Jacob,
	Konstantin Ananyev, Maxime Coquelin, Reshma Pattan,
	Sachin Saxena, Sivaprasad Tummala, Srikanth Yalavarthi,
	Stephen Hemminger, Sunil Kumar Kori, bruce.richardson, mb,
	thomas

On Mon, Feb 26, 2024 at 9:20 PM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> RTE_LOG_LINE cannot be augmented with a prefix format and arguments
> without the user of RTE_LOG_LINE using the args... and ## args compiler
> extension to conditionally remove trailing comma when the macro receives
> only a single argument.
>
> Provide a new/similar macro RTE_LOG_LINE_PREFIX that accepts the prefix
> format and arguments as separate parameters allowing them to be expanded
> at the correct locations inside of RTE_FMT() allowing the rest of the
> non-prefix format string and arguments to be collapsed to the argument
> pack which can be directly forwarded with __VA_ARGS__ avoiding the need
> for conditional comma removal.
>
> I've done my best to manually check expansions (preprocessed) and compiled
> printf of the logs to validate correct output.
>
> note: due to drastic change in series i have not carried any series acks
>       forward.
>
> v3:
>   * remove leading _ from RTE_LOG_COMMA the macro is not internal
>   * add doxygen comment for existing RTE_LOG{,DP}_LINE function-like
>     macros, based on RTE_LOG{,DP} comments.
>   * add doxygen comment for new RTE_LOG{,DP}_LINE_PREFIX function-like
>     macros, based on RTE_LOG{,DP} comments.
>   * merge 2 vhost patches into a single patch (mistake in previous
>     submission)

I find this new helper less tricky to use and easier to read than the
RTE_FMT_* stuff that gets copy/pasted everywhere.
The changes are quite mechanical, so even though we are past -rc1, +1
for me on the series.

Can we finish the job and convert remaining macros that prefix messages in lib/?


-- 
David Marchand


^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH v3 00/16] stop using variadic argument pack extension
  2024-02-28 17:29   ` David Marchand
@ 2024-02-28 17:59     ` Tyler Retzlaff
  2024-02-29  8:06       ` David Marchand
  0 siblings, 1 reply; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-28 17:59 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Anatoly Burakov, Ashish Gupta, Chenbo Xia,
	Cristian Dumitrescu, David Hunt, Fan Zhang, Hemant Agrawal,
	Honnappa Nagarahalli, Jasvinder Singh, Jerin Jacob,
	Konstantin Ananyev, Maxime Coquelin, Reshma Pattan,
	Sachin Saxena, Sivaprasad Tummala, Srikanth Yalavarthi,
	Stephen Hemminger, Sunil Kumar Kori, bruce.richardson, mb,
	thomas

On Wed, Feb 28, 2024 at 06:29:14PM +0100, David Marchand wrote:
> On Mon, Feb 26, 2024 at 9:20 PM Tyler Retzlaff
> <roretzla@linux.microsoft.com> wrote:
> >
> > RTE_LOG_LINE cannot be augmented with a prefix format and arguments
> > without the user of RTE_LOG_LINE using the args... and ## args compiler
> > extension to conditionally remove trailing comma when the macro receives
> > only a single argument.
> >
> > Provide a new/similar macro RTE_LOG_LINE_PREFIX that accepts the prefix
> > format and arguments as separate parameters allowing them to be expanded
> > at the correct locations inside of RTE_FMT() allowing the rest of the
> > non-prefix format string and arguments to be collapsed to the argument
> > pack which can be directly forwarded with __VA_ARGS__ avoiding the need
> > for conditional comma removal.
> >
> > I've done my best to manually check expansions (preprocessed) and compiled
> > printf of the logs to validate correct output.
> >
> > note: due to drastic change in series i have not carried any series acks
> >       forward.
> >
> > v3:
> >   * remove leading _ from RTE_LOG_COMMA the macro is not internal
> >   * add doxygen comment for existing RTE_LOG{,DP}_LINE function-like
> >     macros, based on RTE_LOG{,DP} comments.
> >   * add doxygen comment for new RTE_LOG{,DP}_LINE_PREFIX function-like
> >     macros, based on RTE_LOG{,DP} comments.
> >   * merge 2 vhost patches into a single patch (mistake in previous
> >     submission)
> 
> I find this new helper less tricky to use and easier to read than the
> RTE_FMT_* stuff that gets copy/pasted everywhere.
> The changes are quite mechanical, so even though we are past -rc1, +1
> for me on the series.
> 
> Can we finish the job and convert remaining macros that prefix messages in lib/?

I didn't realize I missed any. do you have a list or a regex that points
me at them.  I was just searching for use of args... 

Happy to make the conversion of the others in the next rev.

ty

> 
> 
> -- 
> David Marchand

^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH v3 00/16] stop using variadic argument pack extension
  2024-02-28 17:59     ` Tyler Retzlaff
@ 2024-02-29  8:06       ` David Marchand
  0 siblings, 0 replies; 120+ messages in thread
From: David Marchand @ 2024-02-29  8:06 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Anatoly Burakov, Ashish Gupta, Chenbo Xia,
	Cristian Dumitrescu, David Hunt, Fan Zhang, Hemant Agrawal,
	Honnappa Nagarahalli, Jasvinder Singh, Jerin Jacob,
	Konstantin Ananyev, Maxime Coquelin, Reshma Pattan,
	Sachin Saxena, Sivaprasad Tummala, Srikanth Yalavarthi,
	Stephen Hemminger, Sunil Kumar Kori, bruce.richardson, mb,
	thomas

On Wed, Feb 28, 2024 at 6:59 PM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
> > I find this new helper less tricky to use and easier to read than the
> > RTE_FMT_* stuff that gets copy/pasted everywhere.
> > The changes are quite mechanical, so even though we are past -rc1, +1
> > for me on the series.
> >
> > Can we finish the job and convert remaining macros that prefix messages in lib/?
>
> I didn't realize I missed any. do you have a list or a regex that points
> me at them.  I was just searching for use of args...
>
> Happy to make the conversion of the others in the next rev.

Basically, this new macro/approach makes direct use of RTE_FMT_HEAD unneeded.

So I grepped like this:
$ git grep RTE_FMT_HEAD -- lib/ :^lib/log/ :^lib/eal/include/rte_common.h
b55361f252:lib/cryptodev/rte_cryptodev.h:               RTE_FMT("%s()
line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
b55361f252:lib/cryptodev/rte_cryptodev.h:               RTE_FMT("%s()
line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
b55361f252:lib/cryptodev/rte_cryptodev.h:               RTE_FMT("[%s]
%s: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
b55361f252:lib/eal/windows/include/rte_windows.h:
RTE_FMT_HEAD(__VA_ARGS__ ,), GetLastError(), \
b55361f252:lib/eventdev/eventdev_pmd.h:         RTE_FMT("%s() line %u:
" RTE_FMT_HEAD(__VA_ARGS__ ,), \
b55361f252:lib/eventdev/eventdev_pmd.h:         RTE_FMT("%s() line %u:
" RTE_FMT_HEAD(__VA_ARGS__ ,), \
b55361f252:lib/eventdev/rte_event_timer_adapter.c:
RTE_FMT("EVTIMER: %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
b55361f252:lib/graph/graph_private.h:           RTE_FMT("%s():%u "
RTE_FMT_HEAD(__VA_ARGS__ ,),                \
b55361f252:lib/member/member.h:         RTE_FMT("%s(): "
RTE_FMT_HEAD(__VA_ARGS__ ,), \
b55361f252:lib/node/node_private.h:             RTE_FMT("%s: %s():%u "
RTE_FMT_HEAD(__VA_ARGS__ ,),            \


-- 
David Marchand


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 00/22] stop using variadic argument pack extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (19 preceding siblings ...)
  2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
@ 2024-02-29 19:53 ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 01/22] log: add a per line log helper with parameterized prefix Tyler Retzlaff
                     ` (21 more replies)
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
  21 siblings, 22 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

RTE_LOG_LINE cannot be augmented with a prefix format and arguments
without the user of RTE_LOG_LINE using the args... and ## args compiler
extension to conditionally remove trailing comma when the macro receives
only a single argument.

Provide a new/similar macro RTE_LOG_LINE_PREFIX that accepts the prefix
format and arguments as separate parameters allowing them to be expanded
at the correct locations inside of RTE_FMT() allowing the rest of the
non-prefix format string and arguments to be collapsed to the argument
pack which can be directly forwarded with __VA_ARGS__ avoiding the need
for conditional comma removal.

I've done my best to manually check expansions (preprocessed) and compiled
printf of the logs to validate correct output.

v4:
  * remove unintended addition of prefix to bpf log helper.
  * use RTE_LOG_LINE_PREFIX in other places using RTE_FMT_HEAD
    and RTE_FMT_TAIL.
  * add a checkpatch check to prevent reintroduction of ##args.

v3:
  * remove leading _ from RTE_LOG_COMMA the macro is not internal
  * add doxygen comment for existing RTE_LOG{,DP}_LINE function-like
    macros, based on RTE_LOG{,DP} comments.
  * add doxygen comment for new RTE_LOG{,DP}_LINE_PREFIX function-like
    macros, based on RTE_LOG{,DP} comments.
  * merge 2 vhost patches into a single patch (mistake in previous
    submission)

v2:
  * revamp entire series to be ISO C99 compliant, stop using variadic
    argument pack extension.

Tyler Retzlaff (22):
  log: add a per line log helper with parameterized prefix
  cfgfile: stop using variadic argument pack extension
  cmdline: stop using variadic argument pack extension
  compressdev: stop using variadic argument pack extension
  metrics: stop using variadic argument pack extension
  mldev: stop using variadic argument pack extension
  net: stop using variadic argument pack extension
  pdump: stop using variadic argument pack extension
  power: stop using variadic argument pack extension
  rawdev: stop using variadic argument pack extension
  rcu: stop using variadic argument pack extension
  stack: stop using variadic argument pack extension
  eal: stop using variadic argument pack extension
  vhost: stop using variadic argument pack extension
  ip_frag: stop using variadic argument pack extension
  bpf: stop using variadic argument pack extension
  cryptodev: stop using variadic argument pack extension
  eventdev: stop using variadic argument pack extension
  graph: stop using variadic argument pack extension
  member: stop using variadic argument pack extension
  node: stop using variadic argument pack extension
  devtools: forbid use argument variadic pack extension

 devtools/checkpatches.sh                   |  8 +++
 lib/bpf/bpf_impl.h                         |  4 +-
 lib/cfgfile/rte_cfgfile.c                  |  5 +-
 lib/cmdline/cmdline_parse.c                |  2 +-
 lib/cmdline/cmdline_parse_num.c            |  4 +-
 lib/compressdev/rte_compressdev_internal.h |  4 +-
 lib/cryptodev/rte_cryptodev.h              | 15 ++---
 lib/eal/common/eal_trace.h                 |  8 +--
 lib/eal/windows/include/rte_windows.h      |  5 +-
 lib/eventdev/eventdev_pmd.h                | 10 ++-
 lib/eventdev/rte_event_timer_adapter.c     |  5 +-
 lib/graph/graph_private.h                  |  5 +-
 lib/ip_frag/ip_frag_common.h               |  4 +-
 lib/log/rte_log.h                          | 97 ++++++++++++++++++++++++++++++
 lib/member/member.h                        |  5 +-
 lib/metrics/rte_metrics_telemetry.c        | 12 ++--
 lib/mldev/rte_mldev.h                      |  4 +-
 lib/net/rte_net_crc.c                      |  4 +-
 lib/node/node_private.h                    |  6 +-
 lib/pdump/rte_pdump.c                      |  4 +-
 lib/power/power_common.h                   |  6 +-
 lib/rawdev/rte_rawdev_pmd.h                | 17 +++---
 lib/rcu/rte_rcu_qsbr.c                     |  4 +-
 lib/rcu/rte_rcu_qsbr.h                     | 12 ++--
 lib/stack/stack_pvt.h                      | 16 ++---
 lib/vhost/vhost.h                          |  8 +--
 lib/vhost/vhost_crypto.c                   | 21 ++++---
 27 files changed, 196 insertions(+), 99 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 01/22] log: add a per line log helper with parameterized prefix
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 02/22] cfgfile: stop using variadic argument pack extension Tyler Retzlaff
                     ` (20 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Providing a custom prefix when logging is common for components. Lift
ISO C99 compliant helper macros from mlx5_common.h and provide
RTE_LOG_LINE_PREFIX macro that can expand similar to RTE_LOG_LINE with
a custom prefix and argument list.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/log/rte_log.h | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)

diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index fbc0df7..8f10e31 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -367,18 +367,115 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
 #define RTE_LOG_CHECK_NO_NEWLINE(...)
 #endif
 
+/**
+ * Generates a log message with a single trailing newline.
+ *
+ * The RTE_LOG_LINE() is a helper that expands logging of a message
+ * with RTE_LOG() appending a single newline to the formatted message.
+ *
+ * @param l
+ *   Log level. A value between EMERG (1) and DEBUG (8). The short name
+ *   is expanded by the macro, so it cannot be an integer value.
+ * @param t
+ *   The log type, for example, EAL. The short name is expanded by the
+ *   macro, so it cannot be an integer value.
+ * @param ...
+ *   The fmt string, as in printf(3), followed by the variable arguments
+ *   required by the format.
+ */
 #define RTE_LOG_LINE(l, t, ...) do { \
 	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \
 	RTE_LOG(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
 		RTE_FMT_TAIL(__VA_ARGS__ ,))); \
 } while (0)
 
+/**
+ * Generates a log message for data path with a single trailing newline.
+ *
+ * Similar to RTE_LOG_LINE(), except that it is removed at compilation
+ * time if the RTE_LOG_DP_LEVEL configuration option is lower than the
+ * log level argument.
+ *
+ * The RTE_LOG_LINE() is a helper that expands logging of a message
+ * with RTE_LOG_DP() appending a single newline to the formatted
+ * message.
+ *
+ * @param l
+ *   Log level. A value between EMERG (1) and DEBUG (8). The short name
+ *   is expanded by the macro, so it cannot be an integer value.
+ * @param t
+ *   The log type, for example, EAL. The short name is expanded by the
+ *   macro, so it cannot be an integer value.
+ * @param ...
+ *   The fmt string, as in printf(3), followed by the variable arguments
+ *   required by the format.
+ */
 #define RTE_LOG_DP_LINE(l, t, ...) do { \
 	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \
 	RTE_LOG_DP(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
 		RTE_FMT_TAIL(__VA_ARGS__ ,))); \
 } while (0)
 
+#define RTE_LOG_COMMA ,
+
+/*
+ * Generates a log message with a supplied prefix and arguments with a
+ * single trailing newline.
+ *
+ * The RTE_LOG_LINE_PREFIX() is a helper that expands logging of a
+ * message with RTE_LOG() prepending the supplied prefix and arguments
+ * appending a single newline to the formatted message.
+ *
+ * @param l
+ *   Log level. A value between EMERG (1) and DEBUG (8). The short name
+ *   is expanded by the macro, so it cannot be an integer value.
+ * @param t
+ *   The log type, for example, EAL. The short name is expanded by the
+ *   macro, so it cannot be an integer value.
+ * @param prefix
+ *   The prefix format string.
+ * @param args
+ *   The arguments for the prefix format string. If args contains
+ *   multiple arguments use RTE_LOG_COMMA to defer expansion.
+ * @param ...
+ *   The fmt string, as in printf(3), followed by the variable arguments
+ *   required by the format.
+ */
+#define RTE_LOG_LINE_PREFIX(l, t, prefix, args, ...) do { \
+	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(prefix __VA_ARGS__ ,)); \
+	RTE_LOG(l, t, RTE_FMT(prefix RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+	    args RTE_LOG_COMMA RTE_FMT_TAIL(__VA_ARGS__ ,))); \
+} while (0)
+
+/*
+ * Generates a log message for the data path with a supplied prefix and
+ * arguments with a single trailing newline.
+ *
+ * The RTE_LOG_DP_LINE_PREFIX() is a helper that expands logging of a
+ * message with RTE_LOG_DP() prepending the supplied prefix and
+ * arguments appending a single newline to the formatted message.
+ *
+ * @param l
+ *   Log level. A value between EMERG (1) and DEBUG (8). The short name
+ *   is expanded by the macro, so it cannot be an integer value.
+ * @param t
+ *   The log type, for example, EAL. The short name is expanded by the
+ *   macro, so it cannot be an integer value.
+ * @param prefix
+ *   The prefix format string.
+ * @param args
+ *   The arguments for the prefix format string. If args contains
+ *   multiple arguments use RTE_LOG_COMMA to defer expansion.
+ * @param ...
+ *   The fmt string, as in printf(3), followed by the variable arguments
+ *   required by the format.
+ */
+#define RTE_LOG_DP_LINE_PREFIX(l, t, prefix, args, ...) do { \
+	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(prefix __VA_ARGS__ ,)); \
+	RTE_LOG_DP(l, t, RTE_FMT(prefix RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+	    args RTE_LOG_COMMA RTE_FMT_TAIL(__VA_ARGS__ ,))); \
+} while (0)
+
 #define RTE_LOG_REGISTER_IMPL(type, name, level)			    \
 int type;								    \
 RTE_INIT(__##type)							    \
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 02/22] cfgfile: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 01/22] log: add a per line log helper with parameterized prefix Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 03/22] cmdline: " Tyler Retzlaff
                     ` (19 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/cfgfile/rte_cfgfile.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/cfgfile/rte_cfgfile.c b/lib/cfgfile/rte_cfgfile.c
index 6a5e4fd..e7e690f 100644
--- a/lib/cfgfile/rte_cfgfile.c
+++ b/lib/cfgfile/rte_cfgfile.c
@@ -31,8 +31,9 @@ struct rte_cfgfile {
 RTE_LOG_REGISTER_DEFAULT(cfgfile_logtype, INFO);
 #define RTE_LOGTYPE_CFGFILE cfgfile_logtype
 
-#define CFG_LOG(level, fmt, args...)					\
-	RTE_LOG_LINE(level, CFGFILE, "%s(): " fmt, __func__, ## args)
+#define CFG_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, CFGFILE, "%s(): ", __func__, __VA_ARGS__)
+
 /* >8 End of setting up dynamic logging */
 
 /** when we resize a file structure, how many extra entries
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 03/22] cmdline: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 01/22] log: add a per line log helper with parameterized prefix Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 02/22] cfgfile: stop using variadic argument pack extension Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 04/22] compressdev: " Tyler Retzlaff
                     ` (18 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Remove use of args... and just use __VA_ARGS__. The macros expanding
the argument pack do not require args extension to remove trailing comma.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/cmdline/cmdline_parse.c     | 2 +-
 lib/cmdline/cmdline_parse_num.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/cmdline/cmdline_parse.c b/lib/cmdline/cmdline_parse.c
index b6d6dac..76a212d 100644
--- a/lib/cmdline/cmdline_parse.c
+++ b/lib/cmdline/cmdline_parse.c
@@ -16,7 +16,7 @@
 #ifdef RTE_LIBRTE_CMDLINE_DEBUG
 #define debug_printf printf
 #else
-#define debug_printf(args...) do {} while(0)
+#define debug_printf(...) do {} while (0)
 #endif
 
 #define CMDLINE_BUFFER_SIZE 64
diff --git a/lib/cmdline/cmdline_parse_num.c b/lib/cmdline/cmdline_parse_num.c
index 820af07..e849878 100644
--- a/lib/cmdline/cmdline_parse_num.c
+++ b/lib/cmdline/cmdline_parse_num.c
@@ -14,9 +14,9 @@
 #include "cmdline_parse_num.h"
 
 #ifdef RTE_LIBRTE_CMDLINE_DEBUG
-#define debug_printf(args...) printf(args)
+#define debug_printf(...) printf(__VA_ARGS__)
 #else
-#define debug_printf(args...) do {} while(0)
+#define debug_printf(...) do {} while (0)
 #endif
 
 struct cmdline_token_ops cmdline_token_num_ops = {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 04/22] compressdev: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 03/22] cmdline: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 05/22] metrics: " Tyler Retzlaff
                     ` (17 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/compressdev/rte_compressdev_internal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/compressdev/rte_compressdev_internal.h b/lib/compressdev/rte_compressdev_internal.h
index 01b7764..0bc8c87 100644
--- a/lib/compressdev/rte_compressdev_internal.h
+++ b/lib/compressdev/rte_compressdev_internal.h
@@ -23,8 +23,8 @@
 extern int compressdev_logtype;
 #define RTE_LOGTYPE_COMPRESSDEV compressdev_logtype
 
-#define COMPRESSDEV_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, COMPRESSDEV, "%s(): " fmt, __func__, ## args)
+#define COMPRESSDEV_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, COMPRESSDEV, "%s(): ", __func__, __VA_ARGS__)
 
 /**
  * Dequeue processed packets from queue pair of a device.
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 05/22] metrics: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (3 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 04/22] compressdev: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 06/22] mldev: " Tyler Retzlaff
                     ` (16 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/metrics/rte_metrics_telemetry.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/metrics/rte_metrics_telemetry.c b/lib/metrics/rte_metrics_telemetry.c
index b8c9d75..dc43611 100644
--- a/lib/metrics/rte_metrics_telemetry.c
+++ b/lib/metrics/rte_metrics_telemetry.c
@@ -19,14 +19,14 @@
 #define RTE_LOGTYPE_METRICS metrics_log_level
 
 /* Logging Macros */
-#define METRICS_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, METRICS, "%s(): "fmt, __func__, ## args)
+#define METRICS_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, METRICS, "%s(): ", __func__, __VA_ARGS__)
 
-#define METRICS_LOG_ERR(fmt, args...) \
-	METRICS_LOG(ERR, fmt, ## args)
+#define METRICS_LOG_ERR(...) \
+	METRICS_LOG(ERR, __VA_ARGS__)
 
-#define METRICS_LOG_WARN(fmt, args...) \
-	METRICS_LOG(WARNING, fmt, ## args)
+#define METRICS_LOG_WARN(...) \
+	METRICS_LOG(WARNING, __VA_ARGS__)
 
 static int32_t
 rte_metrics_tel_reg_port_ethdev_to_metrics(uint16_t port_id)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 06/22] mldev: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (4 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 05/22] metrics: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 07/22] net: " Tyler Retzlaff
                     ` (15 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/mldev/rte_mldev.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/mldev/rte_mldev.h b/lib/mldev/rte_mldev.h
index 27e372f..01577bd 100644
--- a/lib/mldev/rte_mldev.h
+++ b/lib/mldev/rte_mldev.h
@@ -146,8 +146,8 @@
 extern int rte_ml_dev_logtype;
 #define RTE_LOGTYPE_MLDEV rte_ml_dev_logtype
 
-#define RTE_MLDEV_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, MLDEV, "%s(): " fmt, __func__, ##args)
+#define RTE_MLDEV_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, MLDEV, "%s(): ", __func__, __VA_ARGS__)
 
 #define RTE_ML_STR_MAX 128
 /**< Maximum length of name string */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 07/22] net: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (5 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 06/22] mldev: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 08/22] pdump: " Tyler Retzlaff
                     ` (14 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/net/rte_net_crc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/net/rte_net_crc.c b/lib/net/rte_net_crc.c
index b401ea3..346c285 100644
--- a/lib/net/rte_net_crc.c
+++ b/lib/net/rte_net_crc.c
@@ -73,8 +73,8 @@
 RTE_LOG_REGISTER_DEFAULT(libnet_logtype, INFO);
 #define RTE_LOGTYPE_NET libnet_logtype
 
-#define NET_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, NET, "%s(): " fmt, __func__, ## args)
+#define NET_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, NET, "%s(): ", __func__, __VA_ARGS__)
 
 /* Scalar handling */
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 08/22] pdump: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (6 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 07/22] net: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 09/22] power: " Tyler Retzlaff
                     ` (13 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/pdump/rte_pdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index f6160f9..679c3dd 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -18,8 +18,8 @@
 RTE_LOG_REGISTER_DEFAULT(pdump_logtype, NOTICE);
 #define RTE_LOGTYPE_PDUMP pdump_logtype
 
-#define PDUMP_LOG_LINE(level, fmt, args...) \
-	RTE_LOG_LINE(level, PDUMP, "%s(): " fmt, __func__, ## args)
+#define PDUMP_LOG_LINE(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, PDUMP, "%s(): ", __func__, __VA_ARGS__)
 
 /* Used for the multi-process communication */
 #define PDUMP_MP	"mp_pdump"
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 09/22] power: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (7 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 08/22] pdump: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 10/22] rawdev: " Tyler Retzlaff
                     ` (12 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/power/power_common.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/power/power_common.h b/lib/power/power_common.h
index 3096640..77bc593 100644
--- a/lib/power/power_common.h
+++ b/lib/power/power_common.h
@@ -16,10 +16,10 @@
 	RTE_LOG_LINE(level, POWER, "" __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
-#define POWER_DEBUG_LOG(fmt, args...) \
-	RTE_LOG_LINE(ERR, POWER, "%s: " fmt, __func__, ## args)
+#define POWER_DEBUG_LOG(...) \
+	RTE_LOG_LINE_PREFIX(ERR, POWER, "%s(): ", __func__, __VA_ARGS__)
 #else
-#define POWER_DEBUG_LOG(fmt, args...)
+#define POWER_DEBUG_LOG(fmt, ...)
 #endif
 
 /* check if scaling driver matches one we want */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 10/22] rawdev: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (8 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 09/22] power: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 11/22] rcu: " Tyler Retzlaff
                     ` (11 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/rawdev/rte_rawdev_pmd.h | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
index 7173282..22b4064 100644
--- a/lib/rawdev/rte_rawdev_pmd.h
+++ b/lib/rawdev/rte_rawdev_pmd.h
@@ -30,16 +30,17 @@
 #define RTE_LOGTYPE_RAWDEV librawdev_logtype
 
 /* Logging Macros */
-#define RTE_RDEV_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, RAWDEV, "%s(): " fmt, __func__, ##args)
+#define RTE_RDEV_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, RAWDEV, "%s(): ", __func__, __VA_ARGS__)
 
-#define RTE_RDEV_ERR(fmt, args...) \
-	RTE_RDEV_LOG(ERR, fmt, ## args)
-#define RTE_RDEV_DEBUG(fmt, args...) \
-	RTE_RDEV_LOG(DEBUG, fmt, ## args)
-#define RTE_RDEV_INFO(fmt, args...) \
-	RTE_RDEV_LOG(INFO, fmt, ## args)
+#define RTE_RDEV_ERR(...) \
+	RTE_RDEV_LOG(ERR, __VA_ARGS__)
 
+#define RTE_RDEV_DEBUG(...) \
+	RTE_RDEV_LOG(DEBUG, __VA_ARGS__)
+
+#define RTE_RDEV_INFO(...) \
+	RTE_RDEV_LOG(INFO, __VA_ARGS__)
 
 /* Macros to check for valid device */
 #define RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, retval) do { \
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 11/22] rcu: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (9 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 10/22] rawdev: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 12/22] stack: " Tyler Retzlaff
                     ` (10 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@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..f08d974 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, ...) \
+	RTE_LOG_LINE_PREFIX(level, RCU, "%s(): ", __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 e7ef788..e4119cc 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, ...) \
+	RTE_LOG_DP_LINE_PREFIX(level, RCU, "%s(): ", __func__, __VA_ARGS__)
 #else
-#define __RTE_RCU_DP_LOG(level, fmt, args...)
+#define __RTE_RCU_DP_LOG(level, ...)
 #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, ...) do { \
 	if (v->qsbr_cnt[thread_id].lock_cnt) \
-		RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args); \
+		RTE_LOG_LINE_PREFIX(level, RCU, "%s(): ", __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


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 12/22] stack: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (10 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 11/22] rcu: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 13/22] eal: " Tyler Retzlaff
                     ` (9 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/stack/stack_pvt.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/stack/stack_pvt.h b/lib/stack/stack_pvt.h
index 2dce42a..fc95796 100644
--- a/lib/stack/stack_pvt.h
+++ b/lib/stack/stack_pvt.h
@@ -10,16 +10,16 @@
 extern int stack_logtype;
 #define RTE_LOGTYPE_STACK stack_logtype
 
-#define STACK_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, STACK, "%s(): "fmt, __func__, ##args)
+#define STACK_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, STACK, "%s(): ", __func__, __VA_ARGS__)
 
-#define STACK_LOG_ERR(fmt, args...) \
-	STACK_LOG(ERR, fmt, ## args)
+#define STACK_LOG_ERR(...) \
+	STACK_LOG(ERR, __VA_ARGS__)
 
-#define STACK_LOG_WARN(fmt, args...) \
-	STACK_LOG(WARNING, fmt, ## args)
+#define STACK_LOG_WARN(...) \
+	STACK_LOG(WARNING, __VA_ARGS__)
 
-#define STACK_LOG_INFO(fmt, args...) \
-	STACK_LOG(INFO, fmt, ## args)
+#define STACK_LOG_INFO(fmt, ...) \
+	STACK_LOG(INFO, __VA_ARGS__)
 
 #endif /* _STACK_PVT_H_ */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 13/22] eal: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (11 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 12/22] stack: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 14/22] vhost: " Tyler Retzlaff
                     ` (8 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Use RTE_LOG_LINE_PREFIX instead of EAL_LOG 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 <roretzla@linux.microsoft.com>
---
 lib/eal/common/eal_trace.h            | 8 ++++----
 lib/eal/windows/include/rte_windows.h | 5 ++---
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/eal/common/eal_trace.h b/lib/eal/common/eal_trace.h
index bd082a0..5526267 100644
--- a/lib/eal/common/eal_trace.h
+++ b/lib/eal/common/eal_trace.h
@@ -16,11 +16,11 @@
 #include "eal_private.h"
 #include "eal_thread.h"
 
-#define trace_err(fmt, args...) \
-	EAL_LOG(ERR, "%s():%u " fmt, __func__, __LINE__, ## args)
+#define trace_err(...) \
+	RTE_LOG_LINE_PREFIX(ERR, EAL, "%s():%u ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
-#define trace_crit(fmt, args...) \
-	EAL_LOG(CRIT, "%s():%u " fmt, __func__, __LINE__, ## args)
+#define trace_crit(...) \
+	RTE_LOG_LINE_PREFIX(CRIT, EAL, "%s():%u ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #define TRACE_CTF_MAGIC 0xC1FC1FC1
 #define TRACE_MAX_ARGS	32
diff --git a/lib/eal/windows/include/rte_windows.h b/lib/eal/windows/include/rte_windows.h
index 0b0d117..feca6bb 100644
--- a/lib/eal/windows/include/rte_windows.h
+++ b/lib/eal/windows/include/rte_windows.h
@@ -48,9 +48,8 @@
  * Log GetLastError() with context, usually a Win32 API function and arguments.
  */
 #define RTE_LOG_WIN32_ERR(...) \
-	RTE_LOG_LINE(DEBUG, EAL, RTE_FMT("GetLastError()=%lu: " \
-		RTE_FMT_HEAD(__VA_ARGS__ ,), GetLastError(), \
-		RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(DEBUG, EAL,
+		"GetLastError()=%lu: " GetLastError(), __VA_ARGS__)
 
 #ifdef __cplusplus
 }
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 14/22] vhost: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (12 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 13/22] eal: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 15/22] ip_frag: " Tyler Retzlaff
                     ` (7 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@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


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 15/22] ip_frag: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (13 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 14/22] vhost: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 16/22] bpf: " Tyler Retzlaff
                     ` (6 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Remove use of args... and just use __VA_ARGS__. The macros expanding
the argument pack do not require args extension to remove trailing comma.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/ip_frag/ip_frag_common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h
index c766154..f66a963 100644
--- a/lib/ip_frag/ip_frag_common.h
+++ b/lib/ip_frag/ip_frag_common.h
@@ -26,9 +26,9 @@
 	RTE_LOG_LINE(level, IPFRAG, "" __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_IP_FRAG_DEBUG
-#define	IP_FRAG_LOG(lvl, fmt, args...)	RTE_LOG(lvl, IPFRAG, fmt, ##args)
+#define	IP_FRAG_LOG(lvl, ...)	RTE_LOG(lvl, IPFRAG, __VA_ARGS__)
 #else
-#define	IP_FRAG_LOG(lvl, fmt, args...)	do {} while(0)
+#define	IP_FRAG_LOG(lvl, fmt, ...)	do {} while (0)
 #endif /* IP_FRAG_DEBUG */
 
 #define IPV4_KEYLEN 1
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 16/22] bpf: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (14 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 15/22] ip_frag: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 17/22] cryptodev: " Tyler Retzlaff
                     ` (5 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Remove fmt, args... and forward with __VA_ARGS__.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/bpf/bpf_impl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h
index 1a3d97d..20c9ef9 100644
--- a/lib/bpf/bpf_impl.h
+++ b/lib/bpf/bpf_impl.h
@@ -29,8 +29,8 @@ struct rte_bpf {
 extern int rte_bpf_logtype;
 #define RTE_LOGTYPE_BPF rte_bpf_logtype
 
-#define	RTE_BPF_LOG_LINE(lvl, fmt, args...) \
-	RTE_LOG_LINE(lvl, BPF, fmt, ##args)
+#define	RTE_BPF_LOG_LINE(lvl, ...) \
+	RTE_LOG_LINE(lvl, BPF, __VA_ARGS__)
 
 static inline size_t
 bpf_size(uint32_t bpf_op_sz)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 17/22] cryptodev: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (15 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 16/22] bpf: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 18/22] eventdev: " Tyler Retzlaff
                     ` (4 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/cryptodev/rte_cryptodev.h | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index f6ab0e5..00ba6a2 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -34,22 +34,19 @@
 
 /* Logging Macros */
 #define CDEV_LOG_ERR(...) \
-	RTE_LOG_LINE(ERR, CRYPTODEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(ERR, CRYPTODEV, \
+		"%s() line %u: ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #define CDEV_LOG_INFO(...) \
 	RTE_LOG_LINE(INFO, CRYPTODEV, "" __VA_ARGS__)
 
 #define CDEV_LOG_DEBUG(...) \
-	RTE_LOG_LINE(DEBUG, CRYPTODEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(DEBUG, CRYPTODEV, \
+		"%s() line %u: ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #define CDEV_PMD_TRACE(...) \
-	RTE_LOG_LINE(DEBUG, CRYPTODEV, \
-		RTE_FMT("[%s] %s: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
-			dev, __func__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(DEBUG, CRYPTODEV, \
+		"[%s] %s: ", dev RTE_LOG_COMMA __func__, __VA_ARGS__)
 
 /**
  * A macro that points to an offset from the start
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 18/22] eventdev: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (16 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 17/22] cryptodev: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 19/22] graph: " Tyler Retzlaff
                     ` (3 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/eventdev/eventdev_pmd.h            | 10 ++++------
 lib/eventdev/rte_event_timer_adapter.c |  5 ++---
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index c415624..2ad8802 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -36,15 +36,13 @@
 
 /* Logging Macros */
 #define RTE_EDEV_LOG_ERR(...) \
-	RTE_LOG_LINE(ERR, EVENTDEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(ERR, EVENTDEV, \
+		"%s() line %u: ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
 #define RTE_EDEV_LOG_DEBUG(...) \
-	RTE_LOG_LINE(DEBUG, EVENTDEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(DEBUG, EVENTDEV, \
+		"%s() line %u: ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 #else
 #define RTE_EDEV_LOG_DEBUG(...) (void)0
 #endif
diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c
index e6d3492..a3c6fb7 100644
--- a/lib/eventdev/rte_event_timer_adapter.c
+++ b/lib/eventdev/rte_event_timer_adapter.c
@@ -41,9 +41,8 @@
 static const struct event_timer_adapter_ops swtim_ops;
 
 #define EVTIM_LOG(level, logtype, ...) \
-	RTE_LOG_LINE(level, logtype, \
-		RTE_FMT("EVTIMER: %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(level, logtype, \
+		"EVTIMER: %s() line %u: ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #define EVTIM_LOG_ERR(...) EVTIM_LOG(ERR, EVTIM, __VA_ARGS__)
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 19/22] graph: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (17 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 18/22] eventdev: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 20/22] member: " Tyler Retzlaff
                     ` (2 subsequent siblings)
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/graph/graph_private.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h
index fb88d4b..73c0884 100644
--- a/lib/graph/graph_private.h
+++ b/lib/graph/graph_private.h
@@ -21,9 +21,8 @@
 #define RTE_LOGTYPE_GRAPH rte_graph_logtype
 
 #define GRAPH_LOG(level, ...)                                                  \
-	RTE_LOG_LINE(level, GRAPH,                                             \
-		RTE_FMT("%s():%u " RTE_FMT_HEAD(__VA_ARGS__ ,),                \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(level, GRAPH, \
+		"%s():%u ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #define graph_err(...) GRAPH_LOG(ERR, __VA_ARGS__)
 #define graph_warn(...) GRAPH_LOG(WARNING, __VA_ARGS__)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 20/22] member: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (18 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 19/22] graph: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 21/22] node: " Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 22/22] devtools: forbid use argument variadic " Tyler Retzlaff
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/member/member.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/member/member.h b/lib/member/member.h
index cf600c4..d71c26b 100644
--- a/lib/member/member.h
+++ b/lib/member/member.h
@@ -8,7 +8,6 @@
 #define RTE_LOGTYPE_MEMBER librte_member_logtype
 
 #define MEMBER_LOG(level, ...) \
-	RTE_LOG_LINE(level,  MEMBER, \
-		RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__ ,), \
-			__func__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(level, MEMBER, \
+		"%s(): ", __func__, __VA_ARGS__)
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 21/22] node: stop using variadic argument pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (19 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 20/22] member: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  2024-02-29 19:53   ` [PATCH v4 22/22] devtools: forbid use argument variadic " Tyler Retzlaff
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/node/node_private.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/node/node_private.h b/lib/node/node_private.h
index 2b9bad1..3498b15 100644
--- a/lib/node/node_private.h
+++ b/lib/node/node_private.h
@@ -16,10 +16,8 @@
 #define RTE_LOGTYPE_NODE rte_node_logtype
 
 #define NODE_LOG(level, node_name, ...)                                        \
-	RTE_LOG_LINE(level, NODE,                                              \
-		RTE_FMT("%s: %s():%u " RTE_FMT_HEAD(__VA_ARGS__ ,),            \
-			node_name, __func__, __LINE__,                         \
-			RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(level, NODE, "%s: %s():%u ", \
+		node_name RTE_LOG_COMMA __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #define node_err(node_name, ...) NODE_LOG(ERR, node_name, __VA_ARGS__)
 #define node_info(node_name, ...) NODE_LOG(INFO, node_name, __VA_ARGS__)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v4 22/22] devtools: forbid use argument variadic pack extension
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
                     ` (20 preceding siblings ...)
  2024-02-29 19:53   ` [PATCH v4 21/22] node: " Tyler Retzlaff
@ 2024-02-29 19:53   ` Tyler Retzlaff
  21 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 19:53 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Prevent introduction of new use of args... and ##args compiler
extension.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index e379700..811655b 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -61,6 +61,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# forbid use of variadic argument pack extension in macros
+	awk -v FOLDERS="lib drivers app examples" \
+		-v EXPRESSIONS='#[[:space:]]*define.*[^(,[:space:]]\\.\\.\\.[[:space:]]*)' \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Do not use variadic argument pack in macros' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# no output on stdout or stderr
 	awk -v FOLDERS="lib drivers" \
 		-v EXPRESSIONS="\\\<printf\\\> \\\<fprintf\\\(stdout, \\\<fprintf\\\(stderr," \
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 00/22] stop using variadic argument pack extension
  2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
                   ` (20 preceding siblings ...)
  2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
@ 2024-02-29 21:31 ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 01/22] log: add a per line log helper with parameterized prefix Tyler Retzlaff
                     ` (22 more replies)
  21 siblings, 23 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

RTE_LOG_LINE cannot be augmented with a prefix format and arguments
without the user of RTE_LOG_LINE using the args... and ## args compiler
extension to conditionally remove trailing comma when the macro receives
only a single argument.

Provide a new/similar macro RTE_LOG_LINE_PREFIX that accepts the prefix
format and arguments as separate parameters allowing them to be expanded
at the correct locations inside of RTE_FMT() allowing the rest of the
non-prefix format string and arguments to be collapsed to the argument
pack which can be directly forwarded with __VA_ARGS__ avoiding the need
for conditional comma removal.

I've done my best to manually check expansions (preprocessed) and compiled
printf of the logs to validate correct output.

v5:
  * add missing newline escape and comma in rte_windows.h
    macro.

v4:
  * remove unintended addition of prefix to bpf log helper.
  * use RTE_LOG_LINE_PREFIX in other places using RTE_FMT_HEAD
    and RTE_FMT_TAIL.
  * add a checkpatch check to prevent reintroduction of ##args.

v3:
  * remove leading _ from RTE_LOG_COMMA the macro is not internal
  * add doxygen comment for existing RTE_LOG{,DP}_LINE function-like
    macros, based on RTE_LOG{,DP} comments.
  * add doxygen comment for new RTE_LOG{,DP}_LINE_PREFIX function-like
    macros, based on RTE_LOG{,DP} comments.
  * merge 2 vhost patches into a single patch (mistake in previous
    submission)

v2:
  * revamp entire series to be ISO C99 compliant, stop using variadic
    argument pack extension.

Tyler Retzlaff (22):
  log: add a per line log helper with parameterized prefix
  cfgfile: stop using variadic argument pack extension
  cmdline: stop using variadic argument pack extension
  compressdev: stop using variadic argument pack extension
  metrics: stop using variadic argument pack extension
  mldev: stop using variadic argument pack extension
  net: stop using variadic argument pack extension
  pdump: stop using variadic argument pack extension
  power: stop using variadic argument pack extension
  rawdev: stop using variadic argument pack extension
  rcu: stop using variadic argument pack extension
  stack: stop using variadic argument pack extension
  eal: stop using variadic argument pack extension
  vhost: stop using variadic argument pack extension
  ip_frag: stop using variadic argument pack extension
  bpf: stop using variadic argument pack extension
  cryptodev: stop using variadic argument pack extension
  eventdev: stop using variadic argument pack extension
  graph: stop using variadic argument pack extension
  member: stop using variadic argument pack extension
  node: stop using variadic argument pack extension
  devtools: forbid use argument variadic pack extension

 devtools/checkpatches.sh                   |  8 +++
 lib/bpf/bpf_impl.h                         |  4 +-
 lib/cfgfile/rte_cfgfile.c                  |  5 +-
 lib/cmdline/cmdline_parse.c                |  2 +-
 lib/cmdline/cmdline_parse_num.c            |  4 +-
 lib/compressdev/rte_compressdev_internal.h |  4 +-
 lib/cryptodev/rte_cryptodev.h              | 15 ++---
 lib/eal/common/eal_trace.h                 |  8 +--
 lib/eal/windows/include/rte_windows.h      |  5 +-
 lib/eventdev/eventdev_pmd.h                | 10 ++-
 lib/eventdev/rte_event_timer_adapter.c     |  5 +-
 lib/graph/graph_private.h                  |  5 +-
 lib/ip_frag/ip_frag_common.h               |  4 +-
 lib/log/rte_log.h                          | 97 ++++++++++++++++++++++++++++++
 lib/member/member.h                        |  5 +-
 lib/metrics/rte_metrics_telemetry.c        | 12 ++--
 lib/mldev/rte_mldev.h                      |  4 +-
 lib/net/rte_net_crc.c                      |  4 +-
 lib/node/node_private.h                    |  6 +-
 lib/pdump/rte_pdump.c                      |  4 +-
 lib/power/power_common.h                   |  6 +-
 lib/rawdev/rte_rawdev_pmd.h                | 17 +++---
 lib/rcu/rte_rcu_qsbr.c                     |  4 +-
 lib/rcu/rte_rcu_qsbr.h                     | 12 ++--
 lib/stack/stack_pvt.h                      | 16 ++---
 lib/vhost/vhost.h                          |  8 +--
 lib/vhost/vhost_crypto.c                   | 21 ++++---
 27 files changed, 196 insertions(+), 99 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 01/22] log: add a per line log helper with parameterized prefix
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 02/22] cfgfile: stop using variadic argument pack extension Tyler Retzlaff
                     ` (21 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Providing a custom prefix when logging is common for components. Lift
ISO C99 compliant helper macros from mlx5_common.h and provide
RTE_LOG_LINE_PREFIX macro that can expand similar to RTE_LOG_LINE with
a custom prefix and argument list.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/log/rte_log.h | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)

diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index fbc0df7..8f10e31 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -367,18 +367,115 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
 #define RTE_LOG_CHECK_NO_NEWLINE(...)
 #endif
 
+/**
+ * Generates a log message with a single trailing newline.
+ *
+ * The RTE_LOG_LINE() is a helper that expands logging of a message
+ * with RTE_LOG() appending a single newline to the formatted message.
+ *
+ * @param l
+ *   Log level. A value between EMERG (1) and DEBUG (8). The short name
+ *   is expanded by the macro, so it cannot be an integer value.
+ * @param t
+ *   The log type, for example, EAL. The short name is expanded by the
+ *   macro, so it cannot be an integer value.
+ * @param ...
+ *   The fmt string, as in printf(3), followed by the variable arguments
+ *   required by the format.
+ */
 #define RTE_LOG_LINE(l, t, ...) do { \
 	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \
 	RTE_LOG(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
 		RTE_FMT_TAIL(__VA_ARGS__ ,))); \
 } while (0)
 
+/**
+ * Generates a log message for data path with a single trailing newline.
+ *
+ * Similar to RTE_LOG_LINE(), except that it is removed at compilation
+ * time if the RTE_LOG_DP_LEVEL configuration option is lower than the
+ * log level argument.
+ *
+ * The RTE_LOG_LINE() is a helper that expands logging of a message
+ * with RTE_LOG_DP() appending a single newline to the formatted
+ * message.
+ *
+ * @param l
+ *   Log level. A value between EMERG (1) and DEBUG (8). The short name
+ *   is expanded by the macro, so it cannot be an integer value.
+ * @param t
+ *   The log type, for example, EAL. The short name is expanded by the
+ *   macro, so it cannot be an integer value.
+ * @param ...
+ *   The fmt string, as in printf(3), followed by the variable arguments
+ *   required by the format.
+ */
 #define RTE_LOG_DP_LINE(l, t, ...) do { \
 	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(__VA_ARGS__ ,)); \
 	RTE_LOG_DP(l, t, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
 		RTE_FMT_TAIL(__VA_ARGS__ ,))); \
 } while (0)
 
+#define RTE_LOG_COMMA ,
+
+/*
+ * Generates a log message with a supplied prefix and arguments with a
+ * single trailing newline.
+ *
+ * The RTE_LOG_LINE_PREFIX() is a helper that expands logging of a
+ * message with RTE_LOG() prepending the supplied prefix and arguments
+ * appending a single newline to the formatted message.
+ *
+ * @param l
+ *   Log level. A value between EMERG (1) and DEBUG (8). The short name
+ *   is expanded by the macro, so it cannot be an integer value.
+ * @param t
+ *   The log type, for example, EAL. The short name is expanded by the
+ *   macro, so it cannot be an integer value.
+ * @param prefix
+ *   The prefix format string.
+ * @param args
+ *   The arguments for the prefix format string. If args contains
+ *   multiple arguments use RTE_LOG_COMMA to defer expansion.
+ * @param ...
+ *   The fmt string, as in printf(3), followed by the variable arguments
+ *   required by the format.
+ */
+#define RTE_LOG_LINE_PREFIX(l, t, prefix, args, ...) do { \
+	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(prefix __VA_ARGS__ ,)); \
+	RTE_LOG(l, t, RTE_FMT(prefix RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+	    args RTE_LOG_COMMA RTE_FMT_TAIL(__VA_ARGS__ ,))); \
+} while (0)
+
+/*
+ * Generates a log message for the data path with a supplied prefix and
+ * arguments with a single trailing newline.
+ *
+ * The RTE_LOG_DP_LINE_PREFIX() is a helper that expands logging of a
+ * message with RTE_LOG_DP() prepending the supplied prefix and
+ * arguments appending a single newline to the formatted message.
+ *
+ * @param l
+ *   Log level. A value between EMERG (1) and DEBUG (8). The short name
+ *   is expanded by the macro, so it cannot be an integer value.
+ * @param t
+ *   The log type, for example, EAL. The short name is expanded by the
+ *   macro, so it cannot be an integer value.
+ * @param prefix
+ *   The prefix format string.
+ * @param args
+ *   The arguments for the prefix format string. If args contains
+ *   multiple arguments use RTE_LOG_COMMA to defer expansion.
+ * @param ...
+ *   The fmt string, as in printf(3), followed by the variable arguments
+ *   required by the format.
+ */
+#define RTE_LOG_DP_LINE_PREFIX(l, t, prefix, args, ...) do { \
+	RTE_LOG_CHECK_NO_NEWLINE(RTE_FMT_HEAD(prefix __VA_ARGS__ ,)); \
+	RTE_LOG_DP(l, t, RTE_FMT(prefix RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
+	    args RTE_LOG_COMMA RTE_FMT_TAIL(__VA_ARGS__ ,))); \
+} while (0)
+
 #define RTE_LOG_REGISTER_IMPL(type, name, level)			    \
 int type;								    \
 RTE_INIT(__##type)							    \
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 02/22] cfgfile: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 01/22] log: add a per line log helper with parameterized prefix Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 03/22] cmdline: " Tyler Retzlaff
                     ` (20 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/cfgfile/rte_cfgfile.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/cfgfile/rte_cfgfile.c b/lib/cfgfile/rte_cfgfile.c
index 6a5e4fd..e7e690f 100644
--- a/lib/cfgfile/rte_cfgfile.c
+++ b/lib/cfgfile/rte_cfgfile.c
@@ -31,8 +31,9 @@ struct rte_cfgfile {
 RTE_LOG_REGISTER_DEFAULT(cfgfile_logtype, INFO);
 #define RTE_LOGTYPE_CFGFILE cfgfile_logtype
 
-#define CFG_LOG(level, fmt, args...)					\
-	RTE_LOG_LINE(level, CFGFILE, "%s(): " fmt, __func__, ## args)
+#define CFG_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, CFGFILE, "%s(): ", __func__, __VA_ARGS__)
+
 /* >8 End of setting up dynamic logging */
 
 /** when we resize a file structure, how many extra entries
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 03/22] cmdline: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 01/22] log: add a per line log helper with parameterized prefix Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 02/22] cfgfile: stop using variadic argument pack extension Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 04/22] compressdev: " Tyler Retzlaff
                     ` (19 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Remove use of args... and just use __VA_ARGS__. The macros expanding
the argument pack do not require args extension to remove trailing comma.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/cmdline/cmdline_parse.c     | 2 +-
 lib/cmdline/cmdline_parse_num.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/cmdline/cmdline_parse.c b/lib/cmdline/cmdline_parse.c
index b6d6dac..76a212d 100644
--- a/lib/cmdline/cmdline_parse.c
+++ b/lib/cmdline/cmdline_parse.c
@@ -16,7 +16,7 @@
 #ifdef RTE_LIBRTE_CMDLINE_DEBUG
 #define debug_printf printf
 #else
-#define debug_printf(args...) do {} while(0)
+#define debug_printf(...) do {} while (0)
 #endif
 
 #define CMDLINE_BUFFER_SIZE 64
diff --git a/lib/cmdline/cmdline_parse_num.c b/lib/cmdline/cmdline_parse_num.c
index 820af07..e849878 100644
--- a/lib/cmdline/cmdline_parse_num.c
+++ b/lib/cmdline/cmdline_parse_num.c
@@ -14,9 +14,9 @@
 #include "cmdline_parse_num.h"
 
 #ifdef RTE_LIBRTE_CMDLINE_DEBUG
-#define debug_printf(args...) printf(args)
+#define debug_printf(...) printf(__VA_ARGS__)
 #else
-#define debug_printf(args...) do {} while(0)
+#define debug_printf(...) do {} while (0)
 #endif
 
 struct cmdline_token_ops cmdline_token_num_ops = {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 04/22] compressdev: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-02-29 21:31   ` [PATCH v5 03/22] cmdline: " Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 05/22] metrics: " Tyler Retzlaff
                     ` (18 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/compressdev/rte_compressdev_internal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/compressdev/rte_compressdev_internal.h b/lib/compressdev/rte_compressdev_internal.h
index 01b7764..0bc8c87 100644
--- a/lib/compressdev/rte_compressdev_internal.h
+++ b/lib/compressdev/rte_compressdev_internal.h
@@ -23,8 +23,8 @@
 extern int compressdev_logtype;
 #define RTE_LOGTYPE_COMPRESSDEV compressdev_logtype
 
-#define COMPRESSDEV_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, COMPRESSDEV, "%s(): " fmt, __func__, ## args)
+#define COMPRESSDEV_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, COMPRESSDEV, "%s(): ", __func__, __VA_ARGS__)
 
 /**
  * Dequeue processed packets from queue pair of a device.
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 05/22] metrics: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (3 preceding siblings ...)
  2024-02-29 21:31   ` [PATCH v5 04/22] compressdev: " Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 06/22] mldev: " Tyler Retzlaff
                     ` (17 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/metrics/rte_metrics_telemetry.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/metrics/rte_metrics_telemetry.c b/lib/metrics/rte_metrics_telemetry.c
index b8c9d75..dc43611 100644
--- a/lib/metrics/rte_metrics_telemetry.c
+++ b/lib/metrics/rte_metrics_telemetry.c
@@ -19,14 +19,14 @@
 #define RTE_LOGTYPE_METRICS metrics_log_level
 
 /* Logging Macros */
-#define METRICS_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, METRICS, "%s(): "fmt, __func__, ## args)
+#define METRICS_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, METRICS, "%s(): ", __func__, __VA_ARGS__)
 
-#define METRICS_LOG_ERR(fmt, args...) \
-	METRICS_LOG(ERR, fmt, ## args)
+#define METRICS_LOG_ERR(...) \
+	METRICS_LOG(ERR, __VA_ARGS__)
 
-#define METRICS_LOG_WARN(fmt, args...) \
-	METRICS_LOG(WARNING, fmt, ## args)
+#define METRICS_LOG_WARN(...) \
+	METRICS_LOG(WARNING, __VA_ARGS__)
 
 static int32_t
 rte_metrics_tel_reg_port_ethdev_to_metrics(uint16_t port_id)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 06/22] mldev: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (4 preceding siblings ...)
  2024-02-29 21:31   ` [PATCH v5 05/22] metrics: " Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 07/22] net: " Tyler Retzlaff
                     ` (16 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/mldev/rte_mldev.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/mldev/rte_mldev.h b/lib/mldev/rte_mldev.h
index 27e372f..01577bd 100644
--- a/lib/mldev/rte_mldev.h
+++ b/lib/mldev/rte_mldev.h
@@ -146,8 +146,8 @@
 extern int rte_ml_dev_logtype;
 #define RTE_LOGTYPE_MLDEV rte_ml_dev_logtype
 
-#define RTE_MLDEV_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, MLDEV, "%s(): " fmt, __func__, ##args)
+#define RTE_MLDEV_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, MLDEV, "%s(): ", __func__, __VA_ARGS__)
 
 #define RTE_ML_STR_MAX 128
 /**< Maximum length of name string */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 07/22] net: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (5 preceding siblings ...)
  2024-02-29 21:31   ` [PATCH v5 06/22] mldev: " Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 08/22] pdump: " Tyler Retzlaff
                     ` (15 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/net/rte_net_crc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/net/rte_net_crc.c b/lib/net/rte_net_crc.c
index b401ea3..346c285 100644
--- a/lib/net/rte_net_crc.c
+++ b/lib/net/rte_net_crc.c
@@ -73,8 +73,8 @@
 RTE_LOG_REGISTER_DEFAULT(libnet_logtype, INFO);
 #define RTE_LOGTYPE_NET libnet_logtype
 
-#define NET_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, NET, "%s(): " fmt, __func__, ## args)
+#define NET_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, NET, "%s(): ", __func__, __VA_ARGS__)
 
 /* Scalar handling */
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 08/22] pdump: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (6 preceding siblings ...)
  2024-02-29 21:31   ` [PATCH v5 07/22] net: " Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 09/22] power: " Tyler Retzlaff
                     ` (14 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/pdump/rte_pdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index f6160f9..679c3dd 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -18,8 +18,8 @@
 RTE_LOG_REGISTER_DEFAULT(pdump_logtype, NOTICE);
 #define RTE_LOGTYPE_PDUMP pdump_logtype
 
-#define PDUMP_LOG_LINE(level, fmt, args...) \
-	RTE_LOG_LINE(level, PDUMP, "%s(): " fmt, __func__, ## args)
+#define PDUMP_LOG_LINE(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, PDUMP, "%s(): ", __func__, __VA_ARGS__)
 
 /* Used for the multi-process communication */
 #define PDUMP_MP	"mp_pdump"
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 09/22] power: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (7 preceding siblings ...)
  2024-02-29 21:31   ` [PATCH v5 08/22] pdump: " Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 10/22] rawdev: " Tyler Retzlaff
                     ` (13 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/power/power_common.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/power/power_common.h b/lib/power/power_common.h
index 3096640..77bc593 100644
--- a/lib/power/power_common.h
+++ b/lib/power/power_common.h
@@ -16,10 +16,10 @@
 	RTE_LOG_LINE(level, POWER, "" __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
-#define POWER_DEBUG_LOG(fmt, args...) \
-	RTE_LOG_LINE(ERR, POWER, "%s: " fmt, __func__, ## args)
+#define POWER_DEBUG_LOG(...) \
+	RTE_LOG_LINE_PREFIX(ERR, POWER, "%s(): ", __func__, __VA_ARGS__)
 #else
-#define POWER_DEBUG_LOG(fmt, args...)
+#define POWER_DEBUG_LOG(fmt, ...)
 #endif
 
 /* check if scaling driver matches one we want */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 10/22] rawdev: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (8 preceding siblings ...)
  2024-02-29 21:31   ` [PATCH v5 09/22] power: " Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 11/22] rcu: " Tyler Retzlaff
                     ` (12 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/rawdev/rte_rawdev_pmd.h | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h
index 7173282..22b4064 100644
--- a/lib/rawdev/rte_rawdev_pmd.h
+++ b/lib/rawdev/rte_rawdev_pmd.h
@@ -30,16 +30,17 @@
 #define RTE_LOGTYPE_RAWDEV librawdev_logtype
 
 /* Logging Macros */
-#define RTE_RDEV_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, RAWDEV, "%s(): " fmt, __func__, ##args)
+#define RTE_RDEV_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, RAWDEV, "%s(): ", __func__, __VA_ARGS__)
 
-#define RTE_RDEV_ERR(fmt, args...) \
-	RTE_RDEV_LOG(ERR, fmt, ## args)
-#define RTE_RDEV_DEBUG(fmt, args...) \
-	RTE_RDEV_LOG(DEBUG, fmt, ## args)
-#define RTE_RDEV_INFO(fmt, args...) \
-	RTE_RDEV_LOG(INFO, fmt, ## args)
+#define RTE_RDEV_ERR(...) \
+	RTE_RDEV_LOG(ERR, __VA_ARGS__)
 
+#define RTE_RDEV_DEBUG(...) \
+	RTE_RDEV_LOG(DEBUG, __VA_ARGS__)
+
+#define RTE_RDEV_INFO(...) \
+	RTE_RDEV_LOG(INFO, __VA_ARGS__)
 
 /* Macros to check for valid device */
 #define RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, retval) do { \
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 11/22] rcu: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (9 preceding siblings ...)
  2024-02-29 21:31   ` [PATCH v5 10/22] rawdev: " Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 12/22] stack: " Tyler Retzlaff
                     ` (11 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@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..f08d974 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, ...) \
+	RTE_LOG_LINE_PREFIX(level, RCU, "%s(): ", __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 e7ef788..e4119cc 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, ...) \
+	RTE_LOG_DP_LINE_PREFIX(level, RCU, "%s(): ", __func__, __VA_ARGS__)
 #else
-#define __RTE_RCU_DP_LOG(level, fmt, args...)
+#define __RTE_RCU_DP_LOG(level, ...)
 #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, ...) do { \
 	if (v->qsbr_cnt[thread_id].lock_cnt) \
-		RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args); \
+		RTE_LOG_LINE_PREFIX(level, RCU, "%s(): ", __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


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 12/22] stack: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (10 preceding siblings ...)
  2024-02-29 21:31   ` [PATCH v5 11/22] rcu: " Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 13/22] eal: " Tyler Retzlaff
                     ` (10 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/stack/stack_pvt.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/stack/stack_pvt.h b/lib/stack/stack_pvt.h
index 2dce42a..fc95796 100644
--- a/lib/stack/stack_pvt.h
+++ b/lib/stack/stack_pvt.h
@@ -10,16 +10,16 @@
 extern int stack_logtype;
 #define RTE_LOGTYPE_STACK stack_logtype
 
-#define STACK_LOG(level, fmt, args...) \
-	RTE_LOG_LINE(level, STACK, "%s(): "fmt, __func__, ##args)
+#define STACK_LOG(level, ...) \
+	RTE_LOG_LINE_PREFIX(level, STACK, "%s(): ", __func__, __VA_ARGS__)
 
-#define STACK_LOG_ERR(fmt, args...) \
-	STACK_LOG(ERR, fmt, ## args)
+#define STACK_LOG_ERR(...) \
+	STACK_LOG(ERR, __VA_ARGS__)
 
-#define STACK_LOG_WARN(fmt, args...) \
-	STACK_LOG(WARNING, fmt, ## args)
+#define STACK_LOG_WARN(...) \
+	STACK_LOG(WARNING, __VA_ARGS__)
 
-#define STACK_LOG_INFO(fmt, args...) \
-	STACK_LOG(INFO, fmt, ## args)
+#define STACK_LOG_INFO(fmt, ...) \
+	STACK_LOG(INFO, __VA_ARGS__)
 
 #endif /* _STACK_PVT_H_ */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 13/22] eal: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (11 preceding siblings ...)
  2024-02-29 21:31   ` [PATCH v5 12/22] stack: " Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 14/22] vhost: " Tyler Retzlaff
                     ` (9 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Use RTE_LOG_LINE_PREFIX instead of EAL_LOG 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 <roretzla@linux.microsoft.com>
---
 lib/eal/common/eal_trace.h            | 8 ++++----
 lib/eal/windows/include/rte_windows.h | 5 ++---
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/eal/common/eal_trace.h b/lib/eal/common/eal_trace.h
index bd082a0..5526267 100644
--- a/lib/eal/common/eal_trace.h
+++ b/lib/eal/common/eal_trace.h
@@ -16,11 +16,11 @@
 #include "eal_private.h"
 #include "eal_thread.h"
 
-#define trace_err(fmt, args...) \
-	EAL_LOG(ERR, "%s():%u " fmt, __func__, __LINE__, ## args)
+#define trace_err(...) \
+	RTE_LOG_LINE_PREFIX(ERR, EAL, "%s():%u ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
-#define trace_crit(fmt, args...) \
-	EAL_LOG(CRIT, "%s():%u " fmt, __func__, __LINE__, ## args)
+#define trace_crit(...) \
+	RTE_LOG_LINE_PREFIX(CRIT, EAL, "%s():%u ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #define TRACE_CTF_MAGIC 0xC1FC1FC1
 #define TRACE_MAX_ARGS	32
diff --git a/lib/eal/windows/include/rte_windows.h b/lib/eal/windows/include/rte_windows.h
index 0b0d117..567ed7d 100644
--- a/lib/eal/windows/include/rte_windows.h
+++ b/lib/eal/windows/include/rte_windows.h
@@ -48,9 +48,8 @@
  * Log GetLastError() with context, usually a Win32 API function and arguments.
  */
 #define RTE_LOG_WIN32_ERR(...) \
-	RTE_LOG_LINE(DEBUG, EAL, RTE_FMT("GetLastError()=%lu: " \
-		RTE_FMT_HEAD(__VA_ARGS__ ,), GetLastError(), \
-		RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(DEBUG, EAL, \
+		"GetLastError()=%lu: ", GetLastError(), __VA_ARGS__)
 
 #ifdef __cplusplus
 }
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 14/22] vhost: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (12 preceding siblings ...)
  2024-02-29 21:31   ` [PATCH v5 13/22] eal: " Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 15/22] ip_frag: " Tyler Retzlaff
                     ` (8 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@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


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 15/22] ip_frag: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (13 preceding siblings ...)
  2024-02-29 21:31   ` [PATCH v5 14/22] vhost: " Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:31   ` [PATCH v5 16/22] bpf: " Tyler Retzlaff
                     ` (7 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Remove use of args... and just use __VA_ARGS__. The macros expanding
the argument pack do not require args extension to remove trailing comma.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/ip_frag/ip_frag_common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h
index c766154..f66a963 100644
--- a/lib/ip_frag/ip_frag_common.h
+++ b/lib/ip_frag/ip_frag_common.h
@@ -26,9 +26,9 @@
 	RTE_LOG_LINE(level, IPFRAG, "" __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_IP_FRAG_DEBUG
-#define	IP_FRAG_LOG(lvl, fmt, args...)	RTE_LOG(lvl, IPFRAG, fmt, ##args)
+#define	IP_FRAG_LOG(lvl, ...)	RTE_LOG(lvl, IPFRAG, __VA_ARGS__)
 #else
-#define	IP_FRAG_LOG(lvl, fmt, args...)	do {} while(0)
+#define	IP_FRAG_LOG(lvl, fmt, ...)	do {} while (0)
 #endif /* IP_FRAG_DEBUG */
 
 #define IPV4_KEYLEN 1
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 16/22] bpf: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (14 preceding siblings ...)
  2024-02-29 21:31   ` [PATCH v5 15/22] ip_frag: " Tyler Retzlaff
@ 2024-02-29 21:31   ` Tyler Retzlaff
  2024-02-29 21:32   ` [PATCH v5 17/22] cryptodev: " Tyler Retzlaff
                     ` (6 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:31 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Remove fmt, args... and forward with __VA_ARGS__.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/bpf/bpf_impl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h
index 1a3d97d..20c9ef9 100644
--- a/lib/bpf/bpf_impl.h
+++ b/lib/bpf/bpf_impl.h
@@ -29,8 +29,8 @@ struct rte_bpf {
 extern int rte_bpf_logtype;
 #define RTE_LOGTYPE_BPF rte_bpf_logtype
 
-#define	RTE_BPF_LOG_LINE(lvl, fmt, args...) \
-	RTE_LOG_LINE(lvl, BPF, fmt, ##args)
+#define	RTE_BPF_LOG_LINE(lvl, ...) \
+	RTE_LOG_LINE(lvl, BPF, __VA_ARGS__)
 
 static inline size_t
 bpf_size(uint32_t bpf_op_sz)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 17/22] cryptodev: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (15 preceding siblings ...)
  2024-02-29 21:31   ` [PATCH v5 16/22] bpf: " Tyler Retzlaff
@ 2024-02-29 21:32   ` Tyler Retzlaff
  2024-02-29 21:32   ` [PATCH v5 18/22] eventdev: " Tyler Retzlaff
                     ` (5 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:32 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/cryptodev/rte_cryptodev.h | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index f6ab0e5..00ba6a2 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -34,22 +34,19 @@
 
 /* Logging Macros */
 #define CDEV_LOG_ERR(...) \
-	RTE_LOG_LINE(ERR, CRYPTODEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(ERR, CRYPTODEV, \
+		"%s() line %u: ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #define CDEV_LOG_INFO(...) \
 	RTE_LOG_LINE(INFO, CRYPTODEV, "" __VA_ARGS__)
 
 #define CDEV_LOG_DEBUG(...) \
-	RTE_LOG_LINE(DEBUG, CRYPTODEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(DEBUG, CRYPTODEV, \
+		"%s() line %u: ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #define CDEV_PMD_TRACE(...) \
-	RTE_LOG_LINE(DEBUG, CRYPTODEV, \
-		RTE_FMT("[%s] %s: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
-			dev, __func__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(DEBUG, CRYPTODEV, \
+		"[%s] %s: ", dev RTE_LOG_COMMA __func__, __VA_ARGS__)
 
 /**
  * A macro that points to an offset from the start
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 18/22] eventdev: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (16 preceding siblings ...)
  2024-02-29 21:32   ` [PATCH v5 17/22] cryptodev: " Tyler Retzlaff
@ 2024-02-29 21:32   ` Tyler Retzlaff
  2024-02-29 21:32   ` [PATCH v5 19/22] graph: " Tyler Retzlaff
                     ` (4 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:32 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/eventdev/eventdev_pmd.h            | 10 ++++------
 lib/eventdev/rte_event_timer_adapter.c |  5 ++---
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index c415624..2ad8802 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -36,15 +36,13 @@
 
 /* Logging Macros */
 #define RTE_EDEV_LOG_ERR(...) \
-	RTE_LOG_LINE(ERR, EVENTDEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(ERR, EVENTDEV, \
+		"%s() line %u: ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
 #define RTE_EDEV_LOG_DEBUG(...) \
-	RTE_LOG_LINE(DEBUG, EVENTDEV, \
-		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(DEBUG, EVENTDEV, \
+		"%s() line %u: ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 #else
 #define RTE_EDEV_LOG_DEBUG(...) (void)0
 #endif
diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c
index e6d3492..a3c6fb7 100644
--- a/lib/eventdev/rte_event_timer_adapter.c
+++ b/lib/eventdev/rte_event_timer_adapter.c
@@ -41,9 +41,8 @@
 static const struct event_timer_adapter_ops swtim_ops;
 
 #define EVTIM_LOG(level, logtype, ...) \
-	RTE_LOG_LINE(level, logtype, \
-		RTE_FMT("EVTIMER: %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(level, logtype, \
+		"EVTIMER: %s() line %u: ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #define EVTIM_LOG_ERR(...) EVTIM_LOG(ERR, EVTIM, __VA_ARGS__)
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 19/22] graph: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (17 preceding siblings ...)
  2024-02-29 21:32   ` [PATCH v5 18/22] eventdev: " Tyler Retzlaff
@ 2024-02-29 21:32   ` Tyler Retzlaff
  2024-02-29 21:32   ` [PATCH v5 20/22] member: " Tyler Retzlaff
                     ` (3 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:32 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/graph/graph_private.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h
index fb88d4b..73c0884 100644
--- a/lib/graph/graph_private.h
+++ b/lib/graph/graph_private.h
@@ -21,9 +21,8 @@
 #define RTE_LOGTYPE_GRAPH rte_graph_logtype
 
 #define GRAPH_LOG(level, ...)                                                  \
-	RTE_LOG_LINE(level, GRAPH,                                             \
-		RTE_FMT("%s():%u " RTE_FMT_HEAD(__VA_ARGS__ ,),                \
-			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(level, GRAPH, \
+		"%s():%u ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #define graph_err(...) GRAPH_LOG(ERR, __VA_ARGS__)
 #define graph_warn(...) GRAPH_LOG(WARNING, __VA_ARGS__)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 20/22] member: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (18 preceding siblings ...)
  2024-02-29 21:32   ` [PATCH v5 19/22] graph: " Tyler Retzlaff
@ 2024-02-29 21:32   ` Tyler Retzlaff
  2024-02-29 21:32   ` [PATCH v5 21/22] node: " Tyler Retzlaff
                     ` (2 subsequent siblings)
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:32 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/member/member.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/member/member.h b/lib/member/member.h
index cf600c4..d71c26b 100644
--- a/lib/member/member.h
+++ b/lib/member/member.h
@@ -8,7 +8,6 @@
 #define RTE_LOGTYPE_MEMBER librte_member_logtype
 
 #define MEMBER_LOG(level, ...) \
-	RTE_LOG_LINE(level,  MEMBER, \
-		RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__ ,), \
-			__func__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(level, MEMBER, \
+		"%s(): ", __func__, __VA_ARGS__)
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 21/22] node: stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (19 preceding siblings ...)
  2024-02-29 21:32   ` [PATCH v5 20/22] member: " Tyler Retzlaff
@ 2024-02-29 21:32   ` Tyler Retzlaff
  2024-02-29 21:32   ` [PATCH v5 22/22] devtools: forbid use argument variadic " Tyler Retzlaff
  2024-03-01 12:43   ` [PATCH v5 00/22] stop using variadic argument " David Marchand
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:32 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

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 <roretzla@linux.microsoft.com>
---
 lib/node/node_private.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/node/node_private.h b/lib/node/node_private.h
index 2b9bad1..3498b15 100644
--- a/lib/node/node_private.h
+++ b/lib/node/node_private.h
@@ -16,10 +16,8 @@
 #define RTE_LOGTYPE_NODE rte_node_logtype
 
 #define NODE_LOG(level, node_name, ...)                                        \
-	RTE_LOG_LINE(level, NODE,                                              \
-		RTE_FMT("%s: %s():%u " RTE_FMT_HEAD(__VA_ARGS__ ,),            \
-			node_name, __func__, __LINE__,                         \
-			RTE_FMT_TAIL(__VA_ARGS__ ,)))
+	RTE_LOG_LINE_PREFIX(level, NODE, "%s: %s():%u ", \
+		node_name RTE_LOG_COMMA __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__)
 
 #define node_err(node_name, ...) NODE_LOG(ERR, node_name, __VA_ARGS__)
 #define node_info(node_name, ...) NODE_LOG(INFO, node_name, __VA_ARGS__)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* [PATCH v5 22/22] devtools: forbid use argument variadic pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (20 preceding siblings ...)
  2024-02-29 21:32   ` [PATCH v5 21/22] node: " Tyler Retzlaff
@ 2024-02-29 21:32   ` Tyler Retzlaff
  2024-03-01 12:43   ` [PATCH v5 00/22] stop using variadic argument " David Marchand
  22 siblings, 0 replies; 120+ messages in thread
From: Tyler Retzlaff @ 2024-02-29 21:32 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Ashish Gupta, Chenbo Xia, Cristian Dumitrescu,
	David Hunt, Fan Zhang, Hemant Agrawal, Honnappa Nagarahalli,
	Jasvinder Singh, Jerin Jacob, Konstantin Ananyev,
	Maxime Coquelin, Reshma Pattan, Sachin Saxena,
	Sivaprasad Tummala, Srikanth Yalavarthi, Stephen Hemminger,
	Sunil Kumar Kori, bruce.richardson, mb, thomas, Tyler Retzlaff

Prevent introduction of new use of args... and ##args compiler
extension.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index e379700..811655b 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -61,6 +61,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# forbid use of variadic argument pack extension in macros
+	awk -v FOLDERS="lib drivers app examples" \
+		-v EXPRESSIONS='#[[:space:]]*define.*[^(,[:space:]]\\.\\.\\.[[:space:]]*)' \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Do not use variadic argument pack in macros' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# no output on stdout or stderr
 	awk -v FOLDERS="lib drivers" \
 		-v EXPRESSIONS="\\\<printf\\\> \\\<fprintf\\\(stdout, \\\<fprintf\\\(stderr," \
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 120+ messages in thread

* Re: [PATCH v5 00/22] stop using variadic argument pack extension
  2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
                     ` (21 preceding siblings ...)
  2024-02-29 21:32   ` [PATCH v5 22/22] devtools: forbid use argument variadic " Tyler Retzlaff
@ 2024-03-01 12:43   ` David Marchand
  22 siblings, 0 replies; 120+ messages in thread
From: David Marchand @ 2024-03-01 12:43 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Anatoly Burakov, Ashish Gupta, Chenbo Xia,
	Cristian Dumitrescu, David Hunt, Fan Zhang, Hemant Agrawal,
	Honnappa Nagarahalli, Jasvinder Singh, Jerin Jacob,
	Konstantin Ananyev, Maxime Coquelin, Reshma Pattan,
	Sachin Saxena, Sivaprasad Tummala, Srikanth Yalavarthi,
	Stephen Hemminger, Sunil Kumar Kori, bruce.richardson, mb,
	thomas

On Thu, Feb 29, 2024 at 10:32 PM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> RTE_LOG_LINE cannot be augmented with a prefix format and arguments
> without the user of RTE_LOG_LINE using the args... and ## args compiler
> extension to conditionally remove trailing comma when the macro receives
> only a single argument.
>
> Provide a new/similar macro RTE_LOG_LINE_PREFIX that accepts the prefix
> format and arguments as separate parameters allowing them to be expanded
> at the correct locations inside of RTE_FMT() allowing the rest of the
> non-prefix format string and arguments to be collapsed to the argument
> pack which can be directly forwarded with __VA_ARGS__ avoiding the need
> for conditional comma removal.
>
> I've done my best to manually check expansions (preprocessed) and compiled
> printf of the logs to validate correct output.
>
> v5:
>   * add missing newline escape and comma in rte_windows.h
>     macro.

LGTM.
Series applied, thanks.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 120+ messages in thread

end of thread, other threads:[~2024-03-01 12:43 UTC | newest]

Thread overview: 120+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12 21:49 [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Tyler Retzlaff
2024-02-12 21:49 ` [PATCH 01/15] eal: use GCC and MSVC common VA ARGS extension Tyler Retzlaff
2024-02-12 21:49 ` [PATCH 02/15] bpf: " Tyler Retzlaff
2024-02-12 21:49 ` [PATCH 03/15] cfgfile: " Tyler Retzlaff
2024-02-13  9:03   ` Bruce Richardson
2024-02-12 21:49 ` [PATCH 04/15] cmdline: " Tyler Retzlaff
2024-02-13  9:04   ` Bruce Richardson
2024-02-12 21:49 ` [PATCH 05/15] ip_frag: " Tyler Retzlaff
2024-02-12 21:49 ` [PATCH 06/15] compressdev: " Tyler Retzlaff
2024-02-12 21:49 ` [PATCH 07/15] metrics: " Tyler Retzlaff
2024-02-12 21:49 ` [PATCH 08/15] mldev: " Tyler Retzlaff
2024-02-12 21:49 ` [PATCH 09/15] net: " Tyler Retzlaff
2024-02-12 21:49 ` [PATCH 10/15] pdump: " Tyler Retzlaff
2024-02-12 21:49 ` [PATCH 11/15] power: " Tyler Retzlaff
2024-02-12 21:49 ` [PATCH 12/15] rawdev: " Tyler Retzlaff
2024-02-13 12:46   ` Hemant Agrawal
2024-02-12 21:49 ` [PATCH 13/15] rcu: " Tyler Retzlaff
2024-02-12 21:49 ` [PATCH 14/15] stack: " Tyler Retzlaff
2024-02-12 21:49 ` [PATCH 15/15] vhost: " Tyler Retzlaff
2024-02-13  9:00 ` [PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__ Bruce Richardson
2024-02-13  9:09 ` Morten Brørup
2024-02-18 13:38 ` Thomas Monjalon
2024-02-22 23:46 ` [PATCH v2 00/17] stop using variadic argument pack extension Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 01/17] log: add a per line log helper with parameterized prefix Tyler Retzlaff
2024-02-26 18:04     ` Thomas Monjalon
2024-02-22 23:46   ` [PATCH v2 02/17] bpf: stop using variadic argument pack extension Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 03/17] cfgfile: " Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 04/17] cmdline: " Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 05/17] compressdev: " Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 06/17] metrics: " Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 07/17] mldev: " Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 08/17] net: " Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 09/17] pdump: " Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 10/17] power: " Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 11/17] rawdev: " Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 12/17] rcu: " Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 13/17] stack: " Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 14/17] eal: " Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 15/17] vhost: " Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 16/17] " Tyler Retzlaff
2024-02-22 23:46   ` [PATCH v2 17/17] ip_frag: " Tyler Retzlaff
2024-02-23  8:10   ` [PATCH v2 00/17] " Morten Brørup
2024-02-26 20:19 ` [PATCH v3 00/16] " Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 01/16] log: add a per line log helper with parameterized prefix Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 02/16] bpf: stop using variadic argument pack extension Tyler Retzlaff
2024-02-27  9:48     ` Konstantin Ananyev
2024-02-28 13:16     ` David Marchand
2024-02-28 13:34       ` Konstantin Ananyev
2024-02-28 17:24         ` Tyler Retzlaff
2024-02-28 17:27           ` Konstantin Ananyev
2024-02-28 17:29             ` Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 03/16] cfgfile: " Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 04/16] cmdline: " Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 05/16] compressdev: " Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 06/16] metrics: " Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 07/16] mldev: " Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 08/16] net: " Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 09/16] pdump: " Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 10/16] power: " Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 11/16] rawdev: " Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 12/16] rcu: " Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 13/16] stack: " Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 14/16] eal: " Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 15/16] vhost: " Tyler Retzlaff
2024-02-26 20:19   ` [PATCH v3 16/16] ip_frag: " Tyler Retzlaff
2024-02-27  9:48     ` Konstantin Ananyev
2024-02-26 20:54   ` [PATCH v3 00/16] " Stephen Hemminger
2024-02-27 18:14     ` Tyler Retzlaff
2024-02-28 11:45       ` David Marchand
2024-02-28 17:27         ` Tyler Retzlaff
2024-02-28 17:29   ` David Marchand
2024-02-28 17:59     ` Tyler Retzlaff
2024-02-29  8:06       ` David Marchand
2024-02-29 19:53 ` [PATCH v4 00/22] " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 01/22] log: add a per line log helper with parameterized prefix Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 02/22] cfgfile: stop using variadic argument pack extension Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 03/22] cmdline: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 04/22] compressdev: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 05/22] metrics: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 06/22] mldev: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 07/22] net: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 08/22] pdump: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 09/22] power: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 10/22] rawdev: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 11/22] rcu: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 12/22] stack: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 13/22] eal: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 14/22] vhost: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 15/22] ip_frag: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 16/22] bpf: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 17/22] cryptodev: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 18/22] eventdev: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 19/22] graph: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 20/22] member: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 21/22] node: " Tyler Retzlaff
2024-02-29 19:53   ` [PATCH v4 22/22] devtools: forbid use argument variadic " Tyler Retzlaff
2024-02-29 21:31 ` [PATCH v5 00/22] stop using variadic argument " Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 01/22] log: add a per line log helper with parameterized prefix Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 02/22] cfgfile: stop using variadic argument pack extension Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 03/22] cmdline: " Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 04/22] compressdev: " Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 05/22] metrics: " Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 06/22] mldev: " Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 07/22] net: " Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 08/22] pdump: " Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 09/22] power: " Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 10/22] rawdev: " Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 11/22] rcu: " Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 12/22] stack: " Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 13/22] eal: " Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 14/22] vhost: " Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 15/22] ip_frag: " Tyler Retzlaff
2024-02-29 21:31   ` [PATCH v5 16/22] bpf: " Tyler Retzlaff
2024-02-29 21:32   ` [PATCH v5 17/22] cryptodev: " Tyler Retzlaff
2024-02-29 21:32   ` [PATCH v5 18/22] eventdev: " Tyler Retzlaff
2024-02-29 21:32   ` [PATCH v5 19/22] graph: " Tyler Retzlaff
2024-02-29 21:32   ` [PATCH v5 20/22] member: " Tyler Retzlaff
2024-02-29 21:32   ` [PATCH v5 21/22] node: " Tyler Retzlaff
2024-02-29 21:32   ` [PATCH v5 22/22] devtools: forbid use argument variadic " Tyler Retzlaff
2024-03-01 12:43   ` [PATCH v5 00/22] stop using variadic argument " David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).