diff options
author | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2021-09-30 14:12:02 +0200 |
---|---|---|
committer | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2021-10-02 17:54:39 +0200 |
commit | 9a3f4afb700bb4fb6c4d26120de71fb61ffab032 (patch) | |
tree | 5d9942baad0301712beb1f462eee6c7c6ca8432f /tests/auto/corelib | |
parent | a1e7c441de16cb4e8d6bdac39160759116ecd233 (diff) |
Remove checks for features available in C++17
This patch removes most of the checks that are made using C++20
__cpp_* macros for features available in C++17 and earlier.
Library feature check macros (__cpp_lib_*) are unaffected.
Change-Id: I557b2bd0d4ff09b13837555e9880eb28e0355f64
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib')
8 files changed, 0 insertions, 46 deletions
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp index a5bf9cf34f..7323cfe545 100644 --- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp +++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp @@ -535,8 +535,6 @@ void tst_QGlobal::testqOverload() QVERIFY(QConstOverload<QByteArray>::of(&Overloaded::mixedFoo) == static_cast<void (Overloaded::*)(QByteArray) const>(&Overloaded::mixedFoo)); -#if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304 // C++14 - // void returning free overloaded functions QVERIFY(qOverload<>(&freeOverloaded) == static_cast<void (*)()>(&freeOverloaded)); @@ -580,7 +578,6 @@ void tst_QGlobal::testqOverload() QVERIFY(qConstOverload<QByteArray>(&Overloaded::mixedFoo) == static_cast<void (Overloaded::*)(QByteArray) const>(&Overloaded::mixedFoo)); -#endif #endif } diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp index 968ccee043..f13ffe8354 100644 --- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp @@ -827,7 +827,6 @@ void tst_QMetaObject::invokePointer() QCOMPARE(obj.slotResult, QString("sl1:bubu")); } QCOMPARE(countedStructObjectsCount, 0); -#ifdef __cpp_init_captures { CountedStruct str; std::unique_ptr<int> ptr( new int ); @@ -835,7 +834,6 @@ void tst_QMetaObject::invokePointer() QCOMPARE(obj.slotResult, QString("sl1:1")); } QCOMPARE(countedStructObjectsCount, 0); -#endif } void tst_QMetaObject::invokeQueuedMetaMember() @@ -1151,7 +1149,6 @@ void tst_QMetaObject::invokeBlockingQueuedPointer() QCOMPARE(exp, QString("yessir")); QCOMPARE(obj.slotResult, QString("sl1:bubu")); } -#ifdef __cpp_init_captures { std::unique_ptr<int> ptr(new int); QVERIFY(QMetaObject::invokeMethod(&obj, @@ -1159,7 +1156,6 @@ void tst_QMetaObject::invokeBlockingQueuedPointer() Qt::BlockingQueuedConnection)); QCOMPARE(obj.slotResult, QString("sl1:hehe")); } -#endif QVERIFY(QMetaObject::invokeMethod(&obj, [&](){obj.moveToThread(QThread::currentThread());}, Qt::BlockingQueuedConnection)); t.quit(); QVERIFY(t.wait()); diff --git a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp index b42019bf04..543449c5e6 100644 --- a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp +++ b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp @@ -1509,7 +1509,6 @@ void tst_QStringApiSymmetry::tok_impl() const QCOMPARE(toQStringList(tok), resultCS); } -#ifdef __cpp_deduction_guides QCOMPARE(toQStringList(QStringTokenizer{haystack, needle}), resultCS); QCOMPARE(toQStringList(QStringTokenizer{haystack, needle, Qt::KeepEmptyParts, Qt::CaseSensitive}), resultCS); QCOMPARE(toQStringList(QStringTokenizer{haystack, needle, Qt::CaseInsensitive, Qt::KeepEmptyParts}), resultCIS); @@ -1522,7 +1521,6 @@ void tst_QStringApiSymmetry::tok_impl() const // yet `tok` should have kept a copy alive as needed: QCOMPARE(toQStringList(tok), resultCS); } -#endif // __cpp_deduction_guides if constexpr (has_tokenize_method_v<Haystack>) { QCOMPARE(toQStringList(haystack.tokenize(needle)), resultCS); diff --git a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp index a78004f04d..3d95022181 100644 --- a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp +++ b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp @@ -552,13 +552,11 @@ void tst_QStringView::tokenize() const QFETCH(const QStringList, result); // lvalue QString -#ifdef __cpp_deduction_guides { auto rit = result.cbegin(); for (auto sv : QStringTokenizer{str, sep}) QCOMPARE(sv, *rit++); } -#endif { auto rit = result.cbegin(); for (auto sv : QStringView{str}.tokenize(sep)) @@ -566,13 +564,11 @@ void tst_QStringView::tokenize() const } // rvalue QString -#ifdef __cpp_deduction_guides { auto rit = result.cbegin(); for (auto sv : QStringTokenizer{str, QString{sep}}) QCOMPARE(sv, *rit++); } -#endif { auto rit = result.cbegin(); for (auto sv : QStringView{str}.tokenize(QString{sep})) @@ -580,13 +576,11 @@ void tst_QStringView::tokenize() const } // (rvalue) QChar -#ifdef __cpp_deduction_guides if (sep.size() == 1) { auto rit = result.cbegin(); for (auto sv : QStringTokenizer{str, sep.front()}) QCOMPARE(sv, *rit++); } -#endif if (sep.size() == 1) { auto rit = result.cbegin(); for (auto sv : QStringView{str}.tokenize(sep.front())) @@ -594,13 +588,11 @@ void tst_QStringView::tokenize() const } // (rvalue) char16_t -#ifdef __cpp_deduction_guides if (sep.size() == 1) { auto rit = result.cbegin(); for (auto sv : QStringTokenizer{str, *qToStringViewIgnoringNull(sep).utf16()}) QCOMPARE(sv, *rit++); } -#endif if (sep.size() == 1) { auto rit = result.cbegin(); for (auto sv : QStringView{str}.tokenize(*qToStringViewIgnoringNull(sep).utf16())) @@ -615,20 +607,17 @@ void tst_QStringView::tokenize() const return literal; }; const std::unique_ptr<const char16_t[]> literal = make_literal(sep); -#ifdef __cpp_deduction_guides { auto rit = result.cbegin(); for (auto sv : QStringTokenizer{str, literal.get()}) QCOMPARE(sv, *rit++); } -#endif { auto rit = result.cbegin(); for (auto sv : QStringView{str}.tokenize(literal.get())) QCOMPARE(sv, *rit++); } -#ifdef __cpp_deduction_guides #ifdef __cpp_lib_ranges // lvalue QString { @@ -657,7 +646,6 @@ void tst_QStringView::tokenize() const QCOMPARE(result, actual); } #endif // __cpp_lib_ranges -#endif // __cpp_deduction_guides } template <typename Char> diff --git a/tests/auto/corelib/tools/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp index 48931a81ea..3d26720fab 100644 --- a/tests/auto/corelib/tools/qlist/tst_qlist.cpp +++ b/tests/auto/corelib/tools/qlist/tst_qlist.cpp @@ -1143,7 +1143,6 @@ void tst_QList::count() const void tst_QList::cpp17ctad() const { -#ifdef __cpp_deduction_guides #define QVERIFY_IS_VECTOR_OF(obj, Type) \ QVERIFY2((std::is_same<decltype(obj), QList<Type>>::value), \ QMetaType::fromType<decltype(obj)::value_type>().name()) @@ -1163,9 +1162,6 @@ void tst_QList::cpp17ctad() const CHECK(QString, QStringLiteral("one"), QStringLiteral("two"), QStringLiteral("three")); #undef QVERIFY_IS_VECTOR_OF #undef CHECK -#else - QSKIP("This test requires C++17 Constructor Template Argument Deduction support enabled in the compiler."); -#endif } void tst_QList::data() const diff --git a/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp b/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp index 21567137fd..90b3557ef5 100644 --- a/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp +++ b/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp @@ -94,7 +94,6 @@ static int s_globalState = 0; void tst_QScopeGuard::construction() { -#ifdef __cpp_deduction_guides QScopeGuard fromLambda([] { }); QScopeGuard fromFunction(func); QScopeGuard fromFunctionPointer(&func); @@ -105,14 +104,10 @@ void tst_QScopeGuard::construction() std::function<void()> stdFunction(func); QScopeGuard fromNamedStdFunction(stdFunction); #endif -#else - QSKIP("This test requires C++17 Class Template Argument Deduction support enabled in the compiler."); -#endif } void tst_QScopeGuard::constructionFromLvalue() { -#ifdef __cpp_deduction_guides Callable::resetCounts(); { Callable callable; @@ -127,14 +122,10 @@ void tst_QScopeGuard::constructionFromLvalue() } QCOMPARE(Callable::copied, 1); QCOMPARE(Callable::moved, 0); -#else - QSKIP("This test requires C++17 Class Template Argument Deduction support enabled in the compiler."); -#endif } void tst_QScopeGuard::constructionFromRvalue() { -#ifdef __cpp_deduction_guides Callable::resetCounts(); { Callable callable; @@ -149,9 +140,6 @@ void tst_QScopeGuard::constructionFromRvalue() } QCOMPARE(Callable::copied, 0); QCOMPARE(Callable::moved, 1); -#else - QSKIP("This test requires C++17 Class Template Argument Deduction support enabled in the compiler."); -#endif } void tst_QScopeGuard::leavingScope() diff --git a/tests/auto/corelib/tools/qset/tst_qset.cpp b/tests/auto/corelib/tools/qset/tst_qset.cpp index 490e8e97fd..421657dc27 100644 --- a/tests/auto/corelib/tools/qset/tst_qset.cpp +++ b/tests/auto/corelib/tools/qset/tst_qset.cpp @@ -339,7 +339,6 @@ void tst_QSet::clear() void tst_QSet::cpp17ctad() { -#ifdef __cpp_deduction_guides #define QVERIFY_IS_SET_OF(obj, Type) \ QVERIFY2((std::is_same<decltype(obj), QSet<Type>>::value), \ QMetaType::fromType<decltype(obj)::value_type>().name()) @@ -359,9 +358,6 @@ void tst_QSet::cpp17ctad() CHECK(QString, QStringLiteral("one"), QStringLiteral("two"), QStringLiteral("three")); #undef QVERIFY_IS_SET_OF #undef CHECK -#else - QSKIP("This test requires C++17 Constructor Template Argument Deduction support enabled in the compiler."); -#endif } void tst_QSet::remove() diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp index 0598a39cb6..6e95577655 100644 --- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp +++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp @@ -907,7 +907,6 @@ void tst_QVarLengthArray::count() void tst_QVarLengthArray::cpp17ctad() { -#ifdef __cpp_deduction_guides #define QVERIFY_IS_VLA_OF(obj, Type) \ QVERIFY2((std::is_same<decltype(obj), QVarLengthArray<Type>>::value), \ QMetaType::fromType<decltype(obj)::value_type>().name()) @@ -927,10 +926,6 @@ void tst_QVarLengthArray::cpp17ctad() CHECK(QString, QStringLiteral("one"), QStringLiteral("two"), QStringLiteral("three")); #undef QVERIFY_IS_VLA_OF #undef CHECK -#else - QSKIP("This test requires C++17 Constructor Template Argument Deduction support enabled in the compiler."); -#endif - } void tst_QVarLengthArray::first() |