From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E6E7BA00C5; Mon, 6 Jul 2020 09:49:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8DC051D685; Mon, 6 Jul 2020 09:49:52 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id BD34D1D684 for ; Mon, 6 Jul 2020 09:49:50 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 36AD0C0A; Mon, 6 Jul 2020 00:49:50 -0700 (PDT) Received: from net-arm-thunderx2-03.shanghai.arm.com (net-arm-thunderx2-03.shanghai.arm.com [10.169.41.185]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C4A503F71E; Mon, 6 Jul 2020 00:49:45 -0700 (PDT) From: Joyce Kong To: maxime.coquelin@redhat.com, jerinj@marvell.com, zhihong.wang@intel.com, xiaolong.ye@intel.com, beilei.xing@intel.com, jia.guo@intel.com, john.mcnamara@intel.com, matan@mellanox.com, shahafs@mellanox.com, viacheslavo@mellanox.com, honnappa.nagarahalli@arm.com, phil.yang@arm.com, ruifeng.wang@arm.com Cc: dev@dpdk.org, nd@arm.com Date: Mon, 6 Jul 2020 15:49:25 +0800 Message-Id: <20200706074930.54299-2-joyce.kong@arm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200706074930.54299-1-joyce.kong@arm.com> References: <20200611033248.39049-1-joyce.kong@arm.com> <20200706074930.54299-1-joyce.kong@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 1/6] lib/eal: add a common wrapper for restricted pointers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The 'restrict' keyword is recognized in C99, while type qulifier '__restrict' compiles ok in C with all language levels. This patch is to add a wrapper defining '__rte_restrict' with 'restrict' and '__restrict' to be supported by all compilers. Signed-off-by: Joyce Kong --- lib/librte_eal/include/rte_common.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/librte_eal/include/rte_common.h b/lib/librte_eal/include/rte_common.h index 0843ce69e..cda32c056 100644 --- a/lib/librte_eal/include/rte_common.h +++ b/lib/librte_eal/include/rte_common.h @@ -103,6 +103,16 @@ typedef uint16_t unaligned_uint16_t; */ #define __rte_unused __attribute__((__unused__)) +/** + * Define a wrapper for restricted pointers which can be supported + * by all compilers. + */ +#if __STDC_VERSION__ >= 199901 +#define __rte_restrict restrict +#else +#define __rte_restrict __restrict +#endif + /** * definition to mark a variable or function parameter as used so * as to avoid a compiler warning -- 2.27.0