summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2013-09-13 18:59:49 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-19 20:50:05 +0200
commit4ff1d0e1e73e6467aeed9313afe09ec6ece4884d (patch)
treedad9de015fe52a1761086d2f8885e93d7028ff83
parent83f0f6747f5ecf1143335b1719892de4b7a292bb (diff)
downloadqtwebkit-4ff1d0e1e73e6467aeed9313afe09ec6ece4884d.tar.gz
Fix build with clang
Forcing C++11 on clang does not work on older versions of clang. Instead fix https://bugs.webkit.org/show_bug.cgi?id=115741 by disabling rvalue references if clang is using a too old version of libstdc++11. Avoid compile_asserts unless we have the same C++11 static asserts used in trunk. Finally build ANGLE with the same C++11 state as the rest, otherwise it will expect libstdc++ symbols instead of libc++ symbols. Change-Id: Ifa49325a73d6dc17bc67bccd79813b25860df915 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
-rw-r--r--Source/ThirdParty/ANGLE/ANGLE.pri2
-rw-r--r--Source/WTF/wtf/Compiler.h6
-rw-r--r--Source/WebCore/bindings/scripts/CodeGeneratorJS.pm4
-rw-r--r--Source/WebCore/dom/Attribute.h4
-rw-r--r--Tools/qmake/mkspecs/features/default_pre.prf6
-rw-r--r--Tools/qmake/mkspecs/features/unix/default_pre.prf1
6 files changed, 16 insertions, 7 deletions
diff --git a/Source/ThirdParty/ANGLE/ANGLE.pri b/Source/ThirdParty/ANGLE/ANGLE.pri
index fcb4a44da..e069b141f 100644
--- a/Source/ThirdParty/ANGLE/ANGLE.pri
+++ b/Source/ThirdParty/ANGLE/ANGLE.pri
@@ -7,8 +7,6 @@
SOURCE_DIR = $${ROOT_WEBKIT_DIR}/Source/ThirdParty/ANGLE
-*clang: QT_CONFIG -= c++11
-
INCLUDEPATH += \
$$SOURCE_DIR/include/GLSLANG \
$$SOURCE_DIR/include/KHR
diff --git a/Source/WTF/wtf/Compiler.h b/Source/WTF/wtf/Compiler.h
index 7a2e25f49..644bbf2db 100644
--- a/Source/WTF/wtf/Compiler.h
+++ b/Source/WTF/wtf/Compiler.h
@@ -61,6 +61,12 @@
#define WTF_COMPILER_SUPPORTS_HAS_TRIVIAL_DESTRUCTOR __has_feature(has_trivial_destructor)
#define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS __has_feature(cxx_strong_enums)
#define WTF_COMPILER_SUPPORTS_CXX_REFERENCE_QUALIFIED_FUNCTIONS __has_feature(cxx_reference_qualified_functions)
+
+#if defined(__APPLE__) && COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) && defined(_GLIBCXX_VERSION) && (_GLIBCXX_VERSION <= 20070719)
+/* WTF expects the standard library to have std::move when the compiler supports rvalue references, but some old versions of stdc++11 shipped by Apple does not. */
+#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES 0
+#endif
+
#endif
#ifndef CLANG_PRAGMA
diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 9e9d59dcc..df4234e23 100644
--- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -2807,7 +2807,7 @@ END
void* expectedVTablePointer = reinterpret_cast<void*>(${vtableRefWin});
#else
void* expectedVTablePointer = ${vtableRefGnu};
-#if COMPILER(CLANG)
+#if COMPILER(CLANG) && COMPILER_SUPPORTS(CXX_STATIC_ASSERT)
// If this fails $implType does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
COMPILE_ASSERT(__is_polymorphic($implType), ${implType}_is_not_polymorphic);
@@ -2821,7 +2821,7 @@ END
#endif
END
push(@implContent, <<END) if $interface->extendedAttributes->{"ImplementationLacksVTable"};
-#if COMPILER(CLANG)
+#if COMPILER(CLANG) && COMPILER_SUPPORTS(CXX_STATIC_ASSERT)
// If you hit this failure the interface definition has the ImplementationLacksVTable
// attribute. You should remove that attribute. If the class has subclasses
// that may be passed through this toJS() function you should use the SkipVTableValidation
diff --git a/Source/WebCore/dom/Attribute.h b/Source/WebCore/dom/Attribute.h
index 61c9ec5a8..c590f9a03 100644
--- a/Source/WebCore/dom/Attribute.h
+++ b/Source/WebCore/dom/Attribute.h
@@ -61,8 +61,8 @@ public:
// elements may have placed the Attribute in a hash by name.
void parserSetName(const QualifiedName& name) { m_name = name; }
-#if COMPILER(MSVC)
- // NOTE: This constructor is not actually implemented, it's just defined so MSVC
+#if COMPILER(MSVC) || COMPILER(CLANG)
+ // NOTE: This constructor is not actually implemented, it's just defined so MSVC (or clang)
// will let us use a zero-length array of Attributes.
Attribute();
#endif
diff --git a/Tools/qmake/mkspecs/features/default_pre.prf b/Tools/qmake/mkspecs/features/default_pre.prf
index 432ce7998..88ddac0c8 100644
--- a/Tools/qmake/mkspecs/features/default_pre.prf
+++ b/Tools/qmake/mkspecs/features/default_pre.prf
@@ -88,6 +88,12 @@ CONFIG += include_webinspector
# used by bots and developers, will disable it, to enable warnings etc.
CONFIG += production_build
+# Make sure the static libraries are compiled with the same C++11 setting
+# as the module will be linked with. This is particular important on mac
+# since otherwise the libraries can be compiled against libstdc++, but
+# linked against libc++.
+contains(QT_CONFIG, c++11): CONFIG += c++11
+
# Limit the creation of thin archives to Linux, since only GNU's ar supports it.
!debug_and_release:linux-g++*: CONFIG += gnu_thin_archives
diff --git a/Tools/qmake/mkspecs/features/unix/default_pre.prf b/Tools/qmake/mkspecs/features/unix/default_pre.prf
index 67cfff8f7..aafc48ceb 100644
--- a/Tools/qmake/mkspecs/features/unix/default_pre.prf
+++ b/Tools/qmake/mkspecs/features/unix/default_pre.prf
@@ -18,6 +18,5 @@ contains(QT_CONFIG, qpa)|contains(QT_CONFIG, embedded): CONFIG += embedded
# Reduce linking memory pressure on 32-bit debug builds on Linux
linux-g++*:CONFIG(debug, debug|release):isEqual(QT_ARCH,i386): CONFIG += use_all_in_one_files
-*clang: CONFIG += c++11
load(default_pre)