From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B982A42E47; Tue, 11 Jul 2023 17:52:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 00D74410EE; Tue, 11 Jul 2023 17:52:33 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id F208B40A7D for ; Tue, 11 Jul 2023 17:52:29 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 0140021C426C; Tue, 11 Jul 2023 08:52:28 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0140021C426C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689090749; bh=8z9euYeWHlMFYyIwD9X8GKgZDsKRXIQs8F/v0Nn6fvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jM8ML/LuIJ+G8mwwbj10Jc4kaATnJ5jYo3AFNI6KRSuSNMllDGmrutJH+XK03M8fo WeYtUjeJ8WXiZmYtYoOiVPGKjxrdHgx5QyVLPTD4/dNFmQafMk3N8aWFF0nGOxQa+u m5x4HOCakY05EL8P6DoSXTzXo0foOKDaBhvX7Aok= From: Tyler Retzlaff To: dev@dpdk.org Cc: david.marchand@redhat.com, thomas@monjalon.net, Tyler Retzlaff Subject: [PATCH v2] eal: provide per lcore macros for MSVC Date: Tue, 11 Jul 2023 08:52:27 -0700 Message-Id: <1689090747-5331-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689090747-5331-1-git-send-email-roretzla@linux.microsoft.com> References: <1689024585-17303-1-git-send-email-roretzla@linux.microsoft.com> <1689090747-5331-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 Provide per lcore macros that use __declspec(thread) and uses C23 typeof. Signed-off-by: Tyler Retzlaff --- lib/eal/include/rte_per_lcore.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/eal/include/rte_per_lcore.h b/lib/eal/include/rte_per_lcore.h index eaedf0c..2b846f9 100644 --- a/lib/eal/include/rte_per_lcore.h +++ b/lib/eal/include/rte_per_lcore.h @@ -24,19 +24,27 @@ #include +#ifdef RTE_TOOLCHAIN_MSVC /** * Macro to define a per lcore variable "var" of type "type", don't * use keywords like "static" or "volatile" in type, just prefix the * whole macro. */ #define RTE_DEFINE_PER_LCORE(type, name) \ - __thread __typeof__(type) per_lcore_##name + __declspec(thread) typeof(type) per_lcore_##name /** * Macro to declare an extern per lcore variable "var" of type "type" */ #define RTE_DECLARE_PER_LCORE(type, name) \ + extern __declspec(thread) typeof(type) per_lcore_##name +#else +#define RTE_DEFINE_PER_LCORE(type, name) \ + __thread __typeof__(type) per_lcore_##name + +#define RTE_DECLARE_PER_LCORE(type, name) \ extern __thread __typeof__(type) per_lcore_##name +#endif /** * Read/write the per-lcore variable value -- 1.8.3.1