diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qglobal.h | 37 | ||||
-rw-r--r-- | src/corelib/io/qdatastream.cpp | 3 | ||||
-rw-r--r-- | src/corelib/io/qdatastream.h | 5 | ||||
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.cpp | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qarraydata.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/qarraydata.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qhash.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qset.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qtools_p.h | 2 |
11 files changed, 44 insertions, 27 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index b2f9e29b44..7789461a1c 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -45,11 +45,11 @@ #include <stddef.h> -#define QT_VERSION_STR "5.3.0" +#define QT_VERSION_STR "5.4.0" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x050300 +#define QT_VERSION 0x050400 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ @@ -858,22 +858,37 @@ Q_CORE_EXPORT void qFreeAligned(void *ptr); # endif #endif -#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_RVCT) -/* make use of typeof-extension */ +#if defined(Q_COMPILER_DECLTYPE) || (defined(Q_CC_GNU) && !defined(Q_CC_RVCT)) +/* make use of decltype or GCC's __typeof__ extension */ template <typename T> class QForeachContainer { public: - inline QForeachContainer(const T& t) : c(t), brk(0), i(c.begin()), e(c.end()) { } + inline QForeachContainer(const T& t) : c(t), i(c.begin()), e(c.end()), control(1) { } const T c; - int brk; typename T::const_iterator i, e; + int control; }; -#define Q_FOREACH(variable, container) \ -for (QForeachContainer<__typeof__((container))> _container_((container)); \ - !_container_.brk && _container_.i != _container_.e; \ - __extension__ ({ ++_container_.brk; ++_container_.i; })) \ - for (variable = *_container_.i;; __extension__ ({--_container_.brk; break;})) +# ifdef Q_COMPILER_DECLTYPE +# define QT_FOREACH_DECLTYPE(x) typename QtPrivate::remove_reference<decltype(x)>::type +# else +# define QT_FOREACH_DECLTYPE(x) __typeof__((x)) +# endif + +// Explanation of the control word: +// - it's initialized to 1 +// - that means both the inner and outer loops start +// - if there were no breaks, at the end of the inner loop, it's set to 0, which +// causes it to exit (the inner loop is run exactly once) +// - at the end of the outer loop, it's inverted, so it becomes 1 again, allowing +// the outer loop to continue executing +// - if there was a break inside the inner loop, it will exit with control still +// set to 1; in that case, the outer loop will invert it to 0 and will exit too +# define Q_FOREACH(variable, container) \ +for (QForeachContainer<QT_FOREACH_DECLTYPE(container)> _container_((container)); \ + _container_.control && _container_.i != _container_.e; \ + ++_container_.i, _container_.control ^= 1) \ + for (variable = *_container_.i; _container_.control; _container_.control = 0) #else diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index a6fbffee7e..a4c4dbf5ff 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -251,7 +251,7 @@ QT_BEGIN_NAMESPACE return retVal; enum { - DefaultStreamVersion = QDataStream::Qt_5_3 + DefaultStreamVersion = QDataStream::Qt_5_4 }; /*! @@ -542,6 +542,7 @@ void QDataStream::setByteOrder(ByteOrder bo) \value Qt_5_1 Version 14 (Qt 5.1) \value Qt_5_2 Version 15 (Qt 5.2) \value Qt_5_3 Same as Qt_5_2 + \value Qt_5_4 Same as Qt_5_2 \sa setVersion(), version() */ diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h index 28f1d51a12..fb8dce0641 100644 --- a/src/corelib/io/qdatastream.h +++ b/src/corelib/io/qdatastream.h @@ -88,8 +88,9 @@ public: Qt_5_0 = 13, Qt_5_1 = 14, Qt_5_2 = 15, - Qt_5_3 = Qt_5_2 -#if QT_VERSION >= 0x050400 + Qt_5_3 = Qt_5_2, + Qt_5_4 = Qt_5_3 +#if QT_VERSION >= 0x050500 #error Add the datastream version for this Qt version #endif }; diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 4241fe08ca..3e303e529c 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -990,9 +990,9 @@ void QAbstractItemModel::resetInternalData() */ /*! - \fn void *QModelIndex::internalId() const + \fn quintptr QModelIndex::internalId() const - Returns a \c{qint64} used by the model to associate + Returns a \c{quintptr} used by the model to associate the index with the internal data structure. \sa QAbstractItemModel::createIndex() diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 83801a20c5..a2f203bf7a 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -889,11 +889,11 @@ struct ContainerAPI<QVector<T> > : CapabilitiesImpl<QVector<T> > template<typename T> struct ContainerAPI<std::vector<T> > : CapabilitiesImpl<std::vector<T> > -{ static int size(const std::vector<T> *t) { return t->size(); } }; +{ static int size(const std::vector<T> *t) { return int(t->size()); } }; template<typename T> struct ContainerAPI<std::list<T> > : CapabilitiesImpl<std::list<T> > -{ static int size(const std::list<T> *t) { return t->size(); } }; +{ static int size(const std::list<T> *t) { return int(t->size()); } }; class QSequentialIterableImpl { diff --git a/src/corelib/tools/qarraydata.cpp b/src/corelib/tools/qarraydata.cpp index 825b3289c7..45587b1214 100644 --- a/src/corelib/tools/qarraydata.cpp +++ b/src/corelib/tools/qarraydata.cpp @@ -68,7 +68,7 @@ static const QArrayData &qt_array_empty = qt_array[0]; static const QArrayData &qt_array_unsharable_empty = qt_array[1]; QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment, - size_t capacity, AllocationOptions options) + size_t capacity, AllocationOptions options) Q_DECL_NOTHROW { // Alignment is a power of two Q_ASSERT(alignment >= Q_ALIGNOF(QArrayData) @@ -111,7 +111,7 @@ QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment, } void QArrayData::deallocate(QArrayData *data, size_t objectSize, - size_t alignment) + size_t alignment) Q_DECL_NOTHROW { // Alignment is a power of two Q_ASSERT(alignment >= Q_ALIGNOF(QArrayData) diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h index ffb2b8765e..534f310d36 100644 --- a/src/corelib/tools/qarraydata.h +++ b/src/corelib/tools/qarraydata.h @@ -116,9 +116,9 @@ struct Q_CORE_EXPORT QArrayData static QArrayData *allocate(size_t objectSize, size_t alignment, size_t capacity, AllocationOptions options = Default) - Q_REQUIRED_RESULT; + Q_DECL_NOTHROW Q_REQUIRED_RESULT; static void deallocate(QArrayData *data, size_t objectSize, - size_t alignment); + size_t alignment) Q_DECL_NOTHROW; static const QArrayData shared_null[2]; static QArrayData *sharedNull() { return const_cast<QArrayData*>(shared_null); } diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 73fd6369a7..52207dcd4e 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -67,7 +67,7 @@ int qFindByteArray( const char *needle0, int needleLen); -int qAllocMore(int alloc, int extra) +int qAllocMore(int alloc, int extra) Q_DECL_NOTHROW { Q_ASSERT(alloc >= 0 && extra >= 0); Q_ASSERT_X(alloc < (1 << 30) - extra, "qAllocMore", "Requested size is too large!"); diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index d4bf8df442..409774a76d 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -297,7 +297,7 @@ public: inline QHash(std::initializer_list<std::pair<Key,T> > list) : d(const_cast<QHashData *>(&QHashData::shared_null)) { - reserve(list.size()); + 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); } @@ -973,7 +973,7 @@ public: #ifdef Q_COMPILER_INITIALIZER_LISTS inline QMultiHash(std::initializer_list<std::pair<Key,T> > list) { - this->reserve(list.size()); + 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); } diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h index ad2f91b983..291c8fe4f9 100644 --- a/src/corelib/tools/qset.h +++ b/src/corelib/tools/qset.h @@ -60,7 +60,7 @@ public: #ifdef Q_COMPILER_INITIALIZER_LISTS inline QSet(std::initializer_list<T> list) { - reserve(list.size()); + reserve(int(list.size())); for (typename std::initializer_list<T>::const_iterator it = list.begin(); it != list.end(); ++it) insert(*it); } diff --git a/src/corelib/tools/qtools_p.h b/src/corelib/tools/qtools_p.h index b00343dd39..38073a6e30 100644 --- a/src/corelib/tools/qtools_p.h +++ b/src/corelib/tools/qtools_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE // implemented in qbytearray.cpp -int Q_CORE_EXPORT qAllocMore(int alloc, int extra); +int Q_CORE_EXPORT qAllocMore(int alloc, int extra) Q_DECL_NOTHROW; QT_END_NAMESPACE |