From patchwork Wed Nov 15 23:02:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 134405 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8A3B04333B; Thu, 16 Nov 2023 00:03:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9792440A7D; Thu, 16 Nov 2023 00:03:02 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 3C85E4025F for ; Thu, 16 Nov 2023 00:03:00 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 41C5B20B74C2; Wed, 15 Nov 2023 15:02:59 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 41C5B20B74C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1700089379; bh=4IB/nLpismkTxokl5YkJWM3fX0K9eVmwCsPTYZdRdDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PYsVXrRf7ZRMZyl7L01AQS57RgCg82wyVpjUripC5xtLXPdZ97SLRaVcl9H0NDF4Z 2O4c+p5TxWe7AFev3NwpOuEMMoJQWyTxuGukDa5YqQ5ppJFEWLYSBfaoT6gO9xPpEk woYiZ84bP7aLvNmEP09PliKTpLCifjwSNIz/gSBg= From: Tyler Retzlaff To: dev@dpdk.org 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 Subject: [PATCH 1/4] lib: add extension keyword to statement expressions Date: Wed, 15 Nov 2023 15:02:55 -0800 Message-Id: <1700089378-26197-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1700089378-26197-1-git-send-email-roretzla@linux.microsoft.com> References: <1700089378-26197-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add __extension__ keyword to gcc statement expression extensions. Signed-off-by: Tyler Retzlaff --- 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) { \