From a131d6100ca13b00721ea30e6ef0d5225002867e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 22 Nov 2019 09:24:55 +0100 Subject: Fix prefix determination for windeployqt'ed applications Qt5Core.dll of windeployqt'ed applications is right next to the executable, and the prefix is considered the directory where the application is located. QLibraryInfo of a relocatable Qt5Core.dll would return a wrong prefix (by default /..), because it determines the prefix with QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH (by default ".."). We now detect whether the executable was windeployqt'ed by checking whether Qt5Core.dll is next to the executable. However, we must not do that for applications in QT_HOST_BINS, because they are not windeployqt'ed and must still use the standard prefix. We detect this case by checking whether for Qt5Core.dll exists a corresponding Qt5Core.lib in the libdir below the detected prefix. Fixes: QTBUG-79318 Change-Id: I1c9b971b282c6b9b19a93f1819ba8aee74be5be4 Reviewed-by: Friedemann Kleint --- src/corelib/global/qlibraryinfo.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 276741c9fb..8c3ed184ae 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -562,9 +562,31 @@ static QString getRelocatablePrefix() HMODULE hModule = getWindowsModuleHandle(); const int kBufferSize = 4096; wchar_t buffer[kBufferSize]; - const int pathSize = GetModuleFileName(hModule, buffer, kBufferSize); - if (pathSize > 0) - prefixPath = prefixFromQtCoreLibraryHelper(QString::fromWCharArray(buffer, pathSize)); + DWORD pathSize = GetModuleFileName(hModule, buffer, kBufferSize); + const QString qtCoreFilePath = QString::fromWCharArray(buffer, int(pathSize)); + const QString qtCoreDirPath = QFileInfo(qtCoreFilePath).absolutePath(); + pathSize = GetModuleFileName(NULL, buffer, kBufferSize); + const QString exeDirPath = QFileInfo(QString::fromWCharArray(buffer, int(pathSize))).absolutePath(); + if (QFileInfo(exeDirPath) == QFileInfo(qtCoreDirPath)) { + // QtCore DLL is next to the executable. This is either a windeployqt'ed executable or an + // executable within the QT_HOST_BIN directory. We're detecting the latter case by checking + // whether there's an import library corresponding to our QtCore DLL in PREFIX/lib. + const QString libdir = QString::fromLatin1( + qt_configure_strs + qt_configure_str_offsets[QLibraryInfo::LibrariesPath - 1]); + const QLatin1Char slash('/'); + const QString qtCoreImpLibPath + = qtCoreDirPath + + slash + QLatin1String(QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH) + + slash + libdir + + slash + QFileInfo(qtCoreFilePath).completeBaseName() + QLatin1String(".lib"); + if (!QFileInfo::exists(qtCoreImpLibPath)) { + // We did not find a corresponding import library and conclude that this is a + // windeployqt'ed executable. + return exeDirPath; + } + } + if (!qtCoreFilePath.isEmpty()) + prefixPath = prefixFromQtCoreLibraryHelper(qtCoreFilePath); #else #error "The chosen platform / config does not support querying for a dynamic prefix." #endif -- cgit v1.2.3 From c33916a279ef5908e1ebd44644c873933f6a7c77 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 28 Nov 2019 13:38:28 +0100 Subject: Fix prefix determination for windeployqt'ed MinGW applications We hard-coded the assumption the import lib naming scheme is always basename + ".lib" which is wrong for MinGW. This amends commit a131d610. Fixes: QTBUG-80366 Change-Id: Ibefb8a54483cc62743b8783530644b03e720262c Reviewed-by: Ulf Hermann --- src/corelib/global/qlibraryinfo.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 8c3ed184ae..f0f77fe68e 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -574,11 +574,19 @@ static QString getRelocatablePrefix() const QString libdir = QString::fromLatin1( qt_configure_strs + qt_configure_str_offsets[QLibraryInfo::LibrariesPath - 1]); const QLatin1Char slash('/'); - const QString qtCoreImpLibPath - = qtCoreDirPath +#if defined(Q_CC_MINGW) + const QString implibPrefix = QStringLiteral("lib"); + const QString implibSuffix = QStringLiteral(".a"); +#else + const QString implibPrefix; + const QString implibSuffix = QStringLiteral(".lib"); +#endif + const QString qtCoreImpLibFileName = implibPrefix + + QFileInfo(qtCoreFilePath).completeBaseName() + implibSuffix; + const QString qtCoreImpLibPath = qtCoreDirPath + slash + QLatin1String(QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH) + slash + libdir - + slash + QFileInfo(qtCoreFilePath).completeBaseName() + QLatin1String(".lib"); + + slash + qtCoreImpLibFileName; if (!QFileInfo::exists(qtCoreImpLibPath)) { // We did not find a corresponding import library and conclude that this is a // windeployqt'ed executable. -- cgit v1.2.3 From 2a887a517eaaa2c5324aecf3b919899b7a86ff4a Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 6 Dec 2019 18:30:55 +0100 Subject: QCalendar: Optimize std::vector access As we assert on the size of the vector before accessing it, there is no point in using the checked at() method over operator[]. Besides, if at() throws, what are we going to do with the exception anyway. Incidentally, this also works around a compiler bug causing binary incompatibility in QtQml. Change-Id: I460e7514429daecabc304eb2c5f96ed715008b0a Fixes: QTBUG-80535 Reviewed-by: Volker Hilsheimer --- src/corelib/time/qcalendar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/time/qcalendar.cpp b/src/corelib/time/qcalendar.cpp index d308aeba2b..6a4623ce92 100644 --- a/src/corelib/time/qcalendar.cpp +++ b/src/corelib/time/qcalendar.cpp @@ -100,7 +100,7 @@ struct Registry { if (id == QCalendar::System::User) { byId.push_back(calendar); } else { - Q_ASSERT(byId.at(size_t(id)) == nullptr); + Q_ASSERT(byId[size_t(id)] == nullptr); byId[size_t(id)] = calendar; } if (id == QCalendar::System::Gregorian) { @@ -618,7 +618,7 @@ const QCalendarBackend *QCalendarBackend::fromEnum(QCalendar::System system) if (calendarRegistry.isDestroyed() || system == QCalendar::System::User) return nullptr; Q_ASSERT(calendarRegistry->byId.size() >= size_t(system)); - if (auto *c = calendarRegistry->byId.at(size_t(system))) + if (auto *c = calendarRegistry->byId[size_t(system)]) return c; switch (system) { case QCalendar::System::Gregorian: -- cgit v1.2.3 From 5a660353edde7b9f382ee41ecf278fc4537f38fa Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 13 Nov 2019 10:20:09 +0100 Subject: Doc: Fix qdoc compilation errors qtbase Task-number: QTBUG-79824 Change-Id: I6557de598de1931fc30556951d35783d02b83abe Reviewed-by: Paul Wicking --- src/corelib/doc/src/qtcore-index.qdoc | 2 +- src/corelib/doc/src/resource-system.qdoc | 4 +- src/corelib/global/qendian.cpp | 6 +- src/corelib/io/qresource.cpp | 4 +- src/corelib/thread/qatomic.cpp | 204 ++++++++++++++++++++----------- src/corelib/thread/qatomic.h | 6 + 6 files changed, 150 insertions(+), 76 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/doc/src/qtcore-index.qdoc b/src/corelib/doc/src/qtcore-index.qdoc index 40a6584af0..29fc25f69d 100644 --- a/src/corelib/doc/src/qtcore-index.qdoc +++ b/src/corelib/doc/src/qtcore-index.qdoc @@ -56,7 +56,7 @@ \include module-use.qdocinc using qt module \quotefile overview/using-qt-core.cmake - See also the \l[QtDoc]{Building with CMake} overview. + See also the \l[QtDoc]{Build with CMake} overview. \section2 Building with qmake diff --git a/src/corelib/doc/src/resource-system.qdoc b/src/corelib/doc/src/resource-system.qdoc index 69ec5e556b..f9ef317799 100644 --- a/src/corelib/doc/src/resource-system.qdoc +++ b/src/corelib/doc/src/resource-system.qdoc @@ -189,13 +189,13 @@ XML file to indicate a file should be most compressed, regardless of which algorithms \c rcc supports. - \li \c{zstd}: use the \l{Zstandard}{https://zstd.net} library to compress + \li \c{zstd}: use the \l{https://zstd.net}{Zstandard} library to compress contents. Valid compression levels range from 1 to 19, 1 is least compression (least CPU time) and 19 is the most compression (most CPU time). The default level is 14. A special value of 0 tells the \c{zstd} library to choose an implementation-defined default. - \li \c{zlib}: use the \l{zlib}{https://zlib.net} library to compress + \li \c{zlib}: use the \l{https://zlib.net}{zlib} library to compress contents. Valid compression levels range from 1 to 9, with 1the least compression (least CPU time) and 9 the most compression (most CPU time). The special value 0 means "no compression" and should not be used. The diff --git a/src/corelib/global/qendian.cpp b/src/corelib/global/qendian.cpp index 7fd6e13d3b..98dc6a9a4b 100644 --- a/src/corelib/global/qendian.cpp +++ b/src/corelib/global/qendian.cpp @@ -137,7 +137,7 @@ QT_BEGIN_NAMESPACE \sa qToLittleEndian() */ /*! - \fn template T qFromLittleEndian(const void *src) + \fn template inline T qFromLittleEndian(const void *src) \since 4.3 \relates @@ -159,7 +159,7 @@ QT_BEGIN_NAMESPACE \sa qToLittleEndian() */ /*! - \fn template T qFromLittleEndian(T src) + \fn template inline T qFromLittleEndian(T src) \since 4.3 \relates \overload @@ -171,7 +171,7 @@ QT_BEGIN_NAMESPACE unmodified. */ /*! - \fn template T qFromLittleEndian(const void *src, qsizetype count, void *dest) + \fn template inline T qFromLittleEndian(const void *src, qsizetype count, void *dest) \since 5.12 \relates diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 22c22ce711..5cbe49e2f7 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -280,9 +280,9 @@ static inline QStringList *resourceSearchPaths() RCC tool used to compress the payload. \value NoCompression Contents are not compressed - \value ZlibCompression Contents are compressed using \l{zlib}{https://zlib.net} and can + \value ZlibCompression Contents are compressed using \l{https://zlib.net}{zlib} and can be decompressed using the qUncompress() function. - \value ZstdCompression Contents are compressed using \l{zstd}{https://zstd.net}. To + \value ZstdCompression Contents are compressed using \l{https://zstd.net}{zstd}. To decompress, use the \c{ZSTD_decompress} function from the zstd library. diff --git a/src/corelib/thread/qatomic.cpp b/src/corelib/thread/qatomic.cpp index b1a7edad91..5c3ad9412f 100644 --- a/src/corelib/thread/qatomic.cpp +++ b/src/corelib/thread/qatomic.cpp @@ -234,22 +234,26 @@ \sa QAtomicPointer */ -/*! \fn QAtomicInt::QAtomicInt(int value) +/*! + \fn QAtomicInt::QAtomicInt(int value) Constructs a QAtomicInt with the given \a value. */ -/*! \fn QAtomicInteger::QAtomicInteger(T value) +/*! + \fn template QAtomicInteger::QAtomicInteger(T value) Constructs a QAtomicInteger with the given \a value. */ -/*! \fn template QAtomicInteger::QAtomicInteger(const QAtomicInteger &other) +/*! + \fn template QAtomicInteger::QAtomicInteger(const QAtomicInteger &other) Constructs a copy of \a other. */ -/*! \fn template QAtomicInteger &QAtomicInteger::operator=(const QAtomicInteger &other) +/*! + \fn template QAtomicInteger &QAtomicInteger::operator=(const QAtomicInteger &other) Assigns \a other to this QAtomicInteger and returns a reference to this QAtomicInteger. @@ -344,19 +348,22 @@ \sa storeRelaxed(), storeRelease() */ -/*! \fn template bool QAtomicInteger::isReferenceCountingNative() +/*! + \fn template bool QAtomicInteger::isReferenceCountingNative() Returns \c true if reference counting is implemented using atomic processor instructions, false otherwise. */ -/*! \fn template bool QAtomicInteger::isReferenceCountingWaitFree() +/*! + \fn template bool QAtomicInteger::isReferenceCountingWaitFree() Returns \c true if atomic reference counting is wait-free, false otherwise. */ -/*! \fn template bool QAtomicInteger::ref() +/*! + \fn template bool QAtomicInteger::ref() Atomically increments the value of this QAtomicInteger. Returns \c true if the new value is non-zero, false otherwise. @@ -394,7 +401,8 @@ \sa ref(), operator++(), operator--(int) */ -/*! \fn template bool QAtomicInteger::deref() +/*! + \fn template bool QAtomicInteger::deref() Atomically decrements the value of this QAtomicInteger. Returns \c true if the new value is non-zero, false otherwise. @@ -432,18 +440,21 @@ \sa deref(), operator--(), operator++(int) */ -/*! \fn template bool QAtomicInteger::isTestAndSetNative() +/*! + \fn template bool QAtomicInteger::isTestAndSetNative() Returns \c true if test-and-set is implemented using atomic processor instructions, false otherwise. */ -/*! \fn template bool QAtomicInteger::isTestAndSetWaitFree() +/*! + \fn template bool QAtomicInteger::isTestAndSetWaitFree() Returns \c true if atomic test-and-set is wait-free, false otherwise. */ -/*! \fn template bool QAtomicInteger::testAndSetRelaxed(T expectedValue, T newValue) +/*! + \fn template bool QAtomicInteger::testAndSetRelaxed(T expectedValue, T newValue) Atomic test-and-set. @@ -457,7 +468,8 @@ processor to freely reorder memory accesses. */ -/*! \fn template bool QAtomicInteger::testAndSetAcquire(T expectedValue, T newValue) +/*! + \fn template bool QAtomicInteger::testAndSetAcquire(T expectedValue, T newValue) Atomic test-and-set. @@ -472,7 +484,8 @@ be re-ordered before the atomic operation. */ -/*! \fn template bool QAtomicInteger::testAndSetRelease(T expectedValue, T newValue) +/*! + \fn template bool QAtomicInteger::testAndSetRelease(T expectedValue, T newValue) Atomic test-and-set. @@ -487,7 +500,8 @@ re-ordered after the atomic operation. */ -/*! \fn template bool QAtomicInteger::testAndSetOrdered(T expectedValue, T newValue) +/*! + \fn template bool QAtomicInteger::testAndSetOrdered(T expectedValue, T newValue) Atomic test-and-set. @@ -502,19 +516,22 @@ may not be re-ordered. */ -/*! \fn template bool QAtomicInteger::isFetchAndStoreNative() +/*! + \fn template bool QAtomicInteger::isFetchAndStoreNative() Returns \c true if fetch-and-store is implemented using atomic processor instructions, false otherwise. */ -/*! \fn template bool QAtomicInteger::isFetchAndStoreWaitFree() +/*! + \fn template bool QAtomicInteger::isFetchAndStoreWaitFree() Returns \c true if atomic fetch-and-store is wait-free, false otherwise. */ -/*! \fn template T QAtomicInteger::fetchAndStoreRelaxed(T newValue) +/*! + \fn template T QAtomicInteger::fetchAndStoreRelaxed(T newValue) Atomic fetch-and-store. @@ -526,7 +543,8 @@ processor to freely reorder memory accesses. */ -/*! \fn template T QAtomicInteger::fetchAndStoreAcquire(T newValue) +/*! + \fn template T QAtomicInteger::fetchAndStoreAcquire(T newValue) Atomic fetch-and-store. @@ -539,7 +557,8 @@ be re-ordered before the atomic operation. */ -/*! \fn template T QAtomicInteger::fetchAndStoreRelease(T newValue) +/*! + \fn template T QAtomicInteger::fetchAndStoreRelease(T newValue) Atomic fetch-and-store. @@ -552,7 +571,8 @@ re-ordered after the atomic operation. */ -/*! \fn template T QAtomicInteger::fetchAndStoreOrdered(T newValue) +/*! + \fn template T QAtomicInteger::fetchAndStoreOrdered(T newValue) Atomic fetch-and-store. @@ -565,19 +585,22 @@ may not be re-ordered. */ -/*! \fn template bool QAtomicInteger::isFetchAndAddNative() +/*! + \fn template bool QAtomicInteger::isFetchAndAddNative() Returns \c true if fetch-and-add is implemented using atomic processor instructions, false otherwise. */ -/*! \fn template bool QAtomicInteger::isFetchAndAddWaitFree() +/*! + \fn template bool QAtomicInteger::isFetchAndAddWaitFree() Returns \c true if atomic fetch-and-add is wait-free, false otherwise. */ -/*! \fn template T QAtomicInteger::fetchAndAddRelaxed(T valueToAdd) +/*! + \fn template T QAtomicInteger::fetchAndAddRelaxed(T valueToAdd) Atomic fetch-and-add. @@ -591,7 +614,8 @@ \sa operator+=(), fetchAndSubRelaxed() */ -/*! \fn template T QAtomicInteger::fetchAndAddAcquire(T valueToAdd) +/*! + \fn template T QAtomicInteger::fetchAndAddAcquire(T valueToAdd) Atomic fetch-and-add. @@ -606,7 +630,8 @@ \sa operator+=(), fetchAndSubAcquire() */ -/*! \fn template T QAtomicInteger::fetchAndAddRelease(T valueToAdd) +/*! + \fn template T QAtomicInteger::fetchAndAddRelease(T valueToAdd) Atomic fetch-and-add. @@ -621,7 +646,8 @@ \sa operator+=(), fetchAndSubRelease() */ -/*! \fn template T QAtomicInteger::fetchAndAddOrdered(T valueToAdd) +/*! + \fn template T QAtomicInteger::fetchAndAddOrdered(T valueToAdd) Atomic fetch-and-add. @@ -636,7 +662,8 @@ \sa operator+=(), fetchAndSubOrdered() */ -/*! \fn template T QAtomicInteger::operator+=(T value) +/*! + \fn template T QAtomicInteger::operator+=(T value) \since 5.3 Atomic add-and-fetch. @@ -650,7 +677,8 @@ \sa fetchAndAddOrdered(), operator-=() */ -/*! \fn template T QAtomicInteger::fetchAndSubRelaxed(T valueToSub) +/*! + \fn template T QAtomicInteger::fetchAndSubRelaxed(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -665,7 +693,8 @@ \sa operator-=(), fetchAndAddRelaxed() */ -/*! \fn template T QAtomicInteger::fetchAndSubAcquire(T valueToSub) +/*! + \fn template T QAtomicInteger::fetchAndSubAcquire(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -681,7 +710,8 @@ \sa operator-=(), fetchAndAddAcquire() */ -/*! \fn template T QAtomicInteger::fetchAndSubRelease(T valueToSub) +/*! + \fn template T QAtomicInteger::fetchAndSubRelease(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -697,7 +727,8 @@ \sa operator-=(), fetchAndAddRelease() */ -/*! \fn template T QAtomicInteger::fetchAndSubOrdered(T valueToSub) +/*! + \fn template T QAtomicInteger::fetchAndSubOrdered(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -713,7 +744,8 @@ \sa operator-=(), fetchAndAddOrdered() */ -/*! \fn template T QAtomicInteger::operator-=(T value) +/*! + \fn template T QAtomicInteger::operator-=(T value) \since 5.3 Atomic sub-and-fetch. @@ -727,7 +759,8 @@ \sa fetchAndSubOrdered(), operator+=() */ -/*! \fn template T QAtomicInteger::fetchAndOrRelaxed(T valueToOr) +/*! + \fn template T QAtomicInteger::fetchAndOrRelaxed(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -742,7 +775,8 @@ \sa operator|=() */ -/*! \fn template T QAtomicInteger::fetchAndOrAcquire(T valueToOr) +/*! + \fn template T QAtomicInteger::fetchAndOrAcquire(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -758,7 +792,8 @@ \sa operator|=() */ -/*! \fn template T QAtomicInteger::fetchAndOrRelease(T valueToOr) +/*! + \fn template T QAtomicInteger::fetchAndOrRelease(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -774,7 +809,8 @@ \sa operator|=() */ -/*! \fn template T QAtomicInteger::fetchAndOrOrdered(T valueToOr) +/*! + \fn template T QAtomicInteger::fetchAndOrOrdered(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -790,7 +826,8 @@ \sa operator|=() */ -/*! \fn template T QAtomicInteger::operator|=(T value) +/*! + \fn template T QAtomicInteger::operator|=(T value) \since 5.3 Atomic or-and-fetch. @@ -804,7 +841,8 @@ \sa fetchAndOrOrdered() */ -/*! \fn template T QAtomicInteger::fetchAndXorRelaxed(T valueToXor) +/*! + \fn template T QAtomicInteger::fetchAndXorRelaxed(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -819,7 +857,8 @@ \sa operator^=() */ -/*! \fn template T QAtomicInteger::fetchAndXorAcquire(T valueToXor) +/*! + \fn template T QAtomicInteger::fetchAndXorAcquire(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -835,7 +874,8 @@ \sa operator^=() */ -/*! \fn template T QAtomicInteger::fetchAndXorRelease(T valueToXor) +/*! + \fn template T QAtomicInteger::fetchAndXorRelease(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -851,7 +891,8 @@ \sa operator^=() */ -/*! \fn template T QAtomicInteger::fetchAndXorOrdered(T valueToXor) +/*! + \fn template T QAtomicInteger::fetchAndXorOrdered(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -867,7 +908,8 @@ \sa operator^=() */ -/*! \fn template T QAtomicInteger::operator^=(T value) +/*! + \fn template T QAtomicInteger::operator^=(T value) \since 5.3 Atomic xor-and-fetch. @@ -881,7 +923,8 @@ \sa fetchAndXorOrdered() */ -/*! \fn template T QAtomicInteger::fetchAndAndRelaxed(T valueToAnd) +/*! + \fn template T QAtomicInteger::fetchAndAndRelaxed(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -896,7 +939,8 @@ \sa operator&=() */ -/*! \fn template T QAtomicInteger::fetchAndAndAcquire(T valueToAnd) +/*! + \fn template T QAtomicInteger::fetchAndAndAcquire(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -912,7 +956,8 @@ \sa operator&=() */ -/*! \fn template T QAtomicInteger::fetchAndAndRelease(T valueToAnd) +/*! + \fn template T QAtomicInteger::fetchAndAndRelease(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -928,7 +973,8 @@ \sa operator&=() */ -/*! \fn template T QAtomicInteger::fetchAndAndOrdered(T valueToAnd) +/*! + \fn template T QAtomicInteger::fetchAndAndOrdered(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -944,7 +990,8 @@ \sa operator&=() */ -/*! \fn template T QAtomicInteger::operator&=(T value) +/*! + \fn template T QAtomicInteger::operator&=(T value) \since 5.3 Atomic add-and-fetch. @@ -1287,17 +1334,20 @@ \sa QAtomicInteger */ -/*! \fn template QAtomicPointer::QAtomicPointer(T *value) +/*! + \fn template QAtomicPointer::QAtomicPointer(T *value) Constructs a QAtomicPointer with the given \a value. */ -/*! \fn template QAtomicPointer::QAtomicPointer(const QAtomicPointer &other) +/*! + \fn template QAtomicPointer::QAtomicPointer(const QAtomicPointer &other) Constructs a copy of \a other. */ -/*! \fn template QAtomicPointer &QAtomicPointer::operator=(const QAtomicPointer &other) +/*! + \fn template QAtomicPointer &QAtomicPointer::operator=(const QAtomicPointer &other) Assigns \a other to this QAtomicPointer and returns a reference to this QAtomicPointer. @@ -1369,18 +1419,21 @@ \sa storeRelaxed(), loadRelaxed() */ -/*! \fn template bool QAtomicPointer::isTestAndSetNative() +/*! + \fn template bool QAtomicPointer::isTestAndSetNative() Returns \c true if test-and-set is implemented using atomic processor instructions, false otherwise. */ -/*! \fn template bool QAtomicPointer::isTestAndSetWaitFree() +/*! + \fn template bool QAtomicPointer::isTestAndSetWaitFree() Returns \c true if atomic test-and-set is wait-free, false otherwise. */ -/*! \fn template bool QAtomicPointer::testAndSetRelaxed(T *expectedValue, T *newValue) +/*! + \fn template bool QAtomicPointer::testAndSetRelaxed(T *expectedValue, T *newValue) Atomic test-and-set. @@ -1394,7 +1447,8 @@ processor to freely reorder memory accesses. */ -/*! \fn template bool QAtomicPointer::testAndSetAcquire(T *expectedValue, T *newValue) +/*! + \fn template bool QAtomicPointer::testAndSetAcquire(T *expectedValue, T *newValue) Atomic test-and-set. @@ -1409,7 +1463,8 @@ be re-ordered before the atomic operation. */ -/*! \fn template bool QAtomicPointer::testAndSetRelease(T *expectedValue, T *newValue) +/*! + \fn template bool QAtomicPointer::testAndSetRelease(T *expectedValue, T *newValue) Atomic test-and-set. @@ -1424,7 +1479,8 @@ re-ordered after the atomic operation. */ -/*! \fn template bool QAtomicPointer::testAndSetOrdered(T *expectedValue, T *newValue) +/*! + \fn template bool QAtomicPointer::testAndSetOrdered(T *expectedValue, T *newValue) Atomic test-and-set. @@ -1439,19 +1495,22 @@ may not be re-ordered. */ -/*! \fn template bool QAtomicPointer::isFetchAndStoreNative() +/*! + \fn template bool QAtomicPointer::isFetchAndStoreNative() Returns \c true if fetch-and-store is implemented using atomic processor instructions, false otherwise. */ -/*! \fn template bool QAtomicPointer::isFetchAndStoreWaitFree() +/*! + \fn template bool QAtomicPointer::isFetchAndStoreWaitFree() Returns \c true if atomic fetch-and-store is wait-free, false otherwise. */ -/*! \fn template T *QAtomicPointer::fetchAndStoreRelaxed(T *newValue) +/*! + \fn template T *QAtomicPointer::fetchAndStoreRelaxed(T *newValue) Atomic fetch-and-store. @@ -1463,7 +1522,8 @@ processor to freely reorder memory accesses. */ -/*! \fn template T *QAtomicPointer::fetchAndStoreAcquire(T *newValue) +/*! + \fn template T *QAtomicPointer::fetchAndStoreAcquire(T *newValue) Atomic fetch-and-store. @@ -1476,7 +1536,8 @@ be re-ordered before the atomic operation. */ -/*! \fn template T *QAtomicPointer::fetchAndStoreRelease(T *newValue) +/*! + \fn template T *QAtomicPointer::fetchAndStoreRelease(T *newValue) Atomic fetch-and-store. @@ -1489,7 +1550,8 @@ re-ordered after the atomic operation. */ -/*! \fn template T *QAtomicPointer::fetchAndStoreOrdered(T *newValue) +/*! + \fn template T *QAtomicPointer::fetchAndStoreOrdered(T *newValue) Atomic fetch-and-store. @@ -1502,19 +1564,22 @@ may not be re-ordered. */ -/*! \fn template bool QAtomicPointer::isFetchAndAddNative() +/*! + \fn template bool QAtomicPointer::isFetchAndAddNative() Returns \c true if fetch-and-add is implemented using atomic processor instructions, false otherwise. */ -/*! \fn template bool QAtomicPointer::isFetchAndAddWaitFree() +/*! + \fn template bool QAtomicPointer::isFetchAndAddWaitFree() Returns \c true if atomic fetch-and-add is wait-free, false otherwise. */ -/*! \fn template T *QAtomicPointer::fetchAndAddRelaxed(qptrdiff valueToAdd) +/*! + \fn template T *QAtomicPointer::fetchAndAddRelaxed(qptrdiff valueToAdd) Atomic fetch-and-add. @@ -1526,7 +1591,8 @@ processor to freely reorder memory accesses. */ -/*! \fn template T *QAtomicPointer::fetchAndAddAcquire(qptrdiff valueToAdd) +/*! + \fn template T *QAtomicPointer::fetchAndAddAcquire(qptrdiff valueToAdd) Atomic fetch-and-add. @@ -1539,7 +1605,8 @@ be re-ordered before the atomic operation. */ -/*! \fn template T *QAtomicPointer::fetchAndAddRelease(qptrdiff valueToAdd) +/*! + \fn template T *QAtomicPointer::fetchAndAddRelease(qptrdiff valueToAdd) Atomic fetch-and-add. @@ -1552,7 +1619,8 @@ re-ordered after the atomic operation. */ -/*! \fn template T *QAtomicPointer::fetchAndAddOrdered(qptrdiff valueToAdd) +/*! + \fn template T *QAtomicPointer::fetchAndAddOrdered(qptrdiff valueToAdd) Atomic fetch-and-add. diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h index a3b9be0729..aa57ddc610 100644 --- a/src/corelib/thread/qatomic.h +++ b/src/corelib/thread/qatomic.h @@ -50,6 +50,10 @@ QT_BEGIN_NAMESPACE QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wextra") +#ifdef Q_CLANG_QDOC +# undef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS +#endif + // High-level atomic integer operations template class QAtomicInteger : public QBasicAtomicInteger @@ -194,7 +198,9 @@ public: #ifdef Q_QDOC T *load() const; T *loadAcquire() const; + T *loadRelaxed() const; void store(T *newValue); + void storeRelaxed(T *newValue); void storeRelease(T *newValue); static Q_DECL_CONSTEXPR bool isTestAndSetNative(); -- cgit v1.2.3 From c496fee2a5b65fd1b0672923293db058486e350e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 11 Oct 2019 14:10:39 -0700 Subject: qSwap: suppress pedantic warning about noexcept being false This warning is not in -Wall or -Wextra, but it happens in a single place, so we can reasonably suppress it. Fixes: QTBUG-79138 Change-Id: Ib5d667bf77a740c28d2efffd15ccb3f62cf8f431 Reviewed-by: Edward Welbourne Reviewed-by: Allan Sandfeld Jensen --- src/corelib/global/qglobal.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index e335916eac..e636a7cf8f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -944,6 +944,10 @@ QT_WARNING_POP # define Q_DUMMY_COMPARISON_OPERATOR(C) #endif +QT_WARNING_PUSH +// warning: noexcept-expression evaluates to ‘false’ because of a call to ‘void swap(..., ...)' +QT_WARNING_DISABLE_GCC("-Wnoexcept") + namespace QtPrivate { namespace SwapExceptionTester { // insulate users from the "using std::swap" below @@ -963,6 +967,8 @@ inline void qSwap(T &value1, T &value2) swap(value1, value2); } +QT_WARNING_POP + #if QT_DEPRECATED_SINCE(5, 0) Q_CORE_EXPORT QT_DEPRECATED void *qMalloc(size_t size) Q_ALLOC_SIZE(1); Q_CORE_EXPORT QT_DEPRECATED void qFree(void *ptr); -- cgit v1.2.3 From 0edd2e39ad7f959c3d0c56e79abd3c60d9950538 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 11 Dec 2019 19:48:53 +0100 Subject: Let QItemSelectionModel::columnIntersectsSelection honor the parent QItemSelectionModel::columnIntersectsSelection() should honor the parent according to the docs. For rowIntersectsSelection() this was fixed a long time ago but columnIntersectsSelection() was forgotten. Sync the both functions and use range-based for loops as a drive-by. Fixes: QTBUG-80644 Change-Id: Iaf08f85e2225204d1e6564fa4bb0bc826352ed53 Reviewed-by: Friedemann Kleint Reviewed-by: Richard Moe Gustavsen --- src/corelib/itemmodels/qitemselectionmodel.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index c93a4d15b9..ebcc3b10ca 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -1627,10 +1627,9 @@ bool QItemSelectionModel::rowIntersectsSelection(int row, const QModelIndex &par QItemSelection sel = d->ranges; sel.merge(d->currentSelection, d->currentCommand); - for (int i = 0; i < sel.count(); ++i) { - QItemSelectionRange range = sel.at(i); + for (const QItemSelectionRange &range : qAsConst(sel)) { if (range.parent() != parent) - return false; + return false; int top = range.top(); int bottom = range.bottom(); int left = range.left(); @@ -1661,11 +1660,13 @@ bool QItemSelectionModel::columnIntersectsSelection(int column, const QModelInde QItemSelection sel = d->ranges; sel.merge(d->currentSelection, d->currentCommand); - for (int i = 0; i < sel.count(); ++i) { - int left = sel.at(i).left(); - int right = sel.at(i).right(); - int top = sel.at(i).top(); - int bottom = sel.at(i).bottom(); + for (const QItemSelectionRange &range : qAsConst(sel)) { + if (range.parent() != parent) + return false; + int top = range.top(); + int bottom = range.bottom(); + int left = range.left(); + int right = range.right(); if (left <= column && right >= column) { for (int j = top; j <= bottom; j++) { const Qt::ItemFlags flags = d->model->index(j, column, parent).flags(); -- cgit v1.2.3