folly/portability: move some macro definitions to `CPortability.h`
[folly.git] / folly / CPortability.h
index 5c497cb2f06492eca0267117cae5292e986a7c2a..e09a333bec6e854fd9ba89bc661ad1380228f53d 100644 (file)
 #else
 # define FOLLY_EXPORT
 #endif
+
+// noinline
+#ifdef _MSC_VER
+# define FOLLY_NOINLINE __declspec(noinline)
+#elif defined(__clang__) || defined(__GNUC__)
+# define FOLLY_NOINLINE __attribute__((__noinline__))
+#else
+# define FOLLY_NOINLINE
+#endif
+
+// always inline
+#ifdef _MSC_VER
+# define FOLLY_ALWAYS_INLINE __forceinline
+#elif defined(__clang__) || defined(__GNUC__)
+# define FOLLY_ALWAYS_INLINE inline __attribute__((__always_inline__))
+#else
+# define FOLLY_ALWAYS_INLINE inline
+#endif