[v2] lib/eal: fix macros for noinline and alwaysinline for MSVC
Checks
Commit Message
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 <andremue@linux.microsoft.com>
---
lib/eal/include/rte_common.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
@@ -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