From 9dde45722b9ab760e8c14722904cfa4eca5663e9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 26 Mar 2012 15:29:34 -0300 Subject: [PATCH] Remove references to QT_NO_STL from QtConcurrent MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Same as with QtCore, remove the #ifdef and #ifndef and select the side with STL. Change-Id: If1440080328c7c51afe35f5944a19dafc4761ee5 Reviewed-by: Stephen Kelly Reviewed-by: Morten Johan Sørvig --- src/concurrent/qtconcurrentiteratekernel.h | 31 +--------------------- .../qtconcurrentfilter/tst_qtconcurrentfilter.cpp | 4 --- .../tst_qtconcurrentiteratekernel.cpp | 10 ------- .../qtconcurrentmap/tst_qtconcurrentmap.cpp | 4 --- 4 files changed, 1 insertion(+), 48 deletions(-) diff --git a/src/concurrent/qtconcurrentiteratekernel.h b/src/concurrent/qtconcurrentiteratekernel.h index 6776ff0..fb031a6 100644 --- a/src/concurrent/qtconcurrentiteratekernel.h +++ b/src/concurrent/qtconcurrentiteratekernel.h @@ -50,9 +50,7 @@ #include #include -#ifndef QT_NO_STL -# include -#endif +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -62,15 +60,7 @@ QT_BEGIN_NAMESPACE namespace QtConcurrent { -#ifndef QT_NO_STL using std::advance; -#else - template - void advance(It &it, T value) - { - it+=value; - } -#endif /* The BlockSizeManager class manages how many iterations a thread should @@ -149,7 +139,6 @@ public: inline void * getPointer() { return 0; } }; -#ifndef QT_NO_STL inline bool selectIteration(std::bidirectional_iterator_tag) { return false; // while @@ -164,14 +153,6 @@ inline bool selectIteration(std::random_access_iterator_tag) { return true; // for } -#else -// no stl support, always use while iteration -template -inline bool selectIteration(T) -{ - return false; // while -} -#endif template class IterateKernel : public ThreadEngine @@ -180,20 +161,10 @@ public: typedef T ResultType; IterateKernel(Iterator _begin, Iterator _end) -#if defined (QT_NO_STL) - : begin(_begin), end(_end), current(_begin), currentIndex(0), - forIteration(false), progressReportingEnabled(true) -#else : begin(_begin), end(_end), current(_begin), currentIndex(0), forIteration(selectIteration(typename std::iterator_traits::iterator_category())), progressReportingEnabled(true) -#endif { -#if defined (QT_NO_STL) - iterationCount = 0; -#else iterationCount = forIteration ? std::distance(_begin, _end) : 0; - -#endif } virtual ~IterateKernel() { } diff --git a/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp b/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp index eb1faab..c8d4c21 100644 --- a/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp +++ b/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp @@ -57,9 +57,7 @@ private slots: void resultAt(); void incrementalResults(); void noDetach(); -#ifndef QT_NO_STL void stlContainers(); -#endif }; void tst_QtConcurrentFilter::filter() @@ -1496,7 +1494,6 @@ void tst_QtConcurrentFilter::noDetach() } } -#ifndef QT_NO_STL void tst_QtConcurrentFilter::stlContainers() { std::vector vector; @@ -1523,7 +1520,6 @@ void tst_QtConcurrentFilter::stlContainers() QCOMPARE(list2.size(), (std::list::size_type)(1)); QCOMPARE(*list2.begin(), 1); } -#endif QTEST_MAIN(tst_QtConcurrentFilter) #include "tst_qtconcurrentfilter.moc" diff --git a/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp b/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp index 46562b5..538a821 100644 --- a/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp +++ b/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp @@ -65,7 +65,6 @@ struct TestIterator }; #include -#ifndef QT_NO_STL namespace std { template <> struct iterator_traits @@ -79,7 +78,6 @@ int distance(TestIterator &a, TestIterator &b) } } -#endif #include #include @@ -96,10 +94,8 @@ private slots: void stresstest(); void noIterations(); void throttling(); -#ifndef QT_NO_STL void blockSize(); void multipleResults(); -#endif }; QAtomicInt iterations; @@ -268,8 +264,6 @@ public: } }; -// Missing stl iterators prevent correct block size calculation. -#ifndef QT_NO_STL void tst_QtConcurrentIterateKernel::blockSize() { const int expectedMinimumBlockSize = 1024 / QThread::idealThreadCount(); @@ -278,7 +272,6 @@ void tst_QtConcurrentIterateKernel::blockSize() qDebug() << "block size" << peakBlockSize; QVERIFY(peakBlockSize >= expectedMinimumBlockSize); } -#endif class MultipleResultsFor : public IterateKernel { @@ -292,8 +285,6 @@ public: } }; -// Missing stl iterators prevent correct summation. -#ifndef QT_NO_STL void tst_QtConcurrentIterateKernel::multipleResults() { QFuture f = startThreadEngine(new MultipleResultsFor(0, 10)).startAsynchronously(); @@ -303,7 +294,6 @@ void tst_QtConcurrentIterateKernel::multipleResults() QCOMPARE(f.resultAt(9), 9); f.waitForFinished(); } -#endif QTEST_MAIN(tst_QtConcurrentIterateKernel) diff --git a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp index d0609d0..220f28a 100644 --- a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp +++ b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp @@ -72,9 +72,7 @@ private slots: #endif void incrementalResults(); void noDetach(); -#ifndef QT_NO_STL void stlContainers(); -#endif void qFutureAssignmentLeak(); void stressTest(); public slots: @@ -2301,7 +2299,6 @@ void tst_QtConcurrentMap::noDetach() } -#ifndef QT_NO_STL void tst_QtConcurrentMap::stlContainers() { std::vector vector; @@ -2322,7 +2319,6 @@ void tst_QtConcurrentMap::stlContainers() QtConcurrent::blockingMap(list, multiplyBy2Immutable); } -#endif InstanceCounter ic_fn(const InstanceCounter & ic) { -- 2.7.4