Title: [155146] trunk/Source/WTF
- Revision
- 155146
- Author
- [email protected]
- Date
- 2013-09-05 14:01:30 -0700 (Thu, 05 Sep 2013)
Log Message
Clean up wtf/Compiler.h
https://bugs.webkit.org/show_bug.cgi?id=120790
Reviewed by Andreas Kling.
- Get rid of the CLANG_PRAGMA define, it's not used anywhere.
- Remove a workaround for a bug in the version of clang that came with Xcode 4.2.
- Replace WTF_COMPILER_SUPPORTS_CXX_FINAL_CONTROL with a compiler quirk for versions of clang
that have a buggy final implementation and fix a bug in the macro where final would be disabled
for versions of clang where __clang_minor__ is less than 2, regardless of the major version.
- Fail if someone tries to compile the WebKit stack with a compiler that doesn't support rvalue
references or static_assert.
* wtf/Compiler.h:
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (155145 => 155146)
--- trunk/Source/WTF/ChangeLog 2013-09-05 20:54:49 UTC (rev 155145)
+++ trunk/Source/WTF/ChangeLog 2013-09-05 21:01:30 UTC (rev 155146)
@@ -1,5 +1,22 @@
2013-09-05 Anders Carlsson <[email protected]>
+ Clean up wtf/Compiler.h
+ https://bugs.webkit.org/show_bug.cgi?id=120790
+
+ Reviewed by Andreas Kling.
+
+ - Get rid of the CLANG_PRAGMA define, it's not used anywhere.
+ - Remove a workaround for a bug in the version of clang that came with Xcode 4.2.
+ - Replace WTF_COMPILER_SUPPORTS_CXX_FINAL_CONTROL with a compiler quirk for versions of clang
+ that have a buggy final implementation and fix a bug in the macro where final would be disabled
+ for versions of clang where __clang_minor__ is less than 2, regardless of the major version.
+ - Fail if someone tries to compile the WebKit stack with a compiler that doesn't support rvalue
+ references or static_assert.
+
+ * wtf/Compiler.h:
+
+2013-09-05 Anders Carlsson <[email protected]>
+
Change StringBuffer back to not use an OwnPtr in an attempt to fix ports.
* wtf/text/StringBuffer.h:
Modified: trunk/Source/WTF/wtf/Compiler.h (155145 => 155146)
--- trunk/Source/WTF/wtf/Compiler.h 2013-09-05 20:54:49 UTC (rev 155145)
+++ trunk/Source/WTF/wtf/Compiler.h 2013-09-05 21:01:30 UTC (rev 155146)
@@ -41,16 +41,9 @@
#if defined(__clang__)
#define WTF_COMPILER_CLANG 1
-#define CLANG_PRAGMA(PRAGMA) _Pragma(PRAGMA)
-
/* Specific compiler features */
#define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES __has_feature(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_feature(cxx_rvalue_references) && __has_feature(cxx_nonstatic_member_init)
-
+#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES __has_feature(cxx_rvalue_references)
#define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS __has_feature(cxx_deleted_functions)
#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR __has_feature(cxx_nullptr)
#define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS __has_feature(cxx_explicit_conversions)
@@ -58,23 +51,14 @@
#define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_feature(c_static_assert)
#define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT __has_feature(cxx_static_assert)
#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL __has_feature(cxx_override_control)
-
-#ifdef __APPLE__
-/* Enable final only on clang 4.2 and later to avoid bugs like http://webkit.org/b/119165 */
-#define APPLE_CLANG_VERSION_AT_LEAST(major, minor) (defined(__clang_major__) && __clang_major__ >= major && __clang_minor__ >= minor)
-#define WTF_COMPILER_SUPPORTS_CXX_FINAL_CONTROL WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL && APPLE_CLANG_VERSION_AT_LEAST(4, 2)
-#else
-/* We don't know which versions of clang has the bug mentioned above since __clang_major__ and __clang_minor__ are vendor dependent */
-#define WTF_COMPILER_SUPPORTS_CXX_FINAL_CONTROL WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL
-#endif
-
-#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)
+
+/* Disable final on versions of Apple clang earlier than 4.2 to avoid bugs like http://webkit.org/b/119165 */
+#if defined(__APPLE__) && (__clang_major__ < 4 || (__clang_major__ == 4 && __clang_minor__ < 2))
+#define WTF_COMPILER_QUIRK_FINAL_IS_BUGGY
#endif
-#ifndef CLANG_PRAGMA
-#define CLANG_PRAGMA(PRAGMA)
#endif
/* COMPILER(MSVC) - Microsoft Visual C++ */
@@ -92,7 +76,6 @@
#if !COMPILER(CLANG)
#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL 1
-#define WTF_COMPILER_SUPPORTS_CXX_FINAL_CONTROL 1
#define WTF_COMPILER_QUIRK_FINAL_IS_CALLED_SEALED 1
#endif
@@ -161,7 +144,6 @@
#endif
#if GCC_VERSION_AT_LEAST(4, 7, 0)
#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL 1
-#define WTF_COMPILER_SUPPORTS_CXX_FINAL_CONTROL 1
#endif
#endif /* defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L) */
#endif /* COMPILER(GCC) */
@@ -193,6 +175,17 @@
/* ==== Compiler features ==== */
+/* Required C++11 features. We can remove these once they've been required for some time */
+
+#ifdef __cplusplus
+#if !COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)
+#error "Please use a compiler that supports C++11 rvalue references."
+#endif
+#if !COMPILER_SUPPORTS(CXX_STATIC_ASSERT)
+#error "Please use a compiler that supports C++11 static_assert."
+#endif
+#endif
+
/* ALWAYS_INLINE */
#ifndef ALWAYS_INLINE
@@ -282,7 +275,7 @@
#define OVERRIDE
#endif
-#if COMPILER_SUPPORTS(CXX_FINAL_CONTROL)
+#if COMPILER_SUPPORTS(CXX_OVERRIDE_CONTROL) && !COMPILER_QUIRK(FINAL_IS_BUGGY)
#if COMPILER_QUIRK(FINAL_IS_CALLED_SEALED)
#define FINAL sealed
#else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes