From 9402a351dd1f37d595660010c7a55a7c8fb5e668 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 17 Oct 2020 14:04:42 +0200 Subject: [PATCH] tst_containerapisymmetry: code tidies We now require C++17 and thus C++11 features or standard headers should no longer be conditional. Change-Id: I6b72306e809f71ec77acf7ffb97e2ed2ccd96e9d Reviewed-by: Volker Hilsheimer --- .../tst_containerapisymmetry.cpp | 192 ++---------------- 1 file changed, 18 insertions(+), 174 deletions(-) diff --git a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp index 39cb8406cd..d7f43fdeca 100644 --- a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp +++ b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp @@ -41,26 +41,9 @@ #include #include #include - -// MSVC has these containers from the Standard Library, but it lacks -// a __has_include mechanism (that we need to use for other stdlibs). -// For the sake of increasing our test coverage, work around the issue. - -#ifdef Q_CC_MSVC -#define COMPILER_HAS_STDLIB_INCLUDE(x) 1 -#else -#define COMPILER_HAS_STDLIB_INCLUDE(x) __has_include(x) -#endif - -#if COMPILER_HAS_STDLIB_INCLUDE() #include -#endif -#if COMPILER_HAS_STDLIB_INCLUDE() #include -#endif -#if COMPILER_HAS_STDLIB_INCLUDE() #include -#endif struct Movable { @@ -222,20 +205,7 @@ template class VarLengthArray : public QVarLengthArray { public: -#ifdef Q_COMPILER_INHERITING_CONSTRUCTORS using QVarLengthArray::QVarLengthArray; -#else - template - VarLengthArray(InputIterator first, InputIterator last) - : QVarLengthArray(first, last) - { - } - - VarLengthArray(std::initializer_list args) - : QVarLengthArray(args) - { - } -#endif }; class tst_ContainerApiSymmetry : public QObject @@ -285,37 +255,10 @@ private Q_SLOTS: void ranged_ctor_std_list_Complex() { ranged_ctor_non_associative_impl>(); } void ranged_ctor_std_list_duplicates_strategy() { non_associative_container_duplicates_strategy(); } - void ranged_ctor_std_forward_list_int() { -#if COMPILER_HAS_STDLIB_INCLUDE() - ranged_ctor_non_associative_impl>(); -#else - QSKIP(" is needed for this test"); -#endif - } - - void ranged_ctor_std_forward_list_Movable() { -#if COMPILER_HAS_STDLIB_INCLUDE() - ranged_ctor_non_associative_impl>(); -#else - QSKIP(" is needed for this test"); -#endif - } - - void ranged_ctor_std_forward_list_Complex() { -#if COMPILER_HAS_STDLIB_INCLUDE() - ranged_ctor_non_associative_impl>(); -#else - QSKIP(" is needed for this test"); -#endif - } - - void ranged_ctor_std_forward_list_duplicates_strategy() { -#if COMPILER_HAS_STDLIB_INCLUDE() - non_associative_container_duplicates_strategy(); -#else - QSKIP(" is needed for this test"); -#endif - } + void ranged_ctor_std_forward_list_int() { ranged_ctor_non_associative_impl>(); } + void ranged_ctor_std_forward_list_Movable() {ranged_ctor_non_associative_impl>(); } + void ranged_ctor_std_forward_list_Complex() { ranged_ctor_non_associative_impl>(); } + void ranged_ctor_std_forward_list_duplicates_strategy() { non_associative_container_duplicates_strategy(); } void ranged_ctor_std_set_int() { ranged_ctor_non_associative_impl>(); } void ranged_ctor_std_set_Movable() { ranged_ctor_non_associative_impl>(); } @@ -327,70 +270,15 @@ private Q_SLOTS: void ranged_ctor_std_multiset_Complex() { ranged_ctor_non_associative_impl>(); } void ranged_ctor_std_multiset_duplicates_strategy() { non_associative_container_duplicates_strategy(); } - void ranged_ctor_std_unordered_set_int() { -#if COMPILER_HAS_STDLIB_INCLUDE() - ranged_ctor_non_associative_impl>(); -#else - QSKIP(" is needed for this test"); -#endif - } + void ranged_ctor_std_unordered_set_int() { ranged_ctor_non_associative_impl>(); } + void ranged_ctor_std_unordered_set_Movable() { ranged_ctor_non_associative_impl>(); } + void ranged_ctor_std_unordered_set_Complex() { ranged_ctor_non_associative_impl>(); } + void ranged_ctor_std_unordered_set_duplicates_strategy() { non_associative_container_duplicates_strategy(); } - void ranged_ctor_std_unordered_set_Movable() { -#if COMPILER_HAS_STDLIB_INCLUDE() - ranged_ctor_non_associative_impl>(); -#else - QSKIP(" is needed for this test"); -#endif - } - - void ranged_ctor_std_unordered_set_Complex() { -#if COMPILER_HAS_STDLIB_INCLUDE() - ranged_ctor_non_associative_impl>(); -#else - QSKIP(" is needed for this test"); -#endif - } - - void ranged_ctor_unordered_set_duplicates_strategy() { -#if COMPILER_HAS_STDLIB_INCLUDE() - non_associative_container_duplicates_strategy(); -#else - QSKIP(" is needed for this test"); -#endif - } - - - void ranged_ctor_std_unordered_multiset_int() { -#if COMPILER_HAS_STDLIB_INCLUDE() - ranged_ctor_non_associative_impl>(); -#else - QSKIP(" is needed for this test"); -#endif - } - - void ranged_ctor_std_unordered_multiset_Movable() { -#if COMPILER_HAS_STDLIB_INCLUDE() - ranged_ctor_non_associative_impl>(); -#else - QSKIP(" is needed for this test"); -#endif - } - - void ranged_ctor_std_unordered_multiset_Complex() { -#if COMPILER_HAS_STDLIB_INCLUDE() - ranged_ctor_non_associative_impl>(); -#else - QSKIP(" is needed for this test"); -#endif - } - - void ranged_ctor_std_unordered_multiset_duplicates_strategy() { -#if COMPILER_HAS_STDLIB_INCLUDE() - non_associative_container_duplicates_strategy(); -#else - QSKIP(" is needed for this test"); -#endif - } + void ranged_ctor_std_unordered_multiset_int() { ranged_ctor_non_associative_impl>(); } + void ranged_ctor_std_unordered_multiset_Movable() { ranged_ctor_non_associative_impl>(); } + void ranged_ctor_std_unordered_multiset_Complex() { ranged_ctor_non_associative_impl>(); } + void ranged_ctor_std_unordered_multiset_duplicates_strategy() { non_associative_container_duplicates_strategy(); } void ranged_ctor_QSet_int() { ranged_ctor_non_associative_impl>(); } void ranged_ctor_QSet_Movable() { ranged_ctor_non_associative_impl>(); } @@ -406,57 +294,17 @@ private Q_SLOTS: void ranged_ctor_std_multimap_Movable() { ranged_ctor_associative_impl>(); } void ranged_ctor_std_multimap_Complex() { ranged_ctor_associative_impl>(); } - void ranged_ctor_unordered_map_int() { -#if COMPILER_HAS_STDLIB_INCLUDE() - ranged_ctor_associative_impl>(); -#else - QSKIP(" is needed for this test"); -#endif - } - - void ranged_ctor_unordered_map_Movable() { -#if COMPILER_HAS_STDLIB_INCLUDE() - ranged_ctor_associative_impl>(); -#else - QSKIP(" is needed for this test"); -#endif - } - - void ranged_ctor_unordered_map_Complex() { -#if COMPILER_HAS_STDLIB_INCLUDE() - ranged_ctor_associative_impl>(); -#else - QSKIP(" is needed for this test"); -#endif - } + void ranged_ctor_unordered_map_int() { ranged_ctor_associative_impl>(); } + void ranged_ctor_unordered_map_Movable() { ranged_ctor_associative_impl>(); } + void ranged_ctor_unordered_map_Complex() { ranged_ctor_associative_impl>(); } void ranged_ctor_QHash_int() { ranged_ctor_associative_impl>(); } void ranged_ctor_QHash_Movable() { ranged_ctor_associative_impl>(); } void ranged_ctor_QHash_Complex() { ranged_ctor_associative_impl>(); } - void ranged_ctor_unordered_multimap_int() { -#if COMPILER_HAS_STDLIB_INCLUDE() - ranged_ctor_associative_impl>(); -#else - QSKIP(" is needed for this test"); -#endif - } - - void ranged_ctor_unordered_multimap_Movable() { -#if COMPILER_HAS_STDLIB_INCLUDE() - ranged_ctor_associative_impl>(); -#else - QSKIP(" is needed for this test"); -#endif - } - - void ranged_ctor_unordered_multimap_Complex() { -#if COMPILER_HAS_STDLIB_INCLUDE() - ranged_ctor_associative_impl>(); -#else - QSKIP(" is needed for this test"); -#endif - } + void ranged_ctor_unordered_multimap_int() { ranged_ctor_associative_impl>(); } + void ranged_ctor_unordered_multimap_Movable() { ranged_ctor_associative_impl>(); } + void ranged_ctor_unordered_multimap_Complex() { ranged_ctor_associative_impl>(); } void ranged_ctor_QMultiHash_int() { ranged_ctor_associative_impl>(); } void ranged_ctor_QMultiHash_Movable() { ranged_ctor_associative_impl>(); } @@ -567,10 +415,8 @@ struct ContainerDuplicatedValuesStrategy> : ContainerAccept template struct ContainerDuplicatedValuesStrategy> : ContainerAcceptsDuplicateValues {}; -#if COMPILER_HAS_STDLIB_INCLUDE() template struct ContainerDuplicatedValuesStrategy> : ContainerAcceptsDuplicateValues {}; -#endif // assuming https://cplusplus.github.io/LWG/lwg-active.html#2844 resolution template @@ -579,14 +425,12 @@ struct ContainerDuplicatedValuesStrategy> : ContainerRejectsDupli template struct ContainerDuplicatedValuesStrategy> : ContainerAcceptsDuplicateValues {}; -#if COMPILER_HAS_STDLIB_INCLUDE() // assuming https://cplusplus.github.io/LWG/lwg-active.html#2844 resolution template struct ContainerDuplicatedValuesStrategy> : ContainerRejectsDuplicateValues {}; template struct ContainerDuplicatedValuesStrategy> : ContainerAcceptsDuplicateValues {}; -#endif template struct ContainerDuplicatedValuesStrategy> : ContainerRejectsDuplicateValues {};