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 3D67245DBA; Wed, 27 Nov 2024 20:39:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A37E402AE; Wed, 27 Nov 2024 20:39:36 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8BE884029C for ; Wed, 27 Nov 2024 20:39:34 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 8B6842057224; Wed, 27 Nov 2024 11:39:33 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8B6842057224 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1732736373; bh=EIJ9RE+tDOZDUOxD5CfRgGdOF4gXsYe0z+diofzSQC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e2+AbJ1s0HedeOAo2j6DpmSxWAmv3dCi5lh3/gdmPWu71GsbTJOHbYekuTDeM3Hae db9kLMaRB/siPkTSR6HPzZubU8qCp9G2ou/YQfsmAEHjtEeyTPIBkcgROwH0+rbdLS SWG1cutN4kTHP2HFb+XxwnsLJoBBR+GYaLqptlpU= From: Andre Muezerie To: andremue@linux.microsoft.com Cc: dev@dpdk.org, roretzla@linux.microsoft.com Subject: [PATCH v2] lib/eal: fix macros for noinline and alwaysinline for MSVC Date: Wed, 27 Nov 2024 11:39:30 -0800 Message-Id: <1732736370-19115-1-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1732723879-23806-1-git-send-email-andremue@linux.microsoft.com> References: <1732723879-23806-1-git-send-email-andremue@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 MSVC supports forcing code to be inlined or forcing code to not be inlined, like other compilers. This patch fixes existing macros __rte_noinline and __rte_always_inline so that they also do what is expected from them when used with MSVC. Signed-off-by: Andre Muezerie --- lib/eal/include/rte_common.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index 21bfd26b2b..ed6e2c7ffd 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -410,7 +410,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) * Force a function to be inlined */ #ifdef RTE_TOOLCHAIN_MSVC -#define __rte_always_inline +#define __rte_always_inline __forceinline #else #define __rte_always_inline inline __attribute__((always_inline)) #endif @@ -418,7 +418,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) /** * Force a function to be noinlined */ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_noinline __declspec(noinline) +#else #define __rte_noinline __attribute__((noinline)) +#endif /** * Hint function in the hot path -- 2.34.1