Generate a compile error if release is built without compiler optimizations
[WebKit-https.git] / Source / WTF / wtf / Compiler.h
index e6fa803..6975234 100644 (file)
@@ -42,7 +42,7 @@
 #define COMPILER_HAS_CLANG_BUILTIN(x) 0
 #endif
 
-/* COMPILER_HAS_CLANG_HEATURE() - whether the compiler supports a particular language or library feature. */
+/* COMPILER_HAS_CLANG_FEATURE() - whether the compiler supports a particular language or library feature. */
 /* http://clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension */
 #ifdef __has_feature
 #define COMPILER_HAS_CLANG_FEATURE(x) __has_feature(x)
 #define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT 1
 #endif
 
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
-
 #endif /* COMPILER(GCC) */
 
+#if COMPILER(GCC_OR_CLANG) && defined(NDEBUG) && !defined(__OPTIMIZE__) && !defined(RELEASE_WITHOUT_OPTIMIZATIONS)
+#error "Building release without compiler optimizations: WebKit will be slow. Set -DRELEASE_WITHOUT_OPTIMIZATIONS if this is intended."
+#endif
+
 /* COMPILER(MINGW) - MinGW GCC */
 
 #if defined(__MINGW32__)
 
 #endif
 
-/* COMPILER(SUNCC) */
-
-#if defined(__SUNPRO_CC) || defined(__SUNPRO_C)
-#define WTF_COMPILER_SUNCC 1
-#endif
-
 #if !COMPILER(CLANG) && !COMPILER(MSVC)
 #define WTF_COMPILER_QUIRK_CONSIDERS_UNREACHABLE_CODE 1
 #endif
 #define WTF_COMPILER_SUPPORTS_EABI 1
 #endif
 
+/* Non-static data member initializer (NSDMI) for aggregates */
+
+#if defined(__cpp_aggregate_nsdmi) && __cpp_aggregate_nsdmi >= 201304
+#define WTF_COMPILER_SUPPORTS_NSDMI_FOR_AGGREGATES 1
+#endif
+
 /* RELAXED_CONSTEXPR */
 
 #if defined(__cpp_constexpr) && __cpp_constexpr >= 201304
 #define FALLTHROUGH [[gnu::fallthrough]]
 #endif
 
+#elif !defined(FALLTHROUGH) && !defined(__cplusplus)
+
+#if COMPILER(GCC)
+#if GCC_VERSION_AT_LEAST(7, 0, 0)
+#define FALLTHROUGH __attribute__ ((fallthrough))
+#endif
+#endif
+
 #endif // !defined(FALLTHROUGH) && defined(__cplusplus) && defined(__has_cpp_attribute)
 
 #if !defined(FALLTHROUGH)