From patchwork Tue Dec 19 17:27:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 135343 X-Patchwork-Delegate: thomas@monjalon.net 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 31D7943747; Tue, 19 Dec 2023 18:27:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0B3AF42E3E; Tue, 19 Dec 2023 18:27:50 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 7440342E11 for ; Tue, 19 Dec 2023 18:27:47 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id B74B920B3CC2; Tue, 19 Dec 2023 09:27:46 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B74B920B3CC2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1703006866; bh=5HWNgsShq4RKsn8+OGmQ5ptrAyl7dRNL27IRQvCeeH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ea67RJ0WiHl+puy1YOHAm9guk4rQRENsXZVk1HqNYivtpSupbHJp38Wh2+gxxSFY1 fb7Ir65xMdxRLIsvs4xp7i8dPoA9UHAqWHf/qNc2zRAlC+oFlafelQjHNmQJ5eKrqF uIRYDH9ds2VZ2OHxyC/IwVxpjnUexwTNsp7qbAYY= From: Tyler Retzlaff To: dev@dpdk.org Cc: Tyler Retzlaff Subject: [PATCH 1/2] eal: provide type instead of expression to per lcore macro Date: Tue, 19 Dec 2023 09:27:43 -0800 Message-Id: <1703006864-27378-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1703006864-27378-1-git-send-email-roretzla@linux.microsoft.com> References: <1703006864-27378-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 Adjust the use of per lcore macro to provide type as the first argument as to not require __typeof__ during expansion. Signed-off-by: Tyler Retzlaff --- lib/eal/common/eal_common_errno.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eal/common/eal_common_errno.c b/lib/eal/common/eal_common_errno.c index b30e2f0..fff8c1f 100644 --- a/lib/eal/common/eal_common_errno.c +++ b/lib/eal/common/eal_common_errno.c @@ -28,7 +28,7 @@ static const char *sep = ""; #endif #define RETVAL_SZ 256 - static RTE_DEFINE_PER_LCORE(char[RETVAL_SZ], retval); + static RTE_DEFINE_PER_LCORE(char, retval[RETVAL_SZ]); char *ret = RTE_PER_LCORE(retval); /* since some implementations of strerror_r throw an error From patchwork Tue Dec 19 17:27:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 135344 X-Patchwork-Delegate: thomas@monjalon.net 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 2B6B743747; Tue, 19 Dec 2023 18:28:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A702E42E4B; Tue, 19 Dec 2023 18:27:51 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 934AF42E3A for ; Tue, 19 Dec 2023 18:27:47 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id C3DED20B3CC4; Tue, 19 Dec 2023 09:27:46 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C3DED20B3CC4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1703006866; bh=mNX0HhYkYfM/XwpdVXSqWKKBU92WonGrCdwxOg/TDss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C/1BMNIvvn4KoywuGaVkL3CeIbcxF2qJtV8EqQvci7XvDUWZL2R64WAB4pV7v+DHh 08X6mAWn0GM/ScUCk0LGdJEhxFw2EIGEzcbAAHVvo3ApK9nSceinhafh7A2Yp6Zi9x HIuOWbMixtNqHjm1duq81x5Y5/E7m7CMFQ8BXd+U= From: Tyler Retzlaff To: dev@dpdk.org Cc: Tyler Retzlaff Subject: [PATCH 2/2] eal: remove typeof from per lcore macros Date: Tue, 19 Dec 2023 09:27:44 -0800 Message-Id: <1703006864-27378-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1703006864-27378-1-git-send-email-roretzla@linux.microsoft.com> References: <1703006864-27378-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 The design of the macros requires a type to be provided to the macro. By expanding the type parameter inside of typeof it also inadvertently allows an expression to be used which appears not to have been intended after evaluating the parameter name and existing macro use. Technically this is an API break but only for applications that were using these macros outside of the original design intent. Signed-off-by: Tyler Retzlaff --- lib/eal/include/rte_per_lcore.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/eal/include/rte_per_lcore.h b/lib/eal/include/rte_per_lcore.h index 41fe1f0..529995e 100644 --- a/lib/eal/include/rte_per_lcore.h +++ b/lib/eal/include/rte_per_lcore.h @@ -24,10 +24,10 @@ #ifdef RTE_TOOLCHAIN_MSVC #define RTE_DEFINE_PER_LCORE(type, name) \ - __declspec(thread) typeof(type) per_lcore_##name + __declspec(thread) type per_lcore_##name #define RTE_DECLARE_PER_LCORE(type, name) \ - extern __declspec(thread) typeof(type) per_lcore_##name + extern __declspec(thread) type per_lcore_##name #else /** * Macro to define a per lcore variable "var" of type "type", don't @@ -35,13 +35,13 @@ * whole macro. */ #define RTE_DEFINE_PER_LCORE(type, name) \ - __thread __typeof__(type) per_lcore_##name + __thread type per_lcore_##name /** * Macro to declare an extern per lcore variable "var" of type "type" */ #define RTE_DECLARE_PER_LCORE(type, name) \ - extern __thread __typeof__(type) per_lcore_##name + extern __thread type per_lcore_##name #endif /**