diff options
118 files changed, 1490 insertions, 456 deletions
diff --git a/licenseRule.json b/licenseRule.json index e35e8ba7fd1..b40e225e347 100644 --- a/licenseRule.json +++ b/licenseRule.json @@ -119,7 +119,7 @@ "file type": "test", "spdx": ["LicenseRef-Qt-Commercial OR GPL-3.0-only"] }, - "ests/auto/testlib/selftests/": { + "tests/auto/testlib/selftests/(?!README)": { "comment": "Exception. Those are test files", "file type": "test", "spdx": ["LicenseRef-Qt-Commercial OR GPL-3.0-only"] diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 96036eba701..9c29b26fb82 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -804,7 +804,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) QString icon = fileFixify(var("ICON")); t << "@$(DEL_FILE) " << info_plist_out << "\n\t" - << "@plutil -convert xml1 -o - " << info_plist << " | " + << "@set -o pipefail && plutil -convert xml1 -o - " << info_plist << " | " << "sed "; for (const ProString &arg : std::as_const(commonSedArgs)) t << arg; @@ -837,7 +837,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if (!isShallowBundle) symlinks[bundle_dir + "Resources"] = "Versions/Current/Resources"; t << "@$(DEL_FILE) " << info_plist_out << "\n\t" - << "@plutil -convert xml1 -o - " << info_plist << " | " + << "@set -o pipefail && plutil -convert xml1 -o - " << info_plist << " | " << "sed "; for (const ProString &arg : std::as_const(commonSedArgs)) t << arg; diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index 3f5f9180805..7b522f99abb 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -3799,7 +3799,7 @@ function(qt6_generate_deploy_app_script) qt6_generate_deploy_script(${generate_args} CONTENT " qt6_deploy_runtime_dependencies( - EXECUTABLE $<TARGET_FILE_NAME:${arg_TARGET}>.app + EXECUTABLE \"$<TARGET_FILE_NAME:${arg_TARGET}>.app\" ${common_deploy_args}) ") @@ -3807,7 +3807,7 @@ ${common_deploy_args}) qt6_generate_deploy_script(${generate_args} CONTENT " qt6_deploy_runtime_dependencies( - EXECUTABLE $<TARGET_FILE:${arg_TARGET}> + EXECUTABLE \"$<TARGET_FILE:${arg_TARGET}>\" GENERATE_QT_CONF ${common_deploy_args}) ") @@ -3817,7 +3817,7 @@ ${common_deploy_args}) qt6_generate_deploy_script(${generate_args} CONTENT " qt6_deploy_runtime_dependencies( - EXECUTABLE $<TARGET_FILE:${arg_TARGET}> + EXECUTABLE \"$<TARGET_FILE:${arg_TARGET}>\" GENERATE_QT_CONF ${common_deploy_args}) ") diff --git a/src/corelib/doc/snippets/qprocess/CMakeLists.txt b/src/corelib/doc/snippets/qprocess/CMakeLists.txt index 07b66d0b36b..d410d479f7f 100644 --- a/src/corelib/doc/snippets/qprocess/CMakeLists.txt +++ b/src/corelib/doc/snippets/qprocess/CMakeLists.txt @@ -1,3 +1,5 @@ +set(CMAKE_UNITY_BUILD OFF) + add_library(snippets_qprocess OBJECT qprocess-createprocessargumentsmodifier.cpp qprocess-simpleexecution.cpp diff --git a/src/corelib/doc/src/cmake/qt_add_resources.qdoc b/src/corelib/doc/src/cmake/qt_add_resources.qdoc index 570272c6097..445e37e000a 100644 --- a/src/corelib/doc/src/cmake/qt_add_resources.qdoc +++ b/src/corelib/doc/src/cmake/qt_add_resources.qdoc @@ -111,5 +111,9 @@ resources linked into the final target. This especially affects static builds. There, the same resource name in different static libraries conflict in the consuming target. +In contrast to \l{qmake}'s \c{RESOURCES}, \c qt_add_resources does not +attempt to compile any QML or JavaScript files using \l{qmlcachegen}. Use +\l{qt_add_qml_module} for this. + \sa {qt6_add_big_resources}{qt_add_big_resources()} */ diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 1ecec63aed4..d1fc672564f 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -1,6 +1,7 @@ // Copyright (C) 2021 The Qt Company Ltd. // Copyright (C) 2021 Intel Corporation. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:critical reason:execute-external-code #include "qdir.h" #include "qstringlist.h" diff --git a/src/corelib/global/qnumeric.cpp b/src/corelib/global/qnumeric.cpp index 16b2b7ca408..8b153bcdb84 100644 --- a/src/corelib/global/qnumeric.cpp +++ b/src/corelib/global/qnumeric.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2019 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:critical reason:data-parser #include "qnumeric.h" #include "qnumeric_p.h" diff --git a/src/corelib/global/qnumeric.h b/src/corelib/global/qnumeric.h index 2c7110c97a6..bc2bbf9e53e 100644 --- a/src/corelib/global/qnumeric.h +++ b/src/corelib/global/qnumeric.h @@ -1,6 +1,7 @@ // Copyright (C) 2021 The Qt Company Ltd. // Copyright (C) 2025 Klarälvdalens Datakonsult AB, a KDAB Group company, [email protected], author Giuseppe D'Angelo <[email protected]> // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:critical reason:data-parser #ifndef QNUMERIC_H #define QNUMERIC_H diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index fd742898f81..dab903f51fb 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -1,6 +1,7 @@ // Copyright (C) 2021 Intel Corporation. // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:critical reason:cryptography // for rand_s #define _CRT_RAND_S diff --git a/src/corelib/global/qrandom.h b/src/corelib/global/qrandom.h index 5ac864e79ef..30599413d75 100644 --- a/src/corelib/global/qrandom.h +++ b/src/corelib/global/qrandom.h @@ -1,5 +1,6 @@ // Copyright (C) 2020 Intel Corporation. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:critical reason:cryptography #ifndef QRANDOM_H #define QRANDOM_H diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 6f995fe082e..5a0be1d895e 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -893,6 +893,12 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM { Q_CHECK_FILE_NAME(entry, false); + // Detection of WasDeletedAttribute is imperfect: in general, if we can + // successfully stat() or access() a file, it hasn't been deleted (though + // there are exceptions, like /proc/XXX/fd/ entries on Linux). So we have + // to restore this flag in case we fail to stat() anything. + auto hadBeenDeleted = data.entryFlags & QFileSystemMetaData::WasDeletedAttribute; + #if defined(Q_OS_DARWIN) if (what & (QFileSystemMetaData::BundleType | QFileSystemMetaData::CaseSensitive)) { if (!data.hasFlags(QFileSystemMetaData::DirectoryType)) @@ -1103,6 +1109,11 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM if (entryErrno != 0) { what &= ~QFileSystemMetaData::LinkType; // don't clear link: could be broken symlink data.clearFlags(what); + + // see comment at the top + data.entryFlags |= hadBeenDeleted; + data.knownFlagsMask |= hadBeenDeleted; + return false; } return true; diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp index 064be4c2112..cd72f21acdf 100644 --- a/src/corelib/io/qfilesystemwatcher.cpp +++ b/src/corelib/io/qfilesystemwatcher.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qfilesystemwatcher.h" #include "qfilesystemwatcher_p.h" diff --git a/src/corelib/io/qfilesystemwatcher.h b/src/corelib/io/qfilesystemwatcher.h index 668bc143b20..9523945435e 100644 --- a/src/corelib/io/qfilesystemwatcher.h +++ b/src/corelib/io/qfilesystemwatcher.h @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QFILESYSTEMWATCHER_H #define QFILESYSTEMWATCHER_H diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.mm b/src/corelib/io/qfilesystemwatcher_fsevents.mm index 0d9b84890ae..0f49d43bc02 100644 --- a/src/corelib/io/qfilesystemwatcher_fsevents.mm +++ b/src/corelib/io/qfilesystemwatcher_fsevents.mm @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include <qplatformdefs.h> diff --git a/src/corelib/io/qfilesystemwatcher_fsevents_p.h b/src/corelib/io/qfilesystemwatcher_fsevents_p.h index d6ce176a30f..2fc95a99931 100644 --- a/src/corelib/io/qfilesystemwatcher_fsevents_p.h +++ b/src/corelib/io/qfilesystemwatcher_fsevents_p.h @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QFILESYSTEMWATCHER_FSEVENTS_P_H #define QFILESYSTEMWATCHER_FSEVENTS_P_H diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index e60f6881109..4971b41c102 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qfilesystemwatcher.h" #include "qfilesystemwatcher_inotify_p.h" diff --git a/src/corelib/io/qfilesystemwatcher_inotify_p.h b/src/corelib/io/qfilesystemwatcher_inotify_p.h index 05f87df14c1..705fe71725a 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify_p.h +++ b/src/corelib/io/qfilesystemwatcher_inotify_p.h @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QFILESYSTEMWATCHER_INOTIFY_P_H #define QFILESYSTEMWATCHER_INOTIFY_P_H diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index 7a9be337bf8..bc331c9dd2a 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include <qplatformdefs.h> diff --git a/src/corelib/io/qfilesystemwatcher_kqueue_p.h b/src/corelib/io/qfilesystemwatcher_kqueue_p.h index 05844d5be95..a460da6882e 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue_p.h +++ b/src/corelib/io/qfilesystemwatcher_kqueue_p.h @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QFILESYSTEMWATCHER_KQUEUE_P_H #define QFILESYSTEMWATCHER_KQUEUE_P_H diff --git a/src/corelib/io/qfilesystemwatcher_p.h b/src/corelib/io/qfilesystemwatcher_p.h index c34e3e2408f..79cf7443e37 100644 --- a/src/corelib/io/qfilesystemwatcher_p.h +++ b/src/corelib/io/qfilesystemwatcher_p.h @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QFILESYSTEMWATCHER_P_H #define QFILESYSTEMWATCHER_P_H diff --git a/src/corelib/io/qfilesystemwatcher_polling.cpp b/src/corelib/io/qfilesystemwatcher_polling.cpp index 5ec13a77f6c..ea374141563 100644 --- a/src/corelib/io/qfilesystemwatcher_polling.cpp +++ b/src/corelib/io/qfilesystemwatcher_polling.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qfilesystemwatcher_polling_p.h" diff --git a/src/corelib/io/qfilesystemwatcher_polling_p.h b/src/corelib/io/qfilesystemwatcher_polling_p.h index 80d7b7d1526..2ace2947be4 100644 --- a/src/corelib/io/qfilesystemwatcher_polling_p.h +++ b/src/corelib/io/qfilesystemwatcher_polling_p.h @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QFILESYSTEMWATCHER_POLLING_P_H #define QFILESYSTEMWATCHER_POLLING_P_H diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp index 5418265ba2c..3a2cb02c3d7 100644 --- a/src/corelib/io/qfilesystemwatcher_win.cpp +++ b/src/corelib/io/qfilesystemwatcher_win.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qfilesystemwatcher.h" #include "qfilesystemwatcher_win_p.h" diff --git a/src/corelib/io/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h index f6c6fd6c923..0687080b0ed 100644 --- a/src/corelib/io/qfilesystemwatcher_win_p.h +++ b/src/corelib/io/qfilesystemwatcher_win_p.h @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QFILESYSTEMWATCHER_WIN_P_H #define QFILESYSTEMWATCHER_WIN_P_H diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 585a07158ea..9c1bb45dd2d 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:critical reason:network-protocol //#define QIODEVICE_DEBUG @@ -1308,8 +1309,11 @@ QByteArray QIODevice::readAll() The newline character ('\\n') is included in the buffer. If a newline is not encountered before maxSize - 1 bytes are read, a - newline will not be inserted into the buffer. On windows newline - characters are replaced with '\\n'. + newline will not be inserted into the buffer. + + \note Newline translation(e.g., converting \r to \n) is performed + only when the device is opened for reading with QIODevice::Text + flag. Note that on sequential devices, data may not be immediately available, which may result in a partial line being returned. By calling the diff --git a/src/corelib/io/qiodevice.h b/src/corelib/io/qiodevice.h index 6bf7149e9af..263214ff012 100644 --- a/src/corelib/io/qiodevice.h +++ b/src/corelib/io/qiodevice.h @@ -1,5 +1,6 @@ // Copyright (C) 2020 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:header-decls-only #ifndef QIODEVICE_H #define QIODEVICE_H diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h index 151548fb04e..6a1a91e1dea 100644 --- a/src/corelib/io/qiodevice_p.h +++ b/src/corelib/io/qiodevice_p.h @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:critical reason:network-protocol #ifndef QIODEVICE_P_H #define QIODEVICE_P_H diff --git a/src/corelib/io/qstorageinfo.cpp b/src/corelib/io/qstorageinfo.cpp index f3e4dc52b9b..aa7c67e8596 100644 --- a/src/corelib/io/qstorageinfo.cpp +++ b/src/corelib/io/qstorageinfo.cpp @@ -1,6 +1,7 @@ // Copyright (C) 2022 The Qt Company Ltd. // Copyright (C) 2015 Ivan Komissarov <[email protected]> // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qstorageinfo.h" #include "qstorageinfo_p.h" diff --git a/src/corelib/io/qstorageinfo.h b/src/corelib/io/qstorageinfo.h index 48aed19e576..846cfaf4f41 100644 --- a/src/corelib/io/qstorageinfo.h +++ b/src/corelib/io/qstorageinfo.h @@ -1,5 +1,6 @@ // Copyright (C) 2014 Ivan Komissarov <[email protected]> // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QSTORAGEINFO_H #define QSTORAGEINFO_H diff --git a/src/corelib/io/qstorageinfo_linux.cpp b/src/corelib/io/qstorageinfo_linux.cpp index 00331a57127..f706650c637 100644 --- a/src/corelib/io/qstorageinfo_linux.cpp +++ b/src/corelib/io/qstorageinfo_linux.cpp @@ -3,6 +3,7 @@ // Copyright (C) 2016 Intel Corporation. // Copyright (C) 2023 Ahmad Samir <[email protected]> // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qstorageinfo_linux_p.h" diff --git a/src/corelib/io/qstorageinfo_linux_p.h b/src/corelib/io/qstorageinfo_linux_p.h index 8f92b9e9783..26a60dcbc13 100644 --- a/src/corelib/io/qstorageinfo_linux_p.h +++ b/src/corelib/io/qstorageinfo_linux_p.h @@ -3,6 +3,7 @@ // Copyright (C) 2016 Intel Corporation. // Copyright (C) 2023 Ahmad Samir <[email protected]> // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QSTORAGEINFO_LINUX_P_H #define QSTORAGEINFO_LINUX_P_H diff --git a/src/corelib/io/qstorageinfo_mac.cpp b/src/corelib/io/qstorageinfo_mac.cpp index c6c0f501dab..acfa21d8146 100644 --- a/src/corelib/io/qstorageinfo_mac.cpp +++ b/src/corelib/io/qstorageinfo_mac.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2014 Ivan Komissarov <[email protected]> // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qstorageinfo_p.h" diff --git a/src/corelib/io/qstorageinfo_p.h b/src/corelib/io/qstorageinfo_p.h index a917763fe36..0e3f81151e7 100644 --- a/src/corelib/io/qstorageinfo_p.h +++ b/src/corelib/io/qstorageinfo_p.h @@ -1,5 +1,6 @@ // Copyright (C) 2014 Ivan Komissarov <[email protected]> // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QSTORAGEINFO_P_H #define QSTORAGEINFO_P_H diff --git a/src/corelib/io/qstorageinfo_stub.cpp b/src/corelib/io/qstorageinfo_stub.cpp index f2f7d2eb656..805b66b893c 100644 --- a/src/corelib/io/qstorageinfo_stub.cpp +++ b/src/corelib/io/qstorageinfo_stub.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2023 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qstorageinfo_p.h" diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 40580e3be17..34ba7b9682b 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -2,6 +2,7 @@ // Copyright (C) 2014 Ivan Komissarov <[email protected]> // Copyright (C) 2016 Intel Corporation. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qstorageinfo_p.h" diff --git a/src/corelib/io/qstorageinfo_win.cpp b/src/corelib/io/qstorageinfo_win.cpp index 3582612508c..cbaf01848e2 100644 --- a/src/corelib/io/qstorageinfo_win.cpp +++ b/src/corelib/io/qstorageinfo_win.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2014 Ivan Komissarov <[email protected]> // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qstorageinfo_p.h" diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index c1f01267949..73e25c85ddf 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -1,6 +1,7 @@ // Copyright (C) 2016 The Qt Company Ltd. // Copyright (C) 2017 Intel Corporation. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:critical reason:data-parser #include "qtemporaryfile.h" diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 565ce04c6ce..a4fbf69da8b 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3660,17 +3660,29 @@ QList<QUrl> QUrl::fromStringList(const QStringList &urls, ParsingMode mode) */ size_t qHash(const QUrl &url, size_t seed) noexcept { + QtPrivate::QHashCombineWithSeed hasher(seed); + + // non-commutative, we must hash the port first if (!url.d) - return qHash(-1, seed); // the hash of an unset port (-1) - - return qHash(url.d->scheme) ^ - qHash(url.d->userName) ^ - qHash(url.d->password) ^ - qHash(url.d->host) ^ - qHash(url.d->port, seed) ^ - qHash(url.d->path) ^ - qHash(url.d->query) ^ - qHash(url.d->fragment); + return hasher(0, -1); + size_t state = hasher(0, url.d->port); + + if (url.d->hasScheme()) + state = hasher(state, url.d->scheme); + if (url.d->hasUserInfo()) { + // see presentSections(), appendUserName(), etc. + state = hasher(state, url.d->userName); + state = hasher(state, url.d->password); + } + if (url.d->hasHost() || url.d->isLocalFile()) // for XDG compatibility + state = hasher(state, url.d->host); + if (url.d->hasPath()) + state = hasher(state, url.d->path); + if (url.d->hasQuery()) + state = hasher(state, url.d->query); + if (url.d->hasFragment()) + state = hasher(state, url.d->fragment); + return state; } static QUrl adjustFtpPath(QUrl url) diff --git a/src/corelib/ipc/qsharedmemory.cpp b/src/corelib/ipc/qsharedmemory.cpp index a2f6e42579e..7345753ce5b 100644 --- a/src/corelib/ipc/qsharedmemory.cpp +++ b/src/corelib/ipc/qsharedmemory.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qsharedmemory.h" #include "qsharedmemory_p.h" diff --git a/src/corelib/ipc/qsharedmemory.h b/src/corelib/ipc/qsharedmemory.h index ab448b15c16..eec7d82160c 100644 --- a/src/corelib/ipc/qsharedmemory.h +++ b/src/corelib/ipc/qsharedmemory.h @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QSHAREDMEMORY_H #define QSHAREDMEMORY_H diff --git a/src/corelib/ipc/qsharedmemory_p.h b/src/corelib/ipc/qsharedmemory_p.h index 82cce8919ac..df0a6963598 100644 --- a/src/corelib/ipc/qsharedmemory_p.h +++ b/src/corelib/ipc/qsharedmemory_p.h @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QSHAREDMEMORY_P_H #define QSHAREDMEMORY_P_H diff --git a/src/corelib/ipc/qsharedmemory_posix.cpp b/src/corelib/ipc/qsharedmemory_posix.cpp index 582c6628e19..fa215c3b538 100644 --- a/src/corelib/ipc/qsharedmemory_posix.cpp +++ b/src/corelib/ipc/qsharedmemory_posix.cpp @@ -2,6 +2,7 @@ // Copyright (C) 2016 The Qt Company Ltd. // Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, [email protected], author Tobias Koenig <[email protected]> // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qsharedmemory.h" #include "qsharedmemory_p.h" diff --git a/src/corelib/ipc/qsharedmemory_systemv.cpp b/src/corelib/ipc/qsharedmemory_systemv.cpp index dc9de11091d..1777236bacc 100644 --- a/src/corelib/ipc/qsharedmemory_systemv.cpp +++ b/src/corelib/ipc/qsharedmemory_systemv.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qsharedmemory.h" #include "qsharedmemory_p.h" diff --git a/src/corelib/ipc/qsharedmemory_win.cpp b/src/corelib/ipc/qsharedmemory_win.cpp index 472f34f9a18..b46d0da0c8c 100644 --- a/src/corelib/ipc/qsharedmemory_win.cpp +++ b/src/corelib/ipc/qsharedmemory_win.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qsharedmemory.h" #include "qsharedmemory_p.h" diff --git a/src/corelib/ipc/qsystemsemaphore.cpp b/src/corelib/ipc/qsystemsemaphore.cpp index 24f4789f975..67e8c4bf757 100644 --- a/src/corelib/ipc/qsystemsemaphore.cpp +++ b/src/corelib/ipc/qsystemsemaphore.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qsystemsemaphore.h" #include "qsystemsemaphore_p.h" diff --git a/src/corelib/ipc/qsystemsemaphore.h b/src/corelib/ipc/qsystemsemaphore.h index 0981a7eecee..2d80955b85c 100644 --- a/src/corelib/ipc/qsystemsemaphore.h +++ b/src/corelib/ipc/qsystemsemaphore.h @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QSYSTEMSEMAPHORE_H #define QSYSTEMSEMAPHORE_H diff --git a/src/corelib/ipc/qsystemsemaphore_p.h b/src/corelib/ipc/qsystemsemaphore_p.h index 788c4fb7844..5b4630a20a8 100644 --- a/src/corelib/ipc/qsystemsemaphore_p.h +++ b/src/corelib/ipc/qsystemsemaphore_p.h @@ -1,6 +1,7 @@ // Copyright (C) 2016 The Qt Company Ltd. // Copyright (C) 2022 Intel Corporation. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QSYSTEMSEMAPHORE_P_H #define QSYSTEMSEMAPHORE_P_H diff --git a/src/corelib/ipc/qsystemsemaphore_posix.cpp b/src/corelib/ipc/qsystemsemaphore_posix.cpp index 7df9593513c..89a75048b4c 100644 --- a/src/corelib/ipc/qsystemsemaphore_posix.cpp +++ b/src/corelib/ipc/qsystemsemaphore_posix.cpp @@ -3,6 +3,7 @@ // Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, [email protected], author Tobias Koenig <[email protected]> // Copyright (C) 2022 Intel Corporation. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qsystemsemaphore.h" #include "qsystemsemaphore_p.h" diff --git a/src/corelib/ipc/qsystemsemaphore_systemv.cpp b/src/corelib/ipc/qsystemsemaphore_systemv.cpp index e5d231d1d42..54e62c615cf 100644 --- a/src/corelib/ipc/qsystemsemaphore_systemv.cpp +++ b/src/corelib/ipc/qsystemsemaphore_systemv.cpp @@ -1,6 +1,7 @@ // Copyright (C) 2016 The Qt Company Ltd. // Copyright (C) 2022 Intel Corporation. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qsystemsemaphore.h" #include "qsystemsemaphore_p.h" diff --git a/src/corelib/ipc/qsystemsemaphore_win.cpp b/src/corelib/ipc/qsystemsemaphore_win.cpp index f42fecf71f6..a157dec0dd2 100644 --- a/src/corelib/ipc/qsystemsemaphore_win.cpp +++ b/src/corelib/ipc/qsystemsemaphore_win.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qsystemsemaphore.h" #include "qsystemsemaphore_p.h" diff --git a/src/corelib/ipc/qtipccommon.cpp b/src/corelib/ipc/qtipccommon.cpp index 355f6fbc602..e56046497c5 100644 --- a/src/corelib/ipc/qtipccommon.cpp +++ b/src/corelib/ipc/qtipccommon.cpp @@ -1,5 +1,6 @@ // Copyright (C) 2022 Intel Corporation. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #include "qtipccommon.h" #include "qtipccommon_p.h" diff --git a/src/corelib/ipc/qtipccommon.h b/src/corelib/ipc/qtipccommon.h index 658a426914f..375100f9837 100644 --- a/src/corelib/ipc/qtipccommon.h +++ b/src/corelib/ipc/qtipccommon.h @@ -1,5 +1,6 @@ // Copyright (C) 2022 Intel Corporation. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QTIPCCOMMON_H #define QTIPCCOMMON_H diff --git a/src/corelib/ipc/qtipccommon_p.h b/src/corelib/ipc/qtipccommon_p.h index 8836cd64421..dc8619299fc 100644 --- a/src/corelib/ipc/qtipccommon_p.h +++ b/src/corelib/ipc/qtipccommon_p.h @@ -1,5 +1,6 @@ // Copyright (C) 2022 Intel Corporation. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +// Qt-Security score:significant reason:default #ifndef QTIPCCOMMON_P_H #define QTIPCCOMMON_P_H diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index a19e39685f1..3b92c5f48f2 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2189,7 +2189,7 @@ bool QCoreApplication::installTranslator(QTranslator *translationFile) QCoreApplicationPrivate *d = self->d_func(); { - QMutexLocker locker(&d->translateMutex); + QWriteLocker locker(&d->translateMutex); d->translators.prepend(translationFile); } @@ -2221,7 +2221,7 @@ bool QCoreApplication::removeTranslator(QTranslator *translationFile) if (!QCoreApplicationPrivate::checkInstance("removeTranslator")) return false; QCoreApplicationPrivate *d = self->d_func(); - QMutexLocker locker(&d->translateMutex); + QWriteLocker locker(&d->translateMutex); if (d->translators.removeAll(translationFile)) { #ifndef QT_NO_QOBJECT locker.unlock(); @@ -2306,7 +2306,7 @@ QString QCoreApplication::translate(const char *context, const char *sourceText, if (self) { QCoreApplicationPrivate *d = self->d_func(); - QMutexLocker locker(&d->translateMutex); + QReadLocker locker(&d->translateMutex); if (!d->translators.isEmpty()) { QList<QTranslator*>::ConstIterator it; QTranslator *translationFile; @@ -2332,23 +2332,13 @@ QString qtTrId(const char *id, int n) return QCoreApplication::translate(nullptr, id, nullptr, n); } -/*! - \internal - Returns a locked mutex handle if \a translator is registered in QCoreApplication, - and might be therefore queried for translations from other threads. - Returns an unlocked/dummy QMutexLocker otherwise. - */ -std::unique_lock<QMutex> QCoreApplicationPrivate::mutexLockerForTranslator(QTranslator *translator) +bool QCoreApplicationPrivate::isTranslatorInstalled(QTranslator *translator) { if (!QCoreApplication::self) - return std::unique_lock<QMutex>(); - + return false; QCoreApplicationPrivate *d = QCoreApplication::self->d_func(); - std::unique_lock<QMutex> locker(d->translateMutex); - if (!d->translators.contains(translator)) - locker.unlock(); - - return locker; + QReadLocker locker(&d->translateMutex); + return d->translators.contains(translator); } #else diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 4cb6254e98d..0027b1ad57f 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -30,12 +30,10 @@ #include "private/qcore_mac_p.h" #endif -#ifndef QT_NO_TRANSLATION -#include <mutex> -#endif - QT_BEGIN_NAMESPACE +typedef QList<QTranslator*> QTranslatorList; + class QAbstractEventDispatcher; #ifndef QT_NO_QOBJECT @@ -149,9 +147,9 @@ public: static bool is_app_closing; #endif #ifndef QT_NO_TRANSLATION - QList<QTranslator*> translators; - QMutex translateMutex; - static std::unique_lock<QMutex> mutexLockerForTranslator(QTranslator *translator); + QTranslatorList translators; + QReadWriteLock translateMutex; + static bool isTranslatorInstalled(QTranslator *translator); #endif static bool setuidAllowed; diff --git a/src/corelib/kernel/qmetaobjectbuilder.cpp b/src/corelib/kernel/qmetaobjectbuilder.cpp index 60bcdedba13..7fe36d37bce 100644 --- a/src/corelib/kernel/qmetaobjectbuilder.cpp +++ b/src/corelib/kernel/qmetaobjectbuilder.cpp @@ -2080,6 +2080,17 @@ bool QMetaPropertyBuilder::isBindable() const else return false; } +/*! + Returns \c true if the property is required. + The default is \c false. + */ +bool QMetaPropertyBuilder::isRequired() const +{ + if (auto d = d_func()) + return d->flag(Bindable); + else + return false; +} /*! Sets this property to readable if \a value is true. @@ -2236,6 +2247,15 @@ void QMetaPropertyBuilder::setBindable(bool value) } /*! + Sets the\c REQUIRED flag on this property to \a value + */ +void QMetaPropertyBuilder::setRequired(bool value) +{ + if (auto d = d_func()) + d->setFlag(Required, value); +} + +/*! Returns the revision of this property. \sa setRevision() diff --git a/src/corelib/kernel/qmetaobjectbuilder_p.h b/src/corelib/kernel/qmetaobjectbuilder_p.h index cf64e51c30c..36cd08d908c 100644 --- a/src/corelib/kernel/qmetaobjectbuilder_p.h +++ b/src/corelib/kernel/qmetaobjectbuilder_p.h @@ -216,6 +216,7 @@ public: bool isFinal() const; bool isAlias() const; bool isBindable() const; + bool isRequired() const; void setReadable(bool value); void setWritable(bool value); @@ -230,6 +231,7 @@ public: void setFinal(bool value); void setAlias(bool value); void setBindable(bool value); + void setRequired(bool value); int revision() const; void setRevision(int revision); diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 1242a40f185..45c947004f5 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -981,12 +981,6 @@ void QMetaType::unregisterMetaType(QMetaType type) than the QMetaType \a rhs, otherwise returns \c false. */ -/*! \internal */ -bool QMetaTypeModuleHelper::convert(const void *, int, void *, int) const -{ - return false; -} - static constexpr auto createStaticTypeToIdMap() { #define QT_ADD_STATIC_METATYPE(MetaTypeName, MetaTypeId, RealName) \ @@ -1049,8 +1043,8 @@ static bool qIntegerConversionFromFPHelper(From from, To *to) return true; } -// NOLINTNEXTLINE(cppcoreguidelines-virtual-class-destructor): this is not a base class -static constexpr struct : QMetaTypeModuleHelper +namespace { +struct QCoreVariantHelper : QMetaTypeModuleHelper { template<typename T, typename LiteralWrapper = std::conditional_t<std::is_same_v<T, QString>, QLatin1StringView, const char *>> @@ -1060,7 +1054,8 @@ static constexpr struct : QMetaTypeModuleHelper return !(str.isEmpty() || str == LiteralWrapper("0") || str == LiteralWrapper("false")); } - const QtPrivate::QMetaTypeInterface *interfaceForType(int type) const override { + static const QtPrivate::QMetaTypeInterface *interfaceForType(int type) + { switch (type) { QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(QT_METATYPE_CONVERT_ID_TO_TYPE) QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(QT_METATYPE_CONVERT_ID_TO_TYPE) @@ -1072,11 +1067,14 @@ static constexpr struct : QMetaTypeModuleHelper } } -#ifndef QT_BOOTSTRAPPED - bool convert(const void *from, int fromTypeId, void *to, int toTypeId) const override + static bool convert(const void *from, int fromTypeId, void *to, int toTypeId) { Q_ASSERT(fromTypeId != toTypeId); +#ifdef QT_BOOTSTRAPPED + Q_UNUSED(from); + Q_UNUSED(to); +#else // canConvert calls with two nullptr bool onlyCheck = (from == nullptr && to == nullptr); @@ -1747,26 +1745,28 @@ QT_WARNING_DISABLE_CLANG("-Wtautological-compare") QT_WARNING_POP } +#endif // !QT_BOOTSTRAPPED return false; } -#endif // !QT_BOOTSTRAPPED -} metatypeHelper = {}; +}; +} // unnamed namespace -Q_CONSTINIT Q_CORE_EXPORT const QMetaTypeModuleHelper *qMetaTypeGuiHelper = nullptr; -Q_CONSTINIT Q_CORE_EXPORT const QMetaTypeModuleHelper *qMetaTypeWidgetsHelper = nullptr; +Q_CONSTINIT Q_CORE_EXPORT QMetaTypeModuleHelper qMetaTypeGuiHelper = {}; +Q_CONSTINIT Q_CORE_EXPORT QMetaTypeModuleHelper qMetaTypeWidgetsHelper = {}; -static const QMetaTypeModuleHelper *qModuleHelperForType(int type) +#ifndef QT_BOOTSTRAPPED +static bool tryConvertBuiltinTypes(const void *from, int fromTypeId, void *to, int toTypeId) { + int type = qMax(fromTypeId, toTypeId); if (type <= QMetaType::LastCoreType) - return &metatypeHelper; + return QCoreVariantHelper::convert(from, fromTypeId, to, toTypeId); if (type >= QMetaType::FirstGuiType && type <= QMetaType::LastGuiType) - return qMetaTypeGuiHelper; + return qMetaTypeGuiHelper.convert(from, fromTypeId, to, toTypeId); else if (type >= QMetaType::FirstWidgetsType && type <= QMetaType::LastWidgetsType) - return qMetaTypeWidgetsHelper; - return nullptr; + return qMetaTypeWidgetsHelper.convert(from, fromTypeId, to, toTypeId); + return false; } -#ifndef QT_BOOTSTRAPPED template<typename T, typename Key> class QMetaTypeFunctionRegistry { @@ -2471,10 +2471,8 @@ bool QMetaType::convert(QMetaType fromType, const void *from, QMetaType toType, int fromTypeId = fromType.id(); int toTypeId = toType.id(); - if (auto moduleHelper = qModuleHelperForType(qMax(fromTypeId, toTypeId))) { - if (moduleHelper->convert(from, fromTypeId, to, toTypeId)) - return true; - } + if (tryConvertBuiltinTypes(from, fromTypeId, to, toTypeId)) + return true; const auto f = customTypesConversionRegistry()->function({fromTypeId, toTypeId}); if (f) return (*f)(from, to); @@ -2676,10 +2674,9 @@ bool QMetaType::canConvert(QMetaType fromType, QMetaType toType) if (fromTypeId == toTypeId) return true; - if (auto moduleHelper = qModuleHelperForType(qMax(fromTypeId, toTypeId))) { - if (moduleHelper->convert(nullptr, fromTypeId, nullptr, toTypeId)) - return true; - } + if (tryConvertBuiltinTypes(nullptr, fromTypeId, nullptr, toTypeId)) + return true; + const ConverterFunction * const f = customTypesConversionRegistry()->function(std::make_pair(fromTypeId, toTypeId)); if (f) @@ -2879,8 +2876,12 @@ void QMetaType::registerNormalizedTypedef(const NS(QByteArray) & normalizedTypeN static const QtPrivate::QMetaTypeInterface *interfaceForStaticType(int typeId) { Q_ASSERT(typeId < QMetaType::User); - if (auto moduleHelper = qModuleHelperForType(typeId)) - return moduleHelper->interfaceForType(typeId); + if (typeId <= QMetaType::LastCoreType) + return QCoreVariantHelper::interfaceForType(typeId); + if (typeId >= QMetaType::FirstGuiType && typeId <= QMetaType::LastGuiType) + return qMetaTypeGuiHelper.interfaceForType(typeId); + if (typeId >= QMetaType::FirstWidgetsType && typeId <= QMetaType::LastWidgetsType) + return qMetaTypeWidgetsHelper.interfaceForType(typeId); return nullptr; } @@ -2909,40 +2910,18 @@ bool QMetaType::isRegistered(int type) return interfaceForTypeNoWarning(type) != nullptr; } -namespace { -enum NormalizeTypeMode { - DontNormalizeType, - TryNormalizeType -}; -} -template <NormalizeTypeMode tryNormalizedType> static inline -const QtPrivate::QMetaTypeInterface *qMetaTypeTypeImpl(QByteArrayView name) +static const QtPrivate::QMetaTypeInterface *findMetaTypeByName(QByteArrayView name) { - if (name.isEmpty()) - return nullptr; - + Q_PRE(!name.isEmpty()); int type = qMetaTypeStaticType(name); if (type != QMetaType::UnknownType) { return interfaceForStaticType(type); #ifndef QT_BOOTSTRAPPED - } else { - QReadLocker locker(&customTypeRegistry()->lock); + } else if (customTypeRegistry.exists()) { + QReadLocker locker(&customTypeRegistry->lock); auto it = customTypeRegistry->aliases.constFind(name); if (it != customTypeRegistry->aliases.constEnd()) return it.value().data(); - -#ifndef QT_NO_QOBJECT - if (tryNormalizedType) { - const char *typeName = name.constData(); - const NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName); - type = qMetaTypeStaticType(normalizedTypeName); - if (type == QMetaType::UnknownType) { - return customTypeRegistry->aliases.value(normalizedTypeName).data(); - } else { - return interfaceForStaticType(type); - } - } -#endif #endif } return nullptr; @@ -2969,7 +2948,9 @@ const QtPrivate::QMetaTypeInterface *qMetaTypeTypeImpl(QByteArrayView name) */ int qMetaTypeTypeInternal(QByteArrayView name) { - const QtPrivate::QMetaTypeInterface *iface = qMetaTypeTypeImpl<DontNormalizeType>(name); + const QtPrivate::QMetaTypeInterface *iface = nullptr; + if (!name.isEmpty()) + iface = findMetaTypeByName(name); return iface ? iface->typeId.loadRelaxed() : QMetaType::UnknownType; } @@ -3138,7 +3119,20 @@ QMetaType QMetaType::underlyingType() const */ QMetaType QMetaType::fromName(QByteArrayView typeName) { - return QMetaType(qMetaTypeTypeImpl<TryNormalizeType>(typeName)); + if (typeName.isEmpty()) + return QMetaType(); + + const QtPrivate::QMetaTypeInterface *iface = findMetaTypeByName(typeName); + if (iface) + return QMetaType(iface); + +#if !defined(QT_NO_QOBJECT) + const NS(QByteArray) normalizedTypeName = QMetaObject::normalizedType(typeName.constData()); + if (normalizedTypeName != typeName) + iface = findMetaTypeByName(normalizedTypeName); +#endif + + return QMetaType(iface); } /*! diff --git a/src/corelib/kernel/qmetatype_p.h b/src/corelib/kernel/qmetatype_p.h index c05bce5fc8f..b39e1de0be2 100644 --- a/src/corelib/kernel/qmetatype_p.h +++ b/src/corelib/kernel/qmetatype_p.h @@ -40,25 +40,29 @@ QT_BEGIN_NAMESPACE assign_and_return \ } -class Q_CORE_EXPORT QMetaTypeModuleHelper +struct QMetaTypeModuleHelper { - Q_DISABLE_COPY_MOVE(QMetaTypeModuleHelper) -protected: - QMetaTypeModuleHelper() = default; - ~QMetaTypeModuleHelper() = default; -public: - Q_WEAK_OVERLOAD // prevent it from entering the ABI and rendering constexpr useless static constexpr auto makePair(int from, int to) -> quint64 { return (quint64(from) << 32) + quint64(to); } - virtual const QtPrivate::QMetaTypeInterface *interfaceForType(int) const = 0; - virtual bool convert(const void *, int, void *, int) const; + static const QtPrivate::QMetaTypeInterface *interfaceForType_dummy(int) + { + return nullptr; + } + + static bool convert_dummy(const void *, int, void *, int) + { + return false; + } + + decltype(&interfaceForType_dummy) interfaceForType = &interfaceForType_dummy; + decltype(&convert_dummy) convert = &convert_dummy; }; -extern Q_CORE_EXPORT const QMetaTypeModuleHelper *qMetaTypeGuiHelper; -extern Q_CORE_EXPORT const QMetaTypeModuleHelper *qMetaTypeWidgetsHelper; +extern Q_CORE_EXPORT QMetaTypeModuleHelper qMetaTypeGuiHelper; +extern Q_CORE_EXPORT QMetaTypeModuleHelper qMetaTypeWidgetsHelper; namespace QtMetaTypePrivate { template<typename T> diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp index 384253265be..7368af2df6e 100644 --- a/src/corelib/kernel/qproperty.cpp +++ b/src/corelib/kernel/qproperty.cpp @@ -1385,6 +1385,7 @@ QString QPropertyBindingError::description() const /*! \fn template <typename T> template <typename Functor> QPropertyBinding<T> QProperty<T>::setBinding(Functor f) \overload + \since 6.0 Associates the value of this property with the provided functor \a f and returns the previously associated binding. The property's value is set to the @@ -1442,6 +1443,7 @@ QString QPropertyBindingError::description() const /*! \fn template <typename T> template <typename Functor> QPropertyChangeHandler<T, Functor> QProperty<T>::subscribe(Functor f) + \since 6.0 Subscribes the given functor \a f as a callback that is called immediately and whenever the value of the property changes in the future. On each value @@ -1459,6 +1461,7 @@ QString QPropertyBindingError::description() const /*! \fn template <typename T> template <typename Functor> QPropertyNotifier QProperty<T>::addNotifier(Functor f) + \since 6.2 Subscribes the given functor \a f as a callback that is called whenever the value of the property changes. @@ -1948,6 +1951,7 @@ QString QPropertyBindingError::description() const \brief The QPropertyNotifier class controls the lifecycle of change callback installed on a QProperty. \ingroup tools + \since 6.2 QPropertyNotifier is created when registering a callback on a QProperty to listen to changes to the property's value, using QProperty::addNotifier. As diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 47483dc6470..8e655ae9cd6 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -463,12 +463,6 @@ bool QTranslator::load(const QString & filename, const QString & directory, const QString & suffix) { Q_D(QTranslator); - - std::unique_lock locker = QCoreApplicationPrivate::mutexLockerForTranslator(this); - if (locker.owns_lock()) - QCoreApplication::postEvent(QCoreApplication::instance(), - new QEvent(QEvent::LanguageChange)); - d->clear(); QString prefix; @@ -744,12 +738,6 @@ bool QTranslator::load(const QLocale & locale, const QString & suffix) { Q_D(QTranslator); - - std::unique_lock locker = QCoreApplicationPrivate::mutexLockerForTranslator(this); - if (locker.owns_lock()) - QCoreApplication::postEvent(QCoreApplication::instance(), - new QEvent(QEvent::LanguageChange)); - d->clear(); return d->load_translation(locale, filename, prefix, directory, suffix); } @@ -769,12 +757,6 @@ bool QTranslator::load(const QLocale & locale, bool QTranslator::load(const uchar *data, int len, const QString &directory) { Q_D(QTranslator); - - std::unique_lock locker = QCoreApplicationPrivate::mutexLockerForTranslator(this); - if (locker.owns_lock()) - QCoreApplication::postEvent(QCoreApplication::instance(), - new QEvent(QEvent::LanguageChange)); - d->clear(); if (!data || len < MagicLength || memcmp(data, magic, MagicLength)) @@ -1048,6 +1030,7 @@ searchDependencies: void QTranslatorPrivate::clear() { + Q_Q(QTranslator); if (unmapPointer && unmapLength) { #if defined(QT_USE_MMAP) if (used_mmap) { @@ -1075,9 +1058,15 @@ void QTranslatorPrivate::clear() language.clear(); filePath.clear(); + + if (QCoreApplicationPrivate::isTranslatorInstalled(q)) + QCoreApplication::postEvent(QCoreApplication::instance(), + new QEvent(QEvent::LanguageChange)); } /*! + \threadsafe + Returns the translation for the key (\a context, \a sourceText, \a disambiguation). If none is found, also tries (\a context, \a sourceText, ""). If that still fails, returns a null string. diff --git a/src/corelib/serialization/qcborarray.cpp b/src/corelib/serialization/qcborarray.cpp index e00b7a4571f..9a566b999b4 100644 --- a/src/corelib/serialization/qcborarray.cpp +++ b/src/corelib/serialization/qcborarray.cpp @@ -98,6 +98,17 @@ QCborArray::QCborArray(const QCborArray &other) noexcept } /*! + \fn QCborArray::QCborArray(QCborArray &&other) + \since 6.10 + + Move-constructor. + + The moved-from object \a other is placed in the default-constructed state. + + \sa QCborArray::QCborArray() +*/ + +/*! \fn QCborArray::QCborArray(std::initializer_list<QCborValue> args) Initializes this QCborArray from the C++ brace-enclosed list found in \a @@ -126,6 +137,15 @@ QCborArray &QCborArray::operator=(const QCborArray &other) noexcept } /*! + \fn QCborArray &QCborArray::operator=(QCborArray &&other) + \since 6.10 + + Move-assignment operator. + + The moved-from object \a other is placed in a valid, but unspecified state. +*/ + +/*! \fn void QCborArray::swap(QCborArray &other) \memberswap{array} */ diff --git a/src/corelib/serialization/qcborarray.h b/src/corelib/serialization/qcborarray.h index dd24e5604c0..208d5bcc9a1 100644 --- a/src/corelib/serialization/qcborarray.h +++ b/src/corelib/serialization/qcborarray.h @@ -204,7 +204,9 @@ public: QCborArray() noexcept; QCborArray(const QCborArray &other) noexcept; + QCborArray(QCborArray &&other) noexcept = default; QCborArray &operator=(const QCborArray &other) noexcept; + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QCborArray) QCborArray(std::initializer_list<QCborValue> args) : QCborArray() { diff --git a/src/corelib/serialization/qcborcommon.h b/src/corelib/serialization/qcborcommon.h index b9f7a66ae2f..5183a90937f 100644 --- a/src/corelib/serialization/qcborcommon.h +++ b/src/corelib/serialization/qcborcommon.h @@ -7,6 +7,7 @@ #include <QtCore/qobjectdefs.h> #include <QtCore/qmetatype.h> +#include <QtCore/qshareddata.h> #if 0 #pragma qt_class(QtCborCommon) @@ -22,6 +23,9 @@ QT_BEGIN_NAMESPACE class QDebug; +class QCborContainerPrivate; +QT_DECLARE_QESDP_SPECIALIZATION_DTOR(QCborContainerPrivate) // defined in qcborvalue.cpp + enum class QCborSimpleType : quint8 { False = 20, True = 21, diff --git a/src/corelib/serialization/qcbormap.cpp b/src/corelib/serialization/qcbormap.cpp index 6166775c8ce..e6075dcfc36 100644 --- a/src/corelib/serialization/qcbormap.cpp +++ b/src/corelib/serialization/qcbormap.cpp @@ -276,6 +276,17 @@ QCborMap::QCborMap(const QCborMap &other) noexcept } /*! + \fn QCborMap::QCborMap(QCborMap &&other) + \since 6.10 + + Move-constructor. + + The moved-from object \a other is placed in the default-constructed state. + + \sa QCborMap::QCborMap() +*/ + +/*! \fn QCborMap::QCborMap(std::initializer_list<value_type> args) Constructs a QCborMap with items from a brace-initialization list found in @@ -309,6 +320,15 @@ QCborMap &QCborMap::operator=(const QCborMap &other) noexcept } /*! + \fn QCborMap &QCborMap::operator=(QCborMap &&other) + \since 6.10 + + Move-assignment operator. + + The moved-from object \a other is placed in a valid, but unspecified state. +*/ + +/*! \fn void QCborMap::swap(QCborMap &other) \memberswap{map} */ diff --git a/src/corelib/serialization/qcbormap.h b/src/corelib/serialization/qcbormap.h index 039c436c76b..e2945621451 100644 --- a/src/corelib/serialization/qcbormap.h +++ b/src/corelib/serialization/qcbormap.h @@ -239,7 +239,9 @@ public: QCborMap() noexcept; QCborMap(const QCborMap &other) noexcept; + QCborMap(QCborMap &&other) noexcept = default; QCborMap &operator=(const QCborMap &other) noexcept; + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QCborMap) QCborMap(std::initializer_list<value_type> args) : QCborMap() { diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp index fabed2f06e1..5b7ec705079 100644 --- a/src/corelib/serialization/qcborvalue.cpp +++ b/src/corelib/serialization/qcborvalue.cpp @@ -28,6 +28,8 @@ QT_BEGIN_NAMESPACE +QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QCborContainerPrivate) + // Worst case memory allocation for a corrupt stream: 256 MB for 32-bit, 1 GB for 64-bit static constexpr quint64 MaxAcceptableMemoryUse = (sizeof(void*) == 4 ? 256 : 1024) * 1024 * 1024; diff --git a/src/corelib/thread/qatomicwait.cpp b/src/corelib/thread/qatomicwait.cpp index 3d70333ca7b..25ca771643b 100644 --- a/src/corelib/thread/qatomicwait.cpp +++ b/src/corelib/thread/qatomicwait.cpp @@ -4,6 +4,7 @@ #include "qatomicwait_p.h" #include <qendian.h> +#include "qfutex_p.h" #include "qwaitcondition_p.h" #include <array> @@ -96,8 +97,21 @@ struct QAtomicWaitLocks }; } // unnamed namespace +static inline void checkFutexUse() +{ +#if !defined(QATOMICWAIT_USE_FALLBACK) + if (QtFutex::futexAvailable()) { + // This will disable the code and data on systems where futexes are + // always available (currently: FreeBSD, Linux, Windows). + qFatal("Implementation should have used futex!"); + } +#endif +} + static QAtomicWaitLocks &atomicLocks() noexcept { + checkFutexUse(); + static QAtomicWaitLocks global {}; return global; } diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 42011993243..43b16cd0f4f 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -405,13 +405,16 @@ static int fromOffsetString(QStringView offsetString, bool *valid) noexcept \section2 Range of Valid Dates - Dates are stored internally as a Julian Day number, an integer count of - every day in a contiguous range, with 24 November 4714 BCE in the Gregorian - calendar being Julian Day 0 (1 January 4713 BCE in the Julian calendar). - As well as being an efficient and accurate way of storing an absolute date, - it is suitable for converting a date into other calendar systems such as - Hebrew, Islamic or Chinese. The Julian Day number can be obtained using - QDate::toJulianDay() and can be set using QDate::fromJulianDay(). + Dates are stored internally as a modified Julian Day number, an integer + count of every day in a contiguous range, with 24 November 4714 BCE in the + Gregorian calendar being Julian Day 0 (1 January 4713 BCE in the Julian + calendar). As well as being an efficient and accurate way of storing an + absolute date, it is suitable for converting a date into other calendar + systems such as Hebrew, Islamic or Chinese. For the purposes of QDate, + Julian Days are delimited at midnight and, for those of QDateTime, in the + zone used by the datetime. (This departs from the formal definition, which + delimits Julian Days at UTC noon.) The Julian Day number can be obtained + using QDate::toJulianDay() and can be set using QDate::fromJulianDay(). The range of Julian Day numbers that QDate can represent is, for technical reasons, limited to between -784350574879 and 784354017364, which means from diff --git a/src/corelib/tools/qarraydata.cpp b/src/corelib/tools/qarraydata.cpp index 37d6dea35f9..54bd971cb36 100644 --- a/src/corelib/tools/qarraydata.cpp +++ b/src/corelib/tools/qarraydata.cpp @@ -181,13 +181,12 @@ allocateHelper(qsizetype objectSize, qsizetype alignment, qsizetype capacity, return {}; void *data = nullptr; - QArrayData *header = static_cast<QArrayData *>(::malloc(size_t(allocSize))); - if (Q_LIKELY(header)) { - header->ref_.storeRelaxed(1); - header->flags = {}; + void *mem = ::malloc(size_t(allocSize)); + QArrayData *header = nullptr; + if (Q_LIKELY(mem)) { + header = new (mem) QArrayData{1, {}, capacity}; // find where offset should point to so that data() is aligned to alignment bytes data = QTypedArrayData<void>::dataStart(header, alignment); - header->alloc = capacity; } return { data, header }; @@ -245,8 +244,12 @@ QArrayData::reallocateUnaligned(QArrayData *data, void *dataPointer, Q_ASSERT(offset > 0); Q_ASSERT(offset <= allocSize); // equals when all free space is at the beginning - QArrayData *header = static_cast<QArrayData *>(::realloc(data, size_t(allocSize))); - if (header) { + const bool hadData = data; + void *mem = ::realloc(data, size_t(allocSize)); + QArrayData *header = static_cast<QArrayData *>(mem); + if (mem) { + if (!hadData) + header = new (mem) QArrayData{0, {}, {}}; header->alloc = capacity; dataPointer = reinterpret_cast<char *>(header) + offset; } else { diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h index 38d1091ac1f..71e183e646e 100644 --- a/src/corelib/tools/qarraydata.h +++ b/src/corelib/tools/qarraydata.h @@ -39,7 +39,7 @@ struct QArrayData }; Q_DECLARE_FLAGS(ArrayOptions, ArrayOption) - QBasicAtomicInt ref_; + QBasicAtomicInt m_ref; ArrayOptions flags; qsizetype alloc; @@ -56,19 +56,19 @@ struct QArrayData /// Returns true if sharing took place bool ref() noexcept { - ref_.ref(); + m_ref.ref(); return true; } /// Returns false if deallocation is necessary bool deref() noexcept { - return ref_.deref(); + return m_ref.deref(); } bool isShared() const noexcept { - return ref_.loadRelaxed() != 1; + return m_ref.loadRelaxed() != 1; } // Returns true if a detach is necessary before modifying the data @@ -76,7 +76,7 @@ struct QArrayData // detaching is necessary, you should be in a non-const function already bool needsDetach() noexcept { - return ref_.loadRelaxed() > 1; + return m_ref.loadRelaxed() > 1; } qsizetype detachCapacity(qsizetype newSize) const noexcept diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index c20abd12c23..419585b0260 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -82,7 +82,7 @@ public: void destroyAll() noexcept // Call from destructors, ONLY! { Q_ASSERT(this->d); - Q_ASSERT(this->d->ref_.loadRelaxed() == 0); + Q_ASSERT(this->d->m_ref.loadRelaxed() == 0); // As this is to be called only from destructor, it doesn't need to be // exception safe; size not updated. @@ -345,7 +345,7 @@ public: // As this is to be called only from destructor, it doesn't need to be // exception safe; size not updated. - Q_ASSERT(this->d->ref_.loadRelaxed() == 0); + Q_ASSERT(this->d->m_ref.loadRelaxed() == 0); std::destroy(this->begin(), this->end()); } diff --git a/src/corelib/tools/qatomicscopedvaluerollback.h b/src/corelib/tools/qatomicscopedvaluerollback.h index 8f653acba5e..929a2e2d466 100644 --- a/src/corelib/tools/qatomicscopedvaluerollback.h +++ b/src/corelib/tools/qatomicscopedvaluerollback.h @@ -11,6 +11,7 @@ #include <QtCore/qtconfigmacros.h> #include <atomic> +#include <type_traits> QT_BEGIN_NAMESPACE @@ -122,6 +123,33 @@ template <typename T> QAtomicScopedValueRollback(QBasicAtomicPointer<T> &, std::memory_order) -> QAtomicScopedValueRollback<T*>; +template <typename T, typename V, + std::enable_if_t<std::is_convertible_v<V, T>, bool> = true> +QAtomicScopedValueRollback(std::atomic<T>&, V) + -> QAtomicScopedValueRollback<T>; +template <typename T, typename V, + std::enable_if_t<std::is_convertible_v<V, T>, bool> = true> +QAtomicScopedValueRollback(std::atomic<T>&, V, std::memory_order) + -> QAtomicScopedValueRollback<T>; + +template <typename T, typename V, + std::enable_if_t<std::is_convertible_v<V, T>, bool> = true> +QAtomicScopedValueRollback(QBasicAtomicInteger<T>&, V) + -> QAtomicScopedValueRollback<T>; +template <typename T, typename V, + std::enable_if_t<std::is_convertible_v<V, T>, bool> = true> +QAtomicScopedValueRollback(QBasicAtomicInteger<T>&, V, std::memory_order) + -> QAtomicScopedValueRollback<T>; + +template <typename T, typename V, + std::enable_if_t<std::is_convertible_v<V, T*>, bool> = true> +QAtomicScopedValueRollback(QBasicAtomicPointer<T>&, V) + -> QAtomicScopedValueRollback<T*>; +template <typename T, typename V, + std::enable_if_t<std::is_convertible_v<V, T*>, bool> = true> +QAtomicScopedValueRollback(QBasicAtomicPointer<T>&, V, std::memory_order) + -> QAtomicScopedValueRollback<T*>; + QT_END_NAMESPACE #endif // QATOMICASCOPEDVALUEROLLBACK_H diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h index cc12fb9c8d0..ecefd1f55df 100644 --- a/src/corelib/tools/qfreelist_p.h +++ b/src/corelib/tools/qfreelist_p.h @@ -199,27 +199,27 @@ inline typename QFreeList<T, ConstantsType>::ReferenceType QFreeList<T, Constant template <typename T, typename ConstantsType> inline int QFreeList<T, ConstantsType>::next() { - int id, newid, at; - ElementType *v; + int newid; + int id = _next.loadAcquire(); do { - id = _next.loadAcquire(); - - at = id & ConstantsType::IndexMask; + int at = id & ConstantsType::IndexMask; const int block = blockfor(at); - v = _v[block].loadAcquire(); + ElementType *v = _v[block].loadAcquire(); if (!v) { - v = allocate((id & ConstantsType::IndexMask) - at, ConstantsType::Sizes[block]); - if (!_v[block].testAndSetRelease(nullptr, v)) { + ElementType* const alloced = allocate((id & ConstantsType::IndexMask) - at, + ConstantsType::Sizes[block]); + if (_v[block].testAndSetRelease(nullptr, alloced, v)) { + v = alloced; + } else { // race with another thread lost - delete[] v; - v = _v[block].loadAcquire(); + delete[] alloced; Q_ASSERT(v != nullptr); } } newid = v[at].next.loadRelaxed() | (id & ~ConstantsType::IndexMask); - } while (!_next.testAndSetRelease(id, newid)); + } while (!_next.testAndSetOrdered(id, newid, id)); // qDebug("QFreeList::next(): returning %d (_next now %d, serial %d)", // id & ConstantsType::IndexMask, // newid & ConstantsType::IndexMask, diff --git a/src/corelib/tools/qhashfunctions.h b/src/corelib/tools/qhashfunctions.h index cbe217db11e..3e44f5f3442 100644 --- a/src/corelib/tools/qhashfunctions.h +++ b/src/corelib/tools/qhashfunctions.h @@ -298,19 +298,32 @@ bool qHashEquals(const T1 &a, const T2 &b) } namespace QtPrivate { -template <typename Mixer> struct QHashCombiner : private Mixer +template <typename Mixer> struct QHashCombinerWithSeed : private Mixer { - using result_type = typename Mixer::result_type ; + using result_type = typename Mixer::result_type; + size_t seed; + constexpr QHashCombinerWithSeed(result_type s) noexcept : seed(s) {} + + template <typename T> + constexpr result_type operator()(result_type result, const T &t) const + noexcept(noexcept(qHash(t, seed))) + { + return Mixer::operator()(result, qHash(t, seed)); + } +}; #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) || defined(QT_BOOTSTRAPPED) - // Qt 6.x didn't use to pass the seed; bootstrap has no seed +// Earlier Qt 6.x versions of qHashMulti() failed to pass the seed as the seed +// argument of qHash(), so this class exists for compatibility with user and +// inline code that relies on the old behavior. For Qt 7, we'll replace with +// the above version, except for the bootstrapped tools (which have no seed). +template <typename Mixer> struct QHashCombiner : private Mixer +{ + using result_type = typename Mixer::result_type; + static constexpr size_t seed = 0; constexpr QHashCombiner(result_type) noexcept {} Q_DECL_DEPRECATED_X("pass the seed argument") constexpr QHashCombiner() noexcept {} -#else - size_t seed; - constexpr QHashCombiner(result_type s) : seed(s) noexcept {} -#endif template <typename T> constexpr result_type operator()(result_type result, const T &t) const @@ -319,6 +332,9 @@ template <typename Mixer> struct QHashCombiner : private Mixer return Mixer::operator()(result, qHash(t, seed)); } }; +#else +template <typename Mixer> using QHashCombiner = QHashCombinerWithSeed<Mixer>; +#endif struct QHashCombineMixer { @@ -330,6 +346,7 @@ struct QHashCombineMixer } }; using QHashCombine = QHashCombiner<QHashCombineMixer>; +using QHashCombineWithSeed = QHashCombinerWithSeed<QHashCombineMixer>; struct QHashCombineCommutativeMixer : std::plus<size_t> { @@ -341,6 +358,7 @@ struct QHashCombineCommutativeMixer : std::plus<size_t> typedef size_t result_type; }; using QHashCombineCommutative = QHashCombiner<QHashCombineCommutativeMixer>; +using QHashCombineCommutativeWithSeed = QHashCombinerWithSeed<QHashCombineCommutativeMixer>; template <typename... T> using QHashMultiReturnType = decltype( diff --git a/src/gui/compat/removed_api.cpp b/src/gui/compat/removed_api.cpp index 6a39d8b8615..33549a06504 100644 --- a/src/gui/compat/removed_api.cpp +++ b/src/gui/compat/removed_api.cpp @@ -88,3 +88,16 @@ void QWindowSystemInterface::handleContextMenuEvent(QWindow *window, bool mouseT // order sections alphabetically #endif // QT_GUI_REMOVED_SINCE(6, 8) + +#if QT_GUI_REMOVED_SINCE(6, 11) + +#include "qpainter.h" // inlined API + +#include "qquaternion.h" // inlined API + + +// #include "qotherheader.h" +// // implement removed functions from qotherheader.h +// order sections alphabetically + +#endif // QT_GUI_REMOVED_SINCE(6, 11) diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp index c6462dfed7b..6da0c4d387b 100644 --- a/src/gui/kernel/qguivariant.cpp +++ b/src/gui/kernel/qguivariant.cpp @@ -52,14 +52,13 @@ QT_BEGIN_NAMESPACE namespace { - -// NOLINTNEXTLINE(cppcoreguidelines-virtual-class-destructor): this is not a base class struct QVariantGuiHelper : QMetaTypeModuleHelper { #define QT_IMPL_METATYPEINTERFACE_GUI_TYPES(MetaTypeName, MetaTypeId, RealName) \ QT_METATYPE_INTERFACE_INIT(RealName), - const QtPrivate::QMetaTypeInterface *interfaceForType(int type) const override { + static const QtPrivate::QMetaTypeInterface *interfaceForType(int type) + { switch (type) { QT_FOR_EACH_STATIC_GUI_CLASS(QT_METATYPE_CONVERT_ID_TO_TYPE) default: return nullptr; @@ -67,7 +66,7 @@ struct QVariantGuiHelper : QMetaTypeModuleHelper } #undef QT_IMPL_METATYPEINTERFACE_GUI_TYPES - bool convert(const void *from, int fromTypeId, void *to, int toTypeId) const override + static bool convert(const void *from, int fromTypeId, void *to, int toTypeId) { Q_ASSERT(fromTypeId != toTypeId); @@ -133,14 +132,14 @@ struct QVariantGuiHelper : QMetaTypeModuleHelper return false; } }; - -static constexpr QVariantGuiHelper qVariantGuiHelper; - } // namespace used to hide QVariant handler void qRegisterGuiVariant() { - qMetaTypeGuiHelper = &qVariantGuiHelper; + qMetaTypeGuiHelper = QMetaTypeModuleHelper{ + &QVariantGuiHelper::interfaceForType, + &QVariantGuiHelper::convert, + }; } Q_CONSTRUCTOR_FUNCTION(qRegisterGuiVariant) diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp index b91215fdf4a..99061fb7163 100644 --- a/src/gui/math3d/qquaternion.cpp +++ b/src/gui/math3d/qquaternion.cpp @@ -557,7 +557,7 @@ QQuaternion QQuaternion::fromEulerAngles(float pitch, float yaw, float roll) \note If this quaternion is not normalized, the resulting rotation matrix will contain scaling information. - \sa fromRotationMatrix(), getAxes() + \sa fromRotationMatrix(), toAxes() */ QMatrix3x3 QQuaternion::toRotationMatrix() const { @@ -640,8 +640,63 @@ QQuaternion QQuaternion::fromRotationMatrix(const QMatrix3x3 &rot3x3) #ifndef QT_NO_VECTOR3D /*! + \since 6.11 + \class QQuaternion::Axes + \ingroup painting-3D + \inmodule QtGui + + A struct containing the three orthonormal axes that define a + \l{QQuaternion}{quaternion}. + + + \sa QQuaternion::toAxes(), QQuaternion::fromAxes(Axes) +*/ + +/*! + \variable QQuaternion::Axes::x + + The x orthonormal axis that, together with \l{y} and \l{z}, defines a + quaternion. +*/ + +/*! + \variable QQuaternion::Axes::y + + The y orthonormal axis that, together with \l{x} and \l{z}, defines a + quaternion. +*/ + +/*! + \variable QQuaternion::Axes::z + + The z orthonormal axis that, together with \l{x} and \l{y}, defines a + quaternion. +*/ + +/*! + \since 6.11 + + Returns the three orthonormal axes that define this quaternion. + + \sa QQuaternion::Axes, fromAxes(QQuaternion::Axes), toRotationMatrix() +*/ +auto QQuaternion::toAxes() const -> Axes +{ + const QMatrix3x3 rot3x3(toRotationMatrix()); + + return { {rot3x3(0, 0), rot3x3(1, 0), rot3x3(2, 0)}, + {rot3x3(0, 1), rot3x3(1, 1), rot3x3(2, 1)}, + {rot3x3(0, 2), rot3x3(1, 2), rot3x3(2, 2)} }; +} + + +/*! + \fn void QQuaternion::getAxes(QVector3D *xAxis, QVector3D *yAxis, QVector3D *zAxis) const \since 5.5 + \obsolete + Use toAxes() instead. + Returns the 3 orthonormal axes (\a xAxis, \a yAxis, \a zAxis) defining the quaternion. All of \a xAxis, \a yAxis, and \a zAxis must be valid, non-\nullptr pointers, @@ -649,16 +704,6 @@ QQuaternion QQuaternion::fromRotationMatrix(const QMatrix3x3 &rot3x3) \sa fromAxes(), toRotationMatrix() */ -void QQuaternion::getAxes(QVector3D *xAxis, QVector3D *yAxis, QVector3D *zAxis) const -{ - Q_ASSERT(xAxis && yAxis && zAxis); - - const QMatrix3x3 rot3x3(toRotationMatrix()); - - *xAxis = QVector3D(rot3x3(0, 0), rot3x3(1, 0), rot3x3(2, 0)); - *yAxis = QVector3D(rot3x3(0, 1), rot3x3(1, 1), rot3x3(2, 1)); - *zAxis = QVector3D(rot3x3(0, 2), rot3x3(1, 2), rot3x3(2, 2)); -} /*! \since 5.5 @@ -667,7 +712,7 @@ void QQuaternion::getAxes(QVector3D *xAxis, QVector3D *yAxis, QVector3D *zAxis) \note The axes are assumed to be orthonormal. - \sa getAxes(), fromRotationMatrix() + \sa toAxes(), fromRotationMatrix() */ QQuaternion QQuaternion::fromAxes(const QVector3D &xAxis, const QVector3D &yAxis, const QVector3D &zAxis) { @@ -686,6 +731,17 @@ QQuaternion QQuaternion::fromAxes(const QVector3D &xAxis, const QVector3D &yAxis } /*! + \since 6.11 + \overload + + \sa toAxes(), fromRotationMatrix() +*/ +QQuaternion QQuaternion::fromAxes(Axes axes) // clazy:exclude=function-args-by-ref +{ + return fromAxes(axes.x, axes.y, axes.z); +} + +/*! \since 5.5 Constructs the quaternion using specified forward direction \a direction diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h index 0ea844ae41f..ffc95a852ce 100644 --- a/src/gui/math3d/qquaternion.h +++ b/src/gui/math3d/qquaternion.h @@ -118,7 +118,14 @@ QT_WARNING_POP QT7_ONLY(Q_GUI_EXPORT) static QQuaternion fromRotationMatrix(const QMatrix3x3 &rot3x3); #ifndef QT_NO_VECTOR3D - QT7_ONLY(Q_GUI_EXPORT) void getAxes(QVector3D *xAxis, QVector3D *yAxis, QVector3D *zAxis) const; + struct Axes + { + QVector3D x, y, z; + }; + QT7_ONLY(Q_GUI_EXPORT) Axes toAxes() const; + QT7_ONLY(Q_GUI_EXPORT) static QQuaternion fromAxes(Axes axes); // clazy:exclude=function-args-by-ref + QT_GUI_INLINE_SINCE(6, 11) + void getAxes(QVector3D *xAxis, QVector3D *yAxis, QVector3D *zAxis) const; QT7_ONLY(Q_GUI_EXPORT) static QQuaternion fromAxes(const QVector3D &xAxis, const QVector3D &yAxis, const QVector3D &zAxis); @@ -330,6 +337,19 @@ QQuaternion QQuaternion::fromEulerAngles(const QVector3D &angles) return QQuaternion::fromEulerAngles(angles.x(), angles.y(), angles.z()); } +#if QT_GUI_INLINE_IMPL_SINCE(6, 11) +void QQuaternion::getAxes(QVector3D *xAxis, QVector3D *yAxis, QVector3D *zAxis) const +{ + Q_PRE(xAxis); + Q_PRE(yAxis); + Q_PRE(zAxis); + const Axes axes = toAxes(); + *xAxis = axes.x; + *yAxis = axes.y; + *zAxis = axes.z; +} +#endif // QT_GUI_INLINE_IMPL_SINCE(6, 11) + #endif // QT_NO_VECTOR3D constexpr void QQuaternion::setVector(float aX, float aY, float aZ) noexcept diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 5013e96f740..344bb8f1bef 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -41,6 +41,8 @@ #include <private/qrawfont_p.h> #include <private/qfont_p.h> +#include <QtCore/private/qtclasshelper_p.h> + QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; @@ -3652,6 +3654,8 @@ void QPainter::setPen(const QColor &color) } /*! + \fn void QPainter::setPen(const QPen &pen) + Sets the painter's pen to be the given \a pen. The \a pen defines how to draw lines and outlines, and it also @@ -3660,7 +3664,13 @@ void QPainter::setPen(const QColor &color) \sa pen(), {QPainter#Settings}{Settings} */ -void QPainter::setPen(const QPen &pen) +/*! + \fn void QPainter::setPen(QPen &&pen) + \since 6.11 + \overload +*/ + +void QPainter::doSetPen(const QPen &pen, QPen *rvalue) { #ifdef QT_DEBUG_DRAW @@ -3677,7 +3687,7 @@ void QPainter::setPen(const QPen &pen) if (d->state->pen == pen) return; - d->state->pen = pen; + q_choose_assign(d->state->pen, pen, rvalue); if (d->extended) { d->checkEmulation(); @@ -3733,6 +3743,8 @@ const QPen &QPainter::pen() const /*! + \fn void QPainter::setBrush(const QBrush &brush) + Sets the painter's brush to the given \a brush. The painter's brush defines how shapes are filled. @@ -3740,7 +3752,13 @@ const QPen &QPainter::pen() const \sa brush(), {QPainter#Settings}{Settings} */ -void QPainter::setBrush(const QBrush &brush) +/*! + \fn void QPainter::setBrush(QBrush &&brush) + \since 6.11 + \overload +*/ + +void QPainter::doSetBrush(const QBrush &brush, QBrush *rvalue) { #ifdef QT_DEBUG_DRAW if constexpr (qt_show_painter_debug_output) @@ -3756,13 +3774,13 @@ void QPainter::setBrush(const QBrush &brush) return; if (d->extended) { - d->state->brush = brush; + q_choose_assign(d->state->brush, brush, rvalue); d->checkEmulation(); d->extended->brushChanged(); return; } - d->state->brush = brush; + q_choose_assign(d->state->brush, brush, rvalue); d->state->dirtyFlags |= QPaintEngine::DirtyBrush; } diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index 3c09b632364..83bde3b8cad 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -150,11 +150,15 @@ public: QFontInfo fontInfo() const; void setPen(const QColor &color); + QT_GUI_INLINE_SINCE(6, 11) void setPen(const QPen &pen); + void setPen(QPen &&pen) { doSetPen(pen, &pen); } void setPen(Qt::PenStyle style); const QPen &pen() const; + QT_GUI_INLINE_SINCE(6, 11) void setBrush(const QBrush &brush); + void setBrush(QBrush &&brush) { doSetBrush(brush, &brush); } void setBrush(Qt::BrushStyle style); void setBrush(QColor color); void setBrush(Qt::GlobalColor color) { setBrush(QColor(color)); } @@ -419,6 +423,9 @@ public: private: Q_DISABLE_COPY(QPainter) + void doSetPen(const QPen &lvalue, QPen *rvalue); + void doSetBrush(const QBrush &lvalue, QBrush *rvalue); + std::unique_ptr<QPainterPrivate> d_ptr; friend class QWidget; @@ -700,6 +707,21 @@ inline void QPainter::fillRect(const QRectF &r, QGradient::Preset p) fillRect(r, QGradient(p)); } +#if QT_GUI_INLINE_IMPL_SINCE(6, 11) + +void QPainter::setPen(const QPen &p) +{ + doSetPen(p, nullptr); +} + +void QPainter::setBrush(const QBrush &b) +{ + doSetBrush(b, nullptr); +} + +#endif // QT_GUI_INLINE_IMPL_SINCE(6, 11) + + inline void QPainter::setBrushOrigin(int x, int y) { setBrushOrigin(QPoint(x, y)); diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 66f1cf2a985..148d40b8361 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -784,7 +784,7 @@ bool QTransform::operator==(const QTransform &o) const */ size_t qHash(const QTransform &key, size_t seed) noexcept { - QtPrivate::QHashCombine hash(seed); + QtPrivate::QHashCombineWithSeed hash(seed); seed = hash(seed, key.m11()); seed = hash(seed, key.m12()); seed = hash(seed, key.m21()); diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp index b9312f6b304..7a3d4974e53 100644 --- a/src/gui/rhi/qrhi.cpp +++ b/src/gui/rhi/qrhi.cpp @@ -6543,7 +6543,7 @@ bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBind size_t qHash(const QRhiShaderResourceBinding &b, size_t seed) noexcept { const QRhiShaderResourceBinding::Data *d = QRhiImplementation::shaderResourceBindingData(b); - QtPrivate::QHashCombine hash(seed); + QtPrivate::QHashCombineWithSeed hash(seed); seed = hash(seed, d->binding); seed = hash(seed, d->stage); seed = hash(seed, d->type); diff --git a/src/gui/rhi/qshader.cpp b/src/gui/rhi/qshader.cpp index 5e967c62e40..1234d01b6ec 100644 --- a/src/gui/rhi/qshader.cpp +++ b/src/gui/rhi/qshader.cpp @@ -812,7 +812,7 @@ bool operator==(const QShader &lhs, const QShader &rhs) noexcept size_t qHash(const QShader &s, size_t seed) noexcept { if (s.d) { - QtPrivate::QHashCombine hash(seed); + QtPrivate::QHashCombineWithSeed hash(seed); seed = hash(seed, s.stage()); if (!s.d->shaders.isEmpty()) { seed = hash(seed, s.d->shaders.firstKey()); diff --git a/src/gui/text/qfontdatabase_p.h b/src/gui/text/qfontdatabase_p.h index 4cd6996aab8..27fb34aecdd 100644 --- a/src/gui/text/qfontdatabase_p.h +++ b/src/gui/text/qfontdatabase_p.h @@ -51,7 +51,7 @@ inline bool operator!=(const QtFontFallbacksCacheKey &lhs, const QtFontFallbacks inline size_t qHash(const QtFontFallbacksCacheKey &key, size_t seed = 0) noexcept { - QtPrivate::QHashCombine hash(seed); + QtPrivate::QHashCombineWithSeed hash(seed); seed = hash(seed, key.family); seed = hash(seed, int(key.style)); seed = hash(seed, int(key.styleHint)); diff --git a/src/plugins/platforms/CMakeLists.txt b/src/plugins/platforms/CMakeLists.txt index f30c27c24be..498a0772bc9 100644 --- a/src/plugins/platforms/CMakeLists.txt +++ b/src/plugins/platforms/CMakeLists.txt @@ -4,10 +4,10 @@ if(ANDROID) add_subdirectory(android) endif() -if(NOT ANDROID AND NOT WASM) +if(NOT WASM) add_subdirectory(minimal) endif() -if(QT_FEATURE_freetype AND NOT ANDROID AND NOT WASM) +if(QT_FEATURE_freetype AND NOT WASM) add_subdirectory(offscreen) endif() if(QT_FEATURE_xcb) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 38b3bdadd35..3fe837a2c03 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -1219,6 +1219,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::FocusInEvent: // see QWindowsWindow::requestActivateWindow(). if (platformWindow->window()->flags() & Qt::WindowDoesNotAcceptFocus) return false; + [[fallthrough]]; case QtWindows::FocusOutEvent: handleFocusEvent(et, platformWindow); return true; diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index 3f40dea5eb9..82e978862f8 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -1662,128 +1662,123 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op } case CE_ItemViewItem: { if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(option)) { - if (qobject_cast<const QAbstractItemView *>(widget)) { - QRect checkRect = proxy()->subElementRect(SE_ItemViewItemCheckIndicator, vopt, widget); - QRect iconRect = proxy()->subElementRect(SE_ItemViewItemDecoration, vopt, widget); - QRect textRect = proxy()->subElementRect(SE_ItemViewItemText, vopt, widget); + QRect checkRect = proxy()->subElementRect(SE_ItemViewItemCheckIndicator, vopt, widget); + QRect iconRect = proxy()->subElementRect(SE_ItemViewItemDecoration, vopt, widget); + QRect textRect = proxy()->subElementRect(SE_ItemViewItemText, vopt, widget); - // draw the background - proxy()->drawPrimitive(PE_PanelItemViewItem, option, painter, widget); + // draw the background + proxy()->drawPrimitive(PE_PanelItemViewItem, option, painter, widget); - const QRect &rect = vopt->rect; - const bool isRtl = option->direction == Qt::RightToLeft; - bool onlyOne = vopt->viewItemPosition == QStyleOptionViewItem::OnlyOne || - vopt->viewItemPosition == QStyleOptionViewItem::Invalid; - bool isFirst = vopt->viewItemPosition == QStyleOptionViewItem::Beginning; - bool isLast = vopt->viewItemPosition == QStyleOptionViewItem::End; + const QRect &rect = vopt->rect; + const bool isRtl = option->direction == Qt::RightToLeft; + bool onlyOne = vopt->viewItemPosition == QStyleOptionViewItem::OnlyOne || + vopt->viewItemPosition == QStyleOptionViewItem::Invalid; + bool isFirst = vopt->viewItemPosition == QStyleOptionViewItem::Beginning; + bool isLast = vopt->viewItemPosition == QStyleOptionViewItem::End; - // the tree decoration already painted the left side of the rounded rect - if (vopt->features.testFlag(QStyleOptionViewItem::IsDecoratedRootColumn) && - vopt->showDecorationSelected) { - isFirst = false; - if (onlyOne) { - onlyOne = false; - isLast = true; - } + // the tree decoration already painted the left side of the rounded rect + if (vopt->features.testFlag(QStyleOptionViewItem::IsDecoratedRootColumn) && + vopt->showDecorationSelected) { + isFirst = false; + if (onlyOne) { + onlyOne = false; + isLast = true; } + } - if (isRtl) { - if (isFirst) { - isFirst = false; - isLast = true; - } else if (isLast) { - isFirst = true; - isLast = false; - } + if (isRtl) { + if (isFirst) { + isFirst = false; + isLast = true; + } else if (isLast) { + isFirst = true; + isLast = false; } - const bool highlightCurrent = vopt->state.testAnyFlags(State_Selected | State_MouseOver); - if (highlightCurrent) { - const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget); - if (highContrastTheme) - painter->setBrush(vopt->palette.highlight()); - else - painter->setBrush(view->alternatingRowColors() ? vopt->palette.highlight() : WINUI3Colors[colorSchemeIndex][subtleHighlightColor]); - QWidget *editorWidget = view ? view->indexWidget(view->currentIndex()) : nullptr; - if (editorWidget) { - QPalette pal = editorWidget->palette(); - QColor editorBgColor = vopt->backgroundBrush == Qt::NoBrush ? vopt->palette.color(widget->backgroundRole()) : vopt->backgroundBrush.color(); - editorBgColor.setAlpha(255); - pal.setColor(editorWidget->backgroundRole(), editorBgColor); - editorWidget->setPalette(pal); - } - } else { - painter->setBrush(vopt->backgroundBrush); + } + const bool highlightCurrent = vopt->state.testAnyFlags(State_Selected | State_MouseOver); + if (highlightCurrent) { + const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget); + if (highContrastTheme) + painter->setBrush(vopt->palette.highlight()); + else + painter->setBrush(view->alternatingRowColors() ? vopt->palette.highlight() : WINUI3Colors[colorSchemeIndex][subtleHighlightColor]); + QWidget *editorWidget = view ? view->indexWidget(view->currentIndex()) : nullptr; + if (editorWidget) { + QPalette pal = editorWidget->palette(); + QColor editorBgColor = vopt->backgroundBrush == Qt::NoBrush ? vopt->palette.color(widget->backgroundRole()) : vopt->backgroundBrush.color(); + editorBgColor.setAlpha(255); + pal.setColor(editorWidget->backgroundRole(), editorBgColor); + editorWidget->setPalette(pal); } - painter->setPen(Qt::NoPen); + } else { + painter->setBrush(vopt->backgroundBrush); + } + painter->setPen(Qt::NoPen); - if (onlyOne) { - painter->drawRoundedRect(rect.marginsRemoved(QMargins(2, 2, 2, 2)), - secondLevelRoundingRadius, secondLevelRoundingRadius); - } else if (isFirst) { - painter->save(); - painter->setClipRect(rect); - painter->drawRoundedRect(rect.marginsRemoved(QMargins(2, 2, -secondLevelRoundingRadius, 2)), - secondLevelRoundingRadius, secondLevelRoundingRadius); - painter->restore(); - } else if (isLast) { - painter->save(); - painter->setClipRect(rect); - painter->drawRoundedRect(rect.marginsRemoved(QMargins(-secondLevelRoundingRadius, 2, 2, 2)), - secondLevelRoundingRadius, secondLevelRoundingRadius); - painter->restore(); - } else { - painter->drawRect(rect.marginsRemoved(QMargins(0, 2, 0, 2))); - } + if (onlyOne) { + painter->drawRoundedRect(rect.marginsRemoved(QMargins(2, 2, 2, 2)), + secondLevelRoundingRadius, secondLevelRoundingRadius); + } else if (isFirst) { + painter->save(); + painter->setClipRect(rect); + painter->drawRoundedRect(rect.marginsRemoved(QMargins(2, 2, -secondLevelRoundingRadius, 2)), + secondLevelRoundingRadius, secondLevelRoundingRadius); + painter->restore(); + } else if (isLast) { + painter->save(); + painter->setClipRect(rect); + painter->drawRoundedRect(rect.marginsRemoved(QMargins(-secondLevelRoundingRadius, 2, 2, 2)), + secondLevelRoundingRadius, secondLevelRoundingRadius); + painter->restore(); + } else { + painter->drawRect(rect.marginsRemoved(QMargins(0, 2, 0, 2))); + } - // draw the check mark - if (vopt->features & QStyleOptionViewItem::HasCheckIndicator) { - QStyleOptionViewItem option(*vopt); - option.rect = checkRect; - option.state = option.state & ~QStyle::State_HasFocus; + // draw the check mark + if (vopt->features & QStyleOptionViewItem::HasCheckIndicator) { + QStyleOptionViewItem option(*vopt); + option.rect = checkRect; + option.state = option.state & ~QStyle::State_HasFocus; - switch (vopt->checkState) { - case Qt::Unchecked: - option.state |= QStyle::State_Off; - break; - case Qt::PartiallyChecked: - option.state |= QStyle::State_NoChange; - break; - case Qt::Checked: - option.state |= QStyle::State_On; - break; - } - proxy()->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck, &option, painter, widget); + switch (vopt->checkState) { + case Qt::Unchecked: + option.state |= QStyle::State_Off; + break; + case Qt::PartiallyChecked: + option.state |= QStyle::State_NoChange; + break; + case Qt::Checked: + option.state |= QStyle::State_On; + break; } + proxy()->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck, &option, painter, widget); + } - // draw the icon - QIcon::Mode mode = QIcon::Normal; - if (!(vopt->state & QStyle::State_Enabled)) - mode = QIcon::Disabled; - else if (vopt->state & QStyle::State_Selected) - mode = QIcon::Selected; - QIcon::State state = vopt->state & QStyle::State_Open ? QIcon::On : QIcon::Off; - vopt->icon.paint(painter, iconRect, vopt->decorationAlignment, mode, state); - - painter->setPen(highlightCurrent && highContrastTheme ? vopt->palette.base().color() - : vopt->palette.text().color()); - d->viewItemDrawText(painter, vopt, textRect); - - // paint a vertical marker for QListView - if (vopt->state & State_Selected) { - if (const QListView *lv = qobject_cast<const QListView *>(widget); - lv && lv->viewMode() != QListView::IconMode && !highContrastTheme) { - painter->setPen(vopt->palette.accent().color()); - const auto xPos = isRtl ? rect.right() - 1 : rect.left(); - const QLineF lines[2] = { - QLineF(xPos, rect.y() + 2, xPos, rect.y() + rect.height() - 2), - QLineF(xPos + 1, rect.y() + 2, xPos + 1, rect.y() + rect.height() - 2), - }; - painter->drawLines(lines, 2); - } + // draw the icon + QIcon::Mode mode = QIcon::Normal; + if (!(vopt->state & QStyle::State_Enabled)) + mode = QIcon::Disabled; + else if (vopt->state & QStyle::State_Selected) + mode = QIcon::Selected; + QIcon::State state = vopt->state & QStyle::State_Open ? QIcon::On : QIcon::Off; + vopt->icon.paint(painter, iconRect, vopt->decorationAlignment, mode, state); + + painter->setPen(highlightCurrent && highContrastTheme ? vopt->palette.base().color() + : vopt->palette.text().color()); + d->viewItemDrawText(painter, vopt, textRect); + + // paint a vertical marker for QListView + if (vopt->state & State_Selected) { + if (const QListView *lv = qobject_cast<const QListView *>(widget); + lv && lv->viewMode() != QListView::IconMode && !highContrastTheme) { + painter->setPen(vopt->palette.accent().color()); + const auto xPos = isRtl ? rect.right() - 1 : rect.left(); + const QLineF lines[2] = { + QLineF(xPos, rect.y() + 2, xPos, rect.y() + rect.height() - 2), + QLineF(xPos + 1, rect.y() + 2, xPos + 1, rect.y() + rect.height() - 2), + }; + painter->drawLines(lines, 2); } - } else { - QRect textRect = proxy()->subElementRect(SE_ItemViewItemText, vopt, widget); - d->viewItemDrawText(painter, vopt, textRect); } } break; diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp index d8e10343854..6f4611d9139 100644 --- a/src/sql/models/qsqlquerymodel.cpp +++ b/src/sql/models/qsqlquerymodel.cpp @@ -561,9 +561,9 @@ QSqlError QSqlQueryModel::lastError() const \sa lastError() */ -void QSqlQueryModel::setLastError(const QSqlError &error) +void QSqlQueryModel::setLastError(const QSqlError &error) const { - Q_D(QSqlQueryModel); + Q_D(const QSqlQueryModel); d->error = error; } diff --git a/src/sql/models/qsqlquerymodel.h b/src/sql/models/qsqlquerymodel.h index 72b9b053f03..24877118865 100644 --- a/src/sql/models/qsqlquerymodel.h +++ b/src/sql/models/qsqlquerymodel.h @@ -79,7 +79,7 @@ protected: virtual void queryChange(); virtual QModelIndex indexInQuery(const QModelIndex &item) const; - void setLastError(const QSqlError &error); + void setLastError(const QSqlError &error) const; QSqlQueryModel(QSqlQueryModelPrivate &dd, QObject *parent = nullptr); }; diff --git a/src/testlib/3rdparty/valgrind/qt_attribution.json b/src/testlib/3rdparty/valgrind/qt_attribution.json index 3146fd82c57..262bc8380b4 100644 --- a/src/testlib/3rdparty/valgrind/qt_attribution.json +++ b/src/testlib/3rdparty/valgrind/qt_attribution.json @@ -11,7 +11,7 @@ "Description": "An instrumentation framework for building dynamic analysis tools.", "Homepage": "http://valgrind.org/", - "Version": "3.24.0", + "Version": "3.25.1", "PURL": "pkg:generic/valgrind@$<VERSION>?download_url=https://valgrind.org/", "License": "BSD 4-clause \"Original\" or \"Old\" License", "LicenseId": "BSD-4-Clause", diff --git a/src/testlib/3rdparty/valgrind/valgrind_p.h b/src/testlib/3rdparty/valgrind/valgrind_p.h index 77ca3ad8692..ab49937ccd4 100644 --- a/src/testlib/3rdparty/valgrind/valgrind_p.h +++ b/src/testlib/3rdparty/valgrind/valgrind_p.h @@ -89,7 +89,7 @@ || (__VALGRIND_MAJOR__ == 3 && __VALGRIND_MINOR__ >= 6)) */ #define __VALGRIND_MAJOR__ 3 -#define __VALGRIND_MINOR__ 24 +#define __VALGRIND_MINOR__ 25 #include <stdarg.h> @@ -126,6 +126,7 @@ #undef PLAT_mips32_linux #undef PLAT_mips64_linux #undef PLAT_nanomips_linux +#undef PLAT_riscv64_linux #undef PLAT_x86_solaris #undef PLAT_amd64_solaris @@ -172,6 +173,8 @@ # define PLAT_mips32_linux 1 #elif defined(__linux__) && defined(__nanomips__) # define PLAT_nanomips_linux 1 +#elif defined(__linux__) && defined(__riscv) && (__riscv_xlen == 64) +# define PLAT_riscv64_linux 1 #elif defined(__sun) && defined(__i386__) # define PLAT_x86_solaris 1 #elif defined(__sun) && defined(__x86_64__) @@ -1129,6 +1132,87 @@ typedef } while (0) #endif + +/* ----------------------- riscv64-linux ------------------------ */ + +#if defined(PLAT_riscv64_linux) + +typedef + struct { + unsigned long int nraddr; /* where's the code? */ + } + OrigFn; + +#define __SPECIAL_INSTRUCTION_PREAMBLE \ + ".option push\n\t" \ + ".option norvc\n\t" \ + "srli zero, zero, 3\n\t" \ + "srli zero, zero, 13\n\t" \ + "srli zero, zero, 51\n\t" \ + "srli zero, zero, 61\n\t" + +#define __SPECIAL_INSTRUCTION_POSTAMBLE \ + ".option pop\n\t" \ + +#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \ + _zzq_default, _zzq_request, \ + _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \ + \ + __extension__ \ + ({volatile unsigned long int _zzq_args[6]; \ + volatile unsigned long int _zzq_result; \ + _zzq_args[0] = (unsigned long int)(_zzq_request); \ + _zzq_args[1] = (unsigned long int)(_zzq_arg1); \ + _zzq_args[2] = (unsigned long int)(_zzq_arg2); \ + _zzq_args[3] = (unsigned long int)(_zzq_arg3); \ + _zzq_args[4] = (unsigned long int)(_zzq_arg4); \ + _zzq_args[5] = (unsigned long int)(_zzq_arg5); \ + __asm__ volatile("mv a3, %1\n\t" /*default*/ \ + "mv a4, %2\n\t" /*ptr*/ \ + __SPECIAL_INSTRUCTION_PREAMBLE \ + /* a3 = client_request ( a4 ) */ \ + "or a0, a0, a0\n\t" \ + __SPECIAL_INSTRUCTION_POSTAMBLE \ + "mv %0, a3" /*result*/ \ + : "=r" (_zzq_result) \ + : "r" ((unsigned long int)(_zzq_default)), \ + "r" (&_zzq_args[0]) \ + : "memory", "a3", "a4"); \ + _zzq_result; \ + }) + +#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ + { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \ + unsigned long int __addr; \ + __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \ + /* a3 = guest_NRADDR */ \ + "or a1, a1, a1\n\t" \ + __SPECIAL_INSTRUCTION_POSTAMBLE \ + "mv %0, a3" \ + : "=r" (__addr) \ + : \ + : "memory", "a3" \ + ); \ + _zzq_orig->nraddr = __addr; \ + } + +#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_T0 \ + __SPECIAL_INSTRUCTION_PREAMBLE \ + /* branch-and-link-to-noredir t0 */ \ + "or a2, a2, a2\n\t" \ + __SPECIAL_INSTRUCTION_POSTAMBLE + +#define VALGRIND_VEX_INJECT_IR() \ + do { \ + __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \ + "or a3, a3, a3\n\t" \ + __SPECIAL_INSTRUCTION_POSTAMBLE \ + : : : "memory" \ + ); \ + } while (0) + +#endif /* PLAT_riscv64_linux */ + /* Insert assembly code for other platforms here... */ #endif /* NVALGRIND */ @@ -6606,6 +6690,456 @@ typedef #endif /* PLAT_mips64_linux */ +/* ----------------------- riscv64-linux ----------------------- */ + +#if defined(PLAT_riscv64_linux) + +/* These regs are trashed by the hidden call. */ +#define __CALLER_SAVED_REGS \ + "ra", \ + "t0", "t1", "t2", "t3", "t4", "t5", "t6", \ + "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", \ + "ft0", "ft1", "ft2", "ft3", "ft4", "ft5", "ft6", "ft7", \ + "ft8", "ft9", "ft10", "ft11", \ + "fa0", "fa1", "fa2", "fa3", "fa4", "fa5", "fa6", "fa7" + +/* s11 is callee-saved, so we can use it to save and restore sp around + the hidden call. */ +#define VALGRIND_ALIGN_STACK \ + "mv s11, sp\n\t" \ + "andi sp, sp, 0xfffffffffffffff0\n\t" +#define VALGRIND_RESTORE_STACK \ + "mv sp, s11\n\t" + +/* These CALL_FN_ macros assume that on riscv64-linux, + sizeof(unsigned long) == 8. */ + +#define CALL_FN_W_v(lval, orig) \ + do { \ + volatile OrigFn _orig = (orig); \ + volatile unsigned long _argvec[1]; \ + volatile unsigned long _res; \ + _argvec[0] = (unsigned long)_orig.nraddr; \ + __asm__ volatile( \ + VALGRIND_ALIGN_STACK \ + "ld t0, 0(%1) \n\t" /* target->t0 */ \ + VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_T0 \ + VALGRIND_RESTORE_STACK \ + "mv %0, a0\n" \ + : /*out*/ "=r" (_res) \ + : /*in*/ "0" (&_argvec[0]) \ + : /*trash*/ "memory", __CALLER_SAVED_REGS, "s11" \ + ); \ + lval = (__typeof__(lval)) _res; \ + } while (0) + +#define CALL_FN_W_W(lval, orig, arg1) \ + do { \ + volatile OrigFn _orig = (orig); \ + volatile unsigned long _argvec[2]; \ + volatile unsigned long _res; \ + _argvec[0] = (unsigned long)_orig.nraddr; \ + _argvec[1] = (unsigned long)(arg1); \ + __asm__ volatile( \ + VALGRIND_ALIGN_STACK \ + "ld a0, 8(%1) \n\t" \ + "ld t0, 0(%1) \n\t" /* target->t0 */ \ + VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_T0 \ + VALGRIND_RESTORE_STACK \ + "mv %0, a0\n" \ + : /*out*/ "=r" (_res) \ + : /*in*/ "0" (&_argvec[0]) \ + : /*trash*/ "memory", __CALLER_SAVED_REGS, "s11" \ + ); \ + lval = (__typeof__(lval)) _res; \ + } while (0) + +#define CALL_FN_W_WW(lval, orig, arg1,arg2) \ + do { \ + volatile OrigFn _orig = (orig); \ + volatile unsigned long _argvec[3]; \ + volatile unsigned long _res; \ + _argvec[0] = (unsigned long)_orig.nraddr; \ + _argvec[1] = (unsigned long)(arg1); \ + _argvec[2] = (unsigned long)(arg2); \ + __asm__ volatile( \ + VALGRIND_ALIGN_STACK \ + "ld a0, 8(%1) \n\t" \ + "ld a1, 16(%1) \n\t" \ + "ld t0, 0(%1) \n\t" /* target->t0 */ \ + VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_T0 \ + VALGRIND_RESTORE_STACK \ + "mv %0, a0\n" \ + : /*out*/ "=r" (_res) \ + : /*in*/ "0" (&_argvec[0]) \ + : /*trash*/ "memory", __CALLER_SAVED_REGS, "s11" \ + ); \ + lval = (__typeof__(lval)) _res; \ + } while (0) + +#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \ + do { \ + volatile OrigFn _orig = (orig); \ + volatile unsigned long _argvec[4]; \ + volatile unsigned long _res; \ + _argvec[0] = (unsigned long)_orig.nraddr; \ + _argvec[1] = (unsigned long)(arg1); \ + _argvec[2] = (unsigned long)(arg2); \ + _argvec[3] = (unsigned long)(arg3); \ + __asm__ volatile( \ + VALGRIND_ALIGN_STACK \ + "ld a0, 8(%1) \n\t" \ + "ld a1, 16(%1) \n\t" \ + "ld a2, 24(%1) \n\t" \ + "ld t0, 0(%1) \n\t" /* target->t0 */ \ + VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_T0 \ + VALGRIND_RESTORE_STACK \ + "mv %0, a0\n" \ + : /*out*/ "=r" (_res) \ + : /*in*/ "0" (&_argvec[0]) \ + : /*trash*/ "memory", __CALLER_SAVED_REGS, "s11" \ + ); \ + lval = (__typeof__(lval)) _res; \ + } while (0) + +#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \ + do { \ + volatile OrigFn _orig = (orig); \ + volatile unsigned long _argvec[5]; \ + volatile unsigned long _res; \ + _argvec[0] = (unsigned long)_orig.nraddr; \ + _argvec[1] = (unsigned long)(arg1); \ + _argvec[2] = (unsigned long)(arg2); \ + _argvec[3] = (unsigned long)(arg3); \ + _argvec[4] = (unsigned long)(arg4); \ + __asm__ volatile( \ + VALGRIND_ALIGN_STACK \ + "ld a0, 8(%1) \n\t" \ + "ld a1, 16(%1) \n\t" \ + "ld a2, 24(%1) \n\t" \ + "ld a3, 32(%1) \n\t" \ + "ld t0, 0(%1) \n\t" /* target->t0 */ \ + VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_T0 \ + VALGRIND_RESTORE_STACK \ + "mv %0, a0" \ + : /*out*/ "=r" (_res) \ + : /*in*/ "0" (&_argvec[0]) \ + : /*trash*/ "memory", __CALLER_SAVED_REGS, "s11" \ + ); \ + lval = (__typeof__(lval)) _res; \ + } while (0) + +#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \ + do { \ + volatile OrigFn _orig = (orig); \ + volatile unsigned long _argvec[6]; \ + volatile unsigned long _res; \ + _argvec[0] = (unsigned long)_orig.nraddr; \ + _argvec[1] = (unsigned long)(arg1); \ + _argvec[2] = (unsigned long)(arg2); \ + _argvec[3] = (unsigned long)(arg3); \ + _argvec[4] = (unsigned long)(arg4); \ + _argvec[5] = (unsigned long)(arg5); \ + __asm__ volatile( \ + VALGRIND_ALIGN_STACK \ + "ld a0, 8(%1) \n\t" \ + "ld a1, 16(%1) \n\t" \ + "ld a2, 24(%1) \n\t" \ + "ld a3, 32(%1) \n\t" \ + "ld a4, 40(%1) \n\t" \ + "ld t0, 0(%1) \n\t" /* target->t0 */ \ + VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_T0 \ + VALGRIND_RESTORE_STACK \ + "mv %0, a0" \ + : /*out*/ "=r" (_res) \ + : /*in*/ "0" (&_argvec[0]) \ + : /*trash*/ "memory", __CALLER_SAVED_REGS, "s11" \ + ); \ + lval = (__typeof__(lval)) _res; \ + } while (0) + +#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \ + do { \ + volatile OrigFn _orig = (orig); \ + volatile unsigned long _argvec[7]; \ + volatile unsigned long _res; \ + _argvec[0] = (unsigned long)_orig.nraddr; \ + _argvec[1] = (unsigned long)(arg1); \ + _argvec[2] = (unsigned long)(arg2); \ + _argvec[3] = (unsigned long)(arg3); \ + _argvec[4] = (unsigned long)(arg4); \ + _argvec[5] = (unsigned long)(arg5); \ + _argvec[6] = (unsigned long)(arg6); \ + __asm__ volatile( \ + VALGRIND_ALIGN_STACK \ + "ld a0, 8(%1) \n\t" \ + "ld a1, 16(%1) \n\t" \ + "ld a2, 24(%1) \n\t" \ + "ld a3, 32(%1) \n\t" \ + "ld a4, 40(%1) \n\t" \ + "ld a5, 48(%1) \n\t" \ + "ld t0, 0(%1) \n\t" /* target->t0 */ \ + VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_T0 \ + VALGRIND_RESTORE_STACK \ + "mv %0, a0" \ + : /*out*/ "=r" (_res) \ + : /*in*/ "0" (&_argvec[0]) \ + : /*trash*/ "memory", __CALLER_SAVED_REGS, "s11" \ + ); \ + lval = (__typeof__(lval)) _res; \ + } while (0) + +#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ + arg7) \ + do { \ + volatile OrigFn _orig = (orig); \ + volatile unsigned long _argvec[8]; \ + volatile unsigned long _res; \ + _argvec[0] = (unsigned long)_orig.nraddr; \ + _argvec[1] = (unsigned long)(arg1); \ + _argvec[2] = (unsigned long)(arg2); \ + _argvec[3] = (unsigned long)(arg3); \ + _argvec[4] = (unsigned long)(arg4); \ + _argvec[5] = (unsigned long)(arg5); \ + _argvec[6] = (unsigned long)(arg6); \ + _argvec[7] = (unsigned long)(arg7); \ + __asm__ volatile( \ + VALGRIND_ALIGN_STACK \ + "ld a0, 8(%1) \n\t" \ + "ld a1, 16(%1) \n\t" \ + "ld a2, 24(%1) \n\t" \ + "ld a3, 32(%1) \n\t" \ + "ld a4, 40(%1) \n\t" \ + "ld a5, 48(%1) \n\t" \ + "ld a6, 56(%1) \n\t" \ + "ld t0, 0(%1) \n\t" /* target->t0 */ \ + VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_T0 \ + VALGRIND_RESTORE_STACK \ + "mv %0, a0" \ + : /*out*/ "=r" (_res) \ + : /*in*/ "0" (&_argvec[0]) \ + : /*trash*/ "memory", __CALLER_SAVED_REGS, "s11" \ + ); \ + lval = (__typeof__(lval)) _res; \ + } while (0) + +#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ + arg7,arg8) \ + do { \ + volatile OrigFn _orig = (orig); \ + volatile unsigned long _argvec[9]; \ + volatile unsigned long _res; \ + _argvec[0] = (unsigned long)_orig.nraddr; \ + _argvec[1] = (unsigned long)(arg1); \ + _argvec[2] = (unsigned long)(arg2); \ + _argvec[3] = (unsigned long)(arg3); \ + _argvec[4] = (unsigned long)(arg4); \ + _argvec[5] = (unsigned long)(arg5); \ + _argvec[6] = (unsigned long)(arg6); \ + _argvec[7] = (unsigned long)(arg7); \ + _argvec[8] = (unsigned long)(arg8); \ + __asm__ volatile( \ + VALGRIND_ALIGN_STACK \ + "ld a0, 8(%1) \n\t" \ + "ld a1, 16(%1) \n\t" \ + "ld a2, 24(%1) \n\t" \ + "ld a3, 32(%1) \n\t" \ + "ld a4, 40(%1) \n\t" \ + "ld a5, 48(%1) \n\t" \ + "ld a6, 56(%1) \n\t" \ + "ld a7, 64(%1) \n\t" \ + "ld t0, 0(%1) \n\t" /* target->t0 */ \ + VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_T0 \ + VALGRIND_RESTORE_STACK \ + "mv %0, a0" \ + : /*out*/ "=r" (_res) \ + : /*in*/ "0" (&_argvec[0]) \ + : /*trash*/ "memory", __CALLER_SAVED_REGS, "s11" \ + ); \ + lval = (__typeof__(lval)) _res; \ + } while (0) + +#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ + arg7,arg8,arg9) \ + do { \ + volatile OrigFn _orig = (orig); \ + volatile unsigned long _argvec[10]; \ + volatile unsigned long _res; \ + _argvec[0] = (unsigned long)_orig.nraddr; \ + _argvec[1] = (unsigned long)(arg1); \ + _argvec[2] = (unsigned long)(arg2); \ + _argvec[3] = (unsigned long)(arg3); \ + _argvec[4] = (unsigned long)(arg4); \ + _argvec[5] = (unsigned long)(arg5); \ + _argvec[6] = (unsigned long)(arg6); \ + _argvec[7] = (unsigned long)(arg7); \ + _argvec[8] = (unsigned long)(arg8); \ + _argvec[9] = (unsigned long)(arg9); \ + __asm__ volatile( \ + VALGRIND_ALIGN_STACK \ + "addi sp, sp, -16 \n\t" \ + "ld a0, 8(%1) \n\t" \ + "ld a1, 16(%1) \n\t" \ + "ld a2, 24(%1) \n\t" \ + "ld a3, 32(%1) \n\t" \ + "ld a4, 40(%1) \n\t" \ + "ld a5, 48(%1) \n\t" \ + "ld a6, 56(%1) \n\t" \ + "ld a7, 64(%1) \n\t" \ + "ld t0, 72(%1) \n\t" \ + "sd t0, 0(sp) \n\t" \ + "ld t0, 0(%1) \n\t" /* target->t0 */ \ + VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_T0 \ + VALGRIND_RESTORE_STACK \ + "mv %0, a0" \ + : /*out*/ "=r" (_res) \ + : /*in*/ "0" (&_argvec[0]) \ + : /*trash*/ "memory", __CALLER_SAVED_REGS, "s11" \ + ); \ + lval = (__typeof__(lval)) _res; \ + } while (0) + +#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ + arg7,arg8,arg9,arg10) \ + do { \ + volatile OrigFn _orig = (orig); \ + volatile unsigned long _argvec[11]; \ + volatile unsigned long _res; \ + _argvec[0] = (unsigned long)_orig.nraddr; \ + _argvec[1] = (unsigned long)(arg1); \ + _argvec[2] = (unsigned long)(arg2); \ + _argvec[3] = (unsigned long)(arg3); \ + _argvec[4] = (unsigned long)(arg4); \ + _argvec[5] = (unsigned long)(arg5); \ + _argvec[6] = (unsigned long)(arg6); \ + _argvec[7] = (unsigned long)(arg7); \ + _argvec[8] = (unsigned long)(arg8); \ + _argvec[9] = (unsigned long)(arg9); \ + _argvec[10] = (unsigned long)(arg10); \ + __asm__ volatile( \ + VALGRIND_ALIGN_STACK \ + "addi sp, sp, -16 \n\t" \ + "ld a0, 8(%1) \n\t" \ + "ld a1, 16(%1) \n\t" \ + "ld a2, 24(%1) \n\t" \ + "ld a3, 32(%1) \n\t" \ + "ld a4, 40(%1) \n\t" \ + "ld a5, 48(%1) \n\t" \ + "ld a6, 56(%1) \n\t" \ + "ld a7, 64(%1) \n\t" \ + "ld t0, 72(%1) \n\t" \ + "sd t0, 0(sp) \n\t" \ + "ld t0, 80(%1) \n\t" \ + "sd t0, 8(sp) \n\t" \ + "ld t0, 0(%1) \n\t" /* target->t0 */ \ + VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_T0 \ + VALGRIND_RESTORE_STACK \ + "mv %0, a0" \ + : /*out*/ "=r" (_res) \ + : /*in*/ "0" (&_argvec[0]) \ + : /*trash*/ "memory", __CALLER_SAVED_REGS, "s11" \ + ); \ + lval = (__typeof__(lval)) _res; \ + } while (0) + +#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ + arg7,arg8,arg9,arg10,arg11) \ + do { \ + volatile OrigFn _orig = (orig); \ + volatile unsigned long _argvec[12]; \ + volatile unsigned long _res; \ + _argvec[0] = (unsigned long)_orig.nraddr; \ + _argvec[1] = (unsigned long)(arg1); \ + _argvec[2] = (unsigned long)(arg2); \ + _argvec[3] = (unsigned long)(arg3); \ + _argvec[4] = (unsigned long)(arg4); \ + _argvec[5] = (unsigned long)(arg5); \ + _argvec[6] = (unsigned long)(arg6); \ + _argvec[7] = (unsigned long)(arg7); \ + _argvec[8] = (unsigned long)(arg8); \ + _argvec[9] = (unsigned long)(arg9); \ + _argvec[10] = (unsigned long)(arg10); \ + _argvec[11] = (unsigned long)(arg11); \ + __asm__ volatile( \ + VALGRIND_ALIGN_STACK \ + "addi sp, sp, -32 \n\t" \ + "ld a0, 8(%1) \n\t" \ + "ld a1, 16(%1) \n\t" \ + "ld a2, 24(%1) \n\t" \ + "ld a3, 32(%1) \n\t" \ + "ld a4, 40(%1) \n\t" \ + "ld a5, 48(%1) \n\t" \ + "ld a6, 56(%1) \n\t" \ + "ld a7, 64(%1) \n\t" \ + "ld t0, 72(%1) \n\t" \ + "sd t0, 0(sp) \n\t" \ + "ld t0, 80(%1) \n\t" \ + "sd t0, 8(sp) \n\t" \ + "ld t0, 88(%1) \n\t" \ + "sd t0, 16(sp) \n\t" \ + "ld t0, 0(%1) \n\t" /* target->t0 */ \ + VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_T0 \ + VALGRIND_RESTORE_STACK \ + "mv %0, a0" \ + : /*out*/ "=r" (_res) \ + : /*in*/ "0" (&_argvec[0]) \ + : /*trash*/ "memory", __CALLER_SAVED_REGS, "s11" \ + ); \ + lval = (__typeof__(lval)) _res; \ + } while (0) + +#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ + arg7,arg8,arg9,arg10,arg11, \ + arg12) \ + do { \ + volatile OrigFn _orig = (orig); \ + volatile unsigned long _argvec[13]; \ + volatile unsigned long _res; \ + _argvec[0] = (unsigned long)_orig.nraddr; \ + _argvec[1] = (unsigned long)(arg1); \ + _argvec[2] = (unsigned long)(arg2); \ + _argvec[3] = (unsigned long)(arg3); \ + _argvec[4] = (unsigned long)(arg4); \ + _argvec[5] = (unsigned long)(arg5); \ + _argvec[6] = (unsigned long)(arg6); \ + _argvec[7] = (unsigned long)(arg7); \ + _argvec[8] = (unsigned long)(arg8); \ + _argvec[9] = (unsigned long)(arg9); \ + _argvec[10] = (unsigned long)(arg10); \ + _argvec[11] = (unsigned long)(arg11); \ + _argvec[12] = (unsigned long)(arg12); \ + __asm__ volatile( \ + VALGRIND_ALIGN_STACK \ + "addi sp, sp, -32 \n\t" \ + "ld a0, 8(%1) \n\t" \ + "ld a1, 16(%1) \n\t" \ + "ld a2, 24(%1) \n\t" \ + "ld a3, 32(%1) \n\t" \ + "ld a4, 40(%1) \n\t" \ + "ld a5, 48(%1) \n\t" \ + "ld a6, 56(%1) \n\t" \ + "ld a7, 64(%1) \n\t" \ + "ld t0, 72(%1) \n\t" \ + "sd t0, 0(sp) \n\t" \ + "ld t0, 80(%1) \n\t" \ + "sd t0, 8(sp) \n\t" \ + "ld t0, 88(%1) \n\t" \ + "sd t0, 16(sp) \n\t" \ + "ld t0, 96(%1) \n\t" \ + "sd t0, 24(sp) \n\t" \ + "ld t0, 0(%1) \n\t" /* target->t0 */ \ + VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_T0 \ + VALGRIND_RESTORE_STACK \ + "mv %0, a0" \ + : /*out*/ "=r" (_res) \ + : /*in*/ "0" (&_argvec[0]) \ + : /*trash*/ "memory", __CALLER_SAVED_REGS, "s11" \ + ); \ + lval = (__typeof__(lval)) _res; \ + } while (0) + +#endif /* PLAT_riscv64_linux */ + /* ------------------------------------------------------------------ */ /* ARCHITECTURE INDEPENDENT MACROS for CLIENT REQUESTS. */ /* */ @@ -7162,6 +7696,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) #undef PLAT_mips32_linux #undef PLAT_mips64_linux #undef PLAT_nanomips_linux +#undef PLAT_riscv64_linux #undef PLAT_x86_solaris #undef PLAT_amd64_solaris diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp index 17a19aa780d..c843927d366 100644 --- a/src/widgets/kernel/qwidgetsvariant.cpp +++ b/src/widgets/kernel/qwidgetsvariant.cpp @@ -11,18 +11,16 @@ QT_BEGIN_NAMESPACE namespace { - -// NOLINTNEXTLINE(cppcoreguidelines-virtual-class-destructor): this is not a base class -static constexpr struct : QMetaTypeModuleHelper +struct QVariantWidgetsHelper : QMetaTypeModuleHelper { - const QtPrivate::QMetaTypeInterface *interfaceForType(int type) const override { + static const QtPrivate::QMetaTypeInterface *interfaceForType(int type) + { switch (type) { QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_METATYPE_CONVERT_ID_TO_TYPE) default: return nullptr; } } -} qVariantWidgetsHelper; - +}; #undef QT_IMPL_METATYPEINTERFACE_WIDGETS_TYPES @@ -30,7 +28,9 @@ static constexpr struct : QMetaTypeModuleHelper void qRegisterWidgetsVariant() { - qMetaTypeWidgetsHelper = &qVariantWidgetsHelper; + qMetaTypeWidgetsHelper = QMetaTypeModuleHelper{ + &QVariantWidgetsHelper::interfaceForType, + }; } Q_CONSTRUCTOR_FUNCTION(qRegisterWidgetsVariant) diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index e9cc250c517..c341a025115 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -591,7 +591,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem, if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange) painter->setPen(highlightedOutline); else - painter->setPen(colorScheme() == Qt::ColorScheme::Dark ? outline.lighter(150) + painter->setPen(colorScheme() == Qt::ColorScheme::Dark ? outline.lighter(240) : outline.lighter(110)); painter->drawRect(rect); diff --git a/src/widgets/styles/qfusionstyle_p_p.h b/src/widgets/styles/qfusionstyle_p_p.h index 67abdd74dc8..62641609d59 100644 --- a/src/widgets/styles/qfusionstyle_p_p.h +++ b/src/widgets/styles/qfusionstyle_p_p.h @@ -70,10 +70,7 @@ public: } if (pal.window().style() == Qt::TexturePattern) return QColor(0, 0, 0, 160); - if (colorScheme() == Qt::ColorScheme::Dark) - return pal.window().color().lighter(140); - else - return pal.window().color().darker(140); + return pal.window().color().darker(140); } QColor highlightedOutline(const QPalette &pal) const { diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 1e423f21bec..0ea2be1b147 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -430,7 +430,7 @@ void tst_QDir::mkdirRmdir() void tst_QDir::mkdirOnSymlink() { -#if !defined(Q_OS_UNIX) || defined(Q_NO_SYMLINKS) || defined(Q_OS_INTEGRITY) || defined(Q_OS_WASM) +#if !defined(Q_OS_UNIX) || defined(Q_NO_SYMLINKS) || defined(Q_OS_INTEGRITY) QSKIP("Test only valid on an OS that supports symlinks"); #else // Create the structure: @@ -477,9 +477,6 @@ void tst_QDir::mkdirOnSymlink() #if defined(Q_OS_QNX) QSKIP("Fails on QNX QTBUG-98561"); #endif -#if defined (Q_OS_WASM) - QEXPECT_FAIL("", "fails on wasm, see bug: QTBUG-127766", Continue); -#endif QVERIFY2(fi.exists() && fi.isDir(), msgDoesNotExist(path).constData()); #endif } diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 781f64a31ab..66c3db2e2f0 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -228,6 +228,7 @@ private slots: void getCharFF(); void remove_and_exists(); void removeOpenFile(); + void removedFileDoesntExist(); void fullDisk(); void writeLargeDataBlock_data(); void writeLargeDataBlock(); @@ -2526,6 +2527,37 @@ void tst_QFile::removeOpenFile() } } +void tst_QFile::removedFileDoesntExist() +{ +#ifdef Q_OS_WIN + QSKIP("Not relevant for Windows - can't remove still-open files"); +#endif + QFile::remove("remove_unclosed.txt"); + QFile f("remove_unclosed.txt"); + QVERIFY(!f.exists()); + bool opened = f.open(QIODevice::ReadWrite | QIODevice::Unbuffered); + QVERIFY(opened); + f.write("blah blah blah"); + + QVERIFY(f.exists()); + + // delete by path, not using f.remove() (that's tested above) + QVERIFY(QFile::remove(f.fileName())); + QVERIFY(!QFile::exists(f.fileName())); + QVERIFY(!f.exists()); + +#ifdef Q_OS_LINUX + QString procPath = u"/proc/self/fd/"_s; + if (QFile::exists(procPath)) { + // reopen the deleted file + procPath += QString::number(f.handle()); + QFile f2(procPath); + QVERIFY(f2.open(QIODevice::ReadOnly)); + QVERIFY(!f2.exists()); + } +#endif +} + void tst_QFile::fullDisk() { QFile file("/dev/full"); diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 761f0552eec..e2190477441 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -141,6 +141,7 @@ private slots: void exists_data(); void exists(); + void deletedFileLinuxProcExists(); void absolutePath_data(); void absolutePath(); @@ -615,6 +616,34 @@ void tst_QFileInfo::exists() QVERIFY(!exists); } +void tst_QFileInfo::deletedFileLinuxProcExists() +{ +#ifdef Q_OS_LINUX + static const char msg[] = "Hello, World\n"; + QFileInfo fi("/proc/self/fd/"); + if (!fi.isDir()) + QSKIP("/proc appears not to be mounted"); + + QFile f("removed_file.txt"); + QVERIFY(f.open(QIODevice::ReadWrite | QIODevice::Unbuffered)); + f.write(msg, strlen(msg)); + + fi.setFile(fi.filePath() + QString::number(f.handle())); + QVERIFY(fi.exists()); + QCOMPARE(fi.size(), strlen(msg)); + + QFile::remove("removed_file.txt"); + fi.refresh(); + QVERIFY(fi.exists()); + + fi.refresh(); + QCOMPARE(fi.size(), strlen(msg)); // this stats, so may change flags + QVERIFY(fi.exists()); +#else + QSKIP("Linux-only test"); +#endif +} + void tst_QFileInfo::absolutePath_data() { QTest::addColumn<QString>("file"); diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 282c7f2e360..71389abc976 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -513,6 +513,7 @@ void tst_QUrl::comparison2() QCOMPARE(url1.toString(), url2.toString()); QCOMPARE(url1, url2); QCOMPARE(qHash(url1), qHash(url2)); + QCOMPARE(qHash(url1, 1), qHash(url2, 1)); } else if (ordering < 0) { QCOMPARE_LT(url1.toString(), url2.toString()); QCOMPARE_NE(url1, url2); @@ -1387,12 +1388,14 @@ void tst_QUrl::toString_constructed() QUrl parsed(asString); QCOMPARE(url, parsed); QCOMPARE(qHash(url), qHash(parsed)); + QCOMPARE(qHash(url, 1), qHash(parsed, 1)); } // clear it and ensure no memory of the previous state remains url.setUrl(QString()); QCOMPARE(url, QUrl()); QCOMPARE(qHash(url), qHash(QUrl())); + QCOMPARE(qHash(url, 1), qHash(QUrl(), 1)); } void tst_QUrl::toDisplayString_PreferLocalFile_data() @@ -4265,6 +4268,7 @@ void tst_QUrl::setComponents() QUrl recreated(toString); QCOMPARE(copy, recreated); QCOMPARE(qHash(copy), qHash(recreated)); + QCOMPARE(qHash(copy, 1), qHash(recreated, 1)); } else { QVERIFY(copy.toString().isEmpty()); } diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index b1e2e8164af..f2d281ae0a4 100644 --- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -708,6 +708,8 @@ void tst_QMetaObjectBuilder::property() prop2.setEnumOrFlag(false); \ prop2.setConstant(false); \ prop2.setFinal(false); \ + prop2.setBindable(false); \ + prop2.setRequired(false); \ } while (0) #define COUNT_FLAGS() \ ((prop2.isReadable() ? 1 : 0) + \ @@ -720,7 +722,9 @@ void tst_QMetaObjectBuilder::property() (prop2.hasStdCppSet() ? 1 : 0) + \ (prop2.isEnumOrFlag() ? 1 : 0) + \ (prop2.isConstant() ? 1 : 0) + \ - (prop2.isFinal() ? 1 : 0)) + (prop2.isFinal() ? 1 : 0) + \ + (prop2.isBindable() ? 1 : 0) + \ + (prop2.isRequired() ? 1 : 0)) #define CHECK_FLAG(setFunc,isFunc) \ do { \ CLEAR_FLAGS(); \ diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index 3756937c94a..bfc6074689b 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -2470,7 +2470,8 @@ void tst_QLocale::formatTimeZone() // Time definitely in Standard Time const QStringList knownCETus = { u"GMT+1"_s, // ICU - u"CET"_s // Standard abbreviation + u"CET"_s, // Standard abbreviation + u"UTC+0100"_s, // used by Emscripten }; const QString cet = enUS.toString(QDate(2013, 1, 1).startOfDay(), u"t"); QVERIFY2(knownCETus.contains(cet), cet.isEmpty() ? "[empty]" : qPrintable(cet)); @@ -2478,7 +2479,8 @@ void tst_QLocale::formatTimeZone() // Time definitely in Daylight Time const QStringList knownCESTus = { u"GMT+2"_s, // ICU - u"CEST"_s // Standard abbreviation + u"CEST"_s, // Standard abbreviation + u"UTC+0200"_s, // used by Emscripten }; const QString cest = enUS.toString(QDate(2013, 6, 1).startOfDay(), u"t"); QVERIFY2(knownCESTus.contains(cest), cest.isEmpty() ? "[empty]" : qPrintable(cest)); diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp index 5804aeeb1e5..87d48d56e6b 100644 --- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp +++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp @@ -73,22 +73,22 @@ void tst_QArrayData::referenceCounting() // Reference counting initialized to 1 (owned) QArrayData array = { Q_BASIC_ATOMIC_INITIALIZER(1), {}, 0 }; - QCOMPARE(array.ref_.loadRelaxed(), 1); + QCOMPARE(array.m_ref.loadRelaxed(), 1); QVERIFY(array.ref()); - QCOMPARE(array.ref_.loadRelaxed(), 2); + QCOMPARE(array.m_ref.loadRelaxed(), 2); QVERIFY(array.deref()); - QCOMPARE(array.ref_.loadRelaxed(), 1); + QCOMPARE(array.m_ref.loadRelaxed(), 1); QVERIFY(array.ref()); - QCOMPARE(array.ref_.loadRelaxed(), 2); + QCOMPARE(array.m_ref.loadRelaxed(), 2); QVERIFY(array.deref()); - QCOMPARE(array.ref_.loadRelaxed(), 1); + QCOMPARE(array.m_ref.loadRelaxed(), 1); QVERIFY(!array.deref()); - QCOMPARE(array.ref_.loadRelaxed(), 0); + QCOMPARE(array.m_ref.loadRelaxed(), 0); // Now would be a good time to free/release allocated data } diff --git a/tests/auto/corelib/tools/qatomicscopedvaluerollback/tst_qatomicscopedvaluerollback.cpp b/tests/auto/corelib/tools/qatomicscopedvaluerollback/tst_qatomicscopedvaluerollback.cpp index 89bd1d7ff61..b53362b43e9 100644 --- a/tests/auto/corelib/tools/qatomicscopedvaluerollback/tst_qatomicscopedvaluerollback.cpp +++ b/tests/auto/corelib/tools/qatomicscopedvaluerollback/tst_qatomicscopedvaluerollback.cpp @@ -5,6 +5,10 @@ #include <QTest> +#include <chrono> + +using namespace std::chrono_literals; + class tst_QAtomicScopedValueRollback : public QObject { Q_OBJECT @@ -15,6 +19,7 @@ private Q_SLOTS: void rollbackToPreviousCommit(); void exceptions(); void earlyExitScope(); + void mixedTypes(); private: void earlyExitScope_helper(int exitpoint, std::atomic<int> &member); }; @@ -132,6 +137,90 @@ void tst_QAtomicScopedValueRollback::earlyExitScope() } } +template <typename T> +struct Wrap { +#if __cpp_deduction_guides < 201907L // no CTAD for aggregates + Q_IMPLICIT Wrap(T &t) : t{t} {} + Q_IMPLICIT Wrap(T &&t) : t{std::move(t)} {} +#endif + T t; + Q_IMPLICIT operator T() const { return t; } +}; + +void tst_QAtomicScopedValueRollback::mixedTypes() +{ + const auto relaxed = std::memory_order_relaxed; + { + std::atomic a{10'000ms}; + { + QAtomicScopedValueRollback rb(a, 5s); + QCOMPARE(a.load(relaxed), 5s); + } + QCOMPARE(a.load(relaxed), 10s); + { + QAtomicScopedValueRollback rb(a, 5s, relaxed); + QCOMPARE(a.load(relaxed), 5s); + } + QCOMPARE(a.load(relaxed), 10s); + } + { + QBasicAtomicInteger a{10'000}; + { + QAtomicScopedValueRollback rb(a, Wrap{5'000}); + QCOMPARE(a.loadRelaxed(), 5'000); + } + QCOMPARE(a.loadRelaxed(), 10'000); + { + QAtomicScopedValueRollback rb(a, Wrap{5'000}, relaxed); + QCOMPARE(a.loadRelaxed(), 5'000); + } + QCOMPARE(a.loadRelaxed(), 10'000); + } + { + QAtomicInteger a{10'000}; + { + QAtomicScopedValueRollback rb(a, Wrap{5'000}); + QCOMPARE(a.loadRelaxed(), 5'000); + } + QCOMPARE(a.loadRelaxed(), 10'000); + { + QAtomicScopedValueRollback rb(a, Wrap{5'000}, relaxed); + QCOMPARE(a.loadRelaxed(), 5'000); + } + QCOMPARE(a.loadRelaxed(), 10'000); + } + { + int i = 10'000; + int j = 5'000; + QBasicAtomicPointer a{&i}; + { + QAtomicScopedValueRollback rb(a, Wrap{&j}); + QCOMPARE(a.loadRelaxed(), &j); + } + QCOMPARE(a.loadRelaxed(), &i); + { + QAtomicScopedValueRollback rb(a, Wrap{&j}, relaxed); + QCOMPARE(a.loadRelaxed(), &j); + } + QCOMPARE(a.loadRelaxed(), &i); + } + { + int i = 10'000; + int j = 5'000; + QAtomicPointer a{&i}; + { + QAtomicScopedValueRollback rb(a, Wrap{&j}); + QCOMPARE(a.loadRelaxed(), &j); + } + QCOMPARE(a.loadRelaxed(), &i); + { + QAtomicScopedValueRollback rb(a, Wrap{&j}, relaxed); + QCOMPARE(a.loadRelaxed(), &j); + } + QCOMPARE(a.loadRelaxed(), &i); + } +} + static void operator*=(std::atomic<int> &lhs, int rhs) { int expected = lhs.load(); diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 39051276371..1c8dd14eba4 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -3264,12 +3264,14 @@ void tst_QWindow::windowExposedAfterReparent() QVERIFY(QTest::qWaitForWindowExposed(&parent)); QVERIFY(QTest::qWaitForWindowExposed(&child)); + // Close the child before reparenting it to ensure it is correctly converted + // to a toplevel window by the window manager. + child.close(); child.setParent(nullptr); - QCoreApplication::processEvents(); + child.show(); QVERIFY(QTest::qWaitForWindowExposed(&child)); child.setParent(&parent); - QCoreApplication::processEvents(); QVERIFY(QTest::qWaitForWindowExposed(&child)); } diff --git a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp index bd4a230b78a..d4dc6544a0e 100644 --- a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp +++ b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp @@ -894,6 +894,13 @@ void tst_QQuaternion::fromAxes() QQuaternion result = QQuaternion::fromAxisAndAngle(QVector3D(x1, y1, z1), angle); + { + const auto axes = result.toAxes(); + QVERIFY(myFuzzyCompare(axes.x, xAxis)); + QVERIFY(myFuzzyCompare(axes.y, yAxis)); + QVERIFY(myFuzzyCompare(axes.z, zAxis)); + } + QVector3D axes[3]; result.getAxes(&axes[0], &axes[1], &axes[2]); QVERIFY(myFuzzyCompare(axes[0], xAxis)); @@ -985,8 +992,7 @@ void tst_QQuaternion::fromDirection_data() // othonormal up and dir for (QQuaternion q : orientations) { - QVector3D xAxis, yAxis, zAxis; - q.getAxes(&xAxis, &yAxis, &zAxis); + const auto [xAxis, yAxis, zAxis] = q.toAxes(); QTest::addRow("ortho dirs: (%.1f,%.1f,%.1f), (%.1f,%.1f,%.1f), (%.1f,%.1f,%.1f)", xAxis.x(), xAxis.y(), xAxis.z(), @@ -1007,8 +1013,7 @@ void tst_QQuaternion::fromDirection_data() // invalid up for (QQuaternion q : orientations) { - QVector3D xAxis, yAxis, zAxis; - q.getAxes(&xAxis, &yAxis, &zAxis); + const auto [xAxis, yAxis, zAxis] = q.toAxes(); QTest::addRow("bad dirs: (%.1f,%.1f,%.1f), (%.1f,%.1f,%.1f), (%.1f,%.1f,%.1f)", xAxis.x(), xAxis.y(), xAxis.z(), @@ -1029,16 +1034,14 @@ void tst_QQuaternion::fromDirection() QQuaternion result = QQuaternion::fromDirection(direction, up); QVERIFY(myFuzzyCompare(result, result.normalized())); - QVector3D xAxis, yAxis, zAxis; - result.getAxes(&xAxis, &yAxis, &zAxis); - - QVERIFY(myFuzzyCompare(zAxis, expectedZ)); + const auto axes = result.toAxes(); + QVERIFY(myFuzzyCompare(axes.z, expectedZ)); const QVector3D expectedX = QVector3D::crossProduct(expectedY, expectedZ); if (!qFuzzyIsNull(expectedX.lengthSquared())) { - QVERIFY(myFuzzyCompare(xAxis, expectedX)); - QVERIFY(myFuzzyCompare(yAxis, expectedY)); + QVERIFY(myFuzzyCompare(axes.x, expectedX)); + QVERIFY(myFuzzyCompare(axes.y, expectedY)); } } diff --git a/tests/auto/testlib/selftests/expected_threewaycompare.junitxml b/tests/auto/testlib/selftests/expected_threewaycompare.junitxml index e10872ef1ba..37551ecd23d 100644 --- a/tests/auto/testlib/selftests/expected_threewaycompare.junitxml +++ b/tests/auto/testlib/selftests/expected_threewaycompare.junitxml @@ -25,8 +25,8 @@ </testcase> <testcase name="compareFloats(Qt::partial_ordering::equivalent)" classname="tst_ThreeWayCompare" time="@TEST_DURATION@"> <failure type="fail" message="The result of operator<=>() is not what was expected"> - <![CDATA[ Left (lhs): 1 - Right (rhs): 1 + <![CDATA[ Left (lhs): 1 (0x1p+0) + Right (rhs): 1 (0x1p+0) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): Qt::partial_ordering::less]]> </failure> @@ -34,24 +34,24 @@ <testcase name="compareFloats(Qt::partial_ordering::less)" classname="tst_ThreeWayCompare" time="@TEST_DURATION@"/> <testcase name="compareFloats(Qt::partial_ordering::greater)" classname="tst_ThreeWayCompare" time="@TEST_DURATION@"> <failure type="fail" message="The result of operator<=>() is not what was expected"> - <![CDATA[ Left (lhs): 1.1 - Right (rhs): 1 + <![CDATA[ Left (lhs): 1.1 (0x1.19999ap+0) + Right (rhs): 1 (0x1p+0) Actual (lhs <=> rhs) : std::partial_ordering::greater Expected (expectedOrder): Qt::partial_ordering::less]]> </failure> </testcase> <testcase name="compareDoubles(Qt::partial_ordering::equivalent)" classname="tst_ThreeWayCompare" time="@TEST_DURATION@"> <failure type="fail" message="The result of operator<=>() is not what was expected"> - <![CDATA[ Left (lhs): 0 - Right (rhs): 0 + <![CDATA[ Left (lhs): 0 (0x0p+0) + Right (rhs): 0 (0x0p+0) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): Qt::partial_ordering::greater]]> </failure> </testcase> <testcase name="compareDoubles(Qt::partial_ordering::less)" classname="tst_ThreeWayCompare" time="@TEST_DURATION@"> <failure type="fail" message="The result of operator<=>() is not what was expected"> - <![CDATA[ Left (lhs): 0 - Right (rhs): 0.1 + <![CDATA[ Left (lhs): 0 (0x0p+0) + Right (rhs): 0.1 (0x1.999999999999ap-4) Actual (lhs <=> rhs) : std::partial_ordering::less Expected (expectedOrder): Qt::partial_ordering::greater]]> </failure> @@ -161,16 +161,16 @@ </testcase> <testcase name="stdCompareFloats(std::partial_ordering::equivalent)" classname="tst_ThreeWayCompare" time="@TEST_DURATION@"> <failure type="fail" message="The result of operator<=>() is not what was expected"> - <![CDATA[ Left (lhs): 2 - Right (rhs): 2 + <![CDATA[ Left (lhs): 2 (0x1p+1) + Right (rhs): 2 (0x1p+1) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): std::partial_ordering::less]]> </failure> </testcase> <testcase name="stdCompareFloats(std::partial_ordering::less)" classname="tst_ThreeWayCompare" time="@TEST_DURATION@"> <failure type="fail" message="The result of operator<=>() is not what was expected"> - <![CDATA[ Left (lhs): 2 - Right (rhs): 1.1 + <![CDATA[ Left (lhs): 2 (0x1p+1) + Right (rhs): 1.1 (0x1.19999ap+0) Actual (lhs <=> rhs) : std::partial_ordering::greater Expected (expectedOrder): std::partial_ordering::less]]> </failure> @@ -178,16 +178,16 @@ <testcase name="stdCompareFloats(std::partial_ordering::greater)" classname="tst_ThreeWayCompare" time="@TEST_DURATION@"/> <testcase name="stdCompareDoubles(std::partial_ordering::equivalent)" classname="tst_ThreeWayCompare" time="@TEST_DURATION@"> <failure type="fail" message="The result of operator<=>() is not what was expected"> - <![CDATA[ Left (lhs): 0.15 - Right (rhs): 0.15 + <![CDATA[ Left (lhs): 0.15 (0x1.3333333333333p-3) + Right (rhs): 0.15 (0x1.3333333333333p-3) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): std::partial_ordering::greater]]> </failure> </testcase> <testcase name="stdCompareDoubles(std::partial_ordering::less)" classname="tst_ThreeWayCompare" time="@TEST_DURATION@"> <failure type="fail" message="The result of operator<=>() is not what was expected"> - <![CDATA[ Left (lhs): 0.15 - Right (rhs): 0.25 + <![CDATA[ Left (lhs): 0.15 (0x1.3333333333333p-3) + Right (rhs): 0.25 (0x1p-2) Actual (lhs <=> rhs) : std::partial_ordering::less Expected (expectedOrder): std::partial_ordering::greater]]> </failure> @@ -288,8 +288,8 @@ </testcase> <testcase name="checkWeakComparison" classname="tst_ThreeWayCompare" time="@TEST_DURATION@"> <failure type="fail" message="The result of operator<=>() is not what was expected"> - <![CDATA[ Left (june) : 2012/06/20 14:33:02.500[CEST] - Right (juneLater): 2012/06/20 14:33:02.501[CEST] + <![CDATA[ Left (june) : 2012/06/20 14:33:02.500[UTC] + Right (juneLater): 2012/06/20 14:33:02.501[UTC] Actual (june <=> juneLater) : std::weak_ordering::less Expected (Qt::weak_ordering::greater): Qt::weak_ordering::greater]]> </failure> diff --git a/tests/auto/testlib/selftests/expected_threewaycompare.lightxml b/tests/auto/testlib/selftests/expected_threewaycompare.lightxml index 75679c5e374..082255a2c41 100644 --- a/tests/auto/testlib/selftests/expected_threewaycompare.lightxml +++ b/tests/auto/testlib/selftests/expected_threewaycompare.lightxml @@ -33,8 +33,8 @@ <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[Qt::partial_ordering::equivalent]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 1 - Right (rhs): 1 + Left (lhs): 1 (0x1p+0) + Right (rhs): 1 (0x1p+0) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): Qt::partial_ordering::less]]></Description> </Incident> @@ -44,8 +44,8 @@ <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[Qt::partial_ordering::greater]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 1.1 - Right (rhs): 1 + Left (lhs): 1.1 (0x1.19999ap+0) + Right (rhs): 1 (0x1p+0) Actual (lhs <=> rhs) : std::partial_ordering::greater Expected (expectedOrder): Qt::partial_ordering::less]]></Description> </Incident> @@ -55,16 +55,16 @@ <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[Qt::partial_ordering::equivalent]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 0 - Right (rhs): 0 + Left (lhs): 0 (0x0p+0) + Right (rhs): 0 (0x0p+0) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): Qt::partial_ordering::greater]]></Description> </Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[Qt::partial_ordering::less]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 0 - Right (rhs): 0.1 + Left (lhs): 0 (0x0p+0) + Right (rhs): 0.1 (0x1.999999999999ap-4) Actual (lhs <=> rhs) : std::partial_ordering::less Expected (expectedOrder): Qt::partial_ordering::greater]]></Description> </Incident> @@ -209,16 +209,16 @@ <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[std::partial_ordering::equivalent]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 2 - Right (rhs): 2 + Left (lhs): 2 (0x1p+1) + Right (rhs): 2 (0x1p+1) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): std::partial_ordering::less]]></Description> </Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[std::partial_ordering::less]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 2 - Right (rhs): 1.1 + Left (lhs): 2 (0x1p+1) + Right (rhs): 1.1 (0x1.19999ap+0) Actual (lhs <=> rhs) : std::partial_ordering::greater Expected (expectedOrder): std::partial_ordering::less]]></Description> </Incident> @@ -231,16 +231,16 @@ <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[std::partial_ordering::equivalent]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 0.15 - Right (rhs): 0.15 + Left (lhs): 0.15 (0x1.3333333333333p-3) + Right (rhs): 0.15 (0x1.3333333333333p-3) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): std::partial_ordering::greater]]></Description> </Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[std::partial_ordering::less]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 0.15 - Right (rhs): 0.25 + Left (lhs): 0.15 (0x1.3333333333333p-3) + Right (rhs): 0.25 (0x1p-2) Actual (lhs <=> rhs) : std::partial_ordering::less Expected (expectedOrder): std::partial_ordering::greater]]></Description> </Incident> @@ -372,8 +372,8 @@ <TestFunction name="checkWeakComparison"> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (june) : 2012/06/20 14:33:02.500[CEST] - Right (juneLater): 2012/06/20 14:33:02.501[CEST] + Left (june) : 2012/06/20 14:33:02.500[UTC] + Right (juneLater): 2012/06/20 14:33:02.501[UTC] Actual (june <=> juneLater) : std::weak_ordering::less Expected (Qt::weak_ordering::greater): Qt::weak_ordering::greater]]></Description> </Incident> diff --git a/tests/auto/testlib/selftests/expected_threewaycompare.tap b/tests/auto/testlib/selftests/expected_threewaycompare.tap index daeae42c06f..5d464e0e648 100644 --- a/tests/auto/testlib/selftests/expected_threewaycompare.tap +++ b/tests/auto/testlib/selftests/expected_threewaycompare.tap @@ -27,8 +27,8 @@ not ok 4 - compareInts(Qt::strong_ordering::greater) not ok 5 - compareFloats(Qt::partial_ordering::equivalent) --- # The result of operator<=>() is not what was expected - Left (lhs): 1 - Right (rhs): 1 + Left (lhs): 1 (0x1p+0) + Right (rhs): 1 (0x1p+0) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): Qt::partial_ordering::less at: tst_ThreeWayCompare::compareFloats() (qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp:0) @@ -39,8 +39,8 @@ ok 6 - compareFloats(Qt::partial_ordering::less) not ok 7 - compareFloats(Qt::partial_ordering::greater) --- # The result of operator<=>() is not what was expected - Left (lhs): 1.1 - Right (rhs): 1 + Left (lhs): 1.1 (0x1.19999ap+0) + Right (rhs): 1 (0x1p+0) Actual (lhs <=> rhs) : std::partial_ordering::greater Expected (expectedOrder): Qt::partial_ordering::less at: tst_ThreeWayCompare::compareFloats() (qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp:0) @@ -50,8 +50,8 @@ not ok 7 - compareFloats(Qt::partial_ordering::greater) not ok 8 - compareDoubles(Qt::partial_ordering::equivalent) --- # The result of operator<=>() is not what was expected - Left (lhs): 0 - Right (rhs): 0 + Left (lhs): 0 (0x0p+0) + Right (rhs): 0 (0x0p+0) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): Qt::partial_ordering::greater at: tst_ThreeWayCompare::compareDoubles() (qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp:0) @@ -61,8 +61,8 @@ not ok 8 - compareDoubles(Qt::partial_ordering::equivalent) not ok 9 - compareDoubles(Qt::partial_ordering::less) --- # The result of operator<=>() is not what was expected - Left (lhs): 0 - Right (rhs): 0.1 + Left (lhs): 0 (0x0p+0) + Right (rhs): 0.1 (0x1.999999999999ap-4) Actual (lhs <=> rhs) : std::partial_ordering::less Expected (expectedOrder): Qt::partial_ordering::greater at: tst_ThreeWayCompare::compareDoubles() (qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp:0) @@ -211,8 +211,8 @@ not ok 28 - stdCompareInts(std::strong_ordering::greater) not ok 29 - stdCompareFloats(std::partial_ordering::equivalent) --- # The result of operator<=>() is not what was expected - Left (lhs): 2 - Right (rhs): 2 + Left (lhs): 2 (0x1p+1) + Right (rhs): 2 (0x1p+1) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): std::partial_ordering::less at: tst_ThreeWayCompare::stdCompareFloats() (qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp:0) @@ -222,8 +222,8 @@ not ok 29 - stdCompareFloats(std::partial_ordering::equivalent) not ok 30 - stdCompareFloats(std::partial_ordering::less) --- # The result of operator<=>() is not what was expected - Left (lhs): 2 - Right (rhs): 1.1 + Left (lhs): 2 (0x1p+1) + Right (rhs): 1.1 (0x1.19999ap+0) Actual (lhs <=> rhs) : std::partial_ordering::greater Expected (expectedOrder): std::partial_ordering::less at: tst_ThreeWayCompare::stdCompareFloats() (qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp:0) @@ -234,8 +234,8 @@ ok 31 - stdCompareFloats(std::partial_ordering::greater) not ok 32 - stdCompareDoubles(std::partial_ordering::equivalent) --- # The result of operator<=>() is not what was expected - Left (lhs): 0.15 - Right (rhs): 0.15 + Left (lhs): 0.15 (0x1.3333333333333p-3) + Right (rhs): 0.15 (0x1.3333333333333p-3) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): std::partial_ordering::greater at: tst_ThreeWayCompare::stdCompareDoubles() (qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp:0) @@ -245,8 +245,8 @@ not ok 32 - stdCompareDoubles(std::partial_ordering::equivalent) not ok 33 - stdCompareDoubles(std::partial_ordering::less) --- # The result of operator<=>() is not what was expected - Left (lhs): 0.15 - Right (rhs): 0.25 + Left (lhs): 0.15 (0x1.3333333333333p-3) + Right (rhs): 0.25 (0x1p-2) Actual (lhs <=> rhs) : std::partial_ordering::less Expected (expectedOrder): std::partial_ordering::greater at: tst_ThreeWayCompare::stdCompareDoubles() (qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp:0) @@ -383,8 +383,8 @@ not ok 50 - checkComparisonForTemporaryObjects() not ok 51 - checkWeakComparison() --- # The result of operator<=>() is not what was expected - Left (june) : 2012/06/20 14:33:02.500[CEST] - Right (juneLater): 2012/06/20 14:33:02.501[CEST] + Left (june) : 2012/06/20 14:33:02.500[UTC] + Right (juneLater): 2012/06/20 14:33:02.501[UTC] Actual (june <=> juneLater) : std::weak_ordering::less Expected (Qt::weak_ordering::greater): Qt::weak_ordering::greater at: tst_ThreeWayCompare::checkWeakComparison() (qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp:0) diff --git a/tests/auto/testlib/selftests/expected_threewaycompare.teamcity b/tests/auto/testlib/selftests/expected_threewaycompare.teamcity index 2eed5bdb422..6b92880418e 100644 --- a/tests/auto/testlib/selftests/expected_threewaycompare.teamcity +++ b/tests/auto/testlib/selftests/expected_threewaycompare.teamcity @@ -10,18 +10,18 @@ ##teamcity[testFailed name='compareInts(Qt::strong_ordering::greater)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 2|n Right (rhs): 1|n Actual (lhs <=> rhs) : std::strong_ordering::greater|n Expected (expectedOrder): Qt::strong_ordering::equal' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='compareInts(Qt::strong_ordering::greater)' flowId='tst_ThreeWayCompare'] ##teamcity[testStarted name='compareFloats(Qt::partial_ordering::equivalent)' flowId='tst_ThreeWayCompare'] -##teamcity[testFailed name='compareFloats(Qt::partial_ordering::equivalent)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 1|n Right (rhs): 1|n Actual (lhs <=> rhs) : std::partial_ordering::equivalent|n Expected (expectedOrder): Qt::partial_ordering::less' flowId='tst_ThreeWayCompare'] +##teamcity[testFailed name='compareFloats(Qt::partial_ordering::equivalent)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 1 (0x1p+0)|n Right (rhs): 1 (0x1p+0)|n Actual (lhs <=> rhs) : std::partial_ordering::equivalent|n Expected (expectedOrder): Qt::partial_ordering::less' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='compareFloats(Qt::partial_ordering::equivalent)' flowId='tst_ThreeWayCompare'] ##teamcity[testStarted name='compareFloats(Qt::partial_ordering::less)' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='compareFloats(Qt::partial_ordering::less)' flowId='tst_ThreeWayCompare'] ##teamcity[testStarted name='compareFloats(Qt::partial_ordering::greater)' flowId='tst_ThreeWayCompare'] -##teamcity[testFailed name='compareFloats(Qt::partial_ordering::greater)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 1.1|n Right (rhs): 1|n Actual (lhs <=> rhs) : std::partial_ordering::greater|n Expected (expectedOrder): Qt::partial_ordering::less' flowId='tst_ThreeWayCompare'] +##teamcity[testFailed name='compareFloats(Qt::partial_ordering::greater)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 1.1 (0x1.19999ap+0)|n Right (rhs): 1 (0x1p+0)|n Actual (lhs <=> rhs) : std::partial_ordering::greater|n Expected (expectedOrder): Qt::partial_ordering::less' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='compareFloats(Qt::partial_ordering::greater)' flowId='tst_ThreeWayCompare'] ##teamcity[testStarted name='compareDoubles(Qt::partial_ordering::equivalent)' flowId='tst_ThreeWayCompare'] -##teamcity[testFailed name='compareDoubles(Qt::partial_ordering::equivalent)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 0|n Right (rhs): 0|n Actual (lhs <=> rhs) : std::partial_ordering::equivalent|n Expected (expectedOrder): Qt::partial_ordering::greater' flowId='tst_ThreeWayCompare'] +##teamcity[testFailed name='compareDoubles(Qt::partial_ordering::equivalent)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 0 (0x0p+0)|n Right (rhs): 0 (0x0p+0)|n Actual (lhs <=> rhs) : std::partial_ordering::equivalent|n Expected (expectedOrder): Qt::partial_ordering::greater' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='compareDoubles(Qt::partial_ordering::equivalent)' flowId='tst_ThreeWayCompare'] ##teamcity[testStarted name='compareDoubles(Qt::partial_ordering::less)' flowId='tst_ThreeWayCompare'] -##teamcity[testFailed name='compareDoubles(Qt::partial_ordering::less)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 0|n Right (rhs): 0.1|n Actual (lhs <=> rhs) : std::partial_ordering::less|n Expected (expectedOrder): Qt::partial_ordering::greater' flowId='tst_ThreeWayCompare'] +##teamcity[testFailed name='compareDoubles(Qt::partial_ordering::less)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 0 (0x0p+0)|n Right (rhs): 0.1 (0x1.999999999999ap-4)|n Actual (lhs <=> rhs) : std::partial_ordering::less|n Expected (expectedOrder): Qt::partial_ordering::greater' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='compareDoubles(Qt::partial_ordering::less)' flowId='tst_ThreeWayCompare'] ##teamcity[testStarted name='compareDoubles(Qt::partial_ordering::greater)' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='compareDoubles(Qt::partial_ordering::greater)' flowId='tst_ThreeWayCompare'] @@ -74,18 +74,18 @@ ##teamcity[testFailed name='stdCompareInts(std::strong_ordering::greater)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): -2|n Right (rhs): 1|n Actual (lhs <=> rhs) : std::strong_ordering::less|n Expected (expectedOrder): std::strong_ordering::equal' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='stdCompareInts(std::strong_ordering::greater)' flowId='tst_ThreeWayCompare'] ##teamcity[testStarted name='stdCompareFloats(std::partial_ordering::equivalent)' flowId='tst_ThreeWayCompare'] -##teamcity[testFailed name='stdCompareFloats(std::partial_ordering::equivalent)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 2|n Right (rhs): 2|n Actual (lhs <=> rhs) : std::partial_ordering::equivalent|n Expected (expectedOrder): std::partial_ordering::less' flowId='tst_ThreeWayCompare'] +##teamcity[testFailed name='stdCompareFloats(std::partial_ordering::equivalent)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 2 (0x1p+1)|n Right (rhs): 2 (0x1p+1)|n Actual (lhs <=> rhs) : std::partial_ordering::equivalent|n Expected (expectedOrder): std::partial_ordering::less' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='stdCompareFloats(std::partial_ordering::equivalent)' flowId='tst_ThreeWayCompare'] ##teamcity[testStarted name='stdCompareFloats(std::partial_ordering::less)' flowId='tst_ThreeWayCompare'] -##teamcity[testFailed name='stdCompareFloats(std::partial_ordering::less)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 2|n Right (rhs): 1.1|n Actual (lhs <=> rhs) : std::partial_ordering::greater|n Expected (expectedOrder): std::partial_ordering::less' flowId='tst_ThreeWayCompare'] +##teamcity[testFailed name='stdCompareFloats(std::partial_ordering::less)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 2 (0x1p+1)|n Right (rhs): 1.1 (0x1.19999ap+0)|n Actual (lhs <=> rhs) : std::partial_ordering::greater|n Expected (expectedOrder): std::partial_ordering::less' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='stdCompareFloats(std::partial_ordering::less)' flowId='tst_ThreeWayCompare'] ##teamcity[testStarted name='stdCompareFloats(std::partial_ordering::greater)' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='stdCompareFloats(std::partial_ordering::greater)' flowId='tst_ThreeWayCompare'] ##teamcity[testStarted name='stdCompareDoubles(std::partial_ordering::equivalent)' flowId='tst_ThreeWayCompare'] -##teamcity[testFailed name='stdCompareDoubles(std::partial_ordering::equivalent)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 0.15|n Right (rhs): 0.15|n Actual (lhs <=> rhs) : std::partial_ordering::equivalent|n Expected (expectedOrder): std::partial_ordering::greater' flowId='tst_ThreeWayCompare'] +##teamcity[testFailed name='stdCompareDoubles(std::partial_ordering::equivalent)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 0.15 (0x1.3333333333333p-3)|n Right (rhs): 0.15 (0x1.3333333333333p-3)|n Actual (lhs <=> rhs) : std::partial_ordering::equivalent|n Expected (expectedOrder): std::partial_ordering::greater' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='stdCompareDoubles(std::partial_ordering::equivalent)' flowId='tst_ThreeWayCompare'] ##teamcity[testStarted name='stdCompareDoubles(std::partial_ordering::less)' flowId='tst_ThreeWayCompare'] -##teamcity[testFailed name='stdCompareDoubles(std::partial_ordering::less)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 0.15|n Right (rhs): 0.25|n Actual (lhs <=> rhs) : std::partial_ordering::less|n Expected (expectedOrder): std::partial_ordering::greater' flowId='tst_ThreeWayCompare'] +##teamcity[testFailed name='stdCompareDoubles(std::partial_ordering::less)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (lhs): 0.15 (0x1.3333333333333p-3)|n Right (rhs): 0.25 (0x1p-2)|n Actual (lhs <=> rhs) : std::partial_ordering::less|n Expected (expectedOrder): std::partial_ordering::greater' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='stdCompareDoubles(std::partial_ordering::less)' flowId='tst_ThreeWayCompare'] ##teamcity[testStarted name='stdCompareDoubles(std::partial_ordering::greater)' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='stdCompareDoubles(std::partial_ordering::greater)' flowId='tst_ThreeWayCompare'] @@ -133,7 +133,7 @@ ##teamcity[testFailed name='checkComparisonForTemporaryObjects()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (getClassForValue(0).getValuePointer()): MyClass(2) on memory address with index 0|n Right (getClassForValue(1).getValuePointer()): MyClass(1) on memory address with index 1|n Actual (getClassForValue(0).getValuePointer() <=> getClassForValue(1).getValuePointer()): std::strong_ordering::less|n Expected (std::strong_ordering::equal) : std::strong_ordering::equal' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='checkComparisonForTemporaryObjects()' flowId='tst_ThreeWayCompare'] ##teamcity[testStarted name='checkWeakComparison()' flowId='tst_ThreeWayCompare'] -##teamcity[testFailed name='checkWeakComparison()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (june) : 2012/06/20 14:33:02.500|[CEST|]|n Right (juneLater): 2012/06/20 14:33:02.501|[CEST|]|n Actual (june <=> juneLater) : std::weak_ordering::less|n Expected (Qt::weak_ordering::greater): Qt::weak_ordering::greater' flowId='tst_ThreeWayCompare'] +##teamcity[testFailed name='checkWeakComparison()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)|]' details='The result of operator<=>() is not what was expected|n Left (june) : 2012/06/20 14:33:02.500|[UTC|]|n Right (juneLater): 2012/06/20 14:33:02.501|[UTC|]|n Actual (june <=> juneLater) : std::weak_ordering::less|n Expected (Qt::weak_ordering::greater): Qt::weak_ordering::greater' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='checkWeakComparison()' flowId='tst_ThreeWayCompare'] ##teamcity[testStarted name='cleanupTestCase()' flowId='tst_ThreeWayCompare'] ##teamcity[testFinished name='cleanupTestCase()' flowId='tst_ThreeWayCompare'] diff --git a/tests/auto/testlib/selftests/expected_threewaycompare.txt b/tests/auto/testlib/selftests/expected_threewaycompare.txt index 896cec72819..45496e4420c 100644 --- a/tests/auto/testlib/selftests/expected_threewaycompare.txt +++ b/tests/auto/testlib/selftests/expected_threewaycompare.txt @@ -15,27 +15,27 @@ FAIL! : tst_ThreeWayCompare::compareInts(Qt::strong_ordering::greater) The resu Expected (expectedOrder): Qt::strong_ordering::equal Loc: [qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)] FAIL! : tst_ThreeWayCompare::compareFloats(Qt::partial_ordering::equivalent) The result of operator<=>() is not what was expected - Left (lhs): 1 - Right (rhs): 1 + Left (lhs): 1 (0x1p+0) + Right (rhs): 1 (0x1p+0) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): Qt::partial_ordering::less Loc: [qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)] PASS : tst_ThreeWayCompare::compareFloats(Qt::partial_ordering::less) FAIL! : tst_ThreeWayCompare::compareFloats(Qt::partial_ordering::greater) The result of operator<=>() is not what was expected - Left (lhs): 1.1 - Right (rhs): 1 + Left (lhs): 1.1 (0x1.19999ap+0) + Right (rhs): 1 (0x1p+0) Actual (lhs <=> rhs) : std::partial_ordering::greater Expected (expectedOrder): Qt::partial_ordering::less Loc: [qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)] FAIL! : tst_ThreeWayCompare::compareDoubles(Qt::partial_ordering::equivalent) The result of operator<=>() is not what was expected - Left (lhs): 0 - Right (rhs): 0 + Left (lhs): 0 (0x0p+0) + Right (rhs): 0 (0x0p+0) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): Qt::partial_ordering::greater Loc: [qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)] FAIL! : tst_ThreeWayCompare::compareDoubles(Qt::partial_ordering::less) The result of operator<=>() is not what was expected - Left (lhs): 0 - Right (rhs): 0.1 + Left (lhs): 0 (0x0p+0) + Right (rhs): 0.1 (0x1.999999999999ap-4) Actual (lhs <=> rhs) : std::partial_ordering::less Expected (expectedOrder): Qt::partial_ordering::greater Loc: [qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)] @@ -119,27 +119,27 @@ FAIL! : tst_ThreeWayCompare::stdCompareInts(std::strong_ordering::greater) The Expected (expectedOrder): std::strong_ordering::equal Loc: [qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)] FAIL! : tst_ThreeWayCompare::stdCompareFloats(std::partial_ordering::equivalent) The result of operator<=>() is not what was expected - Left (lhs): 2 - Right (rhs): 2 + Left (lhs): 2 (0x1p+1) + Right (rhs): 2 (0x1p+1) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): std::partial_ordering::less Loc: [qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)] FAIL! : tst_ThreeWayCompare::stdCompareFloats(std::partial_ordering::less) The result of operator<=>() is not what was expected - Left (lhs): 2 - Right (rhs): 1.1 + Left (lhs): 2 (0x1p+1) + Right (rhs): 1.1 (0x1.19999ap+0) Actual (lhs <=> rhs) : std::partial_ordering::greater Expected (expectedOrder): std::partial_ordering::less Loc: [qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)] PASS : tst_ThreeWayCompare::stdCompareFloats(std::partial_ordering::greater) FAIL! : tst_ThreeWayCompare::stdCompareDoubles(std::partial_ordering::equivalent) The result of operator<=>() is not what was expected - Left (lhs): 0.15 - Right (rhs): 0.15 + Left (lhs): 0.15 (0x1.3333333333333p-3) + Right (rhs): 0.15 (0x1.3333333333333p-3) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): std::partial_ordering::greater Loc: [qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)] FAIL! : tst_ThreeWayCompare::stdCompareDoubles(std::partial_ordering::less) The result of operator<=>() is not what was expected - Left (lhs): 0.15 - Right (rhs): 0.25 + Left (lhs): 0.15 (0x1.3333333333333p-3) + Right (rhs): 0.25 (0x1p-2) Actual (lhs <=> rhs) : std::partial_ordering::less Expected (expectedOrder): std::partial_ordering::greater Loc: [qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)] @@ -216,8 +216,8 @@ FAIL! : tst_ThreeWayCompare::checkComparisonForTemporaryObjects() The result of Expected (std::strong_ordering::equal) : std::strong_ordering::equal Loc: [qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)] FAIL! : tst_ThreeWayCompare::checkWeakComparison() The result of operator<=>() is not what was expected - Left (june) : 2012/06/20 14:33:02.500[CEST] - Right (juneLater): 2012/06/20 14:33:02.501[CEST] + Left (june) : 2012/06/20 14:33:02.500[UTC] + Right (juneLater): 2012/06/20 14:33:02.501[UTC] Actual (june <=> juneLater) : std::weak_ordering::less Expected (Qt::weak_ordering::greater): Qt::weak_ordering::greater Loc: [qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp(0)] diff --git a/tests/auto/testlib/selftests/expected_threewaycompare.xml b/tests/auto/testlib/selftests/expected_threewaycompare.xml index 5e8f1f93bac..a3f4d38ee5a 100644 --- a/tests/auto/testlib/selftests/expected_threewaycompare.xml +++ b/tests/auto/testlib/selftests/expected_threewaycompare.xml @@ -35,8 +35,8 @@ <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[Qt::partial_ordering::equivalent]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 1 - Right (rhs): 1 + Left (lhs): 1 (0x1p+0) + Right (rhs): 1 (0x1p+0) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): Qt::partial_ordering::less]]></Description> </Incident> @@ -46,8 +46,8 @@ <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[Qt::partial_ordering::greater]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 1.1 - Right (rhs): 1 + Left (lhs): 1.1 (0x1.19999ap+0) + Right (rhs): 1 (0x1p+0) Actual (lhs <=> rhs) : std::partial_ordering::greater Expected (expectedOrder): Qt::partial_ordering::less]]></Description> </Incident> @@ -57,16 +57,16 @@ <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[Qt::partial_ordering::equivalent]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 0 - Right (rhs): 0 + Left (lhs): 0 (0x0p+0) + Right (rhs): 0 (0x0p+0) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): Qt::partial_ordering::greater]]></Description> </Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[Qt::partial_ordering::less]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 0 - Right (rhs): 0.1 + Left (lhs): 0 (0x0p+0) + Right (rhs): 0.1 (0x1.999999999999ap-4) Actual (lhs <=> rhs) : std::partial_ordering::less Expected (expectedOrder): Qt::partial_ordering::greater]]></Description> </Incident> @@ -211,16 +211,16 @@ <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[std::partial_ordering::equivalent]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 2 - Right (rhs): 2 + Left (lhs): 2 (0x1p+1) + Right (rhs): 2 (0x1p+1) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): std::partial_ordering::less]]></Description> </Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[std::partial_ordering::less]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 2 - Right (rhs): 1.1 + Left (lhs): 2 (0x1p+1) + Right (rhs): 1.1 (0x1.19999ap+0) Actual (lhs <=> rhs) : std::partial_ordering::greater Expected (expectedOrder): std::partial_ordering::less]]></Description> </Incident> @@ -233,16 +233,16 @@ <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[std::partial_ordering::equivalent]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 0.15 - Right (rhs): 0.15 + Left (lhs): 0.15 (0x1.3333333333333p-3) + Right (rhs): 0.15 (0x1.3333333333333p-3) Actual (lhs <=> rhs) : std::partial_ordering::equivalent Expected (expectedOrder): std::partial_ordering::greater]]></Description> </Incident> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <DataTag><![CDATA[std::partial_ordering::less]]></DataTag> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (lhs): 0.15 - Right (rhs): 0.25 + Left (lhs): 0.15 (0x1.3333333333333p-3) + Right (rhs): 0.25 (0x1p-2) Actual (lhs <=> rhs) : std::partial_ordering::less Expected (expectedOrder): std::partial_ordering::greater]]></Description> </Incident> @@ -374,8 +374,8 @@ <TestFunction name="checkWeakComparison"> <Incident type="fail" file="qtbase/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp" line="0"> <Description><![CDATA[The result of operator<=>() is not what was expected - Left (june) : 2012/06/20 14:33:02.500[CEST] - Right (juneLater): 2012/06/20 14:33:02.501[CEST] + Left (june) : 2012/06/20 14:33:02.500[UTC] + Right (juneLater): 2012/06/20 14:33:02.501[UTC] Actual (june <=> juneLater) : std::weak_ordering::less Expected (Qt::weak_ordering::greater): Qt::weak_ordering::greater]]></Description> </Incident> diff --git a/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp b/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp index bcc544d33a1..4a290f9f2fb 100644 --- a/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp +++ b/tests/auto/testlib/selftests/threewaycompare/tst_threewaycompare.cpp @@ -231,7 +231,7 @@ void tst_ThreeWayCompare::checkWeakComparison() QCOMPARE_3WAY(example_left, example_right, std::weak_ordering::less); - QDateTime june(QDate(2012, 6, 20), QTime(14, 33, 2, 500)); + QDateTime june(QDate(2012, 6, 20), QTime(14, 33, 2, 500), QTimeZone::UTC); QDateTime juneLater = june.addMSecs(1); QCOMPARE_3WAY(june, juneLater, Qt::weak_ordering::greater); #endif diff --git a/tests/auto/tools/qmake/testdata/invalid-info-plist/Info.plist b/tests/auto/tools/qmake/testdata/invalid-info-plist/Info.plist new file mode 100644 index 00000000000..5468597e2b4 --- /dev/null +++ b/tests/auto/tools/qmake/testdata/invalid-info-plist/Info.plist @@ -0,0 +1 @@ +<invalid> diff --git a/tests/auto/tools/qmake/testdata/invalid-info-plist/invalid-info-plist.pro b/tests/auto/tools/qmake/testdata/invalid-info-plist/invalid-info-plist.pro new file mode 100644 index 00000000000..0230f9c6736 --- /dev/null +++ b/tests/auto/tools/qmake/testdata/invalid-info-plist/invalid-info-plist.pro @@ -0,0 +1,2 @@ +SOURCES += main.cpp +QMAKE_INFO_PLIST = Info.plist diff --git a/tests/auto/tools/qmake/testdata/invalid-info-plist/main.cpp b/tests/auto/tools/qmake/testdata/invalid-info-plist/main.cpp new file mode 100644 index 00000000000..905869dfa38 --- /dev/null +++ b/tests/auto/tools/qmake/testdata/invalid-info-plist/main.cpp @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp index 278cf4ad232..080f0abbdaa 100644 --- a/tests/auto/tools/qmake/tst_qmake.cpp +++ b/tests/auto/tools/qmake/tst_qmake.cpp @@ -47,6 +47,7 @@ private slots: void rawString(); #if defined(Q_OS_DARWIN) void bundle_spaces(); + void invalid_info_plist(); #elif defined(Q_OS_WIN) void windowsResources(); #endif @@ -534,6 +535,23 @@ void tst_qmake::bundle_spaces() QVERIFY( test_compiler.removeMakefile(workDir) ); } +void tst_qmake::invalid_info_plist() +{ + QString workDir = base_path + "/testdata/invalid-info-plist"; + + // We set up alternate arguments here, to make sure we're testing Mac + // Bundles. We need to actually run make to check whether the failing + // plutil invocation breaks the build. + + test_compiler.setArguments(QStringList(), + QStringList() << "-spec" << "macx-clang"); + + QVERIFY( test_compiler.qmake(workDir, "invalid-info-plist") ); + + // Make fails: plutil fails to parse the Info.plist file + QVERIFY( test_compiler.make(workDir, QString(), true) ); +} + #elif defined(Q_OS_WIN) // defined(Q_OS_DARWIN) void tst_qmake::windowsResources() diff --git a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/BLACKLIST index aca3147b2d6..fde971443d4 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/BLACKLIST +++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/BLACKLIST @@ -1,3 +1,2 @@ [layoutDirection] ubuntu-22.04 -ubuntu-24.04 diff --git a/tests/auto/widgets/kernel/qapplication/BLACKLIST b/tests/auto/widgets/kernel/qapplication/BLACKLIST deleted file mode 100644 index c68c7d6b149..00000000000 --- a/tests/auto/widgets/kernel/qapplication/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ -[touchEventPropagation] -# QTBUG-66745 -opensuse-leap |