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 2C6DE460ED; Wed, 22 Jan 2025 17:24:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D0370402D5; Wed, 22 Jan 2025 17:24:34 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 5B695402BC for ; Wed, 22 Jan 2025 17:24:33 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 53311203E3BA; Wed, 22 Jan 2025 08:24:32 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 53311203E3BA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1737563072; bh=9ElHXDFMjrl8ZIwzADK+cKY05nU7B7zr2eblAk4V3w8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WGdl4kvyDaj6p02afWCTiSHdmCmPxp8DaSilKs8OX92JOgHa00J1o7jw8Uy3oQiQL JyYbCdg0kpb8RHz6LGhdEGZuj0x9CRLG0YS7AOHyl0U2s8J5ELhGGR1tBBK2xE9lD1 0KsKWm5ZjP4rN9190cEH43L8tuP13JyE2YT4V0PA= From: Andre Muezerie To: andremue@linux.microsoft.com Cc: dev@dpdk.org, roretzla@linux.microsoft.com Subject: [PATCH v3] eal: fix macros for MSVC: noinline, alwaysinline, hot Date: Wed, 22 Jan 2025 08:24:25 -0800 Message-Id: <1737563065-18741-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. It does not support the "hot" hint though. 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. __rte_hot is updated to become a noop when MSCS is used. Signed-off-by: Andre Muezerie --- lib/eal/include/rte_common.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index 40592f71b1..f344d54fce 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -427,7 +427,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 @@ -435,12 +435,20 @@ 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 */ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_hot +#else #define __rte_hot __attribute__((hot)) +#endif /** * Hint function in the cold path -- 2.47.2.vfs.0.1