From a2b38f64e6def1538b9d153ec4c6589fa9b6d3c0 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 30 Apr 2019 17:53:53 +0200 Subject: Remove handling of missing =delete and =default support Change-Id: I006dfd0b7cfa3bda5e5ab01bcefa851f031dfe0e Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.h | 6 +++--- src/corelib/kernel/qmetaobject.h | 2 +- src/corelib/kernel/qmetatype.h | 2 +- src/corelib/kernel/qvariant.h | 14 +++++++------- src/corelib/thread/qatomic_cxx11.h | 2 +- src/corelib/thread/qbasicatomic.h | 2 +- src/corelib/thread/qthread.h | 2 -- src/corelib/tools/qmap.h | 2 +- src/corelib/tools/qsharedpointer_impl.h | 12 ++++-------- src/corelib/tools/qstringbuilder.h | 4 ++-- src/gui/image/qiconengine.h | 2 +- src/widgets/kernel/qtooltip.h | 2 +- src/widgets/kernel/qwhatsthis.h | 2 +- src/xml/sax/qxml.h | 2 -- 14 files changed, 24 insertions(+), 32 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index ceae0583ee..4817acb48f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -422,8 +422,8 @@ typedef double qreal; operator to disable copying (the compiler gives an error message). */ #define Q_DISABLE_COPY(Class) \ - Class(const Class &) Q_DECL_EQ_DELETE;\ - Class &operator=(const Class &) Q_DECL_EQ_DELETE; + Class(const Class &) = delete;\ + Class &operator=(const Class &) = delete; #define Q_DISABLE_MOVE(Class) \ Class(Class &&) = delete; \ @@ -1021,7 +1021,7 @@ template Q_DECL_CONSTEXPR typename std::add_const::type &qAsConst(T &t) noexcept { return t; } // prevent rvalue arguments: template -void qAsConst(const T &&) Q_DECL_EQ_DELETE; +void qAsConst(const T &&) = delete; #ifndef QT_NO_FOREACH diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h index 6c5f78d208..10b14a7e03 100644 --- a/src/corelib/kernel/qmetaobject.h +++ b/src/corelib/kernel/qmetaobject.h @@ -183,7 +183,7 @@ private: // signature() has been renamed to methodSignature() in Qt 5. // Warning, that function returns a QByteArray; check the life time if // you convert to char*. - char *signature(struct renamedInQt5_warning_checkTheLifeTime * = nullptr) Q_DECL_EQ_DELETE; + char *signature(struct renamedInQt5_warning_checkTheLifeTime * = nullptr) = delete; #endif static QMetaMethod fromSignalImpl(const QMetaObject *, void **); diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index a47fbfe28d..79ee5eec11 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -849,7 +849,7 @@ struct VariantData const uint flags; private: // copy constructor allowed to be implicit to silence level 4 warning from MSVC - VariantData &operator=(const VariantData &) Q_DECL_EQ_DELETE; + VariantData &operator=(const VariantData &) = delete; }; template diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 2247c7adc8..924cfa1e1a 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -483,27 +483,27 @@ public: private: // force compile error, prevent QVariant(bool) to be called - inline QVariant(void *) Q_DECL_EQ_DELETE; + inline QVariant(void *) = delete; // QVariant::Type is marked as \obsolete, but we don't want to // provide a constructor from its intended replacement, // QMetaType::Type, instead, because the idea behind these // constructors is flawed in the first place. But we also don't // want QVariant(QMetaType::String) to compile and falsely be an // int variant, so delete this constructor: - QVariant(QMetaType::Type) Q_DECL_EQ_DELETE; + QVariant(QMetaType::Type) = delete; // These constructors don't create QVariants of the type associcated // with the enum, as expected, but they would create a QVariant of // type int with the value of the enum value. // Use QVariant v = QColor(Qt::red) instead of QVariant v = Qt::red for // example. - QVariant(Qt::GlobalColor) Q_DECL_EQ_DELETE; - QVariant(Qt::BrushStyle) Q_DECL_EQ_DELETE; - QVariant(Qt::PenStyle) Q_DECL_EQ_DELETE; - QVariant(Qt::CursorShape) Q_DECL_EQ_DELETE; + QVariant(Qt::GlobalColor) = delete; + QVariant(Qt::BrushStyle) = delete; + QVariant(Qt::PenStyle) = delete; + QVariant(Qt::CursorShape) = delete; #ifdef QT_NO_CAST_FROM_ASCII // force compile error when implicit conversion is not wanted - inline QVariant(const char *) Q_DECL_EQ_DELETE; + inline QVariant(const char *) = delete; #endif public: typedef Private DataPtr; diff --git a/src/corelib/thread/qatomic_cxx11.h b/src/corelib/thread/qatomic_cxx11.h index 32d27734fc..2851bae73e 100644 --- a/src/corelib/thread/qatomic_cxx11.h +++ b/src/corelib/thread/qatomic_cxx11.h @@ -462,7 +462,7 @@ template struct QAtomicOps } }; -#if defined(Q_COMPILER_CONSTEXPR) && defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS) +#if defined(Q_COMPILER_CONSTEXPR) # define Q_BASIC_ATOMIC_INITIALIZER(a) { a } #else # define Q_BASIC_ATOMIC_INITIALIZER(a) { ATOMIC_VAR_INIT(a) } diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h index 4c3c1fc01f..7d2e06a499 100644 --- a/src/corelib/thread/qbasicatomic.h +++ b/src/corelib/thread/qbasicatomic.h @@ -75,7 +75,7 @@ QT_END_NAMESPACE // New atomics -#if defined(Q_COMPILER_CONSTEXPR) && defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS) +#if defined(Q_COMPILER_CONSTEXPR) # if defined(Q_CC_CLANG) && Q_CC_CLANG < 303 /* Do not define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS for Clang before version 3.3. diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h index 8e92d75401..c7a6dc8f1a 100644 --- a/src/corelib/thread/qthread.h +++ b/src/corelib/thread/qthread.h @@ -209,7 +209,6 @@ struct Callable { } -#if defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS) // Apply the same semantics of a lambda closure type w.r.t. the special // member functions, if possible: delete the copy assignment operator, // bring back all the others as per the RO5 (cf. ยง8.1.5.1/11 [expr.prim.lambda.closure]) @@ -218,7 +217,6 @@ struct Callable Callable(Callable &&) = default; Callable &operator=(const Callable &) = delete; Callable &operator=(Callable &&) = default; -#endif void operator()() { diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 3b8aad9a33..2d01a75a42 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -142,7 +142,7 @@ private: rightNode()->destroySubTree(); } - QMapNode() Q_DECL_EQ_DELETE; + QMapNode() = delete; Q_DISABLE_COPY(QMapNode) }; diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 9fb452da6b..c219d310dc 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -235,8 +235,8 @@ namespace QtSharedPointer { } private: // prevent construction - ExternalRefCountWithCustomDeleter() Q_DECL_EQ_DELETE; - ~ExternalRefCountWithCustomDeleter() Q_DECL_EQ_DELETE; + ExternalRefCountWithCustomDeleter() = delete; + ~ExternalRefCountWithCustomDeleter() = delete; Q_DISABLE_COPY(ExternalRefCountWithCustomDeleter) }; @@ -280,8 +280,8 @@ namespace QtSharedPointer { private: // prevent construction - ExternalRefCountWithContiguousData() Q_DECL_EQ_DELETE; - ~ExternalRefCountWithContiguousData() Q_DECL_EQ_DELETE; + ExternalRefCountWithContiguousData() = delete; + ~ExternalRefCountWithContiguousData() = delete; Q_DISABLE_COPY(ExternalRefCountWithContiguousData) }; @@ -705,11 +705,7 @@ template class QEnableSharedFromThis { protected: -#ifdef Q_COMPILER_DEFAULT_MEMBERS QEnableSharedFromThis() = default; -#else - Q_DECL_CONSTEXPR QEnableSharedFromThis() {} -#endif QEnableSharedFromThis(const QEnableSharedFromThis &) {} QEnableSharedFromThis &operator=(const QEnableSharedFromThis &) { return *this; } diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 79ed10c7a8..b3cf2f695e 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -150,7 +150,7 @@ class QStringBuilder : public QStringBuilderBase @@ -167,7 +167,7 @@ class QStringBuilder : public QStringBuilderBase