Remove handling of missing Q_COMPILER_INITIALIZER_LISTS
Change-Id: Id65b39c787235a051262544932e6717d076f1ea0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
78a7e54f8f
commit
d775b1fcb3
@ -79,8 +79,6 @@ IconPreviewArea::IconPreviewArea(QWidget *parent)
|
||||
}
|
||||
//! [0]
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
|
||||
//! [42]
|
||||
QVector<QIcon::Mode> IconPreviewArea::iconModes()
|
||||
{
|
||||
@ -107,44 +105,6 @@ QStringList IconPreviewArea::iconStateNames()
|
||||
}
|
||||
//! [42]
|
||||
|
||||
#else // Q_COMPILER_INITIALIZER_LISTS
|
||||
|
||||
//! [43]
|
||||
QVector<QIcon::Mode> IconPreviewArea::iconModes()
|
||||
{
|
||||
static QVector<QIcon::Mode> result;
|
||||
if (result.isEmpty())
|
||||
result << QIcon::Normal << QIcon::Active << QIcon::Disabled << QIcon::Selected;
|
||||
return result;
|
||||
}
|
||||
//! [43]
|
||||
|
||||
QVector<QIcon::State> IconPreviewArea::iconStates()
|
||||
{
|
||||
static QVector<QIcon::State> result;
|
||||
if (result.isEmpty())
|
||||
result << QIcon::Off << QIcon::On;
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList IconPreviewArea::iconModeNames()
|
||||
{
|
||||
static QStringList result;
|
||||
if (result.isEmpty())
|
||||
result << tr("Normal") << tr("Active") << tr("Disabled") << tr("Selected");
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList IconPreviewArea::iconStateNames()
|
||||
{
|
||||
static QStringList result;
|
||||
if (result.isEmpty())
|
||||
result << tr("Off") << tr("On");
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // !Q_COMPILER_INITIALIZER_LISTS
|
||||
|
||||
//! [1]
|
||||
void IconPreviewArea::setIcon(const QIcon &icon)
|
||||
{
|
||||
|
@ -42,9 +42,7 @@
|
||||
#ifndef QFLAGS_H
|
||||
#define QFLAGS_H
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -121,10 +119,8 @@ public:
|
||||
Q_DECL_CONSTEXPR inline QFlags(Zero = nullptr) noexcept : i(0) {}
|
||||
Q_DECL_CONSTEXPR inline QFlags(QFlag flag) noexcept : i(flag) {}
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
Q_DECL_CONSTEXPR inline QFlags(std::initializer_list<Enum> flags) noexcept
|
||||
: i(initializer_list_helper(flags.begin(), flags.end())) {}
|
||||
#endif
|
||||
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(int mask) noexcept { i &= mask; return *this; }
|
||||
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(uint mask) noexcept { i &= mask; return *this; }
|
||||
@ -154,14 +150,12 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
Q_DECL_CONSTEXPR static inline Int initializer_list_helper(typename std::initializer_list<Enum>::const_iterator it,
|
||||
typename std::initializer_list<Enum>::const_iterator end)
|
||||
noexcept
|
||||
{
|
||||
return (it == end ? Int(0) : (Int(*it) | initializer_list_helper(it + 1, end)));
|
||||
}
|
||||
#endif
|
||||
|
||||
Int i;
|
||||
};
|
||||
|
@ -340,7 +340,6 @@ QString QOperatingSystemVersion::name() const
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
/*!
|
||||
\fn bool QOperatingSystemVersion::isAnyOfType(std::initializer_list<OSType> types) const
|
||||
|
||||
@ -355,7 +354,6 @@ bool QOperatingSystemVersion::isAnyOfType(std::initializer_list<OSType> types) c
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\variable QOperatingSystemVersion::Windows7
|
||||
|
@ -119,9 +119,7 @@ public:
|
||||
Q_DECL_CONSTEXPR int segmentCount() const
|
||||
{ return m_micro >= 0 ? 3 : m_minor >= 0 ? 2 : m_major >= 0 ? 1 : 0; }
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
bool isAnyOfType(std::initializer_list<OSType> types) const;
|
||||
#endif
|
||||
Q_DECL_CONSTEXPR OSType type() const { return m_os; }
|
||||
QString name() const;
|
||||
|
||||
|
@ -42,9 +42,7 @@
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qiterator.h>
|
||||
#if defined(Q_COMPILER_INITIALIZER_LISTS)
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -58,14 +56,12 @@ class Q_CORE_EXPORT QJsonArray
|
||||
public:
|
||||
QJsonArray();
|
||||
|
||||
#if defined(Q_COMPILER_INITIALIZER_LISTS) || defined(Q_QDOC)
|
||||
QJsonArray(std::initializer_list<QJsonValue> args)
|
||||
{
|
||||
initialize();
|
||||
for (std::initializer_list<QJsonValue>::const_iterator i = args.begin(); i != args.end(); ++i)
|
||||
append(*i);
|
||||
}
|
||||
#endif
|
||||
|
||||
~QJsonArray();
|
||||
|
||||
|
@ -42,10 +42,8 @@
|
||||
|
||||
#include <QtCore/qjsonvalue.h>
|
||||
#include <QtCore/qiterator.h>
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
#include <QtCore/qpair.h>
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -60,14 +58,12 @@ class Q_CORE_EXPORT QJsonObject
|
||||
public:
|
||||
QJsonObject();
|
||||
|
||||
#if defined(Q_COMPILER_INITIALIZER_LISTS) || defined(Q_QDOC)
|
||||
QJsonObject(std::initializer_list<QPair<QString, QJsonValue> > args)
|
||||
{
|
||||
initialize();
|
||||
for (std::initializer_list<QPair<QString, QJsonValue> >::const_iterator i = args.begin(); i != args.end(); ++i)
|
||||
insert(i->first, i->second);
|
||||
}
|
||||
#endif
|
||||
|
||||
~QJsonObject();
|
||||
|
||||
|
@ -48,11 +48,8 @@
|
||||
#include <QtCore/qhashfunctions.h>
|
||||
#include <QtCore/qcontainertools_impl.h>
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <initializer_list>
|
||||
|
||||
#if defined(Q_CC_MSVC)
|
||||
#pragma warning( push )
|
||||
@ -242,7 +239,6 @@ class QHash
|
||||
|
||||
public:
|
||||
inline QHash() noexcept : d(const_cast<QHashData *>(&QHashData::shared_null)) { }
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
inline QHash(std::initializer_list<std::pair<Key,T> > list)
|
||||
: d(const_cast<QHashData *>(&QHashData::shared_null))
|
||||
{
|
||||
@ -250,7 +246,6 @@ public:
|
||||
for (typename std::initializer_list<std::pair<Key,T> >::const_iterator it = list.begin(); it != list.end(); ++it)
|
||||
insert(it->first, it->second);
|
||||
}
|
||||
#endif
|
||||
QHash(const QHash &other) : d(other.d) { d->ref.ref(); if (!d->sharable) detach(); }
|
||||
~QHash() { if (!d->ref.deref()) freeData(d); }
|
||||
|
||||
@ -1042,14 +1037,12 @@ class QMultiHash : public QHash<Key, T>
|
||||
{
|
||||
public:
|
||||
QMultiHash() noexcept {}
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
inline QMultiHash(std::initializer_list<std::pair<Key,T> > list)
|
||||
{
|
||||
this->reserve(int(list.size()));
|
||||
for (typename std::initializer_list<std::pair<Key,T> >::const_iterator it = list.begin(); it != list.end(); ++it)
|
||||
insert(it->first, it->second);
|
||||
}
|
||||
#endif
|
||||
#ifdef Q_QDOC
|
||||
template <typename InputIterator>
|
||||
QMultiHash(InputIterator f, InputIterator l);
|
||||
|
@ -44,15 +44,11 @@
|
||||
#include <QtCore/qrefcount.h>
|
||||
#include <QtCore/qcontainertools_impl.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <initializer_list>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#if defined(Q_COMPILER_INITIALIZER_LISTS)
|
||||
# include <initializer_list>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
@ -83,10 +79,8 @@ class QLinkedList
|
||||
public:
|
||||
inline QLinkedList() noexcept : d(const_cast<QLinkedListData *>(&QLinkedListData::shared_null)) { }
|
||||
inline QLinkedList(const QLinkedList<T> &l) : d(l.d) { d->ref.ref(); if (!d->sharable) detach(); }
|
||||
#if defined(Q_COMPILER_INITIALIZER_LISTS)
|
||||
inline QLinkedList(std::initializer_list<T> list)
|
||||
: QLinkedList(list.begin(), list.end()) {}
|
||||
#endif
|
||||
template <typename InputIterator, QtPrivate::IfIsInputIterator<InputIterator> = true>
|
||||
inline QLinkedList(InputIterator first, InputIterator last)
|
||||
: QLinkedList()
|
||||
|
@ -48,12 +48,10 @@
|
||||
#include <QtCore/qvector.h>
|
||||
#include <QtCore/qcontainertools_impl.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <initializer_list>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <algorithm>
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <new>
|
||||
@ -166,13 +164,10 @@ public:
|
||||
inline QList &operator=(QList<T> &&other) noexcept
|
||||
{ QList moved(std::move(other)); swap(moved); return *this; }
|
||||
inline void swap(QList<T> &other) noexcept { qSwap(d, other.d); }
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
inline QList(std::initializer_list<T> args)
|
||||
: QList(args.begin(), args.end()) {}
|
||||
#endif
|
||||
template <typename InputIterator, QtPrivate::IfIsInputIterator<InputIterator> = true>
|
||||
QList(InputIterator first, InputIterator last);
|
||||
|
||||
bool operator==(const QList<T> &l) const;
|
||||
inline bool operator!=(const QList<T> &l) const { return !(*this == l); }
|
||||
|
||||
|
@ -49,13 +49,10 @@
|
||||
#include <QtCore/qdebug.h>
|
||||
#endif
|
||||
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <map>
|
||||
#include <new>
|
||||
#include <functional>
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -326,14 +323,12 @@ class QMap
|
||||
|
||||
public:
|
||||
inline QMap() noexcept : d(static_cast<QMapData<Key, T> *>(const_cast<QMapDataBase *>(&QMapDataBase::shared_null))) { }
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
inline QMap(std::initializer_list<std::pair<Key,T> > list)
|
||||
: d(static_cast<QMapData<Key, T> *>(const_cast<QMapDataBase *>(&QMapDataBase::shared_null)))
|
||||
{
|
||||
for (typename std::initializer_list<std::pair<Key,T> >::const_iterator it = list.begin(); it != list.end(); ++it)
|
||||
insert(it->first, it->second);
|
||||
}
|
||||
#endif
|
||||
QMap(const QMap<Key, T> &other);
|
||||
|
||||
inline ~QMap() { if (!d->ref.deref()) d->destroy(); }
|
||||
@ -1186,13 +1181,11 @@ class QMultiMap : public QMap<Key, T>
|
||||
{
|
||||
public:
|
||||
QMultiMap() noexcept {}
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
inline QMultiMap(std::initializer_list<std::pair<Key,T> > list)
|
||||
{
|
||||
for (typename std::initializer_list<std::pair<Key,T> >::const_iterator it = list.begin(); it != list.end(); ++it)
|
||||
insert(it->first, it->second);
|
||||
}
|
||||
#endif
|
||||
QMultiMap(const QMap<Key, T> &other) : QMap<Key, T>(other) {}
|
||||
QMultiMap(QMap<Key, T> &&other) noexcept : QMap<Key, T>(std::move(other)) {}
|
||||
void swap(QMultiMap<Key, T> &other) noexcept { QMap<Key, T>::swap(other); }
|
||||
|
@ -43,10 +43,7 @@
|
||||
#include <QtCore/qhash.h>
|
||||
#include <QtCore/qcontainertools_impl.h>
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
||||
#include <iterator>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -59,10 +56,8 @@ class QSet
|
||||
|
||||
public:
|
||||
inline QSet() noexcept {}
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
inline QSet(std::initializer_list<T> list)
|
||||
: QSet(list.begin(), list.end()) {}
|
||||
#endif
|
||||
template <typename InputIterator, QtPrivate::IfIsInputIterator<InputIterator> = true>
|
||||
inline QSet(InputIterator first, InputIterator last)
|
||||
{
|
||||
|
@ -105,9 +105,7 @@ public:
|
||||
inline explicit QStringList(const QString &i) { append(i); }
|
||||
inline QStringList(const QList<QString> &l) : QList<QString>(l) { }
|
||||
inline QStringList(QList<QString> &&l) noexcept : QList<QString>(std::move(l)) { }
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
inline QStringList(std::initializer_list<QString> args) : QList<QString>(args) { }
|
||||
#endif
|
||||
template <typename InputIterator, QtPrivate::IfIsInputIterator<InputIterator> = true>
|
||||
inline QStringList(InputIterator first, InputIterator last)
|
||||
: QList<QString>(first, last) { }
|
||||
|
@ -45,14 +45,12 @@
|
||||
#include <QtCore/qalgorithms.h>
|
||||
#include <QtCore/qcontainertools_impl.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <initializer_list>
|
||||
#include <iterator>
|
||||
#include <new>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <algorithm>
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
#include <iterator>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -70,12 +68,10 @@ public:
|
||||
append(other.constData(), other.size());
|
||||
}
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
QVarLengthArray(std::initializer_list<T> args)
|
||||
: QVarLengthArray(args.begin(), args.end())
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename InputIterator, QtPrivate::IfIsInputIterator<InputIterator> = true>
|
||||
inline QVarLengthArray(InputIterator first, InputIterator last)
|
||||
@ -103,7 +99,6 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
QVarLengthArray<T, Prealloc> &operator=(std::initializer_list<T> list)
|
||||
{
|
||||
resize(list.size());
|
||||
@ -111,7 +106,6 @@ public:
|
||||
QT_MAKE_CHECKED_ARRAY_ITERATOR(this->begin(), this->size()));
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void removeLast() {
|
||||
Q_ASSERT(s > 0);
|
||||
|
@ -48,12 +48,10 @@
|
||||
#include <QtCore/qcontainertools_impl.h>
|
||||
|
||||
#include <iterator>
|
||||
#include <initializer_list>
|
||||
#include <vector>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -76,10 +74,8 @@ public:
|
||||
QVector<T> &operator=(QVector<T> &&other) noexcept
|
||||
{ QVector moved(std::move(other)); swap(moved); return *this; }
|
||||
void swap(QVector<T> &other) noexcept { qSwap(d, other.d); }
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
inline QVector(std::initializer_list<T> args);
|
||||
QVector<T> &operator=(std::initializer_list<T> args);
|
||||
#endif
|
||||
template <typename InputIterator, QtPrivate::IfIsInputIterator<InputIterator> = true>
|
||||
inline QVector(InputIterator first, InputIterator last);
|
||||
|
||||
@ -521,11 +517,10 @@ QVector<T>::QVector(int asize, const T &t)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
# if defined(Q_CC_MSVC)
|
||||
#if defined(Q_CC_MSVC)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_MSVC(4127) // conditional expression is constant
|
||||
# endif // Q_CC_MSVC
|
||||
#endif // Q_CC_MSVC
|
||||
|
||||
template <typename T>
|
||||
QVector<T>::QVector(std::initializer_list<T> args)
|
||||
@ -550,10 +545,9 @@ QVector<T> &QVector<T>::operator=(std::initializer_list<T> args)
|
||||
return *this;
|
||||
}
|
||||
|
||||
# if defined(Q_CC_MSVC)
|
||||
#if defined(Q_CC_MSVC)
|
||||
QT_WARNING_POP
|
||||
# endif // Q_CC_MSVC
|
||||
#endif // Q_COMPILER_INITIALIZER_LISTS
|
||||
#endif // Q_CC_MSVC
|
||||
|
||||
template <typename T>
|
||||
template <typename InputIterator, QtPrivate::IfIsInputIterator<InputIterator>>
|
||||
|
@ -138,7 +138,6 @@ class QVersionNumber
|
||||
else
|
||||
pointer_segments = new QVector<int>(std::move(seg));
|
||||
}
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
SegmentStorage(std::initializer_list<int> args)
|
||||
{
|
||||
if (dataFitsInline(args.begin(), int(args.size()))) {
|
||||
@ -147,7 +146,6 @@ class QVersionNumber
|
||||
pointer_segments = new QVector<int>(args);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
~SegmentStorage() { if (isUsingPointer()) delete pointer_segments; }
|
||||
|
||||
@ -229,11 +227,9 @@ public:
|
||||
: m_segments(std::move(seg))
|
||||
{}
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
inline QVersionNumber(std::initializer_list<int> args)
|
||||
: m_segments(args)
|
||||
{}
|
||||
#endif
|
||||
|
||||
inline explicit QVersionNumber(int maj)
|
||||
{ m_segments.setSegments(1, maj); }
|
||||
|
@ -710,14 +710,12 @@ void tst_QtConcurrentRun::lambda()
|
||||
QCOMPARE(QtConcurrent::run([](int a, double b){ return a + b; }, 12, 15).result(), double(12+15));
|
||||
QCOMPARE(QtConcurrent::run([](int a , int, int, int, int b){ return a + b; }, 1, 2, 3, 4, 5).result(), 1 + 5);
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
{
|
||||
QString str { "Hello World Foo" };
|
||||
QFuture<QStringList> f1 = QtConcurrent::run([&](){ return str.split(' '); });
|
||||
auto r = f1.result();
|
||||
QCOMPARE(r, QStringList({"Hello", "World", "Foo"}));
|
||||
}
|
||||
#endif
|
||||
|
||||
// and now with explicit pool:
|
||||
QThreadPool pool;
|
||||
@ -726,14 +724,12 @@ void tst_QtConcurrentRun::lambda()
|
||||
QCOMPARE(QtConcurrent::run(&pool, [](int a, double b){ return a + b; }, 12, 15).result(), double(12+15));
|
||||
QCOMPARE(QtConcurrent::run(&pool, [](int a , int, int, int, int b){ return a + b; }, 1, 2, 3, 4, 5).result(), 1 + 5);
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
{
|
||||
QString str { "Hello World Foo" };
|
||||
QFuture<QStringList> f1 = QtConcurrent::run(&pool, [&](){ return str.split(' '); });
|
||||
auto r = f1.result();
|
||||
QCOMPARE(r, QStringList({"Hello", "World", "Foo"}));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QtConcurrentRun)
|
||||
|
@ -258,7 +258,6 @@ void tst_QFlags::classEnum()
|
||||
|
||||
void tst_QFlags::initializerLists()
|
||||
{
|
||||
#if defined(Q_COMPILER_INITIALIZER_LISTS)
|
||||
Qt::MouseButtons bts = { Qt::LeftButton, Qt::RightButton };
|
||||
QVERIFY(bts.testFlag(Qt::LeftButton));
|
||||
QVERIFY(bts.testFlag(Qt::RightButton));
|
||||
@ -268,10 +267,6 @@ void tst_QFlags::initializerLists()
|
||||
QVERIFY(flags.testFlag(MyStrictNoOpEnum::StrictOne));
|
||||
QVERIFY(flags.testFlag(MyStrictNoOpEnum::StrictFour));
|
||||
QVERIFY(!flags.testFlag(MyStrictNoOpEnum::StrictTwo));
|
||||
|
||||
#else
|
||||
QSKIP("This test requires C++11 initializer_list support.");
|
||||
#endif // Q_COMPILER_INITIALIZER_LISTS
|
||||
}
|
||||
|
||||
void tst_QFlags::testSetFlags()
|
||||
|
@ -2754,9 +2754,6 @@ void tst_QtJson::testJsonValueRefDefault()
|
||||
|
||||
void tst_QtJson::arrayInitializerList()
|
||||
{
|
||||
#ifndef Q_COMPILER_INITIALIZER_LISTS
|
||||
QSKIP("initializer_list is enabled only with c++11 support");
|
||||
#else
|
||||
QVERIFY(QJsonArray{}.isEmpty());
|
||||
QCOMPARE(QJsonArray{"one"}.count(), 1);
|
||||
QCOMPARE(QJsonArray{1}.count(), 1);
|
||||
@ -2802,14 +2799,10 @@ void tst_QtJson::arrayInitializerList()
|
||||
QCOMPARE(QJsonValue(a43["one"]), QJsonValue(1));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QtJson::objectInitializerList()
|
||||
{
|
||||
#ifndef Q_COMPILER_INITIALIZER_LISTS
|
||||
QSKIP("initializer_list is enabled only with c++11 support");
|
||||
#else
|
||||
QVERIFY(QJsonObject{}.isEmpty());
|
||||
|
||||
{ // one property
|
||||
@ -2849,7 +2842,6 @@ void tst_QtJson::objectInitializerList()
|
||||
QCOMPARE(QJsonValue(nested[0]), QJsonValue("innerValue"));
|
||||
QCOMPARE(QJsonValue(nested[1]), QJsonValue(2.1));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QtJson::unicodeKeys()
|
||||
|
@ -233,13 +233,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
VarLengthArray(std::initializer_list<T> args)
|
||||
: QVarLengthArray<T>(args)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
class tst_ContainerApiSymmetry : public QObject
|
||||
@ -614,7 +612,6 @@ struct ContainerDuplicatedValuesStrategy<std::unordered_multiset<T...>> : Contai
|
||||
template<typename ... T>
|
||||
struct ContainerDuplicatedValuesStrategy<QSet<T...>> : ContainerRejectsDuplicateValues {};
|
||||
|
||||
#if defined(Q_COMPILER_INITIALIZER_LISTS)
|
||||
template<typename Container>
|
||||
void non_associative_container_check_duplicates_impl(const std::initializer_list<DuplicateStrategyTestType> &reference, const Container &c, ContainerAcceptsDuplicateValues)
|
||||
{
|
||||
@ -716,13 +713,6 @@ void tst_ContainerApiSymmetry::non_associative_container_duplicates_strategy() c
|
||||
Container<DuplicateStrategyTestType> c2{reference.begin(), reference.end()};
|
||||
non_associative_container_check_duplicates(reference, c2);
|
||||
}
|
||||
#else
|
||||
template<template<class ... T> class Container>
|
||||
void tst_ContainerApiSymmetry::non_associative_container_duplicates_strategy() const
|
||||
{
|
||||
QSKIP("Test requires a better compiler");
|
||||
}
|
||||
#endif // Q_COMPILER_INITIALIZER_LISTS
|
||||
|
||||
template <typename Container>
|
||||
void tst_ContainerApiSymmetry::ranged_ctor_associative_impl() const
|
||||
|
@ -287,7 +287,6 @@ void tst_QByteArrayList::indexOf() const
|
||||
|
||||
void tst_QByteArrayList::initializerList() const
|
||||
{
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
// constructor
|
||||
QByteArrayList v1 = {QByteArray("hello"),"world",QByteArray("plop")};
|
||||
QCOMPARE(v1, (QByteArrayList() << "hello" << "world" << "plop"));
|
||||
@ -296,9 +295,6 @@ void tst_QByteArrayList::initializerList() const
|
||||
QByteArrayList v2;
|
||||
v2 = {QByteArray("hello"),"world",QByteArray("plop")};
|
||||
QCOMPARE(v2, v1);
|
||||
#else
|
||||
QSKIP("This test requires C++11 initializer_list support in the compiler.");
|
||||
#endif
|
||||
}
|
||||
|
||||
QTEST_APPLESS_MAIN(tst_QByteArrayList)
|
||||
|
@ -499,7 +499,7 @@ void tst_QCommandLineParser::testSingleDashWordOptionModes()
|
||||
|
||||
void tst_QCommandLineParser::testCpp11StyleInitialization()
|
||||
{
|
||||
#if defined(Q_COMPILER_INITIALIZER_LISTS) && defined(Q_COMPILER_UNIFORM_INIT)
|
||||
#if defined(Q_COMPILER_UNIFORM_INIT)
|
||||
QCoreApplication app(empty_argc, empty_argv);
|
||||
|
||||
QCommandLineParser parser;
|
||||
|
@ -1480,7 +1480,6 @@ void tst_QHash::twoArguments_qHash()
|
||||
|
||||
void tst_QHash::initializerList()
|
||||
{
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
QHash<int, QString> hash = {{1, "bar"}, {1, "hello"}, {2, "initializer_list"}};
|
||||
QCOMPARE(hash.count(), 2);
|
||||
QCOMPARE(hash[1], QString("hello"));
|
||||
@ -1507,9 +1506,6 @@ void tst_QHash::initializerList()
|
||||
|
||||
QMultiHash<int, float> emptyPairs2{{}, {}};
|
||||
QVERIFY(!emptyPairs2.isEmpty());
|
||||
#else
|
||||
QSKIP("Compiler doesn't support initializer lists");
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QHash::eraseValidIteratorOnSharedHash()
|
||||
|
@ -1005,7 +1005,6 @@ void tst_QLinkedList::testSTLIteratorsComplex() const
|
||||
|
||||
void tst_QLinkedList::initializeList() const
|
||||
{
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
QLinkedList<int> v1 { 2, 3, 4 };
|
||||
QCOMPARE(v1, QLinkedList<int>() << 2 << 3 << 4);
|
||||
QCOMPARE(v1, (QLinkedList<int> { 2, 3, 4}));
|
||||
@ -1014,7 +1013,6 @@ void tst_QLinkedList::initializeList() const
|
||||
QLinkedList<QLinkedList<int>> v3;
|
||||
v3 << v1 << (QLinkedList<int>() << 1) << QLinkedList<int>() << v1;
|
||||
QCOMPARE(v3, v2);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1871,7 +1871,6 @@ void tst_QList::testSTLIteratorsComplex() const
|
||||
|
||||
void tst_QList::initializeList() const
|
||||
{
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
QList<int> v1{2,3,4};
|
||||
QCOMPARE(v1, QList<int>() << 2 << 3 << 4);
|
||||
QCOMPARE(v1, (QList<int>{2,3,4}));
|
||||
@ -1880,7 +1879,6 @@ void tst_QList::initializeList() const
|
||||
QList<QList<int>> v3;
|
||||
v3 << v1 << (QList<int>() << 1) << QList<int>() << v1;
|
||||
QCOMPARE(v3, v2);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
@ -1319,7 +1319,6 @@ void tst_QMap::checkMostLeftNode()
|
||||
|
||||
void tst_QMap::initializerList()
|
||||
{
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
QMap<int, QString> map = {{1, "bar"}, {1, "hello"}, {2, "initializer_list"}};
|
||||
QCOMPARE(map.count(), 2);
|
||||
QCOMPARE(map[1], QString("hello"));
|
||||
@ -1346,9 +1345,6 @@ void tst_QMap::initializerList()
|
||||
|
||||
QMultiMap<float, float> emptyPairs2{{}, {}};
|
||||
QVERIFY(!emptyPairs2.isEmpty());
|
||||
#else
|
||||
QSKIP("Compiler doesn't support initializer lists");
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QMap::testInsertWithHint()
|
||||
|
@ -955,7 +955,6 @@ void tst_QSet::makeSureTheComfortFunctionsCompile()
|
||||
|
||||
void tst_QSet::initializerList()
|
||||
{
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
QSet<int> set = {1, 1, 2, 3, 4, 5};
|
||||
QCOMPARE(set.count(), 5);
|
||||
QVERIFY(set.contains(1));
|
||||
@ -976,9 +975,6 @@ void tst_QSet::initializerList()
|
||||
|
||||
QSet<int> set3{{}, {}, {}};
|
||||
QVERIFY(!set3.isEmpty());
|
||||
#else
|
||||
QSKIP("Compiler doesn't support initializer lists");
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QSet::qhash()
|
||||
@ -1011,15 +1007,7 @@ void tst_QSet::qhash()
|
||||
// check that sets of sets work:
|
||||
//
|
||||
{
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
QSet<QSet<int> > intSetSet = { { 0, 1, 2 }, { 0, 1 }, { 1, 2 } };
|
||||
#else
|
||||
QSet<QSet<int> > intSetSet;
|
||||
QSet<int> intSet01, intSet12;
|
||||
intSet01 << 0 << 1;
|
||||
intSet12 << 1 << 2;
|
||||
intSetSet << intSet01 << intSet12 << (intSet01|intSet12);
|
||||
#endif
|
||||
QCOMPARE(intSetSet.size(), 3);
|
||||
}
|
||||
}
|
||||
|
@ -63,9 +63,7 @@ private slots:
|
||||
void joinChar() const;
|
||||
void joinChar_data() const;
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
void initializeList() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern const char email[];
|
||||
@ -519,8 +517,6 @@ void tst_QStringList::joinEmptiness() const
|
||||
QVERIFY(string.isNull());
|
||||
}
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
// C++0x support is required
|
||||
void tst_QStringList::initializeList() const
|
||||
{
|
||||
|
||||
@ -528,7 +524,6 @@ void tst_QStringList::initializeList() const
|
||||
QCOMPARE(v1, (QStringList() << "hello" << "world" << "plop"));
|
||||
QCOMPARE(v1, (QStringList{"hello","world","plop"}));
|
||||
}
|
||||
#endif
|
||||
|
||||
QTEST_APPLESS_MAIN(tst_QStringList)
|
||||
#include "tst_qstringlist.moc"
|
||||
|
@ -908,7 +908,6 @@ void tst_QVarLengthArray::initializeListComplex()
|
||||
template<typename T>
|
||||
void tst_QVarLengthArray::initializeList()
|
||||
{
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
T val1(110);
|
||||
T val2(105);
|
||||
T val3(101);
|
||||
@ -945,9 +944,6 @@ void tst_QVarLengthArray::initializeList()
|
||||
|
||||
v6 = {}; // assign empty
|
||||
QCOMPARE(v6.size(), 0);
|
||||
#else
|
||||
QSKIP("This tests requires a compiler that supports initializer lists.");
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QVarLengthArray::insertMove()
|
||||
|
@ -549,7 +549,6 @@ void tst_QVector::assignmentCustom() const
|
||||
template<typename T>
|
||||
void tst_QVector::assignFromInitializerList() const
|
||||
{
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
T val1(SimpleValue<T>::at(1));
|
||||
T val2(SimpleValue<T>::at(2));
|
||||
T val3(SimpleValue<T>::at(3));
|
||||
@ -560,9 +559,6 @@ void tst_QVector::assignFromInitializerList() const
|
||||
|
||||
v1 = {};
|
||||
QCOMPARE(v1.size(), 0);
|
||||
#else
|
||||
QSKIP("This test requires support for C++11 initializer lists.");
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QVector::assignFromInitializerListInt() const
|
||||
@ -2553,7 +2549,6 @@ void tst_QVector::reallocAfterCopy()
|
||||
template<typename T>
|
||||
void tst_QVector::initializeList()
|
||||
{
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
T val1(SimpleValue<T>::at(1));
|
||||
T val2(SimpleValue<T>::at(2));
|
||||
T val3(SimpleValue<T>::at(3));
|
||||
@ -2570,7 +2565,6 @@ void tst_QVector::initializeList()
|
||||
|
||||
QVector<T> v4({});
|
||||
QCOMPARE(v4.size(), 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QVector::initializeListInt()
|
||||
|
@ -260,12 +260,10 @@ void tst_QVersionNumber::constructorExplicit()
|
||||
|
||||
QCOMPARE(v5.segments(), v6.segments());
|
||||
|
||||
#ifdef Q_COMPILER_INITIALIZER_LISTS
|
||||
QVersionNumber v7(4, 5, 6);
|
||||
QVersionNumber v8 = {4, 5, 6};
|
||||
|
||||
QCOMPARE(v7.segments(), v8.segments());
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QVersionNumber::constructorCopy_data()
|
||||
|
Loading…
Reference in New Issue
Block a user