DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/4] add __extension__ keyword to statement expressions
@ 2023-11-15 23:02 Tyler Retzlaff
  2023-11-15 23:02 ` [PATCH 1/4] lib: add extension " Tyler Retzlaff
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Tyler Retzlaff @ 2023-11-15 23:02 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Aman Singh, Amit Bernstein, Andrew Rybchenko,
	Apeksha Gupta, Beilei Xing, Brian Dooley, Chengwen Feng,
	Cristian Dumitrescu, Evgeny Schemeilin, Ferruh Yigit,
	Gagandeep Singh, Gowrishankar Muthukrishnan, Harman Kalra,
	Hemant Agrawal, Jerin Jacob, Jian Wang, Jiawen Wu, Kai Ji,
	Kiran Kumar K, Maciej Czekaj, Nithin Dabilpuram, Qi Zhang,
	Rahul Lakkireddy, Rakesh Kudurumalla, Ron Beider, Rosen Xu,
	Ruifeng Wang, Sachin Saxena, Satha Rao, Shai Brandes,
	Somnath Kotur, Srikanth Yalavarthi, Sunil Kumar Kori,
	Thomas Monjalon, Tianfei Zhang, Wajeeh Atrash, Xiao Wang,
	Yuying Zhang, Tyler Retzlaff

As requested from previous rejected series this series applies the
__extension__ keyword to all statement expressionsin DPDK.

Tyler Retzlaff (4):
  lib: add extension keyword to statement expressions
  app: add extension keyword to statement expressions
  drivers: add extension keyword to statement expressions
  examples: add extension keyword to statement expressions

 app/graph/utils.c                                |  2 +-
 app/test-eventdev/parser.h                       |  2 +-
 app/test-mldev/parser.h                          |  2 +-
 app/test-pmd/cmdline_tm.c                        |  2 +-
 drivers/bus/fslmc/mc/fsl_mc_sys.h                |  6 ++---
 drivers/common/cnxk/roc_io.h                     |  6 ++---
 drivers/common/cnxk/roc_platform.h               |  2 +-
 drivers/common/dpaax/dpaa_list.h                 |  2 +-
 drivers/common/qat/qat_adf/icp_qat_hw.h          |  2 +-
 drivers/crypto/armv8/rte_armv8_pmd.c             |  4 ++--
 drivers/crypto/caam_jr/caam_jr_desc.h            |  2 +-
 drivers/dma/hisilicon/hisi_dmadev.c              |  2 +-
 drivers/event/octeontx/ssovf_evdev.h             |  4 ++--
 drivers/mempool/octeontx/octeontx_fpavf.h        |  4 ++--
 drivers/ml/cnxk/cn10k_ml_dev.h                   |  4 ++--
 drivers/net/bnxt/bnxt_ethdev.c                   |  4 ++--
 drivers/net/cxgbe/cxgbe_compat.h                 |  2 +-
 drivers/net/ena/base/ena_plat_dpdk.h             | 14 +++++------
 drivers/net/ena/ena_ethdev.c                     | 30 ++++++++++++------------
 drivers/net/enetfec/enet_ethdev.h                |  2 +-
 drivers/net/fm10k/base/fm10k_osdep.h             |  2 +-
 drivers/net/i40e/i40e_rxtx.h                     |  2 +-
 drivers/net/octeontx/base/octeontx_io.h          |  6 ++---
 drivers/net/pfe/base/cbus.h                      |  2 +-
 drivers/net/pfe/base/pfe.h                       | 12 +++++-----
 drivers/net/tap/bpf/bpf_api.h                    |  2 +-
 drivers/net/thunderx/base/nicvf_plat.h           |  4 ++--
 drivers/net/txgbe/base/txgbe_osdep.h             |  2 +-
 drivers/raw/ifpga/afu_pmd_core.h                 |  2 +-
 drivers/raw/ifpga/base/ifpga_compat.h            |  4 ++--
 drivers/raw/ifpga/base/opae_osdep.h              |  4 ++--
 drivers/raw/ifpga/base/opae_spi_transaction.c    |  2 +-
 drivers/raw/ifpga/base/osdep_rte/osdep_generic.h |  4 ++--
 examples/fips_validation/fips_validation.c       |  2 +-
 examples/ip_pipeline/parser.h                    |  2 +-
 examples/pipeline/cli.c                          |  2 +-
 examples/qos_meter/main.h                        |  2 +-
 lib/ethdev/rte_mtr.c                             | 10 ++++----
 lib/ethdev/rte_tm.c                              |  6 ++---
 lib/pipeline/rte_pipeline.c                      |  8 +++----
 lib/pipeline/rte_swx_pipeline_internal.h         |  2 +-
 lib/port/rte_port_source_sink.c                  |  4 ++--
 42 files changed, 92 insertions(+), 92 deletions(-)

-- 
1.8.3.1


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

* [PATCH 1/4] lib: add extension keyword to statement expressions
  2023-11-15 23:02 [PATCH 0/4] add __extension__ keyword to statement expressions Tyler Retzlaff
@ 2023-11-15 23:02 ` Tyler Retzlaff
  2023-11-15 23:02 ` [PATCH 2/4] app: " Tyler Retzlaff
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: Tyler Retzlaff @ 2023-11-15 23:02 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Aman Singh, Amit Bernstein, Andrew Rybchenko,
	Apeksha Gupta, Beilei Xing, Brian Dooley, Chengwen Feng,
	Cristian Dumitrescu, Evgeny Schemeilin, Ferruh Yigit,
	Gagandeep Singh, Gowrishankar Muthukrishnan, Harman Kalra,
	Hemant Agrawal, Jerin Jacob, Jian Wang, Jiawen Wu, Kai Ji,
	Kiran Kumar K, Maciej Czekaj, Nithin Dabilpuram, Qi Zhang,
	Rahul Lakkireddy, Rakesh Kudurumalla, Ron Beider, Rosen Xu,
	Ruifeng Wang, Sachin Saxena, Satha Rao, Shai Brandes,
	Somnath Kotur, Srikanth Yalavarthi, Sunil Kumar Kori,
	Thomas Monjalon, Tianfei Zhang, Wajeeh Atrash, Xiao Wang,
	Yuying Zhang, Tyler Retzlaff

Add __extension__ keyword to gcc statement expression extensions.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/ethdev/rte_mtr.c                     | 10 +++++-----
 lib/ethdev/rte_tm.c                      |  6 +++---
 lib/pipeline/rte_pipeline.c              |  8 ++++----
 lib/pipeline/rte_swx_pipeline_internal.h |  2 +-
 lib/port/rte_port_source_sink.c          |  4 ++--
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/lib/ethdev/rte_mtr.c b/lib/ethdev/rte_mtr.c
index 4e94af9..900837b 100644
--- a/lib/ethdev/rte_mtr.c
+++ b/lib/ethdev/rte_mtr.c
@@ -41,14 +41,14 @@
 }
 
 #define RTE_MTR_FUNC(port_id, func)			\
-({							\
+__extension__ ({					\
 	const struct rte_mtr_ops *ops =			\
-		rte_mtr_ops_get(port_id, error);		\
-	if (ops == NULL)					\
+		rte_mtr_ops_get(port_id, error);	\
+	if (ops == NULL)				\
 		return -rte_errno;			\
 							\
 	if (ops->func == NULL)				\
-		return -rte_mtr_error_set(error,		\
+		return -rte_mtr_error_set(error,	\
 			ENOSYS,				\
 			RTE_MTR_ERROR_TYPE_UNSPECIFIED,	\
 			NULL,				\
@@ -58,7 +58,7 @@
 })
 
 #define RTE_MTR_HNDL_FUNC(port_id, func)		\
-({							\
+__extension__ ({					\
 	const struct rte_mtr_ops *ops =			\
 		rte_mtr_ops_get(port_id, error);	\
 	if (ops == NULL)				\
diff --git a/lib/ethdev/rte_tm.c b/lib/ethdev/rte_tm.c
index 2d08141..d594fe0 100644
--- a/lib/ethdev/rte_tm.c
+++ b/lib/ethdev/rte_tm.c
@@ -40,11 +40,11 @@
 	return ops;
 }
 
-#define RTE_TM_FUNC(port_id, func)				\
-({							\
+#define RTE_TM_FUNC(port_id, func)			\
+__extension__ ({					\
 	const struct rte_tm_ops *ops =			\
 		rte_tm_ops_get(port_id, error);		\
-	if (ops == NULL)					\
+	if (ops == NULL)				\
 		return -rte_errno;			\
 							\
 	if (ops->func == NULL)				\
diff --git a/lib/pipeline/rte_pipeline.c b/lib/pipeline/rte_pipeline.c
index 436cf54..e5cab00 100644
--- a/lib/pipeline/rte_pipeline.c
+++ b/lib/pipeline/rte_pipeline.c
@@ -17,16 +17,16 @@
 #ifdef RTE_PIPELINE_STATS_COLLECT
 
 #define RTE_PIPELINE_STATS_AH_DROP_WRITE(p, mask)			\
-	({ (p)->n_pkts_ah_drop = rte_popcount64(mask); })
+	__extension__ ({ (p)->n_pkts_ah_drop = rte_popcount64(mask); })
 
 #define RTE_PIPELINE_STATS_AH_DROP_READ(p, counter)			\
-	({ (counter) += (p)->n_pkts_ah_drop; (p)->n_pkts_ah_drop = 0; })
+	__extension__ ({ (counter) += (p)->n_pkts_ah_drop; (p)->n_pkts_ah_drop = 0; })
 
 #define RTE_PIPELINE_STATS_TABLE_DROP0(p)				\
-	({ (p)->pkts_drop_mask = (p)->action_mask0[RTE_PIPELINE_ACTION_DROP]; })
+	__extension__ ({ (p)->pkts_drop_mask = (p)->action_mask0[RTE_PIPELINE_ACTION_DROP]; })
 
 #define RTE_PIPELINE_STATS_TABLE_DROP1(p, counter)			\
-({									\
+__extension__ ({							\
 	uint64_t mask = (p)->action_mask0[RTE_PIPELINE_ACTION_DROP];	\
 	mask ^= (p)->pkts_drop_mask;					\
 	(counter) += rte_popcount64(mask);			\
diff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h
index a67b6e9..beb2011 100644
--- a/lib/pipeline/rte_swx_pipeline_internal.h
+++ b/lib/pipeline/rte_swx_pipeline_internal.h
@@ -1485,7 +1485,7 @@ struct thread {
 #endif
 
 #define METADATA_READ(thread, offset, n_bits)                                  \
-({                                                                             \
+__extension__ ({                                                               \
 	uint64_t *m64_ptr = (uint64_t *)&(thread)->metadata[offset];           \
 	uint64_t m64 = *m64_ptr;                                               \
 	uint64_t m64_mask = UINT64_MAX >> (64 - (n_bits));                     \
diff --git a/lib/port/rte_port_source_sink.c b/lib/port/rte_port_source_sink.c
index ff9677c..7b5fcb4 100644
--- a/lib/port/rte_port_source_sink.c
+++ b/lib/port/rte_port_source_sink.c
@@ -176,7 +176,7 @@ struct rte_port_source {
 #else /* RTE_PORT_PCAP */
 
 #define PCAP_SOURCE_LOAD(port, file_name, n_bytes, socket_id)	\
-({								\
+__extension__ ({						\
 	int _ret = 0;						\
 								\
 	if (file_name) {					\
@@ -429,7 +429,7 @@ struct rte_port_sink {
 #else
 
 #define PCAP_SINK_OPEN(port, file_name, max_n_pkts)		\
-({								\
+__extension__ ({						\
 	int _ret = 0;						\
 								\
 	if (file_name) {					\
-- 
1.8.3.1


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

* [PATCH 2/4] app: add extension keyword to statement expressions
  2023-11-15 23:02 [PATCH 0/4] add __extension__ keyword to statement expressions Tyler Retzlaff
  2023-11-15 23:02 ` [PATCH 1/4] lib: add extension " Tyler Retzlaff
@ 2023-11-15 23:02 ` Tyler Retzlaff
  2023-11-15 23:02 ` [PATCH 3/4] drivers: " Tyler Retzlaff
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: Tyler Retzlaff @ 2023-11-15 23:02 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Aman Singh, Amit Bernstein, Andrew Rybchenko,
	Apeksha Gupta, Beilei Xing, Brian Dooley, Chengwen Feng,
	Cristian Dumitrescu, Evgeny Schemeilin, Ferruh Yigit,
	Gagandeep Singh, Gowrishankar Muthukrishnan, Harman Kalra,
	Hemant Agrawal, Jerin Jacob, Jian Wang, Jiawen Wu, Kai Ji,
	Kiran Kumar K, Maciej Czekaj, Nithin Dabilpuram, Qi Zhang,
	Rahul Lakkireddy, Rakesh Kudurumalla, Ron Beider, Rosen Xu,
	Ruifeng Wang, Sachin Saxena, Satha Rao, Shai Brandes,
	Somnath Kotur, Srikanth Yalavarthi, Sunil Kumar Kori,
	Thomas Monjalon, Tianfei Zhang, Wajeeh Atrash, Xiao Wang,
	Yuying Zhang, Tyler Retzlaff

Add __extension__ keyword to gcc statement expression extensions.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 app/graph/utils.c          | 2 +-
 app/test-eventdev/parser.h | 2 +-
 app/test-mldev/parser.h    | 2 +-
 app/test-pmd/cmdline_tm.c  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/graph/utils.c b/app/graph/utils.c
index c7b6ae8..28fb062 100644
--- a/app/graph/utils.c
+++ b/app/graph/utils.c
@@ -13,7 +13,7 @@
 #include "module_api.h"
 
 #define white_spaces_skip(pos)			\
-({						\
+__extension__ ({				\
 	__typeof__(pos) _p = (pos);		\
 	for ( ; isspace(*_p); _p++)		\
 		;				\
diff --git a/app/test-eventdev/parser.h b/app/test-eventdev/parser.h
index 3617872..a1c13ca 100644
--- a/app/test-eventdev/parser.h
+++ b/app/test-eventdev/parser.h
@@ -11,7 +11,7 @@
 #define PARSE_DELIMITER				" \f\n\r\t\v"
 
 #define skip_white_spaces(pos)			\
-({						\
+__extension__ ({				\
 	__typeof__(pos) _p = (pos);		\
 	for ( ; isspace(*_p); _p++)		\
 		;				\
diff --git a/app/test-mldev/parser.h b/app/test-mldev/parser.h
index 8b4207d..e1e0713 100644
--- a/app/test-mldev/parser.h
+++ b/app/test-mldev/parser.h
@@ -13,7 +13,7 @@
 #define PARSE_DELIMITER " \f\n\r\t\v"
 
 #define skip_white_spaces(pos) \
-	({ \
+	__extension__ ({ \
 		__typeof__(pos) _p = (pos); \
 		for (; isspace(*_p); _p++) \
 			; \
diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index c11c80b..2a6a20c 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -20,7 +20,7 @@
 #define MAX_NUM_SHARED_SHAPERS		256
 
 #define skip_white_spaces(pos)			\
-({						\
+__extension__ ({				\
 	__typeof__(pos) _p = (pos);		\
 	for ( ; isspace(*_p); _p++)		\
 		;				\
-- 
1.8.3.1


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

* [PATCH 3/4] drivers: add extension keyword to statement expressions
  2023-11-15 23:02 [PATCH 0/4] add __extension__ keyword to statement expressions Tyler Retzlaff
  2023-11-15 23:02 ` [PATCH 1/4] lib: add extension " Tyler Retzlaff
  2023-11-15 23:02 ` [PATCH 2/4] app: " Tyler Retzlaff
@ 2023-11-15 23:02 ` Tyler Retzlaff
  2023-11-20  7:42   ` Ruifeng Wang
  2023-11-15 23:02 ` [PATCH 4/4] examples: " Tyler Retzlaff
  2024-02-16 10:24 ` [PATCH v2 0/3] add __extension__ " David Marchand
  4 siblings, 1 reply; 16+ messages in thread
From: Tyler Retzlaff @ 2023-11-15 23:02 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Aman Singh, Amit Bernstein, Andrew Rybchenko,
	Apeksha Gupta, Beilei Xing, Brian Dooley, Chengwen Feng,
	Cristian Dumitrescu, Evgeny Schemeilin, Ferruh Yigit,
	Gagandeep Singh, Gowrishankar Muthukrishnan, Harman Kalra,
	Hemant Agrawal, Jerin Jacob, Jian Wang, Jiawen Wu, Kai Ji,
	Kiran Kumar K, Maciej Czekaj, Nithin Dabilpuram, Qi Zhang,
	Rahul Lakkireddy, Rakesh Kudurumalla, Ron Beider, Rosen Xu,
	Ruifeng Wang, Sachin Saxena, Satha Rao, Shai Brandes,
	Somnath Kotur, Srikanth Yalavarthi, Sunil Kumar Kori,
	Thomas Monjalon, Tianfei Zhang, Wajeeh Atrash, Xiao Wang,
	Yuying Zhang, Tyler Retzlaff

Add __extension__ keyword to gcc statement expression extensions.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/bus/fslmc/mc/fsl_mc_sys.h                |  6 ++---
 drivers/common/cnxk/roc_io.h                     |  6 ++---
 drivers/common/cnxk/roc_platform.h               |  2 +-
 drivers/common/dpaax/dpaa_list.h                 |  2 +-
 drivers/common/qat/qat_adf/icp_qat_hw.h          |  2 +-
 drivers/crypto/armv8/rte_armv8_pmd.c             |  4 ++--
 drivers/crypto/caam_jr/caam_jr_desc.h            |  2 +-
 drivers/dma/hisilicon/hisi_dmadev.c              |  2 +-
 drivers/event/octeontx/ssovf_evdev.h             |  4 ++--
 drivers/mempool/octeontx/octeontx_fpavf.h        |  4 ++--
 drivers/ml/cnxk/cn10k_ml_dev.h                   |  4 ++--
 drivers/net/bnxt/bnxt_ethdev.c                   |  4 ++--
 drivers/net/cxgbe/cxgbe_compat.h                 |  2 +-
 drivers/net/ena/base/ena_plat_dpdk.h             | 14 +++++------
 drivers/net/ena/ena_ethdev.c                     | 30 ++++++++++++------------
 drivers/net/enetfec/enet_ethdev.h                |  2 +-
 drivers/net/fm10k/base/fm10k_osdep.h             |  2 +-
 drivers/net/i40e/i40e_rxtx.h                     |  2 +-
 drivers/net/octeontx/base/octeontx_io.h          |  6 ++---
 drivers/net/pfe/base/cbus.h                      |  2 +-
 drivers/net/pfe/base/pfe.h                       | 12 +++++-----
 drivers/net/tap/bpf/bpf_api.h                    |  2 +-
 drivers/net/thunderx/base/nicvf_plat.h           |  4 ++--
 drivers/net/txgbe/base/txgbe_osdep.h             |  2 +-
 drivers/raw/ifpga/afu_pmd_core.h                 |  2 +-
 drivers/raw/ifpga/base/ifpga_compat.h            |  4 ++--
 drivers/raw/ifpga/base/opae_osdep.h              |  4 ++--
 drivers/raw/ifpga/base/opae_spi_transaction.c    |  2 +-
 drivers/raw/ifpga/base/osdep_rte/osdep_generic.h |  4 ++--
 29 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/drivers/bus/fslmc/mc/fsl_mc_sys.h b/drivers/bus/fslmc/mc/fsl_mc_sys.h
index a310c56..c91f14a 100644
--- a/drivers/bus/fslmc/mc/fsl_mc_sys.h
+++ b/drivers/bus/fslmc/mc/fsl_mc_sys.h
@@ -40,11 +40,11 @@ struct fsl_mc_io {
 #define __arch_putq(v, a)	(*(volatile uint64_t *)(a) = (v))
 #define __arch_putq32(v, a)	(*(volatile uint32_t *)(a) = (v))
 #define readq(c) \
-	({ uint64_t __v = __arch_getq(c); __iormb(); __v; })
+	__extension__ ({ uint64_t __v = __arch_getq(c); __iormb(); __v; })
 #define writeq(v, c) \
-	({ uint64_t __v = v; __iowmb(); __arch_putq(__v, c); __v; })
+	__extension__ ({ uint64_t __v = v; __iowmb(); __arch_putq(__v, c); __v; })
 #define writeq32(v, c) \
-	({ uint32_t __v = v; __iowmb(); __arch_putq32(__v, c); __v; })
+	__extension__ ({ uint32_t __v = v; __iowmb(); __arch_putq32(__v, c); __v; })
 #define ioread64(_p)		readq(_p)
 #define iowrite64(_v, _p)	writeq(_v, _p)
 #define iowrite32(_v, _p)	writeq32(_v, _p)
diff --git a/drivers/common/cnxk/roc_io.h b/drivers/common/cnxk/roc_io.h
index af1a10c..131578e 100644
--- a/drivers/common/cnxk/roc_io.h
+++ b/drivers/common/cnxk/roc_io.h
@@ -30,21 +30,21 @@
 #endif
 
 #define roc_load_pair(val0, val1, addr)                                        \
-	({                                                                     \
+	__extension__ ({                                                                     \
 		asm volatile("ldp %x[x0], %x[x1], [%x[p1]]"                    \
 			     : [x0] "=r"(val0), [x1] "=r"(val1)                \
 			     : [p1] "r"(addr));                                \
 	})
 
 #define roc_store_pair(val0, val1, addr)                                       \
-	({                                                                     \
+	__extension__ ({                                                                     \
 		asm volatile(                                                  \
 			"stp %x[x0], %x[x1], [%x[p1], #0]!" ::[x0] "r"(val0),  \
 			[x1] "r"(val1), [p1] "r"(addr));                       \
 	})
 
 #define roc_prefetch_store_keep(ptr)                                           \
-	({ asm volatile("prfm pstl1keep, [%x0]\n" : : "r"(ptr)); })
+	__extension__ ({ asm volatile("prfm pstl1keep, [%x0]\n" : : "r"(ptr)); })
 
 #if defined(__clang__)
 static __plt_always_inline void
diff --git a/drivers/common/cnxk/roc_platform.h b/drivers/common/cnxk/roc_platform.h
index ba23b2e..4ba31ca 100644
--- a/drivers/common/cnxk/roc_platform.h
+++ b/drivers/common/cnxk/roc_platform.h
@@ -82,7 +82,7 @@
 
 /** Divide ceil */
 #define PLT_DIV_CEIL(x, y)			\
-	({					\
+	__extension__ ({			\
 		__typeof(x) __x = x;		\
 		__typeof(y) __y = y;		\
 		(__x + __y - 1) / __y;		\
diff --git a/drivers/common/dpaax/dpaa_list.h b/drivers/common/dpaax/dpaa_list.h
index 319a356..2bf013a 100644
--- a/drivers/common/dpaax/dpaa_list.h
+++ b/drivers/common/dpaax/dpaa_list.h
@@ -31,7 +31,7 @@ struct list_head n = { \
 #define list_entry(node, type, member) \
 	(type *)((void *)node - offsetof(type, member))
 #define list_empty(p) \
-({ \
+__extension__ ({ \
 	const struct list_head *__p298 = (p); \
 	((__p298->next == __p298) && (__p298->prev == __p298)); \
 })
diff --git a/drivers/common/qat/qat_adf/icp_qat_hw.h b/drivers/common/qat/qat_adf/icp_qat_hw.h
index 8b864e1..33756d5 100644
--- a/drivers/common/qat/qat_adf/icp_qat_hw.h
+++ b/drivers/common/qat/qat_adf/icp_qat_hw.h
@@ -292,7 +292,7 @@ enum icp_qat_hw_cipher_convert {
 #define QAT_CIPHER_AEAD_AAD_SIZE_BITPOS 16
 #define QAT_CIPHER_AEAD_AAD_SIZE_LE_BITPOS 0
 #define ICP_QAT_HW_CIPHER_CONFIG_BUILD_UPPER(aad_size) \
-	({ \
+	__extension__ ({ \
 	typeof(aad_size) aad_size1 = aad_size; \
 	(((((aad_size1) >> QAT_CIPHER_AEAD_AAD_UPPER_SHIFT) & \
 	QAT_CIPHER_AEAD_AAD_SIZE_UPPER_MASK) << \
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 824a2cc..1eb4ec2 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -139,7 +139,7 @@
  * Extract particular combined mode crypto function from the 3D array.
  */
 #define CRYPTO_GET_ALGO(order, cop, calg, aalg, keyl)			\
-({									\
+__extension__ ({							\
 	crypto_func_tbl_t *func_tbl =					\
 				(crypto_chain_order[(order)])[(cop)];	\
 									\
@@ -186,7 +186,7 @@
  * Extract particular combined mode crypto function from the 3D array.
  */
 #define CRYPTO_GET_KEY_SCHED(cop, calg, keyl)				\
-({									\
+__extension__ ({							\
 	crypto_key_sched_tbl_t *ks_tbl = crypto_key_sched_dir[(cop)];	\
 									\
 	(calg >= CRYPTO_CIPHER_MAX) ?					\
diff --git a/drivers/crypto/caam_jr/caam_jr_desc.h b/drivers/crypto/caam_jr/caam_jr_desc.h
index 135d51c..6fe6184 100644
--- a/drivers/crypto/caam_jr/caam_jr_desc.h
+++ b/drivers/crypto/caam_jr/caam_jr_desc.h
@@ -32,7 +32,7 @@
 /* Macro for setting up a JD. The structure of the JD is common across all
  * supported protocols, thus its structure is identical.
  */
-#define SEC_JD_INIT(descriptor)	      ({ \
+#define SEC_JD_INIT(descriptor)	      __extension__ ({ \
 	/* CTYPE = job descriptor			       \
 	 * RSMS, DNR = 0
 	 * ONE = 1
diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c
index 0e11ca1..22303e7 100644
--- a/drivers/dma/hisilicon/hisi_dmadev.c
+++ b/drivers/dma/hisilicon/hisi_dmadev.c
@@ -124,7 +124,7 @@
 	hisi_dma_write_queue(hw, qoff, tmp);
 }
 
-#define hisi_dma_poll_hw_state(hw, val, cond, sleep_us, timeout_us) ({ \
+#define hisi_dma_poll_hw_state(hw, val, cond, sleep_us, timeout_us) __extension__ ({ \
 	uint32_t timeout = 0; \
 	while (timeout++ <= (timeout_us)) { \
 		(val) = hisi_dma_read_queue(hw, HISI_DMA_QUEUE_FSM_REG); \
diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h
index e46dc05..8a4cb20 100644
--- a/drivers/event/octeontx/ssovf_evdev.h
+++ b/drivers/event/octeontx/ssovf_evdev.h
@@ -96,14 +96,14 @@
 
 /* ARM64 specific functions */
 #if defined(RTE_ARCH_ARM64)
-#define ssovf_load_pair(val0, val1, addr) ({		\
+#define ssovf_load_pair(val0, val1, addr) __extension__ ({		\
 			asm volatile(			\
 			"ldp %x[x0], %x[x1], [%x[p1]]"	\
 			:[x0]"=r"(val0), [x1]"=r"(val1) \
 			:[p1]"r"(addr)			\
 			); })
 
-#define ssovf_store_pair(val0, val1, addr) ({		\
+#define ssovf_store_pair(val0, val1, addr) __extension__ ({		\
 			asm volatile(			\
 			"stp %x[x0], %x[x1], [%x[p1]]"	\
 			::[x0]"r"(val0), [x1]"r"(val1), [p1]"r"(addr) \
diff --git a/drivers/mempool/octeontx/octeontx_fpavf.h b/drivers/mempool/octeontx/octeontx_fpavf.h
index e27c437..b9519f1 100644
--- a/drivers/mempool/octeontx/octeontx_fpavf.h
+++ b/drivers/mempool/octeontx/octeontx_fpavf.h
@@ -59,14 +59,14 @@
 
 /* ARM64 specific functions */
 #if defined(RTE_ARCH_ARM64)
-#define fpavf_load_pair(val0, val1, addr) ({		\
+#define fpavf_load_pair(val0, val1, addr) __extension__ ({		\
 			asm volatile(			\
 			"ldp %x[x0], %x[x1], [%x[p1]]"	\
 			:[x0]"=r"(val0), [x1]"=r"(val1) \
 			:[p1]"r"(addr)			\
 			); })
 
-#define fpavf_store_pair(val0, val1, addr) ({		\
+#define fpavf_store_pair(val0, val1, addr) __extension__ ({		\
 			asm volatile(			\
 			"stp %x[x0], %x[x1], [%x[p1]]"	\
 			::[x0]"r"(val0), [x1]"r"(val1), [p1]"r"(addr) \
diff --git a/drivers/ml/cnxk/cn10k_ml_dev.h b/drivers/ml/cnxk/cn10k_ml_dev.h
index cee405f..2101f69 100644
--- a/drivers/ml/cnxk/cn10k_ml_dev.h
+++ b/drivers/ml/cnxk/cn10k_ml_dev.h
@@ -44,8 +44,8 @@
 
 /* Memory barrier macros */
 #if defined(RTE_ARCH_ARM)
-#define dmb_st ({ asm volatile("dmb st" : : : "memory"); })
-#define dsb_st ({ asm volatile("dsb st" : : : "memory"); })
+#define dmb_st __extension__ ({ asm volatile("dmb st" : : : "memory"); })
+#define dsb_st __extension__ ({ asm volatile("dsb st" : : : "memory"); })
 #else
 #define dmb_st
 #define dsb_st
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index acf7e6e..389e96a 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -4866,12 +4866,12 @@ static void bnxt_free_ctx_mem(struct bnxt *bp)
 
 #define bnxt_roundup(x, y)   ((((x) + ((y) - 1)) / (y)) * (y))
 
-#define min_t(type, x, y) ({                    \
+#define min_t(type, x, y) __extension__ ({      \
 	type __min1 = (x);                      \
 	type __min2 = (y);                      \
 	__min1 < __min2 ? __min1 : __min2; })
 
-#define max_t(type, x, y) ({                    \
+#define max_t(type, x, y) __extension__ ({      \
 	type __max1 = (x);                      \
 	type __max2 = (y);                      \
 	__max1 > __max2 ? __max1 : __max2; })
diff --git a/drivers/net/cxgbe/cxgbe_compat.h b/drivers/net/cxgbe/cxgbe_compat.h
index 0b02eb6..389080c 100644
--- a/drivers/net/cxgbe/cxgbe_compat.h
+++ b/drivers/net/cxgbe/cxgbe_compat.h
@@ -136,7 +136,7 @@
 #define cxgbe_roundup(_p, _s) (((unsigned long)(_p) + (_s - 1)) & ~(_s - 1))
 
 #ifndef container_of
-#define container_of(ptr, type, member) ({ \
+#define container_of(ptr, type, member) __extension__ ({ \
 		typeof(((type *)0)->member)(*__mptr) = (ptr); \
 		(type *)((char *)__mptr - offsetof(type, member)); })
 #endif
diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h
index 665ac2f..14bf582 100644
--- a/drivers/net/ena/base/ena_plat_dpdk.h
+++ b/drivers/net/ena/base/ena_plat_dpdk.h
@@ -141,9 +141,9 @@
 #define ena_spinlock_t rte_spinlock_t
 #define ENA_SPINLOCK_INIT(spinlock) rte_spinlock_init(&(spinlock))
 #define ENA_SPINLOCK_LOCK(spinlock, flags)				       \
-	({(void)(flags); rte_spinlock_lock(&(spinlock)); })
+	__extension__ ({(void)(flags); rte_spinlock_lock(&(spinlock)); })
 #define ENA_SPINLOCK_UNLOCK(spinlock, flags)				       \
-	({(void)(flags); rte_spinlock_unlock(&(spinlock)); })
+	__extension__ ({(void)(flags); rte_spinlock_unlock(&(spinlock)); })
 #define ENA_SPINLOCK_DESTROY(spinlock) ((void)(spinlock))
 
 typedef struct {
@@ -237,7 +237,7 @@
 		ENA_MEM_ALLOC_COHERENT_ALIGNED(dmadev, size, virt, phys,       \
 			mem_handle, RTE_CACHE_LINE_SIZE)
 #define ENA_MEM_FREE_COHERENT(dmadev, size, virt, phys, mem_handle)	       \
-		({ ENA_TOUCH(size); ENA_TOUCH(phys); ENA_TOUCH(dmadev);	       \
+		__extension__ ({ ENA_TOUCH(size); ENA_TOUCH(phys); ENA_TOUCH(dmadev);	       \
 		   rte_memzone_free(mem_handle); })
 
 #define ENA_MEM_ALLOC_COHERENT_NODE_ALIGNED(				       \
@@ -263,16 +263,16 @@
 
 #define ENA_MEM_ALLOC(dmadev, size) rte_zmalloc(NULL, size, 1)
 #define ENA_MEM_FREE(dmadev, ptr, size)					       \
-	({ ENA_TOUCH(dmadev); ENA_TOUCH(size); rte_free(ptr); })
+	__extension__ ({ ENA_TOUCH(dmadev); ENA_TOUCH(size); rte_free(ptr); })
 
 #define ENA_DB_SYNC(mem_handle) ((void)mem_handle)
 
 #define ENA_REG_WRITE32(bus, value, reg)				       \
-	({ (void)(bus); rte_write32((value), (reg)); })
+	__extension__ ({ (void)(bus); rte_write32((value), (reg)); })
 #define ENA_REG_WRITE32_RELAXED(bus, value, reg)			       \
-	({ (void)(bus); rte_write32_relaxed((value), (reg)); })
+	__extension__ ({ (void)(bus); rte_write32_relaxed((value), (reg)); })
 #define ENA_REG_READ32(bus, reg)					       \
-	({ (void)(bus); rte_read32_relaxed((reg)); })
+	__extension__ ({ (void)(bus); rte_read32_relaxed((reg)); })
 
 #define ATOMIC32_INC(i32_ptr) rte_atomic32_inc(i32_ptr)
 #define ATOMIC32_DEC(i32_ptr) rte_atomic32_dec(i32_ptr)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index dc846d2..beb17c4 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -459,7 +459,7 @@ struct ena_mp_body {
  *       calls to the same proxied function under the same lock.
  */
 #define ENA_PROXY(a, f, ...)						\
-({									\
+__extension__ ({							\
 	struct ena_adapter *_a = (a);					\
 	struct timespec ts = { .tv_sec = ENA_MP_REQ_TMO };		\
 	struct ena_mp_body *req, *rsp;					\
@@ -507,13 +507,13 @@ struct ena_mp_body {
  *********************************************************************/
 
 ENA_PROXY_DESC(ena_com_get_dev_basic_stats, ENA_MP_DEV_STATS_GET,
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(req);
 	ENA_TOUCH(ena_dev);
 	ENA_TOUCH(stats);
 }),
-({
+__extension__ ({
 	ENA_TOUCH(rsp);
 	ENA_TOUCH(ena_dev);
 	if (stats != &adapter->basic_stats)
@@ -522,13 +522,13 @@ struct ena_mp_body {
 	struct ena_com_dev *ena_dev, struct ena_admin_basic_stats *stats);
 
 ENA_PROXY_DESC(ena_com_get_eni_stats, ENA_MP_ENI_STATS_GET,
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(req);
 	ENA_TOUCH(ena_dev);
 	ENA_TOUCH(stats);
 }),
-({
+__extension__ ({
 	ENA_TOUCH(rsp);
 	ENA_TOUCH(ena_dev);
 	if (stats != (struct ena_admin_eni_stats *)&adapter->metrics_stats)
@@ -537,12 +537,12 @@ struct ena_mp_body {
 	struct ena_com_dev *ena_dev, struct ena_admin_eni_stats *stats);
 
 ENA_PROXY_DESC(ena_com_set_dev_mtu, ENA_MP_MTU_SET,
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(ena_dev);
 	req->args.mtu = mtu;
 }),
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(rsp);
 	ENA_TOUCH(ena_dev);
@@ -551,12 +551,12 @@ struct ena_mp_body {
 	struct ena_com_dev *ena_dev, int mtu);
 
 ENA_PROXY_DESC(ena_com_indirect_table_set, ENA_MP_IND_TBL_SET,
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(req);
 	ENA_TOUCH(ena_dev);
 }),
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(rsp);
 	ENA_TOUCH(ena_dev);
@@ -564,13 +564,13 @@ struct ena_mp_body {
 	struct ena_com_dev *ena_dev);
 
 ENA_PROXY_DESC(ena_com_indirect_table_get, ENA_MP_IND_TBL_GET,
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(req);
 	ENA_TOUCH(ena_dev);
 	ENA_TOUCH(ind_tbl);
 }),
-({
+__extension__ ({
 	ENA_TOUCH(rsp);
 	ENA_TOUCH(ena_dev);
 	if (ind_tbl != adapter->indirect_table)
@@ -580,14 +580,14 @@ struct ena_mp_body {
 	struct ena_com_dev *ena_dev, u32 *ind_tbl);
 
 ENA_PROXY_DESC(ena_com_get_customer_metrics, ENA_MP_CUSTOMER_METRICS_GET,
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(req);
 	ENA_TOUCH(ena_dev);
 	ENA_TOUCH(buf);
 	ENA_TOUCH(buf_size);
 }),
-({
+__extension__ ({
 	ENA_TOUCH(rsp);
 	ENA_TOUCH(ena_dev);
 	ENA_TOUCH(buf_size);
@@ -597,13 +597,13 @@ struct ena_mp_body {
 	struct ena_com_dev *ena_dev, char *buf, size_t buf_size);
 
 ENA_PROXY_DESC(ena_com_get_ena_srd_info, ENA_MP_SRD_STATS_GET,
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(req);
 	ENA_TOUCH(ena_dev);
 	ENA_TOUCH(info);
 }),
-({
+__extension__ ({
 	ENA_TOUCH(rsp);
 	ENA_TOUCH(ena_dev);
 	if ((struct ena_stats_srd *)info != &adapter->srd_stats)
diff --git a/drivers/net/enetfec/enet_ethdev.h b/drivers/net/enetfec/enet_ethdev.h
index 573b067..02a3397 100644
--- a/drivers/net/enetfec/enet_ethdev.h
+++ b/drivers/net/enetfec/enet_ethdev.h
@@ -42,7 +42,7 @@
 
 #define ENETFEC_MAX_Q		1
 
-#define writel(v, p) ({*(volatile unsigned int *)(p) = (v); })
+#define writel(v, p) __extension__ ({*(volatile unsigned int *)(p) = (v); })
 #define readl(p) rte_read32(p)
 
 struct bufdesc {
diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h
index 019fba5..25f46c3 100644
--- a/drivers/net/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/fm10k/base/fm10k_osdep.h
@@ -102,7 +102,7 @@
 #endif
 
 #ifndef do_div
-#define do_div(n, base) ({\
+#define do_div(n, base) __extension__ ({\
 	(n) = (n) / (base);\
 })
 #endif /* do_div */
diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h
index b191f23..c3883d8 100644
--- a/drivers/net/i40e/i40e_rxtx.h
+++ b/drivers/net/i40e/i40e_rxtx.h
@@ -46,7 +46,7 @@
 #define I40E_RX_DESC_EXT_STATUS_FLEXBL_FLEX   0x01
 
 #undef container_of
-#define container_of(ptr, type, member) ({ \
+#define container_of(ptr, type, member) __extension__ ({ \
 		typeof(((type *)0)->member)(*__mptr) = (ptr); \
 		(type *)((char *)__mptr - offsetof(type, member)); })
 
diff --git a/drivers/net/octeontx/base/octeontx_io.h b/drivers/net/octeontx/base/octeontx_io.h
index d0b9cfb..323e34b 100644
--- a/drivers/net/octeontx/base/octeontx_io.h
+++ b/drivers/net/octeontx/base/octeontx_io.h
@@ -19,17 +19,17 @@
 
 /* ARM64 specific functions */
 #if defined(RTE_ARCH_ARM64)
-#define octeontx_prefetch_store_keep(_ptr) ({\
+#define octeontx_prefetch_store_keep(_ptr) __extension__ ({\
 	asm volatile("prfm pstl1keep, %a0\n" : : "p" (_ptr)); })
 
-#define octeontx_load_pair(val0, val1, addr) ({		\
+#define octeontx_load_pair(val0, val1, addr) __extension__ ({		\
 			asm volatile(			\
 			"ldp %x[x0], %x[x1], [%x[p1]]"	\
 			:[x0]"=r"(val0), [x1]"=r"(val1) \
 			:[p1]"r"(addr)			\
 			); })
 
-#define octeontx_store_pair(val0, val1, addr) ({		\
+#define octeontx_store_pair(val0, val1, addr) __extension__ ({		\
 			asm volatile(			\
 			"stp %x[x0], %x[x1], [%x[p1]]"	\
 			::[x0]"r"(val0), [x1]"r"(val1), [p1]"r"(addr) \
diff --git a/drivers/net/pfe/base/cbus.h b/drivers/net/pfe/base/cbus.h
index fe7ea60..7b30588 100644
--- a/drivers/net/pfe/base/cbus.h
+++ b/drivers/net/pfe/base/cbus.h
@@ -36,7 +36,7 @@
 
 /* Byte Enables of the Internal memory access. These are interpred in BE */
 #define PE_MEM_ACCESS_BYTE_ENABLE(offset, size)	\
-	({ typeof(size) size_ = (size);		\
+	__extension__ ({ typeof(size) size_ = (size);		\
 	(((BIT(size_) - 1) << (4 - (offset) - (size_))) & 0xf) << 24; })
 
 #include "cbus/emac_mtip.h"
diff --git a/drivers/net/pfe/base/pfe.h b/drivers/net/pfe/base/pfe.h
index 0a88e98..b9cf682 100644
--- a/drivers/net/pfe/base/pfe.h
+++ b/drivers/net/pfe/base/pfe.h
@@ -95,36 +95,36 @@
 #define PMEM_SIZE	0x8000	/* TMU has less... */
 #define PMEM_END	(PMEM_BASE_ADDR + PMEM_SIZE)
 
-#define writel(v, p) ({*(volatile unsigned int *)(p) = (v); })
+#define writel(v, p) __extension__ ({*(volatile unsigned int *)(p) = (v); })
 #define readl(p) (*(const volatile unsigned int *)(p))
 
 /* These check memory ranges from PE point of view/memory map */
 #define IS_DMEM(addr, len)				\
-	({ typeof(addr) addr_ = (addr);			\
+	__extension__ ({ typeof(addr) addr_ = (addr);	\
 	((unsigned long)(addr_) >= DMEM_BASE_ADDR) &&	\
 	(((unsigned long)(addr_) + (len)) <= DMEM_END); })
 
 #define IS_PMEM(addr, len)				\
-	({ typeof(addr) addr_ = (addr);			\
+	__extension__ ({ typeof(addr) addr_ = (addr);	\
 	((unsigned long)(addr_) >= PMEM_BASE_ADDR) &&	\
 	(((unsigned long)(addr_) + (len)) <= PMEM_END); })
 
 #define IS_PE_LMEM(addr, len)				\
-	({ typeof(addr) addr_ = (addr);			\
+	__extension__ ({ typeof(addr) addr_ = (addr);	\
 	((unsigned long)(addr_) >=			\
 	PE_LMEM_BASE_ADDR) &&				\
 	(((unsigned long)(addr_) +			\
 	(len)) <= PE_LMEM_END); })
 
 #define IS_PFE_LMEM(addr, len)				\
-	({ typeof(addr) addr_ = (addr);			\
+	__extension__ ({ typeof(addr) addr_ = (addr);	\
 	((unsigned long)(addr_) >=			\
 	CBUS_VIRT_TO_PFE(LMEM_BASE_ADDR)) &&		\
 	(((unsigned long)(addr_) + (len)) <=		\
 	CBUS_VIRT_TO_PFE(LMEM_END)); })
 
 #define __IS_PHYS_DDR(addr, len)			\
-	({ typeof(addr) addr_ = (addr);			\
+	__extension__ ({ typeof(addr) addr_ = (addr);	\
 	((unsigned long)(addr_) >=			\
 	DDR_PHYS_BASE_ADDR) &&				\
 	(((unsigned long)(addr_) + (len)) <=		\
diff --git a/drivers/net/tap/bpf/bpf_api.h b/drivers/net/tap/bpf/bpf_api.h
index 2638a8a..4cd25fa 100644
--- a/drivers/net/tap/bpf/bpf_api.h
+++ b/drivers/net/tap/bpf/bpf_api.h
@@ -162,7 +162,7 @@ static int BPF_FUNC(map_update_elem, void *map, const void *key,
 
 #ifndef printt
 # define printt(fmt, ...)						\
-	({								\
+	__extension__ ({						\
 		char ____fmt[] = fmt;					\
 		trace_printk(____fmt, sizeof(____fmt), ##__VA_ARGS__);	\
 	})
diff --git a/drivers/net/thunderx/base/nicvf_plat.h b/drivers/net/thunderx/base/nicvf_plat.h
index dd05462..8421f57 100644
--- a/drivers/net/thunderx/base/nicvf_plat.h
+++ b/drivers/net/thunderx/base/nicvf_plat.h
@@ -55,11 +55,11 @@
 
 /* ARM64 specific functions */
 #if defined(RTE_ARCH_ARM64)
-#define nicvf_prefetch_store_keep(_ptr) ({\
+#define nicvf_prefetch_store_keep(_ptr) __extension__ ({\
 	asm volatile("prfm pstl1keep, [%x0]\n" : : "r" (_ptr)); })
 
 
-#define NICVF_LOAD_PAIR(reg1, reg2, addr) ({		\
+#define NICVF_LOAD_PAIR(reg1, reg2, addr) __extension__ ({		\
 			asm volatile(			\
 			"ldp %x[x1], %x[x0], [%x[p1]]"	\
 			: [x1]"=r"(reg1), [x0]"=r"(reg2)\
diff --git a/drivers/net/txgbe/base/txgbe_osdep.h b/drivers/net/txgbe/base/txgbe_osdep.h
index b62c0b0..4fce355 100644
--- a/drivers/net/txgbe/base/txgbe_osdep.h
+++ b/drivers/net/txgbe/base/txgbe_osdep.h
@@ -172,7 +172,7 @@ static inline u64 REVERT_BIT_MASK64(u64 mask)
 
 /* Check whether an address is broadcast. */
 #define TXGBE_IS_BROADCAST(address) \
-		({typeof(address)addr = (address); \
+		__extension__ ({typeof(address)addr = (address); \
 		(((u8 *)(addr))[0] == ((u8)0xff)) && \
 		(((u8 *)(addr))[1] == ((u8)0xff)); })
 
diff --git a/drivers/raw/ifpga/afu_pmd_core.h b/drivers/raw/ifpga/afu_pmd_core.h
index ab5a228..a8f1afe 100644
--- a/drivers/raw/ifpga/afu_pmd_core.h
+++ b/drivers/raw/ifpga/afu_pmd_core.h
@@ -66,7 +66,7 @@ struct afu_rawdev {
 #define MHZ(f)  ((f) * 1000000)
 
 #define dsm_poll_timeout(addr, val, cond, invl, timeout) \
-({                                                       \
+__extension__ ({                                             \
 	uint64_t __wait = 0;                                 \
 	uint64_t __invl = (invl);                            \
 	uint64_t __timeout = (timeout);                      \
diff --git a/drivers/raw/ifpga/base/ifpga_compat.h b/drivers/raw/ifpga/base/ifpga_compat.h
index cdeca70..85e1603 100644
--- a/drivers/raw/ifpga/base/ifpga_compat.h
+++ b/drivers/raw/ifpga/base/ifpga_compat.h
@@ -8,7 +8,7 @@
 #include "opae_osdep.h"
 
 #undef container_of
-#define container_of(ptr, type, member) ({ \
+#define container_of(ptr, type, member) __extension__ ({ \
 		typeof(((type *)0)->member)(*__mptr) = (ptr); \
 		(type *)((char *)__mptr - offsetof(type, member)); })
 
@@ -36,7 +36,7 @@
  * by polling with given interval and timeout.
  */
 #define fpga_wait_register_field(_field, _expect, _reg_addr, _timeout, _invl)\
-({									     \
+__extension__ ({							     \
 	int wait = 0;							     \
 	int ret = -ETIMEDOUT;						     \
 	typeof(_expect) value;						     \
diff --git a/drivers/raw/ifpga/base/opae_osdep.h b/drivers/raw/ifpga/base/opae_osdep.h
index e91205f..cb780b1 100644
--- a/drivers/raw/ifpga/base/opae_osdep.h
+++ b/drivers/raw/ifpga/base/opae_osdep.h
@@ -81,7 +81,7 @@ struct uuid {
 #define opae_memset(a, b, c)    memset((a), (b), (c))
 
 #define readx_poll_timeout(op, val, cond, invl, timeout, args...) \
-({                                                                \
+__extension__ ({                                                      \
 	unsigned long __wait = 0;                                     \
 	unsigned long __invl = (invl);                                \
 	unsigned long __timeout = (timeout);                          \
@@ -107,7 +107,7 @@ struct uuid {
 	readx_poll_timeout(opae_readb, val, cond, invl, timeout, addr)
 
 #define opae_max10_read_poll_timeout(dev, addr, value, cond, invl, timeout) \
-({ \
+__extension__ ({ \
 	int __ret, __tmp; \
 	__tmp = readx_poll_timeout(max10_sys_read, __ret, __ret || (cond), \
 			invl, timeout, (dev), (addr), &(value)); \
diff --git a/drivers/raw/ifpga/base/opae_spi_transaction.c b/drivers/raw/ifpga/base/opae_spi_transaction.c
index cd50d40..21015eb 100644
--- a/drivers/raw/ifpga/base/opae_spi_transaction.c
+++ b/drivers/raw/ifpga/base/opae_spi_transaction.c
@@ -24,7 +24,7 @@
 #define SPI_REG_BYTES 4
 
 #define INIT_SPI_TRAN_HEADER(trans_type, size, address) \
-({ \
+__extension__ ({ \
 	header.trans_type = trans_type; \
 	header.reserve = 0; \
 	header.size = cpu_to_be16(size); \
diff --git a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
index 33041c9..caeda6c 100644
--- a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
+++ b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
@@ -41,12 +41,12 @@
 #define min(a, b) RTE_MIN(a, b)
 #define max(a, b) RTE_MAX(a, b)
 
-#define min_t(type, x, y) ({                    \
+#define min_t(type, x, y) __extension__ ({      \
 	type __min1 = (x);                      \
 	type __min2 = (y);                      \
 	__min1 < __min2 ? __min1 : __min2; })
 
-#define max_t(type, x, y) ({                    \
+#define max_t(type, x, y) __extension__ ({      \
 	type __max1 = (x);                      \
 	type __max2 = (y);                      \
 	__max1 > __max2 ? __max1 : __max2; })
-- 
1.8.3.1


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

* [PATCH 4/4] examples: add extension keyword to statement expressions
  2023-11-15 23:02 [PATCH 0/4] add __extension__ keyword to statement expressions Tyler Retzlaff
                   ` (2 preceding siblings ...)
  2023-11-15 23:02 ` [PATCH 3/4] drivers: " Tyler Retzlaff
@ 2023-11-15 23:02 ` Tyler Retzlaff
  2024-02-16 10:24 ` [PATCH v2 0/3] add __extension__ " David Marchand
  4 siblings, 0 replies; 16+ messages in thread
From: Tyler Retzlaff @ 2023-11-15 23:02 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Aman Singh, Amit Bernstein, Andrew Rybchenko,
	Apeksha Gupta, Beilei Xing, Brian Dooley, Chengwen Feng,
	Cristian Dumitrescu, Evgeny Schemeilin, Ferruh Yigit,
	Gagandeep Singh, Gowrishankar Muthukrishnan, Harman Kalra,
	Hemant Agrawal, Jerin Jacob, Jian Wang, Jiawen Wu, Kai Ji,
	Kiran Kumar K, Maciej Czekaj, Nithin Dabilpuram, Qi Zhang,
	Rahul Lakkireddy, Rakesh Kudurumalla, Ron Beider, Rosen Xu,
	Ruifeng Wang, Sachin Saxena, Satha Rao, Shai Brandes,
	Somnath Kotur, Srikanth Yalavarthi, Sunil Kumar Kori,
	Thomas Monjalon, Tianfei Zhang, Wajeeh Atrash, Xiao Wang,
	Yuying Zhang, Tyler Retzlaff

Add __extension__ keyword to gcc statement expression extensions.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 examples/fips_validation/fips_validation.c | 2 +-
 examples/ip_pipeline/parser.h              | 2 +-
 examples/pipeline/cli.c                    | 2 +-
 examples/qos_meter/main.h                  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c
index f840804..ba65d44 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -14,7 +14,7 @@
 #include "fips_validation.h"
 
 #define skip_white_spaces(pos)			\
-({						\
+__extension__ ({				\
 	__typeof__(pos) _p = (pos);		\
 	for ( ; isspace(*_p); _p++)		\
 		;				\
diff --git a/examples/ip_pipeline/parser.h b/examples/ip_pipeline/parser.h
index 5224b18..4b3fdff 100644
--- a/examples/ip_pipeline/parser.h
+++ b/examples/ip_pipeline/parser.h
@@ -14,7 +14,7 @@
 #define PARSE_DELIMITER				" \f\n\r\t\v"
 
 #define skip_white_spaces(pos)			\
-({						\
+__extension__ ({				\
 	__typeof__(pos) _p = (pos);		\
 	for ( ; isspace(*_p); _p++)		\
 		;				\
diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c
index 2ae6cc5..57a5a53 100644
--- a/examples/pipeline/cli.c
+++ b/examples/pipeline/cli.c
@@ -46,7 +46,7 @@
 #define MSG_CMD_FAIL        "Command \"%s\" failed.\n"
 
 #define skip_white_spaces(pos)			\
-({						\
+__extension__ ({				\
 	__typeof__(pos) _p = (pos);		\
 	for ( ; isspace(*_p); _p++)		\
 		;				\
diff --git a/examples/qos_meter/main.h b/examples/qos_meter/main.h
index 864f019..59e5e0b 100644
--- a/examples/qos_meter/main.h
+++ b/examples/qos_meter/main.h
@@ -24,7 +24,7 @@ enum policer_action policer_table[RTE_COLORS][RTE_COLORS] =
 #if APP_MODE == APP_MODE_FWD
 
 #define FUNC_METER(m, p, time, pkt_len, pkt_color)	\
-({							\
+__extension__ ({					\
 	void *mp = m;					\
 	void *pp = p;					\
 	mp = mp;					\
-- 
1.8.3.1


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

* Re: [PATCH 3/4] drivers: add extension keyword to statement expressions
  2023-11-15 23:02 ` [PATCH 3/4] drivers: " Tyler Retzlaff
@ 2023-11-20  7:42   ` Ruifeng Wang
  0 siblings, 0 replies; 16+ messages in thread
From: Ruifeng Wang @ 2023-11-20  7:42 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Ajit Khaparde, Aman Singh, Amit Bernstein, Andrew Rybchenko,
	Apeksha Gupta, Beilei Xing, Brian Dooley, Chengwen Feng,
	Cristian Dumitrescu, Evgeny Schemeilin, Ferruh Yigit,
	Gagandeep Singh, Gowrishankar Muthukrishnan, Harman Kalra,
	Hemant Agrawal, Jerin Jacob, Jian Wang, Jiawen Wu, Kai Ji,
	Kiran Kumar K, Maciej Czekaj, Nithin Dabilpuram, Qi Zhang,
	Rahul Lakkireddy, Rakesh Kudurumalla, Ron Beider, Rosen Xu,
	Sachin Saxena, Satha Rao, Shai Brandes, Somnath Kotur,
	Srikanth Yalavarthi, Sunil Kumar Kori, Thomas Monjalon,
	Tianfei Zhang, Wajeeh Atrash, Xiao Wang, Yuying Zhang, nd


On 2023/11/16 7:02 AM, Tyler Retzlaff wrote:
> Add __extension__ keyword to gcc statement expression extensions.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>   drivers/bus/fslmc/mc/fsl_mc_sys.h                |  6 ++---
>   drivers/common/cnxk/roc_io.h                     |  6 ++---
>   drivers/common/cnxk/roc_platform.h               |  2 +-
>   drivers/common/dpaax/dpaa_list.h                 |  2 +-
>   drivers/common/qat/qat_adf/icp_qat_hw.h          |  2 +-
>   drivers/crypto/armv8/rte_armv8_pmd.c             |  4 ++--
>   drivers/crypto/caam_jr/caam_jr_desc.h            |  2 +-
>   drivers/dma/hisilicon/hisi_dmadev.c              |  2 +-
>   drivers/event/octeontx/ssovf_evdev.h             |  4 ++--
>   drivers/mempool/octeontx/octeontx_fpavf.h        |  4 ++--
>   drivers/ml/cnxk/cn10k_ml_dev.h                   |  4 ++--
>   drivers/net/bnxt/bnxt_ethdev.c                   |  4 ++--
>   drivers/net/cxgbe/cxgbe_compat.h                 |  2 +-
>   drivers/net/ena/base/ena_plat_dpdk.h             | 14 +++++------
>   drivers/net/ena/ena_ethdev.c                     | 30 ++++++++++++------------
>   drivers/net/enetfec/enet_ethdev.h                |  2 +-
>   drivers/net/fm10k/base/fm10k_osdep.h             |  2 +-
>   drivers/net/i40e/i40e_rxtx.h                     |  2 +-
>   drivers/net/octeontx/base/octeontx_io.h          |  6 ++---
>   drivers/net/pfe/base/cbus.h                      |  2 +-
>   drivers/net/pfe/base/pfe.h                       | 12 +++++-----
>   drivers/net/tap/bpf/bpf_api.h                    |  2 +-
>   drivers/net/thunderx/base/nicvf_plat.h           |  4 ++--
>   drivers/net/txgbe/base/txgbe_osdep.h             |  2 +-
>   drivers/raw/ifpga/afu_pmd_core.h                 |  2 +-
>   drivers/raw/ifpga/base/ifpga_compat.h            |  4 ++--
>   drivers/raw/ifpga/base/opae_osdep.h              |  4 ++--
>   drivers/raw/ifpga/base/opae_spi_transaction.c    |  2 +-
>   drivers/raw/ifpga/base/osdep_rte/osdep_generic.h |  4 ++--
>   29 files changed, 69 insertions(+), 69 deletions(-)
> 
<snip>
> diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
> index 824a2cc..1eb4ec2 100644
> --- a/drivers/crypto/armv8/rte_armv8_pmd.c
> +++ b/drivers/crypto/armv8/rte_armv8_pmd.c
> @@ -139,7 +139,7 @@
>    * Extract particular combined mode crypto function from the 3D array.
>    */
>   #define CRYPTO_GET_ALGO(order, cop, calg, aalg, keyl)			\
> -({									\
> +__extension__ ({							\
>   	crypto_func_tbl_t *func_tbl =					\
>   				(crypto_chain_order[(order)])[(cop)];	\
>   									\
> @@ -186,7 +186,7 @@
>    * Extract particular combined mode crypto function from the 3D array.
>    */
>   #define CRYPTO_GET_KEY_SCHED(cop, calg, keyl)				\
> -({									\
> +__extension__ ({							\
>   	crypto_key_sched_tbl_t *ks_tbl = crypto_key_sched_dir[(cop)];	\
>   									\
>   	(calg >= CRYPTO_CIPHER_MAX) ?					\

Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>

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

* [PATCH v2 0/3] add __extension__ keyword to statement expressions
  2023-11-15 23:02 [PATCH 0/4] add __extension__ keyword to statement expressions Tyler Retzlaff
                   ` (3 preceding siblings ...)
  2023-11-15 23:02 ` [PATCH 4/4] examples: " Tyler Retzlaff
@ 2024-02-16 10:24 ` David Marchand
  2024-02-16 10:24   ` [PATCH v2 1/3] eal: add helper to skip whitespaces David Marchand
                     ` (3 more replies)
  4 siblings, 4 replies; 16+ messages in thread
From: David Marchand @ 2024-02-16 10:24 UTC (permalink / raw)
  To: dev

Tyler explained in v1:
"""
As requested from previous rejected series this series applies the
__extension__ keyword to all statement expressionsin DPDK.
"""

Changes since v1:
- rebased,
- added two cleanups before Tyler patch,


-- 
David Marchand


David Marchand (2):
  eal: add helper to skip whitespaces
  drivers: use common min/max macros

Tyler Retzlaff (1):
  add extension keyword to GCC statement expressions

 app/graph/utils.c                             | 13 ++-----
 app/test-eventdev/parser.c                    | 14 ++++----
 app/test-eventdev/parser.h                    |  8 -----
 app/test-mldev/parser.c                       | 17 ++++-----
 app/test-mldev/parser.h                       |  8 -----
 app/test-pmd/cmdline_tm.c                     | 13 ++-----
 app/test/test_string_fns.c                    | 35 +++++++++++++++++++
 drivers/bus/fslmc/mc/fsl_mc_sys.h             |  6 ++--
 drivers/common/cnxk/roc_io.h                  |  6 ++--
 drivers/common/cnxk/roc_platform.h            |  2 +-
 drivers/common/dpaax/dpaa_list.h              |  2 +-
 drivers/common/qat/qat_adf/icp_qat_hw.h       |  2 +-
 drivers/crypto/armv8/rte_armv8_pmd.c          |  4 +--
 drivers/crypto/caam_jr/caam_jr_desc.h         |  2 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |  2 +-
 drivers/event/octeontx/ssovf_evdev.h          |  4 +--
 drivers/mempool/octeontx/octeontx_fpavf.h     |  4 +--
 drivers/ml/cnxk/cn10k_ml_dev.h                |  4 +--
 drivers/net/bnxt/bnxt_ethdev.c                | 12 +------
 drivers/net/ena/base/ena_plat_dpdk.h          | 14 ++++----
 drivers/net/ena/ena_ethdev.c                  | 30 ++++++++--------
 drivers/net/enetfec/enet_ethdev.h             |  2 +-
 drivers/net/fm10k/base/fm10k_osdep.h          |  2 +-
 drivers/net/octeontx/base/octeontx_io.h       |  6 ++--
 drivers/net/pfe/base/cbus.h                   |  2 +-
 drivers/net/pfe/base/pfe.h                    | 12 +++----
 drivers/net/qede/base/bcm_osal.h              |  6 ++--
 drivers/net/tap/bpf/bpf_api.h                 |  2 +-
 drivers/net/thunderx/base/nicvf_plat.h        |  4 +--
 drivers/net/txgbe/base/txgbe_osdep.h          |  2 +-
 drivers/raw/ifpga/afu_pmd_core.h              |  2 +-
 drivers/raw/ifpga/base/ifpga_compat.h         |  2 +-
 drivers/raw/ifpga/base/opae_osdep.h           |  4 +--
 drivers/raw/ifpga/base/opae_spi_transaction.c |  2 +-
 .../raw/ifpga/base/osdep_rte/osdep_generic.h  | 11 ++----
 examples/fips_validation/fips_validation.c    | 16 +++------
 examples/ip_pipeline/parser.c                 | 14 ++++----
 examples/ip_pipeline/parser.h                 |  8 -----
 examples/pipeline/cli.c                       | 13 ++-----
 examples/qos_meter/main.h                     |  2 +-
 lib/eal/include/rte_string_fns.h              | 27 ++++++++++++++
 lib/ethdev/rte_mtr.c                          | 10 +++---
 lib/ethdev/rte_tm.c                           |  6 ++--
 lib/pipeline/rte_pipeline.c                   |  8 ++---
 lib/pipeline/rte_swx_pipeline_internal.h      |  2 +-
 lib/port/rte_port_source_sink.c               |  4 +--
 46 files changed, 181 insertions(+), 190 deletions(-)

-- 
2.43.0


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

* [PATCH v2 1/3] eal: add helper to skip whitespaces
  2024-02-16 10:24 ` [PATCH v2 0/3] add __extension__ " David Marchand
@ 2024-02-16 10:24   ` David Marchand
  2024-02-16 10:27     ` David Marchand
  2024-02-16 10:24   ` [PATCH v2 2/3] drivers: use common min/max macros David Marchand
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: David Marchand @ 2024-02-16 10:24 UTC (permalink / raw)
  To: dev
  Cc: Tyler Retzlaff, Sunil Kumar Kori, Rakesh Kudurumalla,
	Jerin Jacob, Srikanth Yalavarthi, Cristian Dumitrescu,
	Aman Singh, Yuying Zhang, Brian Dooley,
	Gowrishankar Muthukrishnan

Reduce code duplication by providing a simple inline helper.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 app/graph/utils.c                          | 13 ++------
 app/test-eventdev/parser.c                 | 14 ++++-----
 app/test-eventdev/parser.h                 |  8 -----
 app/test-mldev/parser.c                    | 17 ++++++-----
 app/test-mldev/parser.h                    |  8 -----
 app/test-pmd/cmdline_tm.c                  | 13 ++------
 app/test/test_string_fns.c                 | 35 ++++++++++++++++++++++
 examples/fips_validation/fips_validation.c | 16 +++-------
 examples/ip_pipeline/parser.c              | 14 ++++-----
 examples/ip_pipeline/parser.h              |  8 -----
 examples/pipeline/cli.c                    | 13 ++------
 lib/eal/include/rte_string_fns.h           | 27 +++++++++++++++++
 12 files changed, 98 insertions(+), 88 deletions(-)

diff --git a/app/graph/utils.c b/app/graph/utils.c
index c7b6ae83cf..3e8099ea88 100644
--- a/app/graph/utils.c
+++ b/app/graph/utils.c
@@ -9,17 +9,10 @@
 #include <string.h>
 
 #include <rte_common.h>
+#include <rte_string_fns.h>
 
 #include "module_api.h"
 
-#define white_spaces_skip(pos)			\
-({						\
-	__typeof__(pos) _p = (pos);		\
-	for ( ; isspace(*_p); _p++)		\
-		;				\
-	_p;					\
-})
-
 static void
 hex_string_to_uint64(uint64_t *dst, const char *hexs)
 {
@@ -47,7 +40,7 @@ parser_uint64_read(uint64_t *value, const char *p)
 	char *next;
 	uint64_t val;
 
-	p = white_spaces_skip(p);
+	p = rte_str_skip_leading_spaces(p);
 	if (!isdigit(*p))
 		return -EINVAL;
 
@@ -73,7 +66,7 @@ parser_uint64_read(uint64_t *value, const char *p)
 		break;
 	}
 
-	p = white_spaces_skip(p);
+	p = rte_str_skip_leading_spaces(p);
 	if (*p != '\0')
 		return -EINVAL;
 
diff --git a/app/test-eventdev/parser.c b/app/test-eventdev/parser.c
index bbea47b87d..4fb6d43a06 100644
--- a/app/test-eventdev/parser.c
+++ b/app/test-eventdev/parser.c
@@ -40,7 +40,7 @@ get_hex_val(char c)
 int
 parser_read_arg_bool(const char *p)
 {
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	int result = -EINVAL;
 
 	if (((p[0] == 'y') && (p[1] == 'e') && (p[2] == 's')) ||
@@ -67,7 +67,7 @@ parser_read_arg_bool(const char *p)
 		result = 0;
 	}
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 
 	if (p[0] != '\0')
 		return -EINVAL;
@@ -81,7 +81,7 @@ parser_read_uint64(uint64_t *value, const char *p)
 	char *next;
 	uint64_t val;
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	if (!isdigit(*p))
 		return -EINVAL;
 
@@ -107,7 +107,7 @@ parser_read_uint64(uint64_t *value, const char *p)
 		break;
 	}
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	if (*p != '\0')
 		return -EINVAL;
 
@@ -121,7 +121,7 @@ parser_read_int32(int32_t *value, const char *p)
 	char *next;
 	int32_t val;
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	if (!isdigit(*p))
 		return -EINVAL;
 
@@ -139,13 +139,13 @@ parser_read_uint64_hex(uint64_t *value, const char *p)
 	char *next;
 	uint64_t val;
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 
 	val = strtoul(p, &next, 16);
 	if (p == next)
 		return -EINVAL;
 
-	p = skip_white_spaces(next);
+	p = rte_str_skip_leading_spaces(next);
 	if (*p != '\0')
 		return -EINVAL;
 
diff --git a/app/test-eventdev/parser.h b/app/test-eventdev/parser.h
index 3617872997..6976efe877 100644
--- a/app/test-eventdev/parser.h
+++ b/app/test-eventdev/parser.h
@@ -10,14 +10,6 @@
 
 #define PARSE_DELIMITER				" \f\n\r\t\v"
 
-#define skip_white_spaces(pos)			\
-({						\
-	__typeof__(pos) _p = (pos);		\
-	for ( ; isspace(*_p); _p++)		\
-		;				\
-	_p;					\
-})
-
 static inline size_t
 skip_digits(const char *src)
 {
diff --git a/app/test-mldev/parser.c b/app/test-mldev/parser.c
index 277dcaedb2..ad761312fd 100644
--- a/app/test-mldev/parser.c
+++ b/app/test-mldev/parser.c
@@ -12,6 +12,7 @@
 #include <string.h>
 
 #include <rte_common.h>
+#include <rte_string_fns.h>
 
 #include "parser.h"
 
@@ -52,7 +53,7 @@ get_hex_val(char c)
 int
 parser_read_arg_bool(const char *p)
 {
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	int result = -EINVAL;
 
 	if (((p[0] == 'y') && (p[1] == 'e') && (p[2] == 's')) ||
@@ -77,7 +78,7 @@ parser_read_arg_bool(const char *p)
 		result = 0;
 	}
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 
 	if (p[0] != '\0')
 		return -EINVAL;
@@ -91,7 +92,7 @@ parser_read_uint64(uint64_t *value, const char *p)
 	char *next;
 	uint64_t val;
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	if (!isdigit(*p))
 		return -EINVAL;
 
@@ -117,7 +118,7 @@ parser_read_uint64(uint64_t *value, const char *p)
 		break;
 	}
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	if (*p != '\0')
 		return -EINVAL;
 
@@ -131,7 +132,7 @@ parser_read_int32(int32_t *value, const char *p)
 	char *next;
 	int32_t val;
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	if ((*p != '-') && (!isdigit(*p)))
 		return -EINVAL;
 
@@ -149,7 +150,7 @@ parser_read_int16(int16_t *value, const char *p)
 	char *next;
 	int16_t val;
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	if ((*p != '-') && (!isdigit(*p)))
 		return -EINVAL;
 
@@ -167,13 +168,13 @@ parser_read_uint64_hex(uint64_t *value, const char *p)
 	char *next;
 	uint64_t val;
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 
 	val = strtoul(p, &next, 16);
 	if (p == next)
 		return -EINVAL;
 
-	p = skip_white_spaces(next);
+	p = rte_str_skip_leading_spaces(next);
 	if (*p != '\0')
 		return -EINVAL;
 
diff --git a/app/test-mldev/parser.h b/app/test-mldev/parser.h
index 8b4207d0b0..b12b8f24c0 100644
--- a/app/test-mldev/parser.h
+++ b/app/test-mldev/parser.h
@@ -12,14 +12,6 @@
 
 #define PARSE_DELIMITER " \f\n\r\t\v"
 
-#define skip_white_spaces(pos) \
-	({ \
-		__typeof__(pos) _p = (pos); \
-		for (; isspace(*_p); _p++) \
-			; \
-		_p; \
-	})
-
 static inline size_t
 skip_digits(const char *src)
 {
diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index c11c80b158..6ce074f538 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -11,6 +11,7 @@
 
 #include <rte_ethdev.h>
 #include <rte_flow.h>
+#include <rte_string_fns.h>
 #include <rte_tm.h>
 
 #include "testpmd.h"
@@ -19,14 +20,6 @@
 #define PARSE_DELIMITER				" \f\n\r\t\v"
 #define MAX_NUM_SHARED_SHAPERS		256
 
-#define skip_white_spaces(pos)			\
-({						\
-	__typeof__(pos) _p = (pos);		\
-	for ( ; isspace(*_p); _p++)		\
-		;				\
-	_p;					\
-})
-
 /** Display TM Error Message */
 static void
 print_err_msg(struct rte_tm_error *error)
@@ -112,7 +105,7 @@ read_uint64(uint64_t *value, const char *p)
 	char *next;
 	uint64_t val;
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	if (!isdigit(*p))
 		return -EINVAL;
 
@@ -138,7 +131,7 @@ read_uint64(uint64_t *value, const char *p)
 		break;
 	}
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	if (*p != '\0')
 		return -EINVAL;
 
diff --git a/app/test/test_string_fns.c b/app/test/test_string_fns.c
index ad41106df1..3b311325dc 100644
--- a/app/test/test_string_fns.c
+++ b/app/test/test_string_fns.c
@@ -172,6 +172,39 @@ test_rte_strlcat(void)
 	return 0;
 }
 
+static int
+test_rte_str_skip_leading_spaces(void)
+{
+	static const char empty[] = "";
+	static const char nowhitespace[] = "Thereisreallynowhitespace";
+	static const char somewhitespaces[] = " \f\n\r\t\vThere are some whitespaces";
+	const char *p;
+
+	LOG("Checking '%s'\n", empty);
+	p = rte_str_skip_leading_spaces(empty);
+	if (p != empty) {
+		LOG("Returned address '%s' does not match expected result\n", p);
+		return -1;
+	}
+	LOG("Got expected '%s'\n", p);
+	LOG("Checking '%s'\n", nowhitespace);
+	p = rte_str_skip_leading_spaces(nowhitespace);
+	if (p != nowhitespace) {
+		LOG("Returned address '%s' does not match expected result\n", p);
+		return -1;
+	}
+	LOG("Got expected '%s'\n", p);
+	LOG("Checking '%s'\n", somewhitespaces);
+	p = rte_str_skip_leading_spaces(somewhitespaces);
+	if (p != strchr(somewhitespaces, 'T')) {
+		LOG("Returned address '%s' does not match expected result\n", p);
+		return -1;
+	}
+	LOG("Got expected '%s'\n", p);
+
+	return 0;
+}
+
 static int
 test_string_fns(void)
 {
@@ -179,6 +212,8 @@ test_string_fns(void)
 		return -1;
 	if (test_rte_strlcat() < 0)
 		return -1;
+	if (test_rte_str_skip_leading_spaces() < 0)
+		return -1;
 	return 0;
 }
 
diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c
index f840804009..c15178e55b 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -13,14 +13,6 @@
 
 #include "fips_validation.h"
 
-#define skip_white_spaces(pos)			\
-({						\
-	__typeof__(pos) _p = (pos);		\
-	for ( ; isspace(*_p); _p++)		\
-		;				\
-	_p;					\
-})
-
 static int
 get_file_line(void)
 {
@@ -579,13 +571,13 @@ parser_read_uint64_hex(uint64_t *value, const char *p)
 	char *next;
 	uint64_t val;
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 
 	val = strtoul(p, &next, 16);
 	if (p == next)
 		return -EINVAL;
 
-	p = skip_white_spaces(next);
+	p = rte_str_skip_leading_spaces(next);
 	if (*p != '\0')
 		return -EINVAL;
 
@@ -759,7 +751,7 @@ parser_read_uint64(uint64_t *value, const char *p)
 	char *next;
 	uint64_t val;
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	if (!isdigit(*p))
 		return -EINVAL;
 
@@ -785,7 +777,7 @@ parser_read_uint64(uint64_t *value, const char *p)
 		break;
 	}
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	if (*p != '\0')
 		return -EINVAL;
 
diff --git a/examples/ip_pipeline/parser.c b/examples/ip_pipeline/parser.c
index dfd71a71d3..62fc52f9db 100644
--- a/examples/ip_pipeline/parser.c
+++ b/examples/ip_pipeline/parser.c
@@ -42,7 +42,7 @@ get_hex_val(char c)
 int
 parser_read_arg_bool(const char *p)
 {
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	int result = -EINVAL;
 
 	if (((p[0] == 'y') && (p[1] == 'e') && (p[2] == 's')) ||
@@ -69,7 +69,7 @@ parser_read_arg_bool(const char *p)
 		result = 0;
 	}
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 
 	if (p[0] != '\0')
 		return -EINVAL;
@@ -83,7 +83,7 @@ parser_read_uint64(uint64_t *value, const char *p)
 	char *next;
 	uint64_t val;
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	if (!isdigit(*p))
 		return -EINVAL;
 
@@ -109,7 +109,7 @@ parser_read_uint64(uint64_t *value, const char *p)
 		break;
 	}
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	if (*p != '\0')
 		return -EINVAL;
 
@@ -123,13 +123,13 @@ parser_read_uint64_hex(uint64_t *value, const char *p)
 	char *next;
 	uint64_t val;
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 
 	val = strtoul(p, &next, 16);
 	if (p == next)
 		return -EINVAL;
 
-	p = skip_white_spaces(next);
+	p = rte_str_skip_leading_spaces(next);
 	if (*p != '\0')
 		return -EINVAL;
 
@@ -420,7 +420,7 @@ parse_cpu_core(const char *entry,
 
 	uint32_t s = 0, c = 0, h = 0, val;
 	uint8_t s_parsed = 0, c_parsed = 0, h_parsed = 0;
-	const char *next = skip_white_spaces(entry);
+	const char *next = rte_str_skip_leading_spaces(entry);
 	char type;
 
 	if (p == NULL)
diff --git a/examples/ip_pipeline/parser.h b/examples/ip_pipeline/parser.h
index 5224b18a89..32b5ff9976 100644
--- a/examples/ip_pipeline/parser.h
+++ b/examples/ip_pipeline/parser.h
@@ -13,14 +13,6 @@
 
 #define PARSE_DELIMITER				" \f\n\r\t\v"
 
-#define skip_white_spaces(pos)			\
-({						\
-	__typeof__(pos) _p = (pos);		\
-	for ( ; isspace(*_p); _p++)		\
-		;				\
-	_p;					\
-})
-
 static inline size_t
 skip_digits(const char *src)
 {
diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c
index 2ae6cc579f..c1efea3c1a 100644
--- a/examples/pipeline/cli.c
+++ b/examples/pipeline/cli.c
@@ -19,6 +19,7 @@
 #include <rte_swx_pipeline.h>
 #include <rte_swx_ctl.h>
 #include <rte_swx_ipsec.h>
+#include <rte_string_fns.h>
 
 #include "cli.h"
 
@@ -45,21 +46,13 @@
 #define MSG_FILE_NOT_ENOUGH "Not enough rules in file \"%s\".\n"
 #define MSG_CMD_FAIL        "Command \"%s\" failed.\n"
 
-#define skip_white_spaces(pos)			\
-({						\
-	__typeof__(pos) _p = (pos);		\
-	for ( ; isspace(*_p); _p++)		\
-		;				\
-	_p;					\
-})
-
 static int
 parser_read_uint64(uint64_t *value, const char *p)
 {
 	char *next;
 	uint64_t val;
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	if (!isdigit(*p))
 		return -EINVAL;
 
@@ -85,7 +78,7 @@ parser_read_uint64(uint64_t *value, const char *p)
 		break;
 	}
 
-	p = skip_white_spaces(p);
+	p = rte_str_skip_leading_spaces(p);
 	if (*p != '\0')
 		return -EINVAL;
 
diff --git a/lib/eal/include/rte_string_fns.h b/lib/eal/include/rte_string_fns.h
index bb43b2cba3..13badec7b3 100644
--- a/lib/eal/include/rte_string_fns.h
+++ b/lib/eal/include/rte_string_fns.h
@@ -15,10 +15,12 @@
 extern "C" {
 #endif
 
+#include <ctype.h>
 #include <stdio.h>
 #include <string.h>
 
 #include <rte_common.h>
+#include <rte_compat.h>
 
 /**
  * Takes string "string" parameter and splits it at character "delim"
@@ -115,6 +117,31 @@ rte_strlcat(char *dst, const char *src, size_t size)
 ssize_t
 rte_strscpy(char *dst, const char *src, size_t dsize);
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Search for the first non whitespace character.
+ *
+ * @param src
+ *   The input string to be analysed.
+ *
+ * @return
+ *  The address of the first non whitespace character.
+ */
+__rte_experimental
+static inline const char *
+rte_str_skip_leading_spaces(const char *src)
+{
+	const char *p = src;
+
+	while (isspace(*p))
+		p++;
+
+	return p;
+}
+
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.43.0


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

* [PATCH v2 2/3] drivers: use common min/max macros
  2024-02-16 10:24 ` [PATCH v2 0/3] add __extension__ " David Marchand
  2024-02-16 10:24   ` [PATCH v2 1/3] eal: add helper to skip whitespaces David Marchand
@ 2024-02-16 10:24   ` David Marchand
  2024-02-19  1:37     ` Xu, Rosen
  2024-02-19  2:13     ` Ajit Khaparde
  2024-02-16 10:24   ` [PATCH v2 3/3] add extension keyword to GCC statement expressions David Marchand
  2024-02-16 17:04   ` [PATCH v2 0/3] add __extension__ keyword to " David Marchand
  3 siblings, 2 replies; 16+ messages in thread
From: David Marchand @ 2024-02-16 10:24 UTC (permalink / raw)
  To: dev
  Cc: Ajit Khaparde, Somnath Kotur, Devendra Singh Rawat, Alok Prasad,
	Rosen Xu

Use newly introduced macro.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/bnxt/bnxt_ethdev.c                   | 12 +-----------
 drivers/net/qede/base/bcm_osal.h                 |  6 ++----
 drivers/raw/ifpga/base/osdep_rte/osdep_generic.h | 11 ++---------
 3 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 45d840d7af..8cc012206a 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -4867,17 +4867,7 @@ static void bnxt_free_ctx_mem(struct bnxt *bp)
 
 #define bnxt_roundup(x, y)   ((((x) + ((y) - 1)) / (y)) * (y))
 
-#define min_t(type, x, y) ({                    \
-	type __min1 = (x);                      \
-	type __min2 = (y);                      \
-	__min1 < __min2 ? __min1 : __min2; })
-
-#define max_t(type, x, y) ({                    \
-	type __max1 = (x);                      \
-	type __max2 = (y);                      \
-	__max1 > __max2 ? __max1 : __max2; })
-
-#define clamp_t(type, _x, min, max)     min_t(type, max_t(type, _x, min), max)
+#define clamp_t(type, _x, min, max) RTE_MIN_T(RTE_MAX_T(_x, min, type), max, type)
 
 int bnxt_alloc_ctx_mem(struct bnxt *bp)
 {
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 11019b5623..7869103c63 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -443,10 +443,8 @@ u32 qede_osal_log2(u32);
 #define OSAL_IOMEM volatile
 #define OSAL_UNUSED    __rte_unused
 #define OSAL_UNLIKELY(x)  __builtin_expect(!!(x), 0)
-#define OSAL_MIN_T(type, __min1, __min2)	\
-	((type)(__min1) < (type)(__min2) ? (type)(__min1) : (type)(__min2))
-#define OSAL_MAX_T(type, __max1, __max2)	\
-	((type)(__max1) > (type)(__max2) ? (type)(__max1) : (type)(__max2))
+#define OSAL_MIN_T(type, __min1, __min2) RTE_MIN_T(__min1, __min2, type)
+#define OSAL_MAX_T(type, __max1, __max2) RTE_MAX_T(__max1, __max2, type)
 
 void qede_get_mcp_proto_stats(struct ecore_dev *, enum ecore_mcp_protocol_type,
 			      union ecore_mcp_protocol_stats *);
diff --git a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
index 62c5666ca9..427793a578 100644
--- a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
+++ b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
@@ -44,15 +44,8 @@ extern int ifpga_rawdev_logtype;
 #define min(a, b) RTE_MIN(a, b)
 #define max(a, b) RTE_MAX(a, b)
 
-#define min_t(type, x, y) ({                    \
-	type __min1 = (x);                      \
-	type __min2 = (y);                      \
-	__min1 < __min2 ? __min1 : __min2; })
-
-#define max_t(type, x, y) ({                    \
-	type __max1 = (x);                      \
-	type __max2 = (y);                      \
-	__max1 > __max2 ? __max1 : __max2; })
+#define min_t(type, x, y) RTE_MIN_T(x, y, type)
+#define max_t(type, x, y) RTE_MAX_T(x, y, type)
 
 #define spinlock_t rte_spinlock_t
 #define spinlock_init(x) rte_spinlock_init(x)
-- 
2.43.0


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

* [PATCH v2 3/3] add extension keyword to GCC statement expressions
  2024-02-16 10:24 ` [PATCH v2 0/3] add __extension__ " David Marchand
  2024-02-16 10:24   ` [PATCH v2 1/3] eal: add helper to skip whitespaces David Marchand
  2024-02-16 10:24   ` [PATCH v2 2/3] drivers: use common min/max macros David Marchand
@ 2024-02-16 10:24   ` David Marchand
  2024-02-18  3:07     ` fengchengwen
  2024-02-16 17:04   ` [PATCH v2 0/3] add __extension__ keyword to " David Marchand
  3 siblings, 1 reply; 16+ messages in thread
From: David Marchand @ 2024-02-16 10:24 UTC (permalink / raw)
  To: dev
  Cc: Tyler Retzlaff, Ruifeng Wang, Hemant Agrawal, Sachin Saxena,
	Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	Kai Ji, Gagandeep Singh, Chengwen Feng, Jerin Jacob,
	Harman Kalra, Srikanth Yalavarthi, Shai Brandes,
	Evgeny Schemeilin, Ron Beider, Amit Bernstein, Wajeeh Atrash,
	Apeksha Gupta, Maciej Czekaj, Jiawen Wu, Jian Wang, Rosen Xu,
	Cristian Dumitrescu, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko

From: Tyler Retzlaff <roretzla@linux.microsoft.com>

Add __extension__ keyword to gcc statement expression extensions.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 drivers/bus/fslmc/mc/fsl_mc_sys.h             |  6 ++--
 drivers/common/cnxk/roc_io.h                  |  6 ++--
 drivers/common/cnxk/roc_platform.h            |  2 +-
 drivers/common/dpaax/dpaa_list.h              |  2 +-
 drivers/common/qat/qat_adf/icp_qat_hw.h       |  2 +-
 drivers/crypto/armv8/rte_armv8_pmd.c          |  4 +--
 drivers/crypto/caam_jr/caam_jr_desc.h         |  2 +-
 drivers/dma/hisilicon/hisi_dmadev.c           |  2 +-
 drivers/event/octeontx/ssovf_evdev.h          |  4 +--
 drivers/mempool/octeontx/octeontx_fpavf.h     |  4 +--
 drivers/ml/cnxk/cn10k_ml_dev.h                |  4 +--
 drivers/net/ena/base/ena_plat_dpdk.h          | 14 ++++-----
 drivers/net/ena/ena_ethdev.c                  | 30 +++++++++----------
 drivers/net/enetfec/enet_ethdev.h             |  2 +-
 drivers/net/fm10k/base/fm10k_osdep.h          |  2 +-
 drivers/net/octeontx/base/octeontx_io.h       |  6 ++--
 drivers/net/pfe/base/cbus.h                   |  2 +-
 drivers/net/pfe/base/pfe.h                    | 12 ++++----
 drivers/net/tap/bpf/bpf_api.h                 |  2 +-
 drivers/net/thunderx/base/nicvf_plat.h        |  4 +--
 drivers/net/txgbe/base/txgbe_osdep.h          |  2 +-
 drivers/raw/ifpga/afu_pmd_core.h              |  2 +-
 drivers/raw/ifpga/base/ifpga_compat.h         |  2 +-
 drivers/raw/ifpga/base/opae_osdep.h           |  4 +--
 drivers/raw/ifpga/base/opae_spi_transaction.c |  2 +-
 examples/qos_meter/main.h                     |  2 +-
 lib/ethdev/rte_mtr.c                          | 10 +++----
 lib/ethdev/rte_tm.c                           |  6 ++--
 lib/pipeline/rte_pipeline.c                   |  8 ++---
 lib/pipeline/rte_swx_pipeline_internal.h      |  2 +-
 lib/port/rte_port_source_sink.c               |  4 +--
 31 files changed, 78 insertions(+), 78 deletions(-)

diff --git a/drivers/bus/fslmc/mc/fsl_mc_sys.h b/drivers/bus/fslmc/mc/fsl_mc_sys.h
index a310c5697e..c91f14ade8 100644
--- a/drivers/bus/fslmc/mc/fsl_mc_sys.h
+++ b/drivers/bus/fslmc/mc/fsl_mc_sys.h
@@ -40,11 +40,11 @@ struct fsl_mc_io {
 #define __arch_putq(v, a)	(*(volatile uint64_t *)(a) = (v))
 #define __arch_putq32(v, a)	(*(volatile uint32_t *)(a) = (v))
 #define readq(c) \
-	({ uint64_t __v = __arch_getq(c); __iormb(); __v; })
+	__extension__ ({ uint64_t __v = __arch_getq(c); __iormb(); __v; })
 #define writeq(v, c) \
-	({ uint64_t __v = v; __iowmb(); __arch_putq(__v, c); __v; })
+	__extension__ ({ uint64_t __v = v; __iowmb(); __arch_putq(__v, c); __v; })
 #define writeq32(v, c) \
-	({ uint32_t __v = v; __iowmb(); __arch_putq32(__v, c); __v; })
+	__extension__ ({ uint32_t __v = v; __iowmb(); __arch_putq32(__v, c); __v; })
 #define ioread64(_p)		readq(_p)
 #define iowrite64(_v, _p)	writeq(_v, _p)
 #define iowrite32(_v, _p)	writeq32(_v, _p)
diff --git a/drivers/common/cnxk/roc_io.h b/drivers/common/cnxk/roc_io.h
index af1a10cd66..131578e625 100644
--- a/drivers/common/cnxk/roc_io.h
+++ b/drivers/common/cnxk/roc_io.h
@@ -30,21 +30,21 @@
 #endif
 
 #define roc_load_pair(val0, val1, addr)                                        \
-	({                                                                     \
+	__extension__ ({                                                                     \
 		asm volatile("ldp %x[x0], %x[x1], [%x[p1]]"                    \
 			     : [x0] "=r"(val0), [x1] "=r"(val1)                \
 			     : [p1] "r"(addr));                                \
 	})
 
 #define roc_store_pair(val0, val1, addr)                                       \
-	({                                                                     \
+	__extension__ ({                                                                     \
 		asm volatile(                                                  \
 			"stp %x[x0], %x[x1], [%x[p1], #0]!" ::[x0] "r"(val0),  \
 			[x1] "r"(val1), [p1] "r"(addr));                       \
 	})
 
 #define roc_prefetch_store_keep(ptr)                                           \
-	({ asm volatile("prfm pstl1keep, [%x0]\n" : : "r"(ptr)); })
+	__extension__ ({ asm volatile("prfm pstl1keep, [%x0]\n" : : "r"(ptr)); })
 
 #if defined(__clang__)
 static __plt_always_inline void
diff --git a/drivers/common/cnxk/roc_platform.h b/drivers/common/cnxk/roc_platform.h
index 9d2ea8f009..b7fe132093 100644
--- a/drivers/common/cnxk/roc_platform.h
+++ b/drivers/common/cnxk/roc_platform.h
@@ -82,7 +82,7 @@
 
 /** Divide ceil */
 #define PLT_DIV_CEIL(x, y)			\
-	({					\
+	__extension__ ({			\
 		__typeof(x) __x = x;		\
 		__typeof(y) __y = y;		\
 		(__x + __y - 1) / __y;		\
diff --git a/drivers/common/dpaax/dpaa_list.h b/drivers/common/dpaax/dpaa_list.h
index 319a3562ab..2bf013a186 100644
--- a/drivers/common/dpaax/dpaa_list.h
+++ b/drivers/common/dpaax/dpaa_list.h
@@ -31,7 +31,7 @@ do { \
 #define list_entry(node, type, member) \
 	(type *)((void *)node - offsetof(type, member))
 #define list_empty(p) \
-({ \
+__extension__ ({ \
 	const struct list_head *__p298 = (p); \
 	((__p298->next == __p298) && (__p298->prev == __p298)); \
 })
diff --git a/drivers/common/qat/qat_adf/icp_qat_hw.h b/drivers/common/qat/qat_adf/icp_qat_hw.h
index 8b864e1630..33756d512d 100644
--- a/drivers/common/qat/qat_adf/icp_qat_hw.h
+++ b/drivers/common/qat/qat_adf/icp_qat_hw.h
@@ -292,7 +292,7 @@ enum icp_qat_hw_cipher_convert {
 #define QAT_CIPHER_AEAD_AAD_SIZE_BITPOS 16
 #define QAT_CIPHER_AEAD_AAD_SIZE_LE_BITPOS 0
 #define ICP_QAT_HW_CIPHER_CONFIG_BUILD_UPPER(aad_size) \
-	({ \
+	__extension__ ({ \
 	typeof(aad_size) aad_size1 = aad_size; \
 	(((((aad_size1) >> QAT_CIPHER_AEAD_AAD_UPPER_SHIFT) & \
 	QAT_CIPHER_AEAD_AAD_SIZE_UPPER_MASK) << \
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 524c959ee0..320e2d4b3b 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -139,7 +139,7 @@ crypto_chain_order[] = {
  * Extract particular combined mode crypto function from the 3D array.
  */
 #define CRYPTO_GET_ALGO(order, cop, calg, aalg, keyl)			\
-({									\
+__extension__ ({							\
 	crypto_func_tbl_t *func_tbl =					\
 				(crypto_chain_order[(order)])[(cop)];	\
 									\
@@ -186,7 +186,7 @@ crypto_key_sched_dir[] = {
  * Extract particular combined mode crypto function from the 3D array.
  */
 #define CRYPTO_GET_KEY_SCHED(cop, calg, keyl)				\
-({									\
+__extension__ ({							\
 	crypto_key_sched_tbl_t *ks_tbl = crypto_key_sched_dir[(cop)];	\
 									\
 	(calg >= CRYPTO_CIPHER_MAX) ?					\
diff --git a/drivers/crypto/caam_jr/caam_jr_desc.h b/drivers/crypto/caam_jr/caam_jr_desc.h
index 135d51c392..6fe6184b18 100644
--- a/drivers/crypto/caam_jr/caam_jr_desc.h
+++ b/drivers/crypto/caam_jr/caam_jr_desc.h
@@ -32,7 +32,7 @@
 /* Macro for setting up a JD. The structure of the JD is common across all
  * supported protocols, thus its structure is identical.
  */
-#define SEC_JD_INIT(descriptor)	      ({ \
+#define SEC_JD_INIT(descriptor)	      __extension__ ({ \
 	/* CTYPE = job descriptor			       \
 	 * RSMS, DNR = 0
 	 * ONE = 1
diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c
index 0e11ca14cc..22303e7bef 100644
--- a/drivers/dma/hisilicon/hisi_dmadev.c
+++ b/drivers/dma/hisilicon/hisi_dmadev.c
@@ -124,7 +124,7 @@ hisi_dma_update_queue_mbit(struct hisi_dma_dev *hw, uint32_t qoff,
 	hisi_dma_write_queue(hw, qoff, tmp);
 }
 
-#define hisi_dma_poll_hw_state(hw, val, cond, sleep_us, timeout_us) ({ \
+#define hisi_dma_poll_hw_state(hw, val, cond, sleep_us, timeout_us) __extension__ ({ \
 	uint32_t timeout = 0; \
 	while (timeout++ <= (timeout_us)) { \
 		(val) = hisi_dma_read_queue(hw, HISI_DMA_QUEUE_FSM_REG); \
diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h
index e46dc055eb..8a4cb201d1 100644
--- a/drivers/event/octeontx/ssovf_evdev.h
+++ b/drivers/event/octeontx/ssovf_evdev.h
@@ -96,14 +96,14 @@
 
 /* ARM64 specific functions */
 #if defined(RTE_ARCH_ARM64)
-#define ssovf_load_pair(val0, val1, addr) ({		\
+#define ssovf_load_pair(val0, val1, addr) __extension__ ({		\
 			asm volatile(			\
 			"ldp %x[x0], %x[x1], [%x[p1]]"	\
 			:[x0]"=r"(val0), [x1]"=r"(val1) \
 			:[p1]"r"(addr)			\
 			); })
 
-#define ssovf_store_pair(val0, val1, addr) ({		\
+#define ssovf_store_pair(val0, val1, addr) __extension__ ({		\
 			asm volatile(			\
 			"stp %x[x0], %x[x1], [%x[p1]]"	\
 			::[x0]"r"(val0), [x1]"r"(val1), [p1]"r"(addr) \
diff --git a/drivers/mempool/octeontx/octeontx_fpavf.h b/drivers/mempool/octeontx/octeontx_fpavf.h
index e27c4377e2..b9519f1801 100644
--- a/drivers/mempool/octeontx/octeontx_fpavf.h
+++ b/drivers/mempool/octeontx/octeontx_fpavf.h
@@ -59,14 +59,14 @@
 
 /* ARM64 specific functions */
 #if defined(RTE_ARCH_ARM64)
-#define fpavf_load_pair(val0, val1, addr) ({		\
+#define fpavf_load_pair(val0, val1, addr) __extension__ ({		\
 			asm volatile(			\
 			"ldp %x[x0], %x[x1], [%x[p1]]"	\
 			:[x0]"=r"(val0), [x1]"=r"(val1) \
 			:[p1]"r"(addr)			\
 			); })
 
-#define fpavf_store_pair(val0, val1, addr) ({		\
+#define fpavf_store_pair(val0, val1, addr) __extension__ ({		\
 			asm volatile(			\
 			"stp %x[x0], %x[x1], [%x[p1]]"	\
 			::[x0]"r"(val0), [x1]"r"(val1), [p1]"r"(addr) \
diff --git a/drivers/ml/cnxk/cn10k_ml_dev.h b/drivers/ml/cnxk/cn10k_ml_dev.h
index cee405f3f5..2101f69b7e 100644
--- a/drivers/ml/cnxk/cn10k_ml_dev.h
+++ b/drivers/ml/cnxk/cn10k_ml_dev.h
@@ -44,8 +44,8 @@ extern struct rte_ml_dev_ops ml_dev_dummy_ops;
 
 /* Memory barrier macros */
 #if defined(RTE_ARCH_ARM)
-#define dmb_st ({ asm volatile("dmb st" : : : "memory"); })
-#define dsb_st ({ asm volatile("dsb st" : : : "memory"); })
+#define dmb_st __extension__ ({ asm volatile("dmb st" : : : "memory"); })
+#define dsb_st __extension__ ({ asm volatile("dsb st" : : : "memory"); })
 #else
 #define dmb_st
 #define dsb_st
diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h
index 665ac2f0cc..14bf582a45 100644
--- a/drivers/net/ena/base/ena_plat_dpdk.h
+++ b/drivers/net/ena/base/ena_plat_dpdk.h
@@ -141,9 +141,9 @@ extern int ena_logtype_com;
 #define ena_spinlock_t rte_spinlock_t
 #define ENA_SPINLOCK_INIT(spinlock) rte_spinlock_init(&(spinlock))
 #define ENA_SPINLOCK_LOCK(spinlock, flags)				       \
-	({(void)(flags); rte_spinlock_lock(&(spinlock)); })
+	__extension__ ({(void)(flags); rte_spinlock_lock(&(spinlock)); })
 #define ENA_SPINLOCK_UNLOCK(spinlock, flags)				       \
-	({(void)(flags); rte_spinlock_unlock(&(spinlock)); })
+	__extension__ ({(void)(flags); rte_spinlock_unlock(&(spinlock)); })
 #define ENA_SPINLOCK_DESTROY(spinlock) ((void)(spinlock))
 
 typedef struct {
@@ -237,7 +237,7 @@ ena_mem_alloc_coherent(struct rte_eth_dev_data *data, size_t size,
 		ENA_MEM_ALLOC_COHERENT_ALIGNED(dmadev, size, virt, phys,       \
 			mem_handle, RTE_CACHE_LINE_SIZE)
 #define ENA_MEM_FREE_COHERENT(dmadev, size, virt, phys, mem_handle)	       \
-		({ ENA_TOUCH(size); ENA_TOUCH(phys); ENA_TOUCH(dmadev);	       \
+		__extension__ ({ ENA_TOUCH(size); ENA_TOUCH(phys); ENA_TOUCH(dmadev);	       \
 		   rte_memzone_free(mem_handle); })
 
 #define ENA_MEM_ALLOC_COHERENT_NODE_ALIGNED(				       \
@@ -263,16 +263,16 @@ ena_mem_alloc_coherent(struct rte_eth_dev_data *data, size_t size,
 
 #define ENA_MEM_ALLOC(dmadev, size) rte_zmalloc(NULL, size, 1)
 #define ENA_MEM_FREE(dmadev, ptr, size)					       \
-	({ ENA_TOUCH(dmadev); ENA_TOUCH(size); rte_free(ptr); })
+	__extension__ ({ ENA_TOUCH(dmadev); ENA_TOUCH(size); rte_free(ptr); })
 
 #define ENA_DB_SYNC(mem_handle) ((void)mem_handle)
 
 #define ENA_REG_WRITE32(bus, value, reg)				       \
-	({ (void)(bus); rte_write32((value), (reg)); })
+	__extension__ ({ (void)(bus); rte_write32((value), (reg)); })
 #define ENA_REG_WRITE32_RELAXED(bus, value, reg)			       \
-	({ (void)(bus); rte_write32_relaxed((value), (reg)); })
+	__extension__ ({ (void)(bus); rte_write32_relaxed((value), (reg)); })
 #define ENA_REG_READ32(bus, reg)					       \
-	({ (void)(bus); rte_read32_relaxed((reg)); })
+	__extension__ ({ (void)(bus); rte_read32_relaxed((reg)); })
 
 #define ATOMIC32_INC(i32_ptr) rte_atomic32_inc(i32_ptr)
 #define ATOMIC32_DEC(i32_ptr) rte_atomic32_dec(i32_ptr)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index dc846d2e84..beb17c4125 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -459,7 +459,7 @@ mp_msg_init(struct rte_mp_msg *msg, enum ena_mp_req type, int port_id)
  *       calls to the same proxied function under the same lock.
  */
 #define ENA_PROXY(a, f, ...)						\
-({									\
+__extension__ ({							\
 	struct ena_adapter *_a = (a);					\
 	struct timespec ts = { .tv_sec = ENA_MP_REQ_TMO };		\
 	struct ena_mp_body *req, *rsp;					\
@@ -507,13 +507,13 @@ mp_msg_init(struct rte_mp_msg *msg, enum ena_mp_req type, int port_id)
  *********************************************************************/
 
 ENA_PROXY_DESC(ena_com_get_dev_basic_stats, ENA_MP_DEV_STATS_GET,
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(req);
 	ENA_TOUCH(ena_dev);
 	ENA_TOUCH(stats);
 }),
-({
+__extension__ ({
 	ENA_TOUCH(rsp);
 	ENA_TOUCH(ena_dev);
 	if (stats != &adapter->basic_stats)
@@ -522,13 +522,13 @@ ENA_PROXY_DESC(ena_com_get_dev_basic_stats, ENA_MP_DEV_STATS_GET,
 	struct ena_com_dev *ena_dev, struct ena_admin_basic_stats *stats);
 
 ENA_PROXY_DESC(ena_com_get_eni_stats, ENA_MP_ENI_STATS_GET,
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(req);
 	ENA_TOUCH(ena_dev);
 	ENA_TOUCH(stats);
 }),
-({
+__extension__ ({
 	ENA_TOUCH(rsp);
 	ENA_TOUCH(ena_dev);
 	if (stats != (struct ena_admin_eni_stats *)&adapter->metrics_stats)
@@ -537,12 +537,12 @@ ENA_PROXY_DESC(ena_com_get_eni_stats, ENA_MP_ENI_STATS_GET,
 	struct ena_com_dev *ena_dev, struct ena_admin_eni_stats *stats);
 
 ENA_PROXY_DESC(ena_com_set_dev_mtu, ENA_MP_MTU_SET,
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(ena_dev);
 	req->args.mtu = mtu;
 }),
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(rsp);
 	ENA_TOUCH(ena_dev);
@@ -551,12 +551,12 @@ ENA_PROXY_DESC(ena_com_set_dev_mtu, ENA_MP_MTU_SET,
 	struct ena_com_dev *ena_dev, int mtu);
 
 ENA_PROXY_DESC(ena_com_indirect_table_set, ENA_MP_IND_TBL_SET,
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(req);
 	ENA_TOUCH(ena_dev);
 }),
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(rsp);
 	ENA_TOUCH(ena_dev);
@@ -564,13 +564,13 @@ ENA_PROXY_DESC(ena_com_indirect_table_set, ENA_MP_IND_TBL_SET,
 	struct ena_com_dev *ena_dev);
 
 ENA_PROXY_DESC(ena_com_indirect_table_get, ENA_MP_IND_TBL_GET,
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(req);
 	ENA_TOUCH(ena_dev);
 	ENA_TOUCH(ind_tbl);
 }),
-({
+__extension__ ({
 	ENA_TOUCH(rsp);
 	ENA_TOUCH(ena_dev);
 	if (ind_tbl != adapter->indirect_table)
@@ -580,14 +580,14 @@ ENA_PROXY_DESC(ena_com_indirect_table_get, ENA_MP_IND_TBL_GET,
 	struct ena_com_dev *ena_dev, u32 *ind_tbl);
 
 ENA_PROXY_DESC(ena_com_get_customer_metrics, ENA_MP_CUSTOMER_METRICS_GET,
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(req);
 	ENA_TOUCH(ena_dev);
 	ENA_TOUCH(buf);
 	ENA_TOUCH(buf_size);
 }),
-({
+__extension__ ({
 	ENA_TOUCH(rsp);
 	ENA_TOUCH(ena_dev);
 	ENA_TOUCH(buf_size);
@@ -597,13 +597,13 @@ ENA_PROXY_DESC(ena_com_get_customer_metrics, ENA_MP_CUSTOMER_METRICS_GET,
 	struct ena_com_dev *ena_dev, char *buf, size_t buf_size);
 
 ENA_PROXY_DESC(ena_com_get_ena_srd_info, ENA_MP_SRD_STATS_GET,
-({
+__extension__ ({
 	ENA_TOUCH(adapter);
 	ENA_TOUCH(req);
 	ENA_TOUCH(ena_dev);
 	ENA_TOUCH(info);
 }),
-({
+__extension__ ({
 	ENA_TOUCH(rsp);
 	ENA_TOUCH(ena_dev);
 	if ((struct ena_stats_srd *)info != &adapter->srd_stats)
diff --git a/drivers/net/enetfec/enet_ethdev.h b/drivers/net/enetfec/enet_ethdev.h
index 573b0672cd..02a3397890 100644
--- a/drivers/net/enetfec/enet_ethdev.h
+++ b/drivers/net/enetfec/enet_ethdev.h
@@ -42,7 +42,7 @@
 
 #define ENETFEC_MAX_Q		1
 
-#define writel(v, p) ({*(volatile unsigned int *)(p) = (v); })
+#define writel(v, p) __extension__ ({*(volatile unsigned int *)(p) = (v); })
 #define readl(p) rte_read32(p)
 
 struct bufdesc {
diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h
index 019fba5e25..25f46c3908 100644
--- a/drivers/net/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/fm10k/base/fm10k_osdep.h
@@ -102,7 +102,7 @@ typedef uint64_t   u64;
 #endif
 
 #ifndef do_div
-#define do_div(n, base) ({\
+#define do_div(n, base) __extension__ ({\
 	(n) = (n) / (base);\
 })
 #endif /* do_div */
diff --git a/drivers/net/octeontx/base/octeontx_io.h b/drivers/net/octeontx/base/octeontx_io.h
index d0b9cfbc67..323e34b634 100644
--- a/drivers/net/octeontx/base/octeontx_io.h
+++ b/drivers/net/octeontx/base/octeontx_io.h
@@ -19,17 +19,17 @@
 
 /* ARM64 specific functions */
 #if defined(RTE_ARCH_ARM64)
-#define octeontx_prefetch_store_keep(_ptr) ({\
+#define octeontx_prefetch_store_keep(_ptr) __extension__ ({\
 	asm volatile("prfm pstl1keep, %a0\n" : : "p" (_ptr)); })
 
-#define octeontx_load_pair(val0, val1, addr) ({		\
+#define octeontx_load_pair(val0, val1, addr) __extension__ ({		\
 			asm volatile(			\
 			"ldp %x[x0], %x[x1], [%x[p1]]"	\
 			:[x0]"=r"(val0), [x1]"=r"(val1) \
 			:[p1]"r"(addr)			\
 			); })
 
-#define octeontx_store_pair(val0, val1, addr) ({		\
+#define octeontx_store_pair(val0, val1, addr) __extension__ ({		\
 			asm volatile(			\
 			"stp %x[x0], %x[x1], [%x[p1]]"	\
 			::[x0]"r"(val0), [x1]"r"(val1), [p1]"r"(addr) \
diff --git a/drivers/net/pfe/base/cbus.h b/drivers/net/pfe/base/cbus.h
index fe7ea60067..7b30588c6a 100644
--- a/drivers/net/pfe/base/cbus.h
+++ b/drivers/net/pfe/base/cbus.h
@@ -36,7 +36,7 @@
 
 /* Byte Enables of the Internal memory access. These are interpred in BE */
 #define PE_MEM_ACCESS_BYTE_ENABLE(offset, size)	\
-	({ typeof(size) size_ = (size);		\
+	__extension__ ({ typeof(size) size_ = (size);		\
 	(((BIT(size_) - 1) << (4 - (offset) - (size_))) & 0xf) << 24; })
 
 #include "cbus/emac_mtip.h"
diff --git a/drivers/net/pfe/base/pfe.h b/drivers/net/pfe/base/pfe.h
index 0a88e98c1b..b9cf6827f1 100644
--- a/drivers/net/pfe/base/pfe.h
+++ b/drivers/net/pfe/base/pfe.h
@@ -95,36 +95,36 @@ test_and_set_bit(unsigned long nr, void *addr)
 #define PMEM_SIZE	0x8000	/* TMU has less... */
 #define PMEM_END	(PMEM_BASE_ADDR + PMEM_SIZE)
 
-#define writel(v, p) ({*(volatile unsigned int *)(p) = (v); })
+#define writel(v, p) __extension__ ({*(volatile unsigned int *)(p) = (v); })
 #define readl(p) (*(const volatile unsigned int *)(p))
 
 /* These check memory ranges from PE point of view/memory map */
 #define IS_DMEM(addr, len)				\
-	({ typeof(addr) addr_ = (addr);			\
+	__extension__ ({ typeof(addr) addr_ = (addr);	\
 	((unsigned long)(addr_) >= DMEM_BASE_ADDR) &&	\
 	(((unsigned long)(addr_) + (len)) <= DMEM_END); })
 
 #define IS_PMEM(addr, len)				\
-	({ typeof(addr) addr_ = (addr);			\
+	__extension__ ({ typeof(addr) addr_ = (addr);	\
 	((unsigned long)(addr_) >= PMEM_BASE_ADDR) &&	\
 	(((unsigned long)(addr_) + (len)) <= PMEM_END); })
 
 #define IS_PE_LMEM(addr, len)				\
-	({ typeof(addr) addr_ = (addr);			\
+	__extension__ ({ typeof(addr) addr_ = (addr);	\
 	((unsigned long)(addr_) >=			\
 	PE_LMEM_BASE_ADDR) &&				\
 	(((unsigned long)(addr_) +			\
 	(len)) <= PE_LMEM_END); })
 
 #define IS_PFE_LMEM(addr, len)				\
-	({ typeof(addr) addr_ = (addr);			\
+	__extension__ ({ typeof(addr) addr_ = (addr);	\
 	((unsigned long)(addr_) >=			\
 	CBUS_VIRT_TO_PFE(LMEM_BASE_ADDR)) &&		\
 	(((unsigned long)(addr_) + (len)) <=		\
 	CBUS_VIRT_TO_PFE(LMEM_END)); })
 
 #define __IS_PHYS_DDR(addr, len)			\
-	({ typeof(addr) addr_ = (addr);			\
+	__extension__ ({ typeof(addr) addr_ = (addr);	\
 	((unsigned long)(addr_) >=			\
 	DDR_PHYS_BASE_ADDR) &&				\
 	(((unsigned long)(addr_) + (len)) <=		\
diff --git a/drivers/net/tap/bpf/bpf_api.h b/drivers/net/tap/bpf/bpf_api.h
index 2638a8a4ac..4cd25fa593 100644
--- a/drivers/net/tap/bpf/bpf_api.h
+++ b/drivers/net/tap/bpf/bpf_api.h
@@ -162,7 +162,7 @@ static void BPF_FUNC(trace_printk, const char *fmt, int fmt_size, ...);
 
 #ifndef printt
 # define printt(fmt, ...)						\
-	({								\
+	__extension__ ({						\
 		char ____fmt[] = fmt;					\
 		trace_printk(____fmt, sizeof(____fmt), ##__VA_ARGS__);	\
 	})
diff --git a/drivers/net/thunderx/base/nicvf_plat.h b/drivers/net/thunderx/base/nicvf_plat.h
index dd054627e9..8421f57040 100644
--- a/drivers/net/thunderx/base/nicvf_plat.h
+++ b/drivers/net/thunderx/base/nicvf_plat.h
@@ -55,11 +55,11 @@
 
 /* ARM64 specific functions */
 #if defined(RTE_ARCH_ARM64)
-#define nicvf_prefetch_store_keep(_ptr) ({\
+#define nicvf_prefetch_store_keep(_ptr) __extension__ ({\
 	asm volatile("prfm pstl1keep, [%x0]\n" : : "r" (_ptr)); })
 
 
-#define NICVF_LOAD_PAIR(reg1, reg2, addr) ({		\
+#define NICVF_LOAD_PAIR(reg1, reg2, addr) __extension__ ({		\
 			asm volatile(			\
 			"ldp %x[x1], %x[x0], [%x[p1]]"	\
 			: [x1]"=r"(reg1), [x0]"=r"(reg2)\
diff --git a/drivers/net/txgbe/base/txgbe_osdep.h b/drivers/net/txgbe/base/txgbe_osdep.h
index b62c0b0824..4fce355000 100644
--- a/drivers/net/txgbe/base/txgbe_osdep.h
+++ b/drivers/net/txgbe/base/txgbe_osdep.h
@@ -172,7 +172,7 @@ static inline u64 REVERT_BIT_MASK64(u64 mask)
 
 /* Check whether an address is broadcast. */
 #define TXGBE_IS_BROADCAST(address) \
-		({typeof(address)addr = (address); \
+		__extension__ ({typeof(address)addr = (address); \
 		(((u8 *)(addr))[0] == ((u8)0xff)) && \
 		(((u8 *)(addr))[1] == ((u8)0xff)); })
 
diff --git a/drivers/raw/ifpga/afu_pmd_core.h b/drivers/raw/ifpga/afu_pmd_core.h
index ab5a228147..a8f1afe343 100644
--- a/drivers/raw/ifpga/afu_pmd_core.h
+++ b/drivers/raw/ifpga/afu_pmd_core.h
@@ -66,7 +66,7 @@ afu_rawdev_get_priv(const struct rte_rawdev *rawdev)
 #define MHZ(f)  ((f) * 1000000)
 
 #define dsm_poll_timeout(addr, val, cond, invl, timeout) \
-({                                                       \
+__extension__ ({                                             \
 	uint64_t __wait = 0;                                 \
 	uint64_t __invl = (invl);                            \
 	uint64_t __timeout = (timeout);                      \
diff --git a/drivers/raw/ifpga/base/ifpga_compat.h b/drivers/raw/ifpga/base/ifpga_compat.h
index 8a624d174f..95fba6c28e 100644
--- a/drivers/raw/ifpga/base/ifpga_compat.h
+++ b/drivers/raw/ifpga/base/ifpga_compat.h
@@ -31,7 +31,7 @@
  * by polling with given interval and timeout.
  */
 #define fpga_wait_register_field(_field, _expect, _reg_addr, _timeout, _invl)\
-({									     \
+__extension__ ({							     \
 	int wait = 0;							     \
 	int ret = -ETIMEDOUT;						     \
 	typeof(_expect) value;						     \
diff --git a/drivers/raw/ifpga/base/opae_osdep.h b/drivers/raw/ifpga/base/opae_osdep.h
index e91205f536..cb780b1fed 100644
--- a/drivers/raw/ifpga/base/opae_osdep.h
+++ b/drivers/raw/ifpga/base/opae_osdep.h
@@ -81,7 +81,7 @@ struct uuid {
 #define opae_memset(a, b, c)    memset((a), (b), (c))
 
 #define readx_poll_timeout(op, val, cond, invl, timeout, args...) \
-({                                                                \
+__extension__ ({                                                      \
 	unsigned long __wait = 0;                                     \
 	unsigned long __invl = (invl);                                \
 	unsigned long __timeout = (timeout);                          \
@@ -107,7 +107,7 @@ struct uuid {
 	readx_poll_timeout(opae_readb, val, cond, invl, timeout, addr)
 
 #define opae_max10_read_poll_timeout(dev, addr, value, cond, invl, timeout) \
-({ \
+__extension__ ({ \
 	int __ret, __tmp; \
 	__tmp = readx_poll_timeout(max10_sys_read, __ret, __ret || (cond), \
 			invl, timeout, (dev), (addr), &(value)); \
diff --git a/drivers/raw/ifpga/base/opae_spi_transaction.c b/drivers/raw/ifpga/base/opae_spi_transaction.c
index cd50d40629..21015eb95e 100644
--- a/drivers/raw/ifpga/base/opae_spi_transaction.c
+++ b/drivers/raw/ifpga/base/opae_spi_transaction.c
@@ -24,7 +24,7 @@
 #define SPI_REG_BYTES 4
 
 #define INIT_SPI_TRAN_HEADER(trans_type, size, address) \
-({ \
+__extension__ ({ \
 	header.trans_type = trans_type; \
 	header.reserve = 0; \
 	header.size = cpu_to_be16(size); \
diff --git a/examples/qos_meter/main.h b/examples/qos_meter/main.h
index 864f019f69..59e5e0bce7 100644
--- a/examples/qos_meter/main.h
+++ b/examples/qos_meter/main.h
@@ -24,7 +24,7 @@ enum policer_action policer_table[RTE_COLORS][RTE_COLORS] =
 #if APP_MODE == APP_MODE_FWD
 
 #define FUNC_METER(m, p, time, pkt_len, pkt_color)	\
-({							\
+__extension__ ({					\
 	void *mp = m;					\
 	void *pp = p;					\
 	mp = mp;					\
diff --git a/lib/ethdev/rte_mtr.c b/lib/ethdev/rte_mtr.c
index 4e94af9d9f..900837bc09 100644
--- a/lib/ethdev/rte_mtr.c
+++ b/lib/ethdev/rte_mtr.c
@@ -41,14 +41,14 @@ rte_mtr_ops_get(uint16_t port_id, struct rte_mtr_error *error)
 }
 
 #define RTE_MTR_FUNC(port_id, func)			\
-({							\
+__extension__ ({					\
 	const struct rte_mtr_ops *ops =			\
-		rte_mtr_ops_get(port_id, error);		\
-	if (ops == NULL)					\
+		rte_mtr_ops_get(port_id, error);	\
+	if (ops == NULL)				\
 		return -rte_errno;			\
 							\
 	if (ops->func == NULL)				\
-		return -rte_mtr_error_set(error,		\
+		return -rte_mtr_error_set(error,	\
 			ENOSYS,				\
 			RTE_MTR_ERROR_TYPE_UNSPECIFIED,	\
 			NULL,				\
@@ -58,7 +58,7 @@ rte_mtr_ops_get(uint16_t port_id, struct rte_mtr_error *error)
 })
 
 #define RTE_MTR_HNDL_FUNC(port_id, func)		\
-({							\
+__extension__ ({					\
 	const struct rte_mtr_ops *ops =			\
 		rte_mtr_ops_get(port_id, error);	\
 	if (ops == NULL)				\
diff --git a/lib/ethdev/rte_tm.c b/lib/ethdev/rte_tm.c
index 2d08141133..d594fe0049 100644
--- a/lib/ethdev/rte_tm.c
+++ b/lib/ethdev/rte_tm.c
@@ -40,11 +40,11 @@ rte_tm_ops_get(uint16_t port_id, struct rte_tm_error *error)
 	return ops;
 }
 
-#define RTE_TM_FUNC(port_id, func)				\
-({							\
+#define RTE_TM_FUNC(port_id, func)			\
+__extension__ ({					\
 	const struct rte_tm_ops *ops =			\
 		rte_tm_ops_get(port_id, error);		\
-	if (ops == NULL)					\
+	if (ops == NULL)				\
 		return -rte_errno;			\
 							\
 	if (ops->func == NULL)				\
diff --git a/lib/pipeline/rte_pipeline.c b/lib/pipeline/rte_pipeline.c
index c9ed903d71..945bb025a1 100644
--- a/lib/pipeline/rte_pipeline.c
+++ b/lib/pipeline/rte_pipeline.c
@@ -23,16 +23,16 @@ RTE_LOG_REGISTER_DEFAULT(pipeline_logtype, INFO);
 #ifdef RTE_PIPELINE_STATS_COLLECT
 
 #define RTE_PIPELINE_STATS_AH_DROP_WRITE(p, mask)			\
-	({ (p)->n_pkts_ah_drop = rte_popcount64(mask); })
+	__extension__ ({ (p)->n_pkts_ah_drop = rte_popcount64(mask); })
 
 #define RTE_PIPELINE_STATS_AH_DROP_READ(p, counter)			\
-	({ (counter) += (p)->n_pkts_ah_drop; (p)->n_pkts_ah_drop = 0; })
+	__extension__ ({ (counter) += (p)->n_pkts_ah_drop; (p)->n_pkts_ah_drop = 0; })
 
 #define RTE_PIPELINE_STATS_TABLE_DROP0(p)				\
-	({ (p)->pkts_drop_mask = (p)->action_mask0[RTE_PIPELINE_ACTION_DROP]; })
+	__extension__ ({ (p)->pkts_drop_mask = (p)->action_mask0[RTE_PIPELINE_ACTION_DROP]; })
 
 #define RTE_PIPELINE_STATS_TABLE_DROP1(p, counter)			\
-({									\
+__extension__ ({							\
 	uint64_t mask = (p)->action_mask0[RTE_PIPELINE_ACTION_DROP];	\
 	mask ^= (p)->pkts_drop_mask;					\
 	(counter) += rte_popcount64(mask);			\
diff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h
index 8ec12263b9..92eb933376 100644
--- a/lib/pipeline/rte_swx_pipeline_internal.h
+++ b/lib/pipeline/rte_swx_pipeline_internal.h
@@ -1485,7 +1485,7 @@ instr_operand_nbo(struct thread *t, const struct instr_operand *x)
 #endif
 
 #define METADATA_READ(thread, offset, n_bits)                                  \
-({                                                                             \
+__extension__ ({                                                               \
 	uint64_t *m64_ptr = (uint64_t *)&(thread)->metadata[offset];           \
 	uint64_t m64 = *m64_ptr;                                               \
 	uint64_t m64_mask = UINT64_MAX >> (64 - (n_bits));                     \
diff --git a/lib/port/rte_port_source_sink.c b/lib/port/rte_port_source_sink.c
index 4426f13499..a4486a7199 100644
--- a/lib/port/rte_port_source_sink.c
+++ b/lib/port/rte_port_source_sink.c
@@ -178,7 +178,7 @@ pcap_source_load(struct rte_port_source *port,
 #else /* RTE_PORT_PCAP */
 
 #define PCAP_SOURCE_LOAD(port, file_name, n_bytes, socket_id)	\
-({								\
+__extension__ ({						\
 	int _ret = 0;						\
 								\
 	if (file_name) {					\
@@ -431,7 +431,7 @@ do {								\
 #else
 
 #define PCAP_SINK_OPEN(port, file_name, max_n_pkts)		\
-({								\
+__extension__ ({						\
 	int _ret = 0;						\
 								\
 	if (file_name) {					\
-- 
2.43.0


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

* Re: [PATCH v2 1/3] eal: add helper to skip whitespaces
  2024-02-16 10:24   ` [PATCH v2 1/3] eal: add helper to skip whitespaces David Marchand
@ 2024-02-16 10:27     ` David Marchand
  2024-02-16 10:39       ` Bruce Richardson
  0 siblings, 1 reply; 16+ messages in thread
From: David Marchand @ 2024-02-16 10:27 UTC (permalink / raw)
  To: dev
  Cc: Tyler Retzlaff, Sunil Kumar Kori, Rakesh Kudurumalla,
	Jerin Jacob, Srikanth Yalavarthi, Cristian Dumitrescu,
	Aman Singh, Yuying Zhang, Brian Dooley,
	Gowrishankar Muthukrishnan, Bruce Richardson

On Fri, Feb 16, 2024 at 11:25 AM David Marchand
<david.marchand@redhat.com> wrote:
>
> Reduce code duplication by providing a simple inline helper.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

I forgot to mention:

Changes since v1:
- renamed helper as per Bruce suggestion,


-- 
David Marchand


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

* Re: [PATCH v2 1/3] eal: add helper to skip whitespaces
  2024-02-16 10:27     ` David Marchand
@ 2024-02-16 10:39       ` Bruce Richardson
  0 siblings, 0 replies; 16+ messages in thread
From: Bruce Richardson @ 2024-02-16 10:39 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Tyler Retzlaff, Sunil Kumar Kori, Rakesh Kudurumalla,
	Jerin Jacob, Srikanth Yalavarthi, Cristian Dumitrescu,
	Aman Singh, Yuying Zhang, Brian Dooley,
	Gowrishankar Muthukrishnan

On Fri, Feb 16, 2024 at 11:27:10AM +0100, David Marchand wrote:
> On Fri, Feb 16, 2024 at 11:25 AM David Marchand
> <david.marchand@redhat.com> wrote:
> >
> > Reduce code duplication by providing a simple inline helper.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> 
> I forgot to mention:
> 
> Changes since v1:
> - renamed helper as per Bruce suggestion,
> 
With that done, how can I fail to ack this! :-)

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

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

* Re: [PATCH v2 0/3] add __extension__ keyword to statement expressions
  2024-02-16 10:24 ` [PATCH v2 0/3] add __extension__ " David Marchand
                     ` (2 preceding siblings ...)
  2024-02-16 10:24   ` [PATCH v2 3/3] add extension keyword to GCC statement expressions David Marchand
@ 2024-02-16 17:04   ` David Marchand
  3 siblings, 0 replies; 16+ messages in thread
From: David Marchand @ 2024-02-16 17:04 UTC (permalink / raw)
  To: dev, Tyler Retzlaff

On Fri, Feb 16, 2024 at 11:25 AM David Marchand
<david.marchand@redhat.com> wrote:
>
> Tyler explained in v1:
> """
> As requested from previous rejected series this series applies the
> __extension__ keyword to all statement expressionsin DPDK.
> """
>
> Changes since v1:
> - rebased,
> - added two cleanups before Tyler patch,

Series applied, thanks.


-- 
David Marchand


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

* Re: [PATCH v2 3/3] add extension keyword to GCC statement expressions
  2024-02-16 10:24   ` [PATCH v2 3/3] add extension keyword to GCC statement expressions David Marchand
@ 2024-02-18  3:07     ` fengchengwen
  0 siblings, 0 replies; 16+ messages in thread
From: fengchengwen @ 2024-02-18  3:07 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: Tyler Retzlaff, Ruifeng Wang, Hemant Agrawal, Sachin Saxena,
	Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	Kai Ji, Gagandeep Singh, Jerin Jacob, Harman Kalra,
	Srikanth Yalavarthi, Shai Brandes, Evgeny Schemeilin, Ron Beider,
	Amit Bernstein, Wajeeh Atrash, Apeksha Gupta, Maciej Czekaj,
	Jiawen Wu, Jian Wang, Rosen Xu, Cristian Dumitrescu,
	Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko

For drivers/dma/hisilicon/hisi_dmadev.c part,
Acked-by: Chengwen Feng <fengchengwen@huawei.com>

On 2024/2/16 18:24, David Marchand wrote:
> From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> 
> Add __extension__ keyword to gcc statement expression extensions.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  drivers/bus/fslmc/mc/fsl_mc_sys.h             |  6 ++--
>  drivers/common/cnxk/roc_io.h                  |  6 ++--
>  drivers/common/cnxk/roc_platform.h            |  2 +-
>  drivers/common/dpaax/dpaa_list.h              |  2 +-
>  drivers/common/qat/qat_adf/icp_qat_hw.h       |  2 +-
>  drivers/crypto/armv8/rte_armv8_pmd.c          |  4 +--
>  drivers/crypto/caam_jr/caam_jr_desc.h         |  2 +-
>  drivers/dma/hisilicon/hisi_dmadev.c           |  2 +-
>  drivers/event/octeontx/ssovf_evdev.h          |  4 +--
>  drivers/mempool/octeontx/octeontx_fpavf.h     |  4 +--
>  drivers/ml/cnxk/cn10k_ml_dev.h                |  4 +--
>  drivers/net/ena/base/ena_plat_dpdk.h          | 14 ++++-----
>  drivers/net/ena/ena_ethdev.c                  | 30 +++++++++----------
>  drivers/net/enetfec/enet_ethdev.h             |  2 +-
>  drivers/net/fm10k/base/fm10k_osdep.h          |  2 +-
>  drivers/net/octeontx/base/octeontx_io.h       |  6 ++--
>  drivers/net/pfe/base/cbus.h                   |  2 +-
>  drivers/net/pfe/base/pfe.h                    | 12 ++++----
>  drivers/net/tap/bpf/bpf_api.h                 |  2 +-
>  drivers/net/thunderx/base/nicvf_plat.h        |  4 +--
>  drivers/net/txgbe/base/txgbe_osdep.h          |  2 +-
>  drivers/raw/ifpga/afu_pmd_core.h              |  2 +-
>  drivers/raw/ifpga/base/ifpga_compat.h         |  2 +-
>  drivers/raw/ifpga/base/opae_osdep.h           |  4 +--
>  drivers/raw/ifpga/base/opae_spi_transaction.c |  2 +-
>  examples/qos_meter/main.h                     |  2 +-
>  lib/ethdev/rte_mtr.c                          | 10 +++----
>  lib/ethdev/rte_tm.c                           |  6 ++--
>  lib/pipeline/rte_pipeline.c                   |  8 ++---
>  lib/pipeline/rte_swx_pipeline_internal.h      |  2 +-
>  lib/port/rte_port_source_sink.c               |  4 +--
>  31 files changed, 78 insertions(+), 78 deletions(-)
> 

...

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

* RE: [PATCH v2 2/3] drivers: use common min/max macros
  2024-02-16 10:24   ` [PATCH v2 2/3] drivers: use common min/max macros David Marchand
@ 2024-02-19  1:37     ` Xu, Rosen
  2024-02-19  2:13     ` Ajit Khaparde
  1 sibling, 0 replies; 16+ messages in thread
From: Xu, Rosen @ 2024-02-19  1:37 UTC (permalink / raw)
  To: Marchand, David, dev
  Cc: Ajit Khaparde, Somnath Kotur, Devendra Singh Rawat, Alok Prasad

Hi,

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Friday, February 16, 2024 6:25 PM
> To: dev@dpdk.org
> Cc: Ajit Khaparde <ajit.khaparde@broadcom.com>; Somnath Kotur
> <somnath.kotur@broadcom.com>; Devendra Singh Rawat
> <dsinghrawat@marvell.com>; Alok Prasad <palok@marvell.com>; Xu, Rosen
> <rosen.xu@intel.com>
> Subject: [PATCH v2 2/3] drivers: use common min/max macros
> 
> Use newly introduced macro.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  drivers/net/bnxt/bnxt_ethdev.c                   | 12 +-----------
>  drivers/net/qede/base/bcm_osal.h                 |  6 ++----
>  drivers/raw/ifpga/base/osdep_rte/osdep_generic.h | 11 ++---------
>  3 files changed, 5 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c
> b/drivers/net/bnxt/bnxt_ethdev.c index 45d840d7af..8cc012206a 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -4867,17 +4867,7 @@ static void bnxt_free_ctx_mem(struct bnxt *bp)
> 
>  #define bnxt_roundup(x, y)   ((((x) + ((y) - 1)) / (y)) * (y))
> 
> -#define min_t(type, x, y) ({                    \
> -	type __min1 = (x);                      \
> -	type __min2 = (y);                      \
> -	__min1 < __min2 ? __min1 : __min2; })
> -
> -#define max_t(type, x, y) ({                    \
> -	type __max1 = (x);                      \
> -	type __max2 = (y);                      \
> -	__max1 > __max2 ? __max1 : __max2; })
> -
> -#define clamp_t(type, _x, min, max)     min_t(type, max_t(type, _x, min),
> max)
> +#define clamp_t(type, _x, min, max) RTE_MIN_T(RTE_MAX_T(_x, min,
> type),
> +max, type)
> 
>  int bnxt_alloc_ctx_mem(struct bnxt *bp)  { diff --git
> a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
> index 11019b5623..7869103c63 100644
> --- a/drivers/net/qede/base/bcm_osal.h
> +++ b/drivers/net/qede/base/bcm_osal.h
> @@ -443,10 +443,8 @@ u32 qede_osal_log2(u32);  #define OSAL_IOMEM
> volatile
>  #define OSAL_UNUSED    __rte_unused
>  #define OSAL_UNLIKELY(x)  __builtin_expect(!!(x), 0)
> -#define OSAL_MIN_T(type, __min1, __min2)	\
> -	((type)(__min1) < (type)(__min2) ? (type)(__min1) : (type)(__min2))
> -#define OSAL_MAX_T(type, __max1, __max2)	\
> -	((type)(__max1) > (type)(__max2) ? (type)(__max1) :
> (type)(__max2))
> +#define OSAL_MIN_T(type, __min1, __min2) RTE_MIN_T(__min1, __min2,
> +type) #define OSAL_MAX_T(type, __max1, __max2) RTE_MAX_T(__max1,
> +__max2, type)
> 
>  void qede_get_mcp_proto_stats(struct ecore_dev *, enum
> ecore_mcp_protocol_type,
>  			      union ecore_mcp_protocol_stats *); diff --git
> a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
> b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
> index 62c5666ca9..427793a578 100644
> --- a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
> +++ b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
> @@ -44,15 +44,8 @@ extern int ifpga_rawdev_logtype;  #define min(a, b)
> RTE_MIN(a, b)  #define max(a, b) RTE_MAX(a, b)
> 
> -#define min_t(type, x, y) ({                    \
> -	type __min1 = (x);                      \
> -	type __min2 = (y);                      \
> -	__min1 < __min2 ? __min1 : __min2; })
> -
> -#define max_t(type, x, y) ({                    \
> -	type __max1 = (x);                      \
> -	type __max2 = (y);                      \
> -	__max1 > __max2 ? __max1 : __max2; })
> +#define min_t(type, x, y) RTE_MIN_T(x, y, type) #define max_t(type, x,
> +y) RTE_MAX_T(x, y, type)
> 
>  #define spinlock_t rte_spinlock_t
>  #define spinlock_init(x) rte_spinlock_init(x)
> --
> 2.43.0

Reviewed-by: Rosen Xu <rosen.xu@intel.com>

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

* Re: [PATCH v2 2/3] drivers: use common min/max macros
  2024-02-16 10:24   ` [PATCH v2 2/3] drivers: use common min/max macros David Marchand
  2024-02-19  1:37     ` Xu, Rosen
@ 2024-02-19  2:13     ` Ajit Khaparde
  1 sibling, 0 replies; 16+ messages in thread
From: Ajit Khaparde @ 2024-02-19  2:13 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Somnath Kotur, Devendra Singh Rawat, Alok Prasad, Rosen Xu

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

On Fri, Feb 16, 2024 at 2:25 AM David Marchand
<david.marchand@redhat.com> wrote:
>
> Use newly introduced macro.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

> ---
>  drivers/net/bnxt/bnxt_ethdev.c                   | 12 +-----------
>  drivers/net/qede/base/bcm_osal.h                 |  6 ++----
>  drivers/raw/ifpga/base/osdep_rte/osdep_generic.h | 11 ++---------
>  3 files changed, 5 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index 45d840d7af..8cc012206a 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -4867,17 +4867,7 @@ static void bnxt_free_ctx_mem(struct bnxt *bp)
>
>  #define bnxt_roundup(x, y)   ((((x) + ((y) - 1)) / (y)) * (y))
>
> -#define min_t(type, x, y) ({                    \
> -       type __min1 = (x);                      \
> -       type __min2 = (y);                      \
> -       __min1 < __min2 ? __min1 : __min2; })
> -
> -#define max_t(type, x, y) ({                    \
> -       type __max1 = (x);                      \
> -       type __max2 = (y);                      \
> -       __max1 > __max2 ? __max1 : __max2; })
> -
> -#define clamp_t(type, _x, min, max)     min_t(type, max_t(type, _x, min), max)
> +#define clamp_t(type, _x, min, max) RTE_MIN_T(RTE_MAX_T(_x, min, type), max, type)
>
>  int bnxt_alloc_ctx_mem(struct bnxt *bp)
>  {
> diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
> index 11019b5623..7869103c63 100644
> --- a/drivers/net/qede/base/bcm_osal.h
> +++ b/drivers/net/qede/base/bcm_osal.h
> @@ -443,10 +443,8 @@ u32 qede_osal_log2(u32);
>  #define OSAL_IOMEM volatile
>  #define OSAL_UNUSED    __rte_unused
>  #define OSAL_UNLIKELY(x)  __builtin_expect(!!(x), 0)
> -#define OSAL_MIN_T(type, __min1, __min2)       \
> -       ((type)(__min1) < (type)(__min2) ? (type)(__min1) : (type)(__min2))
> -#define OSAL_MAX_T(type, __max1, __max2)       \
> -       ((type)(__max1) > (type)(__max2) ? (type)(__max1) : (type)(__max2))
> +#define OSAL_MIN_T(type, __min1, __min2) RTE_MIN_T(__min1, __min2, type)
> +#define OSAL_MAX_T(type, __max1, __max2) RTE_MAX_T(__max1, __max2, type)
>
>  void qede_get_mcp_proto_stats(struct ecore_dev *, enum ecore_mcp_protocol_type,
>                               union ecore_mcp_protocol_stats *);
> diff --git a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
> index 62c5666ca9..427793a578 100644
> --- a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
> +++ b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
> @@ -44,15 +44,8 @@ extern int ifpga_rawdev_logtype;
>  #define min(a, b) RTE_MIN(a, b)
>  #define max(a, b) RTE_MAX(a, b)
>
> -#define min_t(type, x, y) ({                    \
> -       type __min1 = (x);                      \
> -       type __min2 = (y);                      \
> -       __min1 < __min2 ? __min1 : __min2; })
> -
> -#define max_t(type, x, y) ({                    \
> -       type __max1 = (x);                      \
> -       type __max2 = (y);                      \
> -       __max1 > __max2 ? __max1 : __max2; })
> +#define min_t(type, x, y) RTE_MIN_T(x, y, type)
> +#define max_t(type, x, y) RTE_MAX_T(x, y, type)
>
>  #define spinlock_t rte_spinlock_t
>  #define spinlock_init(x) rte_spinlock_init(x)
> --
> 2.43.0
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

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

end of thread, other threads:[~2024-02-19  2:13 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-15 23:02 [PATCH 0/4] add __extension__ keyword to statement expressions Tyler Retzlaff
2023-11-15 23:02 ` [PATCH 1/4] lib: add extension " Tyler Retzlaff
2023-11-15 23:02 ` [PATCH 2/4] app: " Tyler Retzlaff
2023-11-15 23:02 ` [PATCH 3/4] drivers: " Tyler Retzlaff
2023-11-20  7:42   ` Ruifeng Wang
2023-11-15 23:02 ` [PATCH 4/4] examples: " Tyler Retzlaff
2024-02-16 10:24 ` [PATCH v2 0/3] add __extension__ " David Marchand
2024-02-16 10:24   ` [PATCH v2 1/3] eal: add helper to skip whitespaces David Marchand
2024-02-16 10:27     ` David Marchand
2024-02-16 10:39       ` Bruce Richardson
2024-02-16 10:24   ` [PATCH v2 2/3] drivers: use common min/max macros David Marchand
2024-02-19  1:37     ` Xu, Rosen
2024-02-19  2:13     ` Ajit Khaparde
2024-02-16 10:24   ` [PATCH v2 3/3] add extension keyword to GCC statement expressions David Marchand
2024-02-18  3:07     ` fengchengwen
2024-02-16 17:04   ` [PATCH v2 0/3] add __extension__ keyword to " 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).