summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/doc/qtcore.qdocconf2
-rw-r--r--src/corelib/global/qglobal.h3
-rw-r--r--src/corelib/global/qlogging.cpp140
-rw-r--r--src/corelib/global/qnamespace.h1
-rw-r--r--src/corelib/global/qnamespace.qdoc11
-rw-r--r--src/corelib/global/qprocessordetection.h2
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp2
-rw-r--r--src/corelib/io/qstorageinfo_unix.cpp66
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp4
-rw-r--r--src/corelib/kernel/qvariant.cpp22
-rw-r--r--src/corelib/thread/qbasicatomic.h4
-rw-r--r--src/corelib/tools/qarraydata.cpp6
-rw-r--r--src/corelib/tools/qarraydata.h4
-rw-r--r--src/corelib/tools/qarraydatapointer.h2
-rw-r--r--src/corelib/tools/qcontiguouscache.h2
-rw-r--r--src/corelib/tools/qelapsedtimer_unix.cpp3
-rw-r--r--src/corelib/tools/qhash.h5
-rw-r--r--src/corelib/tools/qhashfunctions.h3
-rw-r--r--src/corelib/tools/qlinkedlist.h2
-rw-r--r--src/corelib/tools/qlist.h2
-rw-r--r--src/corelib/tools/qmap.h2
-rw-r--r--src/corelib/tools/qrefcount.h6
-rw-r--r--src/corelib/tools/qset.h2
-rw-r--r--src/corelib/tools/qsimd.cpp6
-rw-r--r--src/corelib/tools/qvector.h8
-rw-r--r--src/corelib/tools/tools.pri1
27 files changed, 199 insertions, 114 deletions
diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf
index e98f06d47d..3d64708def 100644
--- a/src/corelib/doc/qtcore.qdocconf
+++ b/src/corelib/doc/qtcore.qdocconf
@@ -4,7 +4,7 @@ project = QtCore
description = Qt Core Reference Documentation
version = $QT_VERSION
-examplesinstallpath = qtbase/corelib
+examplesinstallpath = corelib
qhp.projects = QtCore
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index e35ee0987f..2081ca8649 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -61,6 +61,9 @@
#include <QtCore/qfeatures.h>
#endif
+// The QT_SUPPORTS macro is deprecated. Don't use it in new code.
+// Instead, use #ifdef/ndef QT_NO_feature.
+// ### Qt6: remove macro
#ifdef _MSC_VER
# define QT_SUPPORTS(FEATURE) (!defined QT_NO_##FEATURE)
#else
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 4851d1ce6f..f2e293c45b 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -54,6 +54,7 @@
#include "qthread.h"
#include "private/qloggingregistry_p.h"
#include "private/qcoreapplication_p.h"
+#include "private/qsimd_p.h"
#endif
#ifdef Q_OS_WIN
#include <qt_windows.h>
@@ -1193,6 +1194,89 @@ void QMessagePattern::setPattern(const QString &pattern)
memcpy(literals, literalsVar.constData(), literalsVar.size() * sizeof(const char*));
}
+#if defined(QLOGGING_HAVE_BACKTRACE) && !defined(QT_BOOTSTRAPPED)
+// make sure the function has "Message" in the name so the function is removed
+
+#if (defined(Q_CC_GNU) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) || QT_HAS_ATTRIBUTE(optimize)
+// force skipping the frame pointer, to save the backtrace() function some work
+__attribute__((optimize("omit-frame-pointer")))
+#endif
+static QStringList backtraceFramesForLogMessage(int frameCount)
+{
+ QStringList result;
+ if (frameCount == 0)
+ return result;
+
+ // The results of backtrace_symbols looks like this:
+ // /lib/libc.so.6(__libc_start_main+0xf3) [0x4a937413]
+ // The offset and function name are optional.
+ // This regexp tries to extract the library name (without the path) and the function name.
+ // This code is protected by QMessagePattern::mutex so it is thread safe on all compilers
+ static QRegularExpression rx(QStringLiteral("^(?:[^(]*/)?([^(/]+)\\(([^+]*)(?:[\\+[a-f0-9x]*)?\\) \\[[a-f0-9x]*\\]$"),
+ QRegularExpression::OptimizeOnFirstUsageOption);
+
+ QVarLengthArray<void*, 32> buffer(7 + frameCount);
+ int n = backtrace(buffer.data(), buffer.size());
+ if (n > 0) {
+ int numberPrinted = 0;
+ for (int i = 0; i < n && numberPrinted < frameCount; ++i) {
+ QScopedPointer<char*, QScopedPointerPodDeleter> strings(backtrace_symbols(buffer.data() + i, 1));
+ QString trace = QString::fromLatin1(strings.data()[0]);
+ QRegularExpressionMatch m = rx.match(trace);
+ if (m.hasMatch()) {
+ QString library = m.captured(1);
+ QString function = m.captured(2);
+
+ // skip the trace from QtCore that are because of the qDebug itself
+ if (!numberPrinted && library.contains(QLatin1String("Qt5Core"))
+ && (function.isEmpty() || function.contains(QLatin1String("Message"), Qt::CaseInsensitive)
+ || function.contains(QLatin1String("QDebug")))) {
+ continue;
+ }
+
+ if (function.startsWith(QLatin1String("_Z"))) {
+ QScopedPointer<char, QScopedPointerPodDeleter> demangled(
+ abi::__cxa_demangle(function.toUtf8(), 0, 0, 0));
+ if (demangled)
+ function = QString::fromUtf8(qCleanupFuncinfo(demangled.data()));
+ }
+
+ if (function.isEmpty()) {
+ result.append(QLatin1Char('?') + library + QLatin1Char('?'));
+ } else {
+ result.append(function);
+ }
+ } else {
+ if (numberPrinted == 0) {
+ // innermost, unknown frames are usually the logging framework itself
+ continue;
+ }
+ result.append(QStringLiteral("???"));
+ }
+ numberPrinted++;
+ }
+ }
+ return result;
+}
+
+static QString formatBacktraceForLogMessage(const QMessagePattern::BacktraceParams backtraceParams,
+ const char *function)
+{
+ QString backtraceSeparator = backtraceParams.backtraceSeparator;
+ int backtraceDepth = backtraceParams.backtraceDepth;
+
+ QStringList frames = backtraceFramesForLogMessage(backtraceDepth);
+ if (frames.isEmpty())
+ return QString();
+
+ // if the first frame is unknown, replace it with the context function
+ if (function && frames.at(0).startsWith(QLatin1Char('?')))
+ frames[0] = QString::fromUtf8(qCleanupFuncinfo(function));
+
+ return frames.join(backtraceSeparator);
+}
+#endif // QLOGGING_HAVE_BACKTRACE && !QT_BOOTSTRAPPED
+
#if defined(QT_USE_SLOG2)
#ifndef QT_LOG_CODE
#define QT_LOG_CODE 9000
@@ -1336,62 +1420,8 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
#ifdef QLOGGING_HAVE_BACKTRACE
} else if (token == backtraceTokenC) {
QMessagePattern::BacktraceParams backtraceParams = pattern->backtraceArgs.at(backtraceArgsIdx);
- QString backtraceSeparator = backtraceParams.backtraceSeparator;
- int backtraceDepth = backtraceParams.backtraceDepth;
backtraceArgsIdx++;
- QVarLengthArray<void*, 32> buffer(7 + backtraceDepth);
- int n = backtrace(buffer.data(), buffer.size());
- if (n > 0) {
- int numberPrinted = 0;
- for (int i = 0; i < n && numberPrinted < backtraceDepth; ++i) {
- QScopedPointer<char*, QScopedPointerPodDeleter> strings(backtrace_symbols(buffer.data() + i, 1));
- QString trace = QString::fromLatin1(strings.data()[0]);
- // The results of backtrace_symbols looks like this:
- // /lib/libc.so.6(__libc_start_main+0xf3) [0x4a937413]
- // The offset and function name are optional.
- // This regexp tries to extract the librry name (without the path) and the function name.
- // This code is protected by QMessagePattern::mutex so it is thread safe on all compilers
- static QRegularExpression rx(QStringLiteral("^(?:[^(]*/)?([^(/]+)\\(([^+]*)(?:[\\+[a-f0-9x]*)?\\) \\[[a-f0-9x]*\\]$"),
- QRegularExpression::OptimizeOnFirstUsageOption);
-
- QRegularExpressionMatch m = rx.match(trace);
- if (m.hasMatch()) {
- // skip the trace from QtCore that are because of the qDebug itself
- QString library = m.captured(1);
- QString function = m.captured(2);
- if (!numberPrinted && library.contains(QLatin1String("Qt5Core"))
- && (function.isEmpty() || function.contains(QLatin1String("Message"), Qt::CaseInsensitive)
- || function.contains(QLatin1String("QDebug")))) {
- continue;
- }
-
- if (function.startsWith(QLatin1String("_Z"))) {
- QScopedPointer<char, QScopedPointerPodDeleter> demangled(
- abi::__cxa_demangle(function.toUtf8(), 0, 0, 0));
- if (demangled)
- function = QString::fromUtf8(qCleanupFuncinfo(demangled.data()));
- }
-
- if (numberPrinted > 0)
- message.append(backtraceSeparator);
-
- if (function.isEmpty()) {
- if (numberPrinted == 0 && context.function)
- message += QString::fromUtf8(qCleanupFuncinfo(context.function));
- else
- message += QLatin1Char('?') + library + QLatin1Char('?');
- } else {
- message += function;
- }
-
- } else {
- if (numberPrinted == 0)
- continue;
- message += backtraceSeparator + QLatin1String("???");
- }
- numberPrinted++;
- }
- }
+ message.append(formatBacktraceForLogMessage(backtraceParams, context.function));
#endif
} else if (token == timeTokenC) {
QString timeFormat = pattern->timeArgs.at(timeArgsIdx);
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index c73ceb9503..2a0b8461cd 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -508,6 +508,7 @@ public:
AA_UseStyleSheetPropagationInWidgetStyles = 22, // ### Qt 6: remove me
AA_DontUseNativeDialogs = 23,
AA_SynthesizeMouseForUnhandledTabletEvents = 24,
+ AA_CompressHighFrequencyEvents = 25,
// Add new attributes before this line
AA_AttributeCount
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 60ce1fc916..3c53a23896 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -239,6 +239,17 @@
to mouse events instead. This attribute is enabled
by default. This value has been added in Qt 5.7.
+ \value AA_CompressHighFrequencyEvents Enables compression of certain frequent events.
+ On the X11 windowing system, the default value is true, which means that
+ QEvent::MouseMove, QEvent::TouchUpdate, and changes in window size and
+ position will be combined whenever they occur more frequently than the
+ application handles them, so that they don't accumulate and overwhelm the
+ application later. On other platforms, the default is false.
+ (In the future, the compression feature may be implemented across platforms.)
+ You can test the attribute to see whether compression is enabled.
+ If your application needs to handle all events with no compression,
+ you can unset this attribute. This value has been added in Qt 5.7.
+
The following values are obsolete:
\value AA_ImmediateWidgetCreation This attribute is no longer fully
diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h
index ee94720e7a..6ecd41bc30 100644
--- a/src/corelib/global/qprocessordetection.h
+++ b/src/corelib/global/qprocessordetection.h
@@ -107,7 +107,7 @@
# define Q_PROCESSOR_ARM __TARGET_ARCH_ARM
# elif defined(_M_ARM) && _M_ARM > 1
# define Q_PROCESSOR_ARM _M_ARM
-# elif defined(__ARM64_ARCH_8__)
+# elif defined(__ARM64_ARCH_8__) || defined(__aarch64__)
# define Q_PROCESSOR_ARM 8
# elif defined(__ARM_ARCH_7__) \
|| defined(__ARM_ARCH_7A__) \
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 115b31dd2e..85c795fadd 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -885,7 +885,9 @@ static bool tryDriveUNCFallback(const QFileSystemEntry &fname, QFileSystemMetaDa
#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
if (fname.isDriveRoot()) {
// a valid drive ??
+ const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
DWORD drivesBitmask = ::GetLogicalDrives();
+ ::SetErrorMode(oldErrorMode);
int drivebit = 1 << (fname.filePath().at(0).toUpper().unicode() - QLatin1Char('A').unicode());
if (drivesBitmask & drivebit) {
fileAttrib = FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM;
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index d94a8433a9..c37a690646 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -632,7 +632,9 @@ QFileInfoList QFSFileEngine::drives()
QFileInfoList ret;
#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
#if defined(Q_OS_WIN32)
+ const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
quint32 driveBits = (quint32) GetLogicalDrives() & 0x3ffffff;
+ ::SetErrorMode(oldErrorMode);
#endif
char driveName[] = "A:/";
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp
index a826bcbd9b..3a9f74bf59 100644
--- a/src/corelib/io/qstorageinfo_unix.cpp
+++ b/src/corelib/io/qstorageinfo_unix.cpp
@@ -108,25 +108,6 @@
QT_BEGIN_NAMESPACE
-static bool isPseudoFs(const QString &mountDir, const QByteArray &type)
-{
- if (mountDir.startsWith(QLatin1String("/dev"))
- || mountDir.startsWith(QLatin1String("/proc"))
- || mountDir.startsWith(QLatin1String("/sys"))
- || mountDir.startsWith(QLatin1String("/var/run"))
- || mountDir.startsWith(QLatin1String("/var/lock"))) {
- return true;
- }
- if (type == "tmpfs")
- return true;
-#if defined(Q_OS_LINUX)
- if (type == "rootfs" || type == "rpc_pipefs")
- return true;
-#endif
-
- return false;
-}
-
class QStorageIterator
{
public:
@@ -164,6 +145,39 @@ private:
#endif
};
+template <typename String>
+static bool isParentOf(const String &parent, const QString &dirName)
+{
+ return dirName.startsWith(parent) &&
+ (dirName.size() == parent.size() || dirName.at(parent.size()) == QLatin1Char('/') ||
+ parent.size() == 1);
+}
+
+static bool isPseudoFs(const QStorageIterator &it)
+{
+ QString mountDir = it.rootPath();
+ if (isParentOf(QLatin1String("/dev"), mountDir)
+ || isParentOf(QLatin1String("/proc"), mountDir)
+ || isParentOf(QLatin1String("/sys"), mountDir)
+ || isParentOf(QLatin1String("/var/run"), mountDir)
+ || isParentOf(QLatin1String("/var/lock"), mountDir)) {
+ return true;
+ }
+
+ QByteArray type = it.fileSystemType();
+ if (type == "tmpfs")
+ return false;
+#if defined(Q_OS_LINUX)
+ if (type == "rootfs" || type == "rpc_pipefs")
+ return true;
+#endif
+
+ if (!it.device().startsWith('/'))
+ return true;
+
+ return false;
+}
+
#if defined(Q_OS_BSD4)
inline QStorageIterator::QStorageIterator()
@@ -450,10 +464,8 @@ void QStorageInfoPrivate::initRootPath()
while (it.next()) {
const QString mountDir = it.rootPath();
const QByteArray fsName = it.fileSystemType();
- if (isPseudoFs(mountDir, fsName))
- continue;
// we try to find most suitable entry
- if (oldRootPath.startsWith(mountDir) && maxLength < mountDir.length()) {
+ if (isParentOf(mountDir, oldRootPath) && maxLength < mountDir.length()) {
maxLength = mountDir.length();
rootPath = mountDir;
device = it.device();
@@ -467,11 +479,14 @@ static inline QString retrieveLabel(const QByteArray &device)
#ifdef Q_OS_LINUX
static const char pathDiskByLabel[] = "/dev/disk/by-label";
+ QFileInfo devinfo(QFile::decodeName(device));
+ QString devicePath = devinfo.canonicalFilePath();
+
QDirIterator it(QLatin1String(pathDiskByLabel), QDir::NoDotAndDotDot);
while (it.hasNext()) {
it.next();
QFileInfo fileInfo(it.fileInfo());
- if (fileInfo.isSymLink() && fileInfo.symLinkTarget().toLocal8Bit() == device)
+ if (fileInfo.isSymLink() && fileInfo.symLinkTarget() == devicePath)
return fileInfo.fileName();
}
#elif defined Q_OS_HAIKU
@@ -542,11 +557,10 @@ QList<QStorageInfo> QStorageInfoPrivate::mountedVolumes()
QList<QStorageInfo> volumes;
while (it.next()) {
- const QString mountDir = it.rootPath();
- const QByteArray fsName = it.fileSystemType();
- if (isPseudoFs(mountDir, fsName))
+ if (isPseudoFs(it))
continue;
+ const QString mountDir = it.rootPath();
volumes.append(QStorageInfo(mountDir));
}
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 54afb8a974..d645205155 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -3690,7 +3690,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
\fn QAbstractItemModel::modelAboutToBeReset()
\since 4.2
- This signal is emitted when reset() is called, before the model's internal
+ This signal is emitted when beginResetModel() is called, before the model's internal
state (e.g. persistent model indexes) has been invalidated.
\sa beginResetModel(), modelReset()
@@ -3700,7 +3700,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
\fn QAbstractItemModel::modelReset()
\since 4.1
- This signal is emitted when reset() or endResetModel() is called, after the
+ This signal is emitted when endResetModel() is called, after the
model's internal state (e.g. persistent model indexes) has been invalidated.
Note that if a model is reset it should be considered that all information
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 5feb7a409b..f1d38db96c 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -945,6 +945,26 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
}
}
#endif
+ if (QMetaType::typeFlags(t) & QMetaType::IsEnumeration) {
+ qlonglong value = qConvertToNumber(d, ok);
+ if (*ok) {
+ switch (QMetaType::sizeOf(t)) {
+ case 1:
+ *static_cast<signed char *>(result) = value;
+ return true;
+ case 2:
+ *static_cast<qint16 *>(result) = value;
+ return true;
+ case 4:
+ *static_cast<qint32 *>(result) = value;
+ return true;
+ case 8:
+ *static_cast<qint64 *>(result) = value;
+ return true;
+ }
+ }
+ return *ok;
+ }
return false;
}
return true;
@@ -2819,7 +2839,7 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
/*Int*/ 1 << QVariant::UInt | 1 << QVariant::String | 1 << QVariant::Double
| 1 << QVariant::Bool | 1 << QVariant::LongLong | 1 << QVariant::ULongLong
- | 1 << QVariant::Char | 1 << QVariant::ByteArray,
+ | 1 << QVariant::Char | 1 << QVariant::ByteArray | 1 << QVariant::Int,
/*UInt*/ 1 << QVariant::Int | 1 << QVariant::String | 1 << QVariant::Double
| 1 << QVariant::Bool | 1 << QVariant::LongLong | 1 << QVariant::ULongLong
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h
index 5ea8bbe770..447fca44c0 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qbasicatomic.h
@@ -232,8 +232,8 @@ public:
AtomicType _q_value;
- Type load() const Q_DECL_NOTHROW { return _q_value; }
- void store(Type newValue) Q_DECL_NOTHROW { _q_value = newValue; }
+ Type load() const Q_DECL_NOTHROW { return Ops::load(_q_value); }
+ void store(Type newValue) Q_DECL_NOTHROW { Ops::store(_q_value, newValue); }
operator Type() const Q_DECL_NOTHROW { return loadAcquire(); }
Type operator=(Type newValue) Q_DECL_NOTHROW { storeRelease(newValue); return newValue; }
diff --git a/src/corelib/tools/qarraydata.cpp b/src/corelib/tools/qarraydata.cpp
index bf336a8f31..36f1997a6c 100644
--- a/src/corelib/tools/qarraydata.cpp
+++ b/src/corelib/tools/qarraydata.cpp
@@ -71,7 +71,7 @@ QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment,
// Don't allocate empty headers
if (!(options & RawData) && !capacity) {
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (options & Unsharable)
return const_cast<QArrayData *>(&qt_array_unsharable_empty);
#endif
@@ -116,7 +116,7 @@ QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment,
quintptr data = (quintptr(header) + sizeof(QArrayData) + alignment - 1)
& ~(alignment - 1);
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
header->ref.atomic.store(bool(!(options & Unsharable)));
#else
header->ref.atomic.store(1);
@@ -138,7 +138,7 @@ void QArrayData::deallocate(QArrayData *data, size_t objectSize,
&& !(alignment & (alignment - 1)));
Q_UNUSED(objectSize) Q_UNUSED(alignment)
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (data == &qt_array_unsharable_empty)
return;
#endif
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h
index 79d0d006ac..5a369baf08 100644
--- a/src/corelib/tools/qarraydata.h
+++ b/src/corelib/tools/qarraydata.h
@@ -78,7 +78,7 @@ struct Q_CORE_EXPORT QArrayData
enum AllocationOption {
CapacityReserved = 0x1,
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
Unsharable = 0x2,
#endif
RawData = 0x4,
@@ -255,7 +255,7 @@ struct QTypedArrayData
return allocate(/* capacity */ 0);
}
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
static QTypedArrayData *unsharableEmpty()
{
Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData));
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h
index 2036120520..b97dde5a61 100644
--- a/src/corelib/tools/qarraydatapointer.h
+++ b/src/corelib/tools/qarraydatapointer.h
@@ -133,7 +133,7 @@ public:
return (!d->isMutable() || d->ref.isShared());
}
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
void setSharable(bool sharable)
{
if (needsDetach()) {
diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h
index 06b539933e..18facf7e42 100644
--- a/src/corelib/tools/qcontiguouscache.h
+++ b/src/corelib/tools/qcontiguouscache.h
@@ -102,7 +102,7 @@ public:
inline void detach() { if (d->ref.load() != 1) detach_helper(); }
inline bool isDetached() const { return d->ref.load() == 1; }
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; }
#endif
diff --git a/src/corelib/tools/qelapsedtimer_unix.cpp b/src/corelib/tools/qelapsedtimer_unix.cpp
index e1fc77fb4c..e2c3ae6280 100644
--- a/src/corelib/tools/qelapsedtimer_unix.cpp
+++ b/src/corelib/tools/qelapsedtimer_unix.cpp
@@ -38,9 +38,6 @@
**
****************************************************************************/
-// ask for the latest POSIX, just in case
-#define _POSIX_C_SOURCE 200809L
-
#include "qelapsedtimer.h"
#if defined(Q_OS_VXWORKS)
#include "qfunctions_vxworks.h"
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index b15dc7b07b..7abbeabeae 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -272,7 +272,7 @@ public:
inline void detach() { if (d->ref.isShared()) detach_helper(); }
inline bool isDetached() const { return !d->ref.isShared(); }
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable) { if (!sharable) detach(); if (d != &QHashData::shared_null) d->sharable = sharable; }
#endif
bool isSharedWith(const QHash &other) const { return d == other.d; }
@@ -1092,9 +1092,6 @@ Q_INLINE_TEMPLATE int QMultiHash<Key, T>::count(const Key &key, const T &value)
return n;
}
-Q_CORE_EXPORT int qGlobalQHashSeed();
-Q_CORE_EXPORT void qSetGlobalQHashSeed(int newSeed);
-
Q_DECLARE_ASSOCIATIVE_ITERATOR(Hash)
Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(Hash)
diff --git a/src/corelib/tools/qhashfunctions.h b/src/corelib/tools/qhashfunctions.h
index b6cb84ee15..0eb6c1b5ce 100644
--- a/src/corelib/tools/qhashfunctions.h
+++ b/src/corelib/tools/qhashfunctions.h
@@ -64,6 +64,9 @@ class QString;
class QStringRef;
class QLatin1String;
+Q_CORE_EXPORT int qGlobalQHashSeed();
+Q_CORE_EXPORT void qSetGlobalQHashSeed(int newSeed);
+
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHashBits(const void *p, size_t size, uint seed = 0) Q_DECL_NOTHROW;
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(char key, uint seed = 0) Q_DECL_NOTHROW { return uint(key) ^ seed; }
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index 3e0de52da6..e3eed9184f 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -105,7 +105,7 @@ public:
inline void detach()
{ if (d->ref.isShared()) detach_helper2(this->e); }
inline bool isDetached() const { return !d->ref.isShared(); }
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable) { if (!sharable) detach(); if (d != &QLinkedListData::shared_null) d->sharable = sharable; }
#endif
inline bool isSharedWith(const QLinkedList<T> &other) const { return d == other.d; }
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index ec279769eb..90ed5072e7 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -175,7 +175,7 @@ public:
}
inline bool isDetached() const { return !d->ref.isShared(); }
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable)
{
if (sharable == d->ref.isSharable())
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index f84d733db0..baa10b7a95 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -365,7 +365,7 @@ public:
inline void detach() { if (d->ref.isShared()) detach_helper(); }
inline bool isDetached() const { return !d->ref.isShared(); }
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable)
{
if (sharable == d->ref.isSharable())
diff --git a/src/corelib/tools/qrefcount.h b/src/corelib/tools/qrefcount.h
index 77f06c8077..9586c3a79a 100644
--- a/src/corelib/tools/qrefcount.h
+++ b/src/corelib/tools/qrefcount.h
@@ -53,7 +53,7 @@ class RefCount
public:
inline bool ref() Q_DECL_NOTHROW {
int count = atomic.load();
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (count == 0) // !isSharable
return false;
#endif
@@ -64,7 +64,7 @@ public:
inline bool deref() Q_DECL_NOTHROW {
int count = atomic.load();
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (count == 0) // !isSharable
return false;
#endif
@@ -73,7 +73,7 @@ public:
return atomic.deref();
}
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
bool setSharable(bool sharable) Q_DECL_NOTHROW
{
Q_ASSERT(!isShared());
diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h
index 088403f09d..08b38a08c2 100644
--- a/src/corelib/tools/qset.h
+++ b/src/corelib/tools/qset.h
@@ -85,7 +85,7 @@ public:
inline void detach() { q_hash.detach(); }
inline bool isDetached() const { return q_hash.isDetached(); }
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable) { q_hash.setSharable(sharable); }
#endif
diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
index 9037442d9d..3a5f0f18a1 100644
--- a/src/corelib/tools/qsimd.cpp
+++ b/src/corelib/tools/qsimd.cpp
@@ -697,7 +697,11 @@ void qDetectCpuFeatures()
// contains all the features that the code required. Qt 4 ran for years
// like that, so it shouldn't be a problem.
- qt_cpu_features.store(minFeature | quint32(QSimdInitialized));
+ qt_cpu_features[0].store(minFeature | quint32(QSimdInitialized));
+#ifndef Q_ATOMIC_INT64_IS_SUPPORTED
+ qt_cpu_features[1].store(minFeature >> 32);
+#endif
+
return;
# endif
#endif
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 557bec9676..fea50f4c34 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -106,7 +106,7 @@ public:
inline void detach();
inline bool isDetached() const { return !d->ref.isShared(); }
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable)
{
if (sharable == d->ref.isSharable())
@@ -382,7 +382,7 @@ template <typename T>
void QVector<T>::detach()
{
if (!isDetached()) {
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (!d->alloc)
d = Data::unsharableEmpty();
else
@@ -539,7 +539,7 @@ void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::Allo
x = Data::allocate(aalloc, options);
Q_CHECK_PTR(x);
// aalloc is bigger then 0 so it is not [un]sharedEmpty
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
Q_ASSERT(x->ref.isSharable() || options.testFlag(QArrayData::Unsharable));
#endif
Q_ASSERT(!x->ref.isStatic());
@@ -607,7 +607,7 @@ void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::Allo
Q_ASSERT(d->data());
Q_ASSERT(uint(d->size) <= d->alloc);
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
Q_ASSERT(d != Data::unsharableEmpty());
#endif
Q_ASSERT(aalloc ? d != Data::sharedNull() : d == Data::sharedNull());
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index 93dc71c3d8..b64ec756ba 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -155,6 +155,7 @@ else:SOURCES += tools/qelapsedtimer_generic.cpp
contains(QT_CONFIG, zlib) {
include($$PWD/../../3rdparty/zlib.pri)
} else {
+ CONFIG += no_core_dep
include($$PWD/../../3rdparty/zlib_dependency.pri)
}