commit a5ecf70b5190fb495630c3e9ea405d7131337359
parent 2dc71ae8ac32aaec0b5e00fdb37d9a1c0e26db90
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date: Tue, 2 Aug 2022 17:16:01 +0100
CMT_NO_FORCE_INLINE to disable inlining
Diffstat:
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/include/kfr/cident.h b/include/kfr/cident.h
@@ -347,7 +347,12 @@ extern char* gets(char* __s);
#define CMT_NODEBUG
+#ifndef CMT_NO_FORCE_INLINE
#define CMT_ALWAYS_INLINE __attribute__((__always_inline__))
+#else
+#define CMT_ALWAYS_INLINE
+#endif
+
#define CMT_INLINE __inline__ CMT_ALWAYS_INLINE
#define CMT_INLINE_MEMBER CMT_ALWAYS_INLINE
#if defined(CMT_COMPILER_GCC) && \
@@ -358,7 +363,11 @@ extern char* gets(char* __s);
#define CMT_INLINE_LAMBDA CMT_INLINE_MEMBER
#endif
#define CMT_NOINLINE __attribute__((__noinline__))
+#ifndef CMT_NO_FORCE_INLINE
#define CMT_FLATTEN __attribute__((__flatten__))
+#else
+#define CMT_FLATTEN
+#endif
#define CMT_RESTRICT __restrict__
#define CMT_LIKELY(...) __builtin_expect(!!(__VA_ARGS__), 1)
@@ -366,12 +375,21 @@ extern char* gets(char* __s);
#elif defined(CMT_MSVC_ATTRIBUTES)
+#ifndef CMT_NO_FORCE_INLINE
+#if _MSC_VER >= 1927
+#define CMT_ALWAYS_INLINE [[msvc::forceinline]]
+#else
#define CMT_ALWAYS_INLINE __forceinline
+#endif
+#else
+#define CMT_ALWAYS_INLINE
+#endif
+
#define CMT_NODEBUG
-#define CMT_INLINE /*inline*/ __forceinline
-#define CMT_INLINE_MEMBER __forceinline
+#define CMT_INLINE /*inline*/ CMT_ALWAYS_INLINE
+#define CMT_INLINE_MEMBER CMT_ALWAYS_INLINE
#if _MSC_VER >= 1927
-#define CMT_INLINE_LAMBDA [[msvc::forceinline]]
+#define CMT_INLINE_LAMBDA CMT_ALWAYS_INLINE
#else
#define CMT_INLINE_LAMBDA
#endif