Log Message
Remove CXX_REFERENCE_QUALIFIED_FUNCTIONS and optional's equivalent https://bugs.webkit.org/show_bug.cgi?id=184167 <rdar://problem/39023130>
Reviewed by Yusuke Suzuki. Remove COMPILER_SUPPORTS(CXX_REFERENCE_QUALIFIED_FUNCTIONS), it's supported by all compilers WebKit supports (it's a C++11 feature, *detection* of it with __has_extension was added to clang on May 13th 2011, and VS2015 / GCC support it). Optional.h had a similar thing, ditch it too. * wtf/Compiler.h: * wtf/Optional.h: (std::optional::contained_val const): (std::optional::contained_val): * wtf/Ref.h: * wtf/RefPtr.h: * wtf/text/WTFString.cpp: * wtf/text/WTFString.h:
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (230112 => 230113)
--- trunk/Source/WTF/ChangeLog 2018-03-30 18:45:54 UTC (rev 230112)
+++ trunk/Source/WTF/ChangeLog 2018-03-30 19:16:55 UTC (rev 230113)
@@ -1,5 +1,29 @@
2018-03-30 JF Bastien <jfbast...@apple.com>
+ Remove CXX_REFERENCE_QUALIFIED_FUNCTIONS and optional's equivalent
+ https://bugs.webkit.org/show_bug.cgi?id=184167
+ <rdar://problem/39023130>
+
+ Reviewed by Yusuke Suzuki.
+
+ Remove COMPILER_SUPPORTS(CXX_REFERENCE_QUALIFIED_FUNCTIONS), it's
+ supported by all compilers WebKit supports (it's a C++11 feature,
+ *detection* of it with __has_extension was added to clang on May
+ 13th 2011, and VS2015 / GCC support it).
+
+ Optional.h had a similar thing, ditch it too.
+
+ * wtf/Compiler.h:
+ * wtf/Optional.h:
+ (std::optional::contained_val const):
+ (std::optional::contained_val):
+ * wtf/Ref.h:
+ * wtf/RefPtr.h:
+ * wtf/text/WTFString.cpp:
+ * wtf/text/WTFString.h:
+
+2018-03-30 JF Bastien <jfbast...@apple.com>
+
Introduce WTF_LAZY_INSTANTIATE
https://bugs.webkit.org/show_bug.cgi?id=184169
<rdar://problem/39023385>
Modified: trunk/Source/WTF/wtf/Compiler.h (230112 => 230113)
--- trunk/Source/WTF/wtf/Compiler.h 2018-03-30 18:45:54 UTC (rev 230112)
+++ trunk/Source/WTF/wtf/Compiler.h 2018-03-30 19:16:55 UTC (rev 230113)
@@ -66,7 +66,6 @@
#define WTF_COMPILER_CLANG 1
#define WTF_COMPILER_SUPPORTS_BLOCKS COMPILER_HAS_CLANG_FEATURE(blocks)
#define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT COMPILER_HAS_CLANG_FEATURE(c_static_assert)
-#define WTF_COMPILER_SUPPORTS_CXX_REFERENCE_QUALIFIED_FUNCTIONS COMPILER_HAS_CLANG_FEATURE(cxx_reference_qualified_functions)
#define WTF_COMPILER_SUPPORTS_CXX_EXCEPTIONS COMPILER_HAS_CLANG_FEATURE(cxx_exceptions)
#define WTF_COMPILER_SUPPORTS_BUILTIN_IS_TRIVIALLY_COPYABLE COMPILER_HAS_CLANG_FEATURE(is_trivially_copyable)
@@ -89,7 +88,6 @@
/* Note: This section must come after the Clang section since we check !COMPILER(CLANG) here. */
#if COMPILER(GCC_OR_CLANG) && !COMPILER(CLANG)
#define WTF_COMPILER_GCC 1
-#define WTF_COMPILER_SUPPORTS_CXX_REFERENCE_QUALIFIED_FUNCTIONS 1
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch))
@@ -128,7 +126,6 @@
#if defined(_MSC_VER)
#define WTF_COMPILER_MSVC 1
-#define WTF_COMPILER_SUPPORTS_CXX_REFERENCE_QUALIFIED_FUNCTIONS 1
#if _MSC_VER < 1910
#error "Please use a newer version of Visual Studio. WebKit requires VS2017 or newer to compile."
Modified: trunk/Source/WTF/wtf/Optional.h (230112 => 230113)
--- trunk/Source/WTF/wtf/Optional.h 2018-03-30 18:45:54 UTC (rev 230112)
+++ trunk/Source/WTF/wtf/Optional.h 2018-03-30 19:16:55 UTC (rev 230113)
@@ -113,14 +113,6 @@
# define OPTIONAL_CONSTEXPR_INIT_LIST
# endif
-// FIXME: To make the result of value() type consistent among the compilers, we now intentionally disables move accessors.
-# define OPTIONAL_HAS_MOVE_ACCESSORS 0
-// # if defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ && (defined __cplusplus) && (__cplusplus != 201103L)
-// # define OPTIONAL_HAS_MOVE_ACCESSORS 1
-// # else
-// # define OPTIONAL_HAS_MOVE_ACCESSORS 0
-// # endif
-
# // In C++11 constexpr implies const, so we need to make non-const members also non-constexpr
# if (defined __cplusplus) && (__cplusplus == 201103L)
# define OPTIONAL_MUTABLE_CONSTEXPR
@@ -396,13 +388,8 @@
# if OPTIONAL_HAS_THIS_RVALUE_REFS == 1
constexpr const T& contained_val() const& { return OptionalBase<T>::storage_.value_; }
-# if OPTIONAL_HAS_MOVE_ACCESSORS == 1
OPTIONAL_MUTABLE_CONSTEXPR T&& contained_val() && { return std::move(OptionalBase<T>::storage_.value_); }
OPTIONAL_MUTABLE_CONSTEXPR T& contained_val() & { return OptionalBase<T>::storage_.value_; }
-# else
- T& contained_val() & { return OptionalBase<T>::storage_.value_; }
- T&& contained_val() && { return std::move(OptionalBase<T>::storage_.value_); }
-# endif
# else
constexpr const T& contained_val() const { return OptionalBase<T>::storage_.value_; }
T& contained_val() { return OptionalBase<T>::storage_.value_; }
@@ -538,8 +525,6 @@
return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), dataptr());
}
-# if OPTIONAL_HAS_MOVE_ACCESSORS == 1
-
OPTIONAL_MUTABLE_CONSTEXPR T* operator ->() {
// FIXME: We need to offer special assert function that can be used under the contexpr context.
// CONSTEXPR_ASSERT(initialized());
@@ -580,36 +565,6 @@
return std::move(contained_val());
}
-# else
-
- T* operator ->() {
- assert (initialized());
- return dataptr();
- }
-
- constexpr T const& operator *() const {
- return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), contained_val());
- }
-
- T& operator *() {
- assert (initialized());
- return contained_val();
- }
-
- constexpr T const& value() const {
- // FIXME: We need to offer special assert function that can be used under the contexpr context.
- // return initialized() ? contained_val() : (throw bad_optional_access("bad optional access"), contained_val());
- return contained_val();
- }
-
- T& value() {
- // FIXME: We need to offer special assert function that can be used under the contexpr context.
- // return initialized() ? contained_val() : (throw bad_optional_access("bad optional access"), contained_val());
- return contained_val();
- }
-
-# endif
-
# if OPTIONAL_HAS_THIS_RVALUE_REFS == 1
template <class V>
@@ -618,8 +573,6 @@
return *this ? **this : detail_::convert<T>(detail_::constexpr_forward<V>(v));
}
-# if OPTIONAL_HAS_MOVE_ACCESSORS == 1
-
template <class V>
OPTIONAL_MUTABLE_CONSTEXPR T value_or(V&& v) &&
{
@@ -626,16 +579,6 @@
return *this ? detail_::constexpr_move(const_cast<optional<T>&>(*this).contained_val()) : detail_::convert<T>(detail_::constexpr_forward<V>(v));
}
-# else
-
- template <class V>
- T value_or(V&& v) &&
- {
- return *this ? detail_::constexpr_move(const_cast<optional<T>&>(*this).contained_val()) : detail_::convert<T>(detail_::constexpr_forward<V>(v));
- }
-
-# endif
-
# else
template <class V>
Modified: trunk/Source/WTF/wtf/Ref.h (230112 => 230113)
--- trunk/Source/WTF/wtf/Ref.h 2018-03-30 18:45:54 UTC (rev 230112)
+++ trunk/Source/WTF/wtf/Ref.h 2018-03-30 19:16:55 UTC (rev 230113)
@@ -125,12 +125,8 @@
template<typename X, typename Y> Ref<T, PtrTraits> replace(Ref<X, Y>&&) WARN_UNUSED_RETURN;
-#if COMPILER_SUPPORTS(CXX_REFERENCE_QUALIFIED_FUNCTIONS)
Ref copyRef() && = delete;
Ref copyRef() const & WARN_UNUSED_RETURN { return Ref(*m_ptr); }
-#else
- Ref copyRef() const WARN_UNUSED_RETURN { return Ref(*m_ptr); }
-#endif
T& leakRef() WARN_UNUSED_RETURN
{
Modified: trunk/Source/WTF/wtf/RefPtr.h (230112 => 230113)
--- trunk/Source/WTF/wtf/RefPtr.h 2018-03-30 18:45:54 UTC (rev 230112)
+++ trunk/Source/WTF/wtf/RefPtr.h 2018-03-30 19:16:55 UTC (rev 230113)
@@ -99,12 +99,8 @@
static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); }
-#if COMPILER_SUPPORTS(CXX_REFERENCE_QUALIFIED_FUNCTIONS)
RefPtr copyRef() && = delete;
RefPtr copyRef() const & WARN_UNUSED_RETURN { return RefPtr(m_ptr); }
-#else
- RefPtr copyRef() const WARN_UNUSED_RETURN { return RefPtr(m_ptr); }
-#endif
private:
friend RefPtr adoptRef<T, PtrTraits>(T*);
Modified: trunk/Source/WTF/wtf/text/WTFString.cpp (230112 => 230113)
--- trunk/Source/WTF/wtf/text/WTFString.cpp 2018-03-30 18:45:54 UTC (rev 230112)
+++ trunk/Source/WTF/wtf/text/WTFString.cpp 2018-03-30 19:16:55 UTC (rev 230113)
@@ -678,8 +678,6 @@
return m_impl->toFloat(ok);
}
-#if COMPILER_SUPPORTS(CXX_REFERENCE_QUALIFIED_FUNCTIONS)
-
String String::isolatedCopy() const &
{
// FIXME: Should this function, and the many others like it, be inlined?
@@ -697,16 +695,6 @@
return m_impl ? m_impl->isolatedCopy() : String { };
}
-#else
-
-String String::isolatedCopy() const
-{
- // FIXME: Should this function, and the many others like it, be inlined?
- return m_impl ? m_impl->isolatedCopy() : String { };
-}
-
-#endif
-
bool String::isSafeToSendToAnotherThread() const
{
// AtomicStrings are not safe to send between threads as ~StringImpl()
Modified: trunk/Source/WTF/wtf/text/WTFString.h (230112 => 230113)
--- trunk/Source/WTF/wtf/text/WTFString.h 2018-03-30 18:45:54 UTC (rev 230112)
+++ trunk/Source/WTF/wtf/text/WTFString.h 2018-03-30 19:16:55 UTC (rev 230113)
@@ -299,12 +299,8 @@
bool percentage(int& percentage) const;
-#if COMPILER_SUPPORTS(CXX_REFERENCE_QUALIFIED_FUNCTIONS)
WTF_EXPORT_PRIVATE String isolatedCopy() const &;
WTF_EXPORT_PRIVATE String isolatedCopy() &&;
-#else
- WTF_EXPORT_PRIVATE String isolatedCopy() const;
-#endif
WTF_EXPORT_PRIVATE bool isSafeToSendToAnotherThread() const;
Modified: trunk/Source/WebCore/bindings/js/JSDOMConvertUnion.h (230112 => 230113)
--- trunk/Source/WebCore/bindings/js/JSDOMConvertUnion.h 2018-03-30 18:45:54 UTC (rev 230112)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertUnion.h 2018-03-30 19:16:55 UTC (rev 230113)
@@ -172,7 +172,7 @@
constexpr bool hasNullType = brigand::any<TypeList, std::is_same<IDLNull, brigand::_1>>::value;
if (hasNullType) {
if (value.isUndefinedOrNull())
- return std::move<WTF::CheckMoveParameter>(ConditionalConverter<ReturnType, IDLNull, hasNullType>::convert(state, value).value());
+ return ConditionalConverter<ReturnType, IDLNull, hasNullType>::convert(state, value).value();
}
// 2. Let types be the flattened member types of the union type.
@@ -182,7 +182,7 @@
if (hasDictionaryType) {
if (value.isUndefinedOrNull()) {
// 1. If types includes a dictionary type, then return the result of converting V to that dictionary type.
- return std::move<WTF::CheckMoveParameter>(ConditionalConverter<ReturnType, DictionaryType, hasDictionaryType>::convert(state, value).value());
+ return ConditionalConverter<ReturnType, DictionaryType, hasDictionaryType>::convert(state, value).value();
}
}
@@ -230,8 +230,8 @@
auto arrayBuffer = JSC::JSArrayBuffer::toWrapped(vm, value);
if (arrayBuffer) {
if (hasArrayBufferType)
- return std::move<WTF::CheckMoveParameter>(ConditionalReturner<ReturnType, hasArrayBufferType>::get(WTFMove(arrayBuffer)).value());
- return std::move<WTF::CheckMoveParameter>(ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(state, value).value());
+ return ConditionalReturner<ReturnType, hasArrayBufferType>::get(WTFMove(arrayBuffer)).value();
+ return ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(state, value).value();
}
}
@@ -240,8 +240,8 @@
auto arrayBufferView = JSC::JSArrayBufferView::toWrapped(vm, value);
if (arrayBufferView) {
if (hasArrayBufferViewType)
- return std::move<WTF::CheckMoveParameter>(ConditionalReturner<ReturnType, hasArrayBufferViewType>::get(WTFMove(arrayBufferView)).value());
- return std::move<WTF::CheckMoveParameter>(ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(state, value).value());
+ return ConditionalReturner<ReturnType, hasArrayBufferViewType>::get(WTFMove(arrayBufferView)).value();
+ return ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(state, value).value();
}
}
@@ -253,8 +253,8 @@
auto dataView = JSC::JSDataView::toWrapped(vm, value);
if (dataView) {
if (hasDataViewType)
- return std::move<WTF::CheckMoveParameter>(ConditionalReturner<ReturnType, hasDataViewType>::get(WTFMove(dataView)).value());
- return std::move<WTF::CheckMoveParameter>(ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(state, value).value());
+ return ConditionalReturner<ReturnType, hasDataViewType>::get(WTFMove(dataView)).value();
+ return ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(state, value).value();
}
}
@@ -307,7 +307,7 @@
auto method = JSC::iteratorMethod(state, object);
RETURN_IF_EXCEPTION(scope, ReturnType());
if (!method.isUndefined())
- return std::move<WTF::CheckMoveParameter>(ConditionalSequenceConverter<ReturnType, SequenceType, hasSequenceType>::convert(state, object, method).value());
+ return ConditionalSequenceConverter<ReturnType, SequenceType, hasSequenceType>::convert(state, object, method).value();
}
// 2. If types includes a frozen array type, then:
@@ -320,17 +320,17 @@
auto method = JSC::iteratorMethod(state, object);
RETURN_IF_EXCEPTION(scope, ReturnType());
if (!method.isUndefined())
- return std::move<WTF::CheckMoveParameter>(ConditionalSequenceConverter<ReturnType, FrozenArrayType, hasFrozenArrayType>::convert(state, object, method).value());
+ return ConditionalSequenceConverter<ReturnType, FrozenArrayType, hasFrozenArrayType>::convert(state, object, method).value();
}
// 3. If types includes a dictionary type, then return the result of
// converting V to that dictionary type.
if (hasDictionaryType)
- return std::move<WTF::CheckMoveParameter>(ConditionalConverter<ReturnType, DictionaryType, hasDictionaryType>::convert(state, value).value());
+ return ConditionalConverter<ReturnType, DictionaryType, hasDictionaryType>::convert(state, value).value();
// 4. If types includes a record type, then return the result of converting V to that record type.
if (hasRecordType)
- return std::move<WTF::CheckMoveParameter>(ConditionalConverter<ReturnType, RecordType, hasRecordType>::convert(state, value).value());
+ return ConditionalConverter<ReturnType, RecordType, hasRecordType>::convert(state, value).value();
// 5. If types includes a callback interface type, then return the result of converting V to that interface type.
// (FIXME: Add support for callback interface type and step 12.5)
@@ -337,7 +337,7 @@
// 6. If types includes object, then return the IDL value that is a reference to the object V.
if (hasObjectType)
- return std::move<WTF::CheckMoveParameter>(ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(state, value).value());
+ return ConditionalConverter<ReturnType, ObjectType, hasObjectType>::convert(state, value).value();
}
}
}
@@ -347,7 +347,7 @@
constexpr bool hasBooleanType = brigand::any<TypeList, std::is_same<IDLBoolean, brigand::_1>>::value;
if (hasBooleanType) {
if (value.isBoolean())
- return std::move<WTF::CheckMoveParameter>(ConditionalConverter<ReturnType, IDLBoolean, hasBooleanType>::convert(state, value).value());
+ return ConditionalConverter<ReturnType, IDLBoolean, hasBooleanType>::convert(state, value).value();
}
// 13. If V is a Number value, then:
@@ -355,21 +355,21 @@
constexpr bool hasNumericType = brigand::size<NumericTypeList>::value != 0;
if (hasNumericType) {
if (value.isNumber())
- return std::move<WTF::CheckMoveParameter>(ConditionalConverter<ReturnType, NumericType, hasNumericType>::convert(state, value).value());
+ return ConditionalConverter<ReturnType, NumericType, hasNumericType>::convert(state, value).value();
}
// 14. If types includes a string type, then return the result of converting V to that type.
constexpr bool hasStringType = brigand::size<StringTypeList>::value != 0;
if (hasStringType)
- return std::move<WTF::CheckMoveParameter>(ConditionalConverter<ReturnType, StringType, hasStringType>::convert(state, value).value());
+ return ConditionalConverter<ReturnType, StringType, hasStringType>::convert(state, value).value();
// 15. If types includes a numeric type, then return the result of converting V to that numeric type.
if (hasNumericType)
- return std::move<WTF::CheckMoveParameter>(ConditionalConverter<ReturnType, NumericType, hasNumericType>::convert(state, value).value());
+ return ConditionalConverter<ReturnType, NumericType, hasNumericType>::convert(state, value).value();
// 16. If types includes a boolean, then return the result of converting V to boolean.
if (hasBooleanType)
- return std::move<WTF::CheckMoveParameter>(ConditionalConverter<ReturnType, IDLBoolean, hasBooleanType>::convert(state, value).value());
+ return ConditionalConverter<ReturnType, IDLBoolean, hasBooleanType>::convert(state, value).value();
// 17. Throw a TypeError.
throwTypeError(&state, scope);
_______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes