https://bugs.webkit.org/show_bug.cgi?id=86465
Patch by Allan Sandfeld Jensen <allan.jensen@nokia.com> on 2012-05-22
Reviewed by Darin Adler.
Source/WTF:
Detect C++11 mode in GCC 4.7 and set appropiate compiler feature flags.
Turn C++11 override control into a compiler feature flag.
Fix non-clang support of compiler feature CXX_DELETED_FUNCTIONS.
* wtf/Compiler.h:
* wtf/Noncopyable.h:
Tools:
Update detection of C++11 mode in GCC.
* qmake/mkspecs/features/unix/default_post.prf:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117934
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-05-22 Allan Sandfeld Jensen <allan.jensen@nokia.com>
+
+ GCC 4.7 and C++11 support.
+ https://bugs.webkit.org/show_bug.cgi?id=86465
+
+ Reviewed by Darin Adler.
+
+ Detect C++11 mode in GCC 4.7 and set appropiate compiler feature flags.
+ Turn C++11 override control into a compiler feature flag.
+ Fix non-clang support of compiler feature CXX_DELETED_FUNCTIONS.
+
+ * wtf/Compiler.h:
+ * wtf/Noncopyable.h:
+
2012-05-22 Filip Pizlo <fpizlo@apple.com>
REGRESSION(r117861): It made almost all tests crash on Qt
#define __has_extension __has_feature /* Compatibility with older versions of clang */
#endif
+#define CLANG_PRAGMA(PRAGMA) _Pragma(PRAGMA)
+
/* Specific compiler features */
#define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES __has_feature(cxx_variadic_templates)
#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES __has_feature(cxx_rvalue_references)
#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR __has_feature(cxx_nullptr)
#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_OVERRIDE_CONTROL __has_extension(cxx_override_control)
#define WTF_COMPILER_SUPPORTS_HAS_TRIVIAL_DESTRUCTOR __has_extension(has_trivial_destructor)
#endif
+#ifndef CLANG_PRAGMA
+#define CLANG_PRAGMA(PRAGMA)
+#endif
+
/* COMPILER(MSVC) - Microsoft Visual C++ */
/* COMPILER(MSVC7_OR_LOWER) - Microsoft Visual C++ 2003 or lower*/
/* COMPILER(MSVC9_OR_LOWER) - Microsoft Visual C++ 2008 or lower*/
#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1
#endif
+#if !COMPILER(CLANG)
+#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL 1
+#define WTF_COMPILER_QUIRK_FINAL_IS_CALLED_SEALED 1
+#endif
+
#endif
/* COMPILER(RVCT) - ARM RealView Compilation Tools */
/* Specific compiler features */
#if COMPILER(GCC) && !COMPILER(CLANG)
#if GCC_VERSION_AT_LEAST(4, 7, 0) && __cplusplus >= 201103L
+#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES 1
+#define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS 1
#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1
+#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL 1
#define WTF_COMPILER_QUIRK_GCC11_GLOBAL_ISINF_ISNAN 1
#elif GCC_VERSION_AT_LEAST(4, 6, 0) && defined(__GXX_EXPERIMENTAL_CXX0X__)
#define WARN_UNUSED_RETURN
#endif
-/* OVERRIDE */
+/* OVERRIDE and FINAL */
-#ifndef OVERRIDE
-#if COMPILER(CLANG)
-#if __has_extension(cxx_override_control)
+#if COMPILER_SUPPORTS(CXX_OVERRIDE_CONTROL)
#define OVERRIDE override
-#endif
-#elif COMPILER(MSVC)
-#define OVERRIDE override
-#endif
-#endif
-
-#ifndef OVERRIDE
-#define OVERRIDE
-#endif
-
-/* FINAL */
-#ifndef FINAL
-#if COMPILER(CLANG)
-#if __has_extension(cxx_override_control)
-#define FINAL final
-#endif
-#elif COMPILER(MSVC)
+#if COMPILER_QUIRK(FINAL_IS_CALLED_SEALED)
#define FINAL sealed
-#endif
+#else
+#define FINAL final
#endif
-#ifndef FINAL
+#else
+#define OVERRIDE
#define FINAL
#endif
#if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS)
#define WTF_MAKE_NONCOPYABLE(ClassName) \
- _Pragma("clang diagnostic push") \
- _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") \
- _Pragma("clang diagnostic ignored \"-Wc++0x-extensions\"") \
+ CLANG_PRAGMA("clang diagnostic push") \
+ CLANG_PRAGMA("clang diagnostic ignored \"-Wunknown-pragmas\"") \
+ CLANG_PRAGMA("clang diagnostic ignored \"-Wc++0x-extensions\"") \
private: \
ClassName(const ClassName&) = delete; \
ClassName& operator=(const ClassName&) = delete; \
- _Pragma("clang diagnostic pop")
+ CLANG_PRAGMA("clang diagnostic pop")
#else
#define WTF_MAKE_NONCOPYABLE(ClassName) \
private: \
+2012-05-22 Allan Sandfeld Jensen <allan.jensen@nokia.com>
+
+ GCC 4.7 and C++11 support.
+ https://bugs.webkit.org/show_bug.cgi?id=86465
+
+ Reviewed by Darin Adler.
+
+ Update detection of C++11 mode in GCC.
+
+ * qmake/mkspecs/features/unix/default_post.prf:
+
2012-05-22 Hao Zheng <zhenghao@chromium.org>
[chromium] WebViewHost should use ENABLE guards for some features.
linux-g++* {
isEqual(QT_ARCH,x86_64)|isEqual(QT_ARCH,i386): QMAKE_CXXFLAGS += -Werror
greaterThan(QT_GCC_MAJOR_VERSION, 3):greaterThan(QT_GCC_MINOR_VERSION, 5) {
- if (!contains(QMAKE_CXXFLAGS, -std=c++0x) && !contains(QMAKE_CXXFLAGS, -std=gnu++0x)) {
+ if (!contains(QMAKE_CXXFLAGS, -std=c++0x) && !contains(QMAKE_CXXFLAGS, -std=gnu++0x) && !contains(QMAKE_CXXFLAGS, -std=c++11) && !contains(QMAKE_CXXFLAGS, -std=gnu++11)) {
# We need to deactivate those warnings because some names conflicts with upcoming c++0x types (e.g.nullptr).
QMAKE_CFLAGS_WARN_ON += -Wno-c++0x-compat
QMAKE_CXXFLAGS_WARN_ON += -Wno-c++0x-compat