Chromium Code Reviews| Index: sky/engine/wtf/Compiler.h |
| diff --git a/sky/engine/wtf/Compiler.h b/sky/engine/wtf/Compiler.h |
| index 8efdaf2e8eb24078edd5635c3e13e8c8ec82fc13..ff35d100894309be4206a14eb08ee00c2c7b6826 100644 |
| --- a/sky/engine/wtf/Compiler.h |
| +++ b/sky/engine/wtf/Compiler.h |
| @@ -29,6 +29,12 @@ |
| /* COMPILER() - the compiler being used to build the project */ |
| #define COMPILER(WTF_FEATURE) (defined WTF_COMPILER_##WTF_FEATURE && WTF_COMPILER_##WTF_FEATURE) |
| +/* COMPILER_SUPPORTS() - whether the compiler being used to build the project supports the given feature. */ |
| +#define COMPILER_SUPPORTS(WTF_COMPILER_FEATURE) (defined WTF_COMPILER_SUPPORTS_##WTF_COMPILER_FEATURE && WTF_COMPILER_SUPPORTS_##WTF_COMPILER_FEATURE) |
| + |
| +/* COMPILER_QUIRK() - whether the compiler being used to build the project requires a given quirk. */ |
| +#define COMPILER_QUIRK(WTF_COMPILER_QUIRK) (defined WTF_COMPILER_QUIRK_##WTF_COMPILER_QUIRK && WTF_COMPILER_QUIRK_##WTF_COMPILER_QUIRK) |
| + |
| /* ==== COMPILER() - the compiler being used to build the project ==== */ |
| /* COMPILER(CLANG) - Clang */ |
| @@ -36,12 +42,45 @@ |
| #define WTF_COMPILER_CLANG 1 |
| #define CLANG_PRAGMA(PRAGMA) _Pragma(PRAGMA) |
| + |
| +/* Specific compiler features */ |
| +#define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES __has_extension(cxx_variadic_templates) |
| + |
| +/* There is a bug in clang that comes with Xcode 4.2 where AtomicStrings can't be implicitly converted to Strings |
| + in the presence of move constructors and/or move assignment operators. This bug has been fixed in Xcode 4.3 clang, so we |
| + check for both cxx_rvalue_references as well as the unrelated cxx_nonstatic_member_init feature which we know was added in 4.3 */ |
| +#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES __has_extension(cxx_rvalue_references) && __has_extension(cxx_nonstatic_member_init) |
| + |
| +#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR __has_feature(cxx_nullptr) |
| +#define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS __has_feature(cxx_explicit_conversions) |
| +#define WTF_COMPILER_SUPPORTS_BLOCKS __has_feature(blocks) |
| +#define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_extension(c_static_assert) |
| +#define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT __has_extension(cxx_static_assert) |
| +#define WTF_COMPILER_SUPPORTS_HAS_TRIVIAL_DESTRUCTOR __has_extension(has_trivial_destructor) |
| +#define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS __has_extension(cxx_strong_enums) |
| + |
| #endif |
| #ifndef CLANG_PRAGMA |
| #define CLANG_PRAGMA(PRAGMA) |
| #endif |
| +/* COMPILER(MSVC) - Microsoft Visual C++ */ |
| +#if defined(_MSC_VER) |
| +#define WTF_COMPILER_MSVC 1 |
| + |
| +/* Specific compiler features */ |
| +#if !COMPILER(CLANG) && _MSC_VER >= 1600 |
| +#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1 |
| +#endif |
| + |
| +#if COMPILER(CLANG) |
| +/* Keep strong enums turned off when building with clang-cl: We cannot yet build all of Blink without fallback to cl.exe, and strong enums are exposed at ABI boundaries. */ |
| +#undef WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS |
| +#endif |
| + |
| +#endif |
| + |
| /* COMPILER(GCC) - GNU Compiler Collection */ |
| #if defined(__GNUC__) |
| #define WTF_COMPILER_GCC 1 |
| @@ -52,14 +91,40 @@ |
| #define GCC_VERSION_AT_LEAST(major, minor, patch) 0 |
| #endif |
| +/* Specific compiler features */ |
| +#if COMPILER(GCC) && !COMPILER(CLANG) |
| +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L |
| +/* C11 support */ |
| +#define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT 1 |
|
eseidel
2014/11/12 19:13:10
So this is the change which I removed which got us
|
| +#endif |
| +#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L) |
| +/* C++11 support */ |
| +#if GCC_VERSION_AT_LEAST(4, 3, 0) |
| +#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES 1 |
| +#define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT 1 |
| +#define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES 1 |
| +#endif |
| +#if GCC_VERSION_AT_LEAST(4, 5, 0) |
| +#define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS 1 |
| +#endif |
| +#if GCC_VERSION_AT_LEAST(4, 6, 0) |
| +#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1 |
| +/* Strong enums should work from gcc 4.4, but doesn't seem to support some operators */ |
| +#define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS 1 |
| +#endif |
| +#endif /* defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L) */ |
| +#endif /* COMPILER(GCC) */ |
| + |
| /* ==== Compiler features ==== */ |
| /* ALWAYS_INLINE */ |
| #ifndef ALWAYS_INLINE |
| -#if COMPILER(GCC) && defined(NDEBUG) |
| +#if COMPILER(GCC) && defined(NDEBUG) && !COMPILER(MINGW) |
| #define ALWAYS_INLINE inline __attribute__((__always_inline__)) |
| +#elif COMPILER(MSVC) && defined(NDEBUG) |
| +#define ALWAYS_INLINE __forceinline |
| #else |
| #define ALWAYS_INLINE inline |
| #endif |
| @@ -71,6 +136,8 @@ |
| #ifndef NEVER_INLINE |
| #if COMPILER(GCC) |
| #define NEVER_INLINE __attribute__((__noinline__)) |
| +#elif COMPILER(MSVC) |
| +#define NEVER_INLINE __declspec(noinline) |
| #else |
| #define NEVER_INLINE |
| #endif |
| @@ -105,6 +172,8 @@ |
| #ifndef NO_RETURN |
| #if COMPILER(GCC) |
| #define NO_RETURN __attribute((__noreturn__)) |
| +#elif COMPILER(MSVC) |
| +#define NO_RETURN __declspec(noreturn) |
| #else |
| #define NO_RETURN |
| #endif |
| @@ -140,10 +209,24 @@ |
| #endif |
| #endif |
| +/* OBJC_CLASS */ |
| + |
| +#ifndef OBJC_CLASS |
| +#ifdef __OBJC__ |
| +#define OBJC_CLASS @class |
| +#else |
| +#define OBJC_CLASS class |
| +#endif |
| +#endif |
| + |
| /* WTF_PRETTY_FUNCTION */ |
| #if COMPILER(GCC) |
| +#define WTF_COMPILER_SUPPORTS_PRETTY_FUNCTION 1 |
| #define WTF_PRETTY_FUNCTION __PRETTY_FUNCTION__ |
| +#elif COMPILER(MSVC) |
| +#define WTF_COMPILER_SUPPORTS_PRETTY_FUNCTION 1 |
| +#define WTF_PRETTY_FUNCTION __FUNCSIG__ |
| #else |
| #define WTF_PRETTY_FUNCTION __FUNCTION__ |
| #endif |