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 9399545DB7; Wed, 27 Nov 2024 17:11:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7EE804060C; Wed, 27 Nov 2024 17:11:31 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 07D43402AB for ; Wed, 27 Nov 2024 17:11:30 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id F154E205721F; Wed, 27 Nov 2024 08:11:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F154E205721F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1732723888; bh=aYcrthQ462jzlH13JvaPaq1XooWLhfc17h1Z1hQMXgE=; h=From:To:Cc:Subject:Date:From; b=CIyqNDccIZNuEtaKaL5ntYQUuLY/aUhJijy3Vq+/qxoHgmffT1aYWowGCKo1Lj3aj 2UJOUqNLNLA7BhJNZgDYtNQZQqkTkqwUDLPteLwP3NpeaR+YPglnMC364zS6xZe3Sx QxwObi3eJWsN5zELZx/OQVNNv0FoGhdFtGHm1PNY= From: Andre Muezerie To: Tyler Retzlaff Cc: dev@dpdk.org, Andre Muezerie , Andre Muezerie Subject: [PATCH] lib/eal: fix macros for noinline and alwaysinline for MSVC Date: Wed, 27 Nov 2024 08:11:19 -0800 Message-Id: <1732723879-23806-1-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 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 From: Andre Muezerie 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 4d299f2b36..f97e52f869 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -408,7 +408,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 @@ -416,7 +416,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.47.0.vfs.0.3