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 <andre...@linux.microsoft.com> --- 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