From: Andrew Gallagher Date: Fri, 18 Nov 2016 05:16:07 +0000 (-0800) Subject: folly/portability: move some macro definitions to `CPortability.h` X-Git-Tag: v2016.11.21.00~11 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7b77a513d2683c77df176fcec6108d5ef0eb72c4;p=folly.git 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 --- 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_