From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 64B0E42E42;
	Tue, 11 Jul 2023 08:25:52 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id E430540A7D;
	Tue, 11 Jul 2023 08:25:51 +0200 (CEST)
Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com
 [66.111.4.26]) by mails.dpdk.org (Postfix) with ESMTP id 7A7FF4003C
 for <dev@dpdk.org>; Tue, 11 Jul 2023 08:25:50 +0200 (CEST)
Received: from compute6.internal (compute6.nyi.internal [10.202.2.47])
 by mailout.nyi.internal (Postfix) with ESMTP id 2764D5C0040;
 Tue, 11 Jul 2023 02:25:50 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute6.internal (MEProxy); Tue, 11 Jul 2023 02:25:50 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm2; t=
 1689056750; x=1689143150; bh=MfjjjKIVGkT2+i0Tf2iVvY6mnW6lhgHz/yL
 7za6vngM=; b=YV5r1LeS2MMXqKVQ8ybg/RqwRhAXoitLf11aimWqSiNpVVwnYEH
 mbAGYnCnkUKlLiIHqbzwbZ6Pf/9WSbffXtFEcoZosQ+gg3niAuTHBiwPUslg3z+k
 zhgbpx2AOTLc+cnT71I2yGqaCZBXmwj8g+zr5qx02nE4r4zYQqqo4dThLL4tjxxc
 KOljzLa8zwGK1eYMkP3dkAXpTzUM/MCbErLMmzhN/zxxvXQesp6cW8mHCJ3ErGaV
 3fuMKXi4i3G2tdyHVdxaKFUeigpaOf9nCbev3QQbzJxCoXbx+oubr315B4NsLvro
 V/0kKNcmdx2gxy9JmTR69zEeqSgiaxcG1uw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=
 1689056750; x=1689143150; bh=MfjjjKIVGkT2+i0Tf2iVvY6mnW6lhgHz/yL
 7za6vngM=; b=HXl9rwyyAc37bpl1H4puR1c3vb6HLlBOIrepZLkaQUiAeh9ARRb
 QFTvHveNTWyjFcgv204Gr8GU+QM2lTMfvuVQTiawE03VymuSLp7kuQr9PiRW1XzD
 b8yqf0y4nuvBqp2EvtRAZQIdg3KQLTvMGo0wAyJJuHF6qF7fNSM6GJXUr8BpjwoA
 y0TqEME3Q3zLZAbiq2sLdJ+86hn2bCIVt93GkvFE0xfa9gktFkc3So3Snn54Eoh3
 B/cooFMfMrfw9Oz6qFIEMDYczcSKP7C+YknbiiuSNxgyFLtbqr8hDSoiZBKYmALU
 EvQiwaYf3TEC2f30KENrOw1kwVyCUTYmOqQ==
X-ME-Sender: <xms:7fWsZH7zXadVA5qblMi93BCiwbAGbojDoZR8_7ThLfRVfI6-wHutTQ>
 <xme:7fWsZM784a_vTm89hZ9wq6BaAE3uLuREpgVDpEbRxBAZ28niMP2CVtaY0H4Qn0ANz
 kGswnWQ6wSOwxAh_A>
X-ME-Received: <xmr:7fWsZOcPopV4YGiuGN8lXf3C8C5XTQW10brsfTL-UCHtmyFuedPTWnB-SYnelZFa5B18hM5icUGBFonyFnLQvAljZA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrvdelgddutdelucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkfgjfhgggfgtsehtuf
 ertddttddvnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceothhhohhmrghs
 sehmohhnjhgrlhhonhdrnhgvtheqnecuggftrfgrthhtvghrnheptdejieeifeehtdffgf
 dvleetueeffeehueejgfeuteeftddtieekgfekudehtdfgnecuvehluhhsthgvrhfuihii
 vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonh
 drnhgvth
X-ME-Proxy: <xmx:7vWsZIK7IZAKyWOuC8_-WkE4-HKMjzm9Z2_Xk7OKaTGM-0bTwVNe3w>
 <xmx:7vWsZLJm74D7qvGH4YzU804IABedKSOtQD2kye0dPzxYnbj6XTicsw>
 <xmx:7vWsZBxCMYVLyzhrj0HRnBk44u9FNN8ghAT61Q7DD46jso0NvQihBg>
 <xmx:7vWsZBj173o0o02NxF7PfniHfhISE_52nU4FttIkTDXQf8c_ivazsA>
Feedback-ID: i47234305:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue,
 11 Jul 2023 02:25:49 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org, Tyler Retzlaff <roretzla@linux.microsoft.com>
Cc: david.marchand@redhat.com
Subject: Re: [PATCH] eal: provide per lcore macros for MSVC
Date: Tue, 11 Jul 2023 08:25:47 +0200
Message-ID: <5162377.8F6SAcFxjW@thomas>
In-Reply-To: <1689024585-17303-2-git-send-email-roretzla@linux.microsoft.com>
References: <1689024585-17303-1-git-send-email-roretzla@linux.microsoft.com>
 <1689024585-17303-2-git-send-email-roretzla@linux.microsoft.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

10/07/2023 23:29, Tyler Retzlaff:
> Provide per lcore macros that use __declspec(thread) and uses C23
> typeof.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
> +#ifndef 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
> @@ -37,6 +38,13 @@
>   */
>  #define RTE_DECLARE_PER_LCORE(type, name)			\
>  	extern __thread __typeof__(type) per_lcore_##name
> +#else
> +#define RTE_DEFINE_PER_LCORE(type, name)			\
> +	__declspec(thread) typeof(type) per_lcore_##name
> +
> +#define RTE_DECLARE_PER_LCORE(type, name)			\
> +	extern __declspec(thread) typeof(type) per_lcore_##name
> +#endif

It would be better (here and in other MSVC patches)
to have the opposite logic: start with MSVC implementation.

#ifdef MSVC
	MSVC implementation
#else
	POSIX implementation
#endif