Remove handling of missing =delete and =default support

Change-Id: I006dfd0b7cfa3bda5e5ab01bcefa851f031dfe0e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Allan Sandfeld Jensen 2019-04-30 17:53:53 +02:00
parent 7a0d4b39da
commit a2b38f64e6
14 changed files with 24 additions and 32 deletions

View File

@ -422,8 +422,8 @@ typedef double qreal;
operator to disable copying (the compiler gives an error message). operator to disable copying (the compiler gives an error message).
*/ */
#define Q_DISABLE_COPY(Class) \ #define Q_DISABLE_COPY(Class) \
Class(const Class &) Q_DECL_EQ_DELETE;\ Class(const Class &) = delete;\
Class &operator=(const Class &) Q_DECL_EQ_DELETE; Class &operator=(const Class &) = delete;
#define Q_DISABLE_MOVE(Class) \ #define Q_DISABLE_MOVE(Class) \
Class(Class &&) = delete; \ Class(Class &&) = delete; \
@ -1021,7 +1021,7 @@ template <typename T>
Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; } Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; }
// prevent rvalue arguments: // prevent rvalue arguments:
template <typename T> template <typename T>
void qAsConst(const T &&) Q_DECL_EQ_DELETE; void qAsConst(const T &&) = delete;
#ifndef QT_NO_FOREACH #ifndef QT_NO_FOREACH

View File

@ -183,7 +183,7 @@ private:
// signature() has been renamed to methodSignature() in Qt 5. // signature() has been renamed to methodSignature() in Qt 5.
// Warning, that function returns a QByteArray; check the life time if // Warning, that function returns a QByteArray; check the life time if
// you convert to char*. // you convert to char*.
char *signature(struct renamedInQt5_warning_checkTheLifeTime * = nullptr) Q_DECL_EQ_DELETE; char *signature(struct renamedInQt5_warning_checkTheLifeTime * = nullptr) = delete;
#endif #endif
static QMetaMethod fromSignalImpl(const QMetaObject *, void **); static QMetaMethod fromSignalImpl(const QMetaObject *, void **);

View File

@ -849,7 +849,7 @@ struct VariantData
const uint flags; const uint flags;
private: private:
// copy constructor allowed to be implicit to silence level 4 warning from MSVC // 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<typename const_iterator> template<typename const_iterator>

View File

@ -483,27 +483,27 @@ public:
private: private:
// force compile error, prevent QVariant(bool) to be called // 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 // QVariant::Type is marked as \obsolete, but we don't want to
// provide a constructor from its intended replacement, // provide a constructor from its intended replacement,
// QMetaType::Type, instead, because the idea behind these // QMetaType::Type, instead, because the idea behind these
// constructors is flawed in the first place. But we also don't // constructors is flawed in the first place. But we also don't
// want QVariant(QMetaType::String) to compile and falsely be an // want QVariant(QMetaType::String) to compile and falsely be an
// int variant, so delete this constructor: // 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 // These constructors don't create QVariants of the type associcated
// with the enum, as expected, but they would create a QVariant of // with the enum, as expected, but they would create a QVariant of
// type int with the value of the enum value. // type int with the value of the enum value.
// Use QVariant v = QColor(Qt::red) instead of QVariant v = Qt::red for // Use QVariant v = QColor(Qt::red) instead of QVariant v = Qt::red for
// example. // example.
QVariant(Qt::GlobalColor) Q_DECL_EQ_DELETE; QVariant(Qt::GlobalColor) = delete;
QVariant(Qt::BrushStyle) Q_DECL_EQ_DELETE; QVariant(Qt::BrushStyle) = delete;
QVariant(Qt::PenStyle) Q_DECL_EQ_DELETE; QVariant(Qt::PenStyle) = delete;
QVariant(Qt::CursorShape) Q_DECL_EQ_DELETE; QVariant(Qt::CursorShape) = delete;
#ifdef QT_NO_CAST_FROM_ASCII #ifdef QT_NO_CAST_FROM_ASCII
// force compile error when implicit conversion is not wanted // force compile error when implicit conversion is not wanted
inline QVariant(const char *) Q_DECL_EQ_DELETE; inline QVariant(const char *) = delete;
#endif #endif
public: public:
typedef Private DataPtr; typedef Private DataPtr;

View File

@ -462,7 +462,7 @@ template <typename X> 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 } # define Q_BASIC_ATOMIC_INITIALIZER(a) { a }
#else #else
# define Q_BASIC_ATOMIC_INITIALIZER(a) { ATOMIC_VAR_INIT(a) } # define Q_BASIC_ATOMIC_INITIALIZER(a) { ATOMIC_VAR_INIT(a) }

View File

@ -75,7 +75,7 @@ QT_END_NAMESPACE
// New atomics // 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 # if defined(Q_CC_CLANG) && Q_CC_CLANG < 303
/* /*
Do not define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS for Clang before version 3.3. Do not define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS for Clang before version 3.3.

View File

@ -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 // Apply the same semantics of a lambda closure type w.r.t. the special
// member functions, if possible: delete the copy assignment operator, // 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]) // 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(Callable &&) = default;
Callable &operator=(const Callable &) = delete; Callable &operator=(const Callable &) = delete;
Callable &operator=(Callable &&) = default; Callable &operator=(Callable &&) = default;
#endif
void operator()() void operator()()
{ {

View File

@ -142,7 +142,7 @@ private:
rightNode()->destroySubTree(); rightNode()->destroySubTree();
} }
QMapNode() Q_DECL_EQ_DELETE; QMapNode() = delete;
Q_DISABLE_COPY(QMapNode) Q_DISABLE_COPY(QMapNode)
}; };

View File

@ -235,8 +235,8 @@ namespace QtSharedPointer {
} }
private: private:
// prevent construction // prevent construction
ExternalRefCountWithCustomDeleter() Q_DECL_EQ_DELETE; ExternalRefCountWithCustomDeleter() = delete;
~ExternalRefCountWithCustomDeleter() Q_DECL_EQ_DELETE; ~ExternalRefCountWithCustomDeleter() = delete;
Q_DISABLE_COPY(ExternalRefCountWithCustomDeleter) Q_DISABLE_COPY(ExternalRefCountWithCustomDeleter)
}; };
@ -280,8 +280,8 @@ namespace QtSharedPointer {
private: private:
// prevent construction // prevent construction
ExternalRefCountWithContiguousData() Q_DECL_EQ_DELETE; ExternalRefCountWithContiguousData() = delete;
~ExternalRefCountWithContiguousData() Q_DECL_EQ_DELETE; ~ExternalRefCountWithContiguousData() = delete;
Q_DISABLE_COPY(ExternalRefCountWithContiguousData) Q_DISABLE_COPY(ExternalRefCountWithContiguousData)
}; };
@ -705,11 +705,7 @@ template <class T>
class QEnableSharedFromThis class QEnableSharedFromThis
{ {
protected: protected:
#ifdef Q_COMPILER_DEFAULT_MEMBERS
QEnableSharedFromThis() = default; QEnableSharedFromThis() = default;
#else
Q_DECL_CONSTEXPR QEnableSharedFromThis() {}
#endif
QEnableSharedFromThis(const QEnableSharedFromThis &) {} QEnableSharedFromThis(const QEnableSharedFromThis &) {}
QEnableSharedFromThis &operator=(const QEnableSharedFromThis &) { return *this; } QEnableSharedFromThis &operator=(const QEnableSharedFromThis &) { return *this; }

View File

@ -150,7 +150,7 @@ class QStringBuilder <QString, QString> : public QStringBuilderBase<QStringBuild
const QString &b; const QString &b;
private: private:
QStringBuilder &operator=(const QStringBuilder &) Q_DECL_EQ_DELETE; QStringBuilder &operator=(const QStringBuilder &) = delete;
}; };
template <> template <>
@ -167,7 +167,7 @@ class QStringBuilder <QByteArray, QByteArray> : public QStringBuilderBase<QStrin
const QByteArray &b; const QByteArray &b;
private: private:
QStringBuilder &operator=(const QStringBuilder &) Q_DECL_EQ_DELETE; QStringBuilder &operator=(const QStringBuilder &) = delete;
}; };

View File

@ -94,7 +94,7 @@ public:
virtual void virtual_hook(int id, void *data); virtual void virtual_hook(int id, void *data);
private: private:
QIconEngine &operator=(const QIconEngine &other) Q_DECL_EQ_DELETE; QIconEngine &operator=(const QIconEngine &other) = delete;
}; };
#if QT_DEPRECATED_SINCE(5, 0) #if QT_DEPRECATED_SINCE(5, 0)

View File

@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
class Q_WIDGETS_EXPORT QToolTip class Q_WIDGETS_EXPORT QToolTip
{ {
QToolTip() Q_DECL_EQ_DELETE; QToolTip() = delete;
public: public:
// ### Qt 6 - merge the three showText functions below // ### Qt 6 - merge the three showText functions below
static void showText(const QPoint &pos, const QString &text, QWidget *w = nullptr); static void showText(const QPoint &pos, const QString &text, QWidget *w = nullptr);

View File

@ -54,7 +54,7 @@ class QAction;
class Q_WIDGETS_EXPORT QWhatsThis class Q_WIDGETS_EXPORT QWhatsThis
{ {
QWhatsThis() Q_DECL_EQ_DELETE; QWhatsThis() = delete;
public: public:
static void enterWhatsThisMode(); static void enterWhatsThisMode();

View File

@ -116,12 +116,10 @@ class Q_XML_EXPORT QXmlAttributes
{ {
public: public:
QXmlAttributes(); QXmlAttributes();
#ifdef Q_COMPILER_DEFAULT_MEMBERS
QXmlAttributes(const QXmlAttributes &) = default; QXmlAttributes(const QXmlAttributes &) = default;
QXmlAttributes(QXmlAttributes &&) noexcept = default; QXmlAttributes(QXmlAttributes &&) noexcept = default;
QXmlAttributes &operator=(const QXmlAttributes &) = default; QXmlAttributes &operator=(const QXmlAttributes &) = default;
QXmlAttributes &operator=(QXmlAttributes &&) noexcept = default; QXmlAttributes &operator=(QXmlAttributes &&) noexcept = default;
#endif // default members
QT6_NOT_VIRTUAL ~QXmlAttributes(); QT6_NOT_VIRTUAL ~QXmlAttributes();