From 7b77a513d2683c77df176fcec6108d5ef0eb72c4 Mon Sep 17 00:00:00 2001 From: Andrew Gallagher Date: Thu, 17 Nov 2016 21:16:07 -0800 Subject: [PATCH] folly/portability: move some macro definitions to `CPortability.h` Summary: These macros apply to both C and C++. Reviewed By: yfeldblum Differential Revision: D4199905 fbshipit-source-id: 8dc22959d0a6349c6c76415d1a38eda52cab83a5 --- folly/CPortability.h | 18 ++++++++++++++++++ folly/Portability.h | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/folly/CPortability.h b/folly/CPortability.h index 5c497cb2..e09a333b 100644 --- a/folly/CPortability.h +++ b/folly/CPortability.h @@ -107,3 +107,21 @@ #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 diff --git a/folly/Portability.h b/folly/Portability.h index 4dbc3bd3..1ec55c10 100644 --- a/folly/Portability.h +++ b/folly/Portability.h @@ -74,24 +74,6 @@ constexpr bool kHasUnalignedAccess = false; # define FOLLY_DEPRECATED(msg) #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 - // warn unused result #if defined(_MSC_VER) && (_MSC_VER >= 1700) #define FOLLY_WARN_UNUSED_RESULT _Check_return_ -- 2.34.1