From 7b5d5faae19d1872faafaf05c9acf21b33d327fe Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 16 Jun 2020 11:46:30 +0200 Subject: Remove unused functionality from QTypeInfo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I10fe4cde7a18047599e656cc3bb67b0dfe18a986 Reviewed-by: MÃ¥rten Nordheim --- src/corelib/global/qtypeinfo.h | 32 +------------------------ tests/auto/corelib/global/qflags/tst_qflags.cpp | 2 -- tests/auto/corelib/tools/qpair/tst_qpair.cpp | 1 - 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index e16ffb08ee..175d5205af 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -52,21 +52,13 @@ QT_BEGIN_NAMESPACE template static constexpr bool qIsRelocatable() { -#if defined(Q_CC_CLANG) || !defined(Q_CC_GNU) || Q_CC_GNU >= 501 return std::is_trivially_copyable::value && std::is_trivially_destructible::value; -#else - return std::is_enum::value || std::is_integral::value; -#endif } template static constexpr bool qIsTrivial() { -#if defined(Q_CC_CLANG) || !defined(Q_CC_GNU) || Q_CC_GNU >= 501 return std::is_trivial::value; -#else - return std::is_enum::value || std::is_integral::value; -#endif } /* @@ -78,14 +70,11 @@ class QTypeInfo { public: enum { - isSpecialized = std::is_enum::value, // don't require every enum to be marked manually isPointer = false, isIntegral = std::is_integral::value, isComplex = !qIsTrivial(), isStatic = true, isRelocatable = qIsRelocatable(), - isLarge = (sizeof(T)>sizeof(void*)), - isDummy = false, //### Qt6: remove sizeOf = sizeof(T) }; }; @@ -95,14 +84,11 @@ class QTypeInfo { public: enum { - isSpecialized = true, isPointer = false, isIntegral = false, isComplex = false, isStatic = false, isRelocatable = false, - isLarge = false, - isDummy = false, sizeOf = 0 }; }; @@ -112,14 +98,11 @@ class QTypeInfo { public: enum { - isSpecialized = true, isPointer = true, isIntegral = false, isComplex = false, isStatic = false, isRelocatable = true, - isLarge = false, - isDummy = false, sizeOf = sizeof(T*) }; }; @@ -175,14 +158,11 @@ class QTypeInfoMerger { static_assert(sizeof...(Ts) > 0); public: - static constexpr bool isSpecialized = true; static constexpr bool isComplex = ((QTypeInfoQuery::isComplex) || ...); static constexpr bool isStatic = ((QTypeInfoQuery::isStatic) || ...); static constexpr bool isRelocatable = ((QTypeInfoQuery::isRelocatable) && ...); - static constexpr bool isLarge = sizeof(T) > sizeof(void*); static constexpr bool isPointer = false; static constexpr bool isIntegral = false; - static constexpr bool isDummy = false; static constexpr std::size_t sizeOf = sizeof(T); }; @@ -193,14 +173,11 @@ class QTypeInfo< CONTAINER > \ { \ public: \ enum { \ - isSpecialized = true, \ isPointer = false, \ isIntegral = false, \ isComplex = true, \ isRelocatable = true, \ isStatic = false, \ - isLarge = (sizeof(CONTAINER) > sizeof(void*)), \ - isDummy = false, \ sizeOf = sizeof(CONTAINER) \ }; \ } @@ -212,7 +189,6 @@ Q_DECLARE_MOVABLE_CONTAINER(QSet); #undef Q_DECLARE_MOVABLE_CONTAINER -/* These cannot be movable before ### Qt 6, for BC reasons */ #define Q_DECLARE_MOVABLE_CONTAINER(CONTAINER) \ template class CONTAINER; \ template \ @@ -220,14 +196,11 @@ class QTypeInfo< CONTAINER > \ { \ public: \ enum { \ - isSpecialized = true, \ isPointer = false, \ isIntegral = false, \ isComplex = true, \ - isStatic = (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)), \ + isStatic = false, \ isRelocatable = true, \ - isLarge = (sizeof(CONTAINER) > sizeof(void*)), \ - isDummy = false, \ sizeOf = sizeof(CONTAINER) \ }; \ } @@ -261,14 +234,11 @@ class QTypeInfo \ { \ public: \ enum { \ - isSpecialized = true, \ isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0) && !qIsTrivial(), \ isStatic = (((FLAGS) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), \ isRelocatable = !isStatic || ((FLAGS) & Q_RELOCATABLE_TYPE) || qIsRelocatable(), \ - isLarge = (sizeof(TYPE)>sizeof(void*)), \ isPointer = false, \ isIntegral = std::is_integral< TYPE >::value, \ - isDummy = (((FLAGS) & Q_DUMMY_TYPE) != 0), \ sizeOf = sizeof(TYPE) \ }; \ static inline const char *name() { return #TYPE; } \ diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp index be75f5b3cc..4df448373d 100644 --- a/tests/auto/corelib/global/qflags/tst_qflags.cpp +++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp @@ -151,7 +151,6 @@ Q_DECLARE_FLAGS( MyStrictNoOpFlags, MyStrictNoOpEnum ) Q_STATIC_ASSERT( !QTypeInfo::isComplex ); Q_STATIC_ASSERT( !QTypeInfo::isStatic ); -Q_STATIC_ASSERT( !QTypeInfo::isLarge ); Q_STATIC_ASSERT( !QTypeInfo::isPointer ); void tst_QFlags::classEnum() @@ -322,7 +321,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( MyFlags ) Q_STATIC_ASSERT( !QTypeInfo::isComplex ); Q_STATIC_ASSERT( !QTypeInfo::isStatic ); -Q_STATIC_ASSERT( !QTypeInfo::isLarge ); Q_STATIC_ASSERT( !QTypeInfo::isPointer ); QTEST_MAIN(tst_QFlags) diff --git a/tests/auto/corelib/tools/qpair/tst_qpair.cpp b/tests/auto/corelib/tools/qpair/tst_qpair.cpp index 0a158e5860..6ea1b18df2 100644 --- a/tests/auto/corelib/tools/qpair/tst_qpair.cpp +++ b/tests/auto/corelib/tools/qpair/tst_qpair.cpp @@ -89,7 +89,6 @@ Q_STATIC_ASSERT(!QTypeInfo::isStatic ); Q_STATIC_ASSERT(!QTypeInfo::isComplex); Q_STATIC_ASSERT(!QTypeInfo::isStatic ); -Q_STATIC_ASSERT(!QTypeInfo::isDummy ); Q_STATIC_ASSERT(!QTypeInfo::isPointer); -- cgit v1.2.3