Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/BLI_compiler_compat.h
| Show All 26 Lines | |||||
| * Use to help with cross platform portability. | * Use to help with cross platform portability. | ||||
| */ | */ | ||||
| #if defined(_MSC_VER) | #if defined(_MSC_VER) | ||||
| # define __func__ __FUNCTION__ | # define __func__ __FUNCTION__ | ||||
| # define alloca _alloca | # define alloca _alloca | ||||
| #endif | #endif | ||||
| #if defined(__cplusplus) && ((__cplusplus >= 201103L) || defined(_MSC_VER)) | #if (defined(__GNUC__) || defined(__clang__)) && defined(__cplusplus) | ||||
| # define HAS_CPP11_FEATURES | |||||
| #endif | |||||
| #if (defined(__GNUC__) || defined(__clang__)) && defined(HAS_CPP11_FEATURES) | |||||
| extern "C++" { | extern "C++" { | ||||
| /* Some magic to be sure we don't have reference in the type. */ | /* Some magic to be sure we don't have reference in the type. */ | ||||
| template<typename T> static inline T decltype_helper(T x) { return x; } | template<typename T> static inline T decltype_helper(T x) { return x; } | ||||
| # define typeof(x) decltype(decltype_helper(x)) | # define typeof(x) decltype(decltype_helper(x)) | ||||
| } | } | ||||
| #endif | #endif | ||||
| /* little macro so inline keyword works */ | /* little macro so inline keyword works */ | ||||
| #if defined(_MSC_VER) | #if defined(_MSC_VER) | ||||
| # define BLI_INLINE static __forceinline | # define BLI_INLINE static __forceinline | ||||
| #else | #else | ||||
| # define BLI_INLINE static inline __attribute__((always_inline)) __attribute__((__unused__)) | # define BLI_INLINE static inline __attribute__((always_inline)) __attribute__((__unused__)) | ||||
| #endif | #endif | ||||
| #endif /* __BLI_COMPILER_COMPAT_H__ */ | #endif /* __BLI_COMPILER_COMPAT_H__ */ | ||||