diff options
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qarraydata.h | 30 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 4 |
2 files changed, 2 insertions, 32 deletions
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h index f78b9be2db..7e3f8c9dbd 100644 --- a/src/corelib/tools/qarraydata.h +++ b/src/corelib/tools/qarraydata.h @@ -306,8 +306,6 @@ struct QArrayDataPointerRef // accomplished by hiding a static const instance of QStaticArrayData, which is // POD. -#if defined(Q_COMPILER_VARIADIC_MACROS) -#if defined(Q_COMPILER_LAMBDA) // Hide array inside a lambda #define Q_ARRAY_LITERAL(Type, ...) \ ([]() -> QArrayDataPointerRef<Type> { \ @@ -324,10 +322,7 @@ struct QArrayDataPointerRef return StaticWrapper::get(); \ }()) \ /**/ -#endif -#endif // defined(Q_COMPILER_VARIADIC_MACROS) -#if defined(Q_ARRAY_LITERAL) #define Q_ARRAY_LITERAL_IMPL(Type, ...) \ union { Type type_must_be_POD; } dummy; Q_UNUSED(dummy) \ \ @@ -342,31 +337,6 @@ struct QArrayDataPointerRef { static_cast<QTypedArrayData<Type> *>( \ const_cast<QArrayData *>(&literal.header)) }; \ /**/ -#else -// As a fallback, memory is allocated and data copied to the heap. - -// The fallback macro does NOT use variadic macros and does NOT support -// variable number of arguments. It is suitable for char arrays. - -namespace QtPrivate { - template <class T, size_t N> - inline QArrayDataPointerRef<T> qMakeArrayLiteral(const T (&array)[N]) - { - union { T type_must_be_POD; } dummy; Q_UNUSED(dummy) - - QArrayDataPointerRef<T> result = { QTypedArrayData<T>::allocate(N) }; - Q_CHECK_PTR(result.ptr); - - ::memcpy(result.ptr->data(), array, N * sizeof(T)); - result.ptr->size = N; - - return result; - } -} - -#define Q_ARRAY_LITERAL(Type, Array) \ - QT_PREPEND_NAMESPACE(QtPrivate::qMakeArrayLiteral)<Type>( Array ) -#endif // !defined(Q_ARRAY_LITERAL) namespace QtPrivate { struct Q_CORE_EXPORT QContainerImplHelper diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 4c5d95d1a1..39cb016d98 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -201,7 +201,7 @@ qsizetype QtPrivate::qustrlen(const ushort *str) noexcept return result; } -#if defined(Q_COMPILER_LAMBDA) && !defined(__OPTIMIZE_SIZE__) +#if !defined(__OPTIMIZE_SIZE__) namespace { template <uint MaxCount> struct UnrollTailLoop { @@ -627,7 +627,7 @@ void qt_from_latin1(ushort *dst, const char *str, size_t size) noexcept size = size % 8; dst += offset; str += offset; -# if defined(Q_COMPILER_LAMBDA) && !defined(__OPTIMIZE_SIZE__) +# if !defined(__OPTIMIZE_SIZE__) return UnrollTailLoop<7>::exec(int(size), [=](int i) { dst[i] = (uchar)str[i]; }); # endif #endif |