summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
Commit message (Collapse)AuthorAgeFilesLines
* Use SPDX license identifiersLucie Gérard28 hours84-3117/+201
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QVersionNumber: de-inline QList constructor calls and resize()Marc Mutz4 days2-12/+36
| | | | | | | | | | | | | | | | | | | The QList<int> range ctor and other QList<int> methods have percolated up near the top of the list of Clang -ftime-trace most expensive template instantiations in PCH libQt6Gui.so builds: **** Templates that took longest to instantiate: [...] 5138 ms: QList<int>::QList<const int *, true> (256 times, avg 20 ms) 4327 ms: QtPrivate::QCommonArrayOps<int>::appendIteratorRange<const int *> (256 times, avg 16 ms) The code in 6.3 is already sufficiently different for this patch to not be applicable there. Task-number: QTBUG-97601 Change-Id: I4420c8c90e472ecfd679b414cc4334d2ab55cce3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVarLengthArray: Move unique_ptr<void, free_deleter> to QVLABaseBaseMarc Mutz5 days1-4/+6
| | | | | | | | | | | | | | | | | This avoids repeated re-instantiations of unique_ptr with local deleters, removing that instantiation from the top of the list in Clang -ftime-trace QtWidgets builds: **** Templates that took longest to instantiate: 2627 ms: std::__1::unique_ptr<void, free_deleter> (835 times, avg 3 ms) Amends e297e80fd0ec6ce4c97ee1b40426c76377b45ecc. Pick-to: 6.3 Task-number: QTBUG-97601 Task-number: QTBUG-99039 Change-Id: I1281f6cf9248a3796d9dfdc653f19f5a67dc3bda Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove remnants of the old Intel C++ compilerThiago Macieira6 days1-1/+1
| | | | | | | | | | | | | We don't support it any more. I don't think it has ever properly compiled Qt 6 (and it's no longer working for me against GCC 12's libstdc++ headers). If you report a bug against it, Intel support's first question is if you can try instead the new Clang/LLVM-based oneAPI C++ compiler. So we support only that one, which identifies itself as Q_CC_CLANG. Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eb57a092c8439e Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QHash: port away from std::aligned_storageMarc Mutz10 days1-1/+1
| | | | | | | | | | | It's deprecated in C++23. Just use an explicitly-aligned char array directly, wrapped in a struct to avoid decays to char*. Task-number: QTBUG-99122 Pick-to: 6.3 6.2 Change-Id: I802761c1af62efa6ffc006b07837a7deed1ea4cc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use Q_CC_{GNU,MSVC}_ONLY when comparing to particular versionsMarc Mutz11 days2-3/+3
| | | | | | | | | | | | | | | | | This prevents false-negatives and false-positives, as e.g. Clang 10.0.0 masks as GCC 4.2, so Q_CC_GNU is 402 on that compiler. Depending on the test (Q_CC_GNU > NNN or Q_CC_GNU < NNN), the result of the test is almost random. Q_CC_<comp>_ONLY makes sure we match only GCC or MSVC, not bycatch such as Clang or ICC. Pick-to: 6.3 6.2 5.15 Change-Id: I4c550a11ecf85fc9a2216b330b69bd03d45b47e0 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QVersionNumber: Show type in QDebug outputFlorian Bruhin13 days1-1/+2
| | | | | | | | | | | To make it clearer what kind of object is being printed, and also more consistent with the QDebug output of other classes. Fixes: QTBUG-103085 Pick-to: 6.3 Change-Id: Ia7441dd373d359be2a87ec618684d27375a1dcf8 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qhashfunctions.h: add std::hash specialization for QByteArrayViewThiago Macieira2022-04-221-0/+1
| | | | | | | | [ChangeLog][QtCore][QByteArrayView] Added std::hash specialization. Change-Id: If05aeeb7176e4f13af9afffd16e7f03dfa413a66 Reviewed-by: Rui Oliveira Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QVarLengthArray: add missing (size, value) ctorMarc Mutz2022-04-132-0/+21
| | | | | | | | | | | Extend the corresponding test in tst_containerapisymmetry. [ChangeLog][QtCore][QVarLengthArray] Added (size, value) constructor. Fixes: QTBUG-102469 Change-Id: I4802eebe6ba1a6835e4d6f41e1d3db2a0d7c7894 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVarLengthArray: simplify SFINAE on resize(n, v)Marc Mutz2022-04-131-6/+6
| | | | | | | | | | | | Use our usual if_x<> = true pattern to move the constraint to where it belongs (absent C++20 requires-clauses): into the template argument list. Amends a00a1d8806cfbf17e04b88d1b4ff4a9cf5b6294a. Change-Id: I846b96bdeec3def221346897181d3d4d3a55316d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Q[Multi]Hash: fix squeeze()Ivan Solovev2022-04-061-15/+29
| | | | | | | | | | | | | | | | | | | When calling QHash::reserve(), or when creating the internal QHashPrivate::Data structure, the value 0 for the size parameter is reserved for performing the squeeze operation. However commit 8a984ab772dd194e39094e728b869e65912912a7 broke it, by using the 0 value in QHashPrivate::Data constructors as a mark that no resizing needs to be done. This patch reverts the problematic commit (also applying some later fixes to the code), and adds the missing tests for Q[Multi]Hash::squeeze(). Pick-to: 6.3 6.2 Change-Id: Id644df7b2beb008e6a37b2c89b709adfbd893e25 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Q[Multi]Hash::reserve(): do nothing if desired size is less than currentIvan Solovev2022-04-061-0/+6
| | | | | | | | | | | | | | | | Calling Q[Multi]Hash::reserve(n) when n is much smaller than the current amount of elements in the hash, could result in an infinite loop, because at some point the algorithm could not find a free bucket for the element. Fixing it by returning early if the new desired capacity is less than current. Fixes: QTBUG-102067 Pick-to: 6.3 6.2 Change-Id: I38ef0b2168c4e2a317eedf91b2155b1fdffb1c27 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QByteArray/QVarLengthArray: add missing resize(n, v) overloadsMarc Mutz2022-04-062-5/+35
| | | | | | | | | | | | | | | | | | QList and QString had them, so add them to QByteArray and QVarLengthArray, too. In the QVLA case, we need to jump though a hoop or two to avoid having to duplicate all the reallocation logic. Nothing a few template tricks cannot solve. [ChangeLog][QtCore][QByteArray] Added resize(n, ch) overload. [ChangeLog][QtCore][QVarLengthArray] Added resize(n, v) overload. Fixes: QTBUG-102270 Change-Id: I0d281ae5b574f440f682e4a62427b434dcf5b687 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: QMap: Add ref-qualifiers to \fn signatures for toStd[Multi]Map()Topi Reinio2022-03-312-2/+2
| | | | | | | | | | Because of a bug in QDoc there was never a warning reported for the missing qualifiers. Pick-to: 6.3 Task-number: QTBUG-101461 Change-Id: Ibb9114bc5d29e75158d2ac254169ba2a73043f0d Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* Apply Q_CONSTINIT across the codebaseMarc Mutz2022-03-293-7/+9
| | | | | | | | | Still not complete. Just grepping for static and thread_local. Task-number: QTBUG-100486 Change-Id: I90ca14e8db3a95590ecde5f89924cf6fcc9755a3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtCore: Replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-03-265-10/+10
| | | | | | | Task-number: QTBUG-98434 Change-Id: Ib7c5fc0aaca6ef33b93c7486e99502c555bf20bc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QtCore: replace QLatin1String/QLatin1Char with _L1/u'' where applicableSona Kurazyan2022-03-253-14/+16
| | | | | | | | | | | As a drive-by, did also minor refactorings/improvements. Task-number: QTBUG-98434 Change-Id: I81964176ae2f07ea63674c96f47f9c6aa046854f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
* Fix build with latest Apple clang versionVolker Hilsheimer2022-03-211-2/+2
| | | | | | | | | | | | | | | | | | Building with Apple clang 13.1.6.13160021 (from command line tools 13.3) results in qhash.cpp:754:39: error: passing 16-byte aligned argument to 32-byte aligned parameter 3 of 'operator()' may result in an unaligned pointer access [-Werror,-Walign-mismatch] hash2x32bytes(state0, state1, src, src + 1); ^ Help the compiler with deducing the right type for 'src' and 'srcend'. Also makes 'src' const explicitly. Change-Id: Id14a034f0fa4c2a002d9b37729d803a50a0e5e9c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRect: add toRectF()Marc Mutz2022-03-192-4/+24
| | | | | | | | | | For symmetry with QRectF::toRect(). [ChangeLog][QtCore][QRect] Added toRectF(). Fixes: QTBUG-73160 Change-Id: If2bda64b8fe4bc113191dda927e9bb86ebcb4c69 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLine/QMargins: add toLineF/toMarginsF()Marc Mutz2022-03-194-7/+38
| | | | | | | | | | | | | For symmetry with QLineF::toLine(). [ChangeLog][QtCore][QLine] Added toLineF(). [ChangeLog][QtCore][QMargins] Added toMarginsF(). Task-number: QTBUG-73160 Change-Id: I69051cdd2fe4a3c0a000ab86e363a2918a7aea7c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QSize/QPoint: add toSizeF/toPointF()Marc Mutz2022-03-194-8/+36
| | | | | | | | | | | | | For symmetry with QSizeF::toSize(). [ChangeLog][QtCore][QSize] Added toSizeF(). [ChangeLog][QtCore][QPoint] Added toPointF(). Task-number: QTBUG-73160 Change-Id: I65b088b4f7365ab671ef2f0c75821b707f5ac26d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QMargins: fix a missing "full stop" in the docsMarc Mutz2022-03-191-1/+1
| | | | | | Pick-to: 6.3 6.2 5.15 Change-Id: Ic8012ce12ef8d2fee2dc785e373e9c9d8f658ff5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVariant: reduce transitive includesFabian Kosmale2022-03-171-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Forward declare more types in qvariant.h, and do the same for qdebug.h (which will be removed from qvariant in a separate patch). As we now only forward declare containers (e.g. QMap, QList, ...), code which includes <QVariantMap>, <QVariantList>... breaks without further adjustment: So far, those headers simply included qvariant.h. However, by introducing new actual headers for those types and adjusting sync.profile, we can avoid this issue. To avoid breaking leaf modules and user code, we make the change opt-in: Unless QT_LEAN_HEADERS is defined to a value of >= 1, we still include the superfluous headers. We also set this macro in qtbase via QT_EXTRA_INTERNAL_TARGET_DEFINES. [ChangeLog][Potentially Source-Incompatible Changes] qvariant.h no longer includes <QList>, <QMap>, <QHash>, <QVarLengthArray>, <QSet> and <QObject>. Code that relied on transitive includes might need to explicitly include those headers now. Notably, including <QVariant> (or qvariant.h) is no longer sufficient when using QVariant(List|Map|Hash). Using them now requires including respectively <QVariantList>, <QVariantMap>, or <QVariantHash>. Alternatively, including <QVariant> and the <QList>, <QMap> or <QHash> header also works. [ChangeLog][Potentially Source-Incompatible Changes] qdebug.h no longer includes <QSet>, <QHash>, <QVarLengthArray> and <QMap>. Code that relied on transitive includes might need to explicitly include those headers now. Task-number: QTBUG-97601 Change-Id: I142e5de709ed0b305716369a3266389ab7fbbb71 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Core: Do not depend on transitive includesFabian Kosmale2022-03-171-0/+1
| | | | | Change-Id: I2c71188a4d27692a2d6ef1aa447b329627214b17 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QHash: fix -Werror=maybe-uninitialized (GCC 11.2)Marc Mutz2022-03-171-1/+1
| | | | | | | | | | | | | | | | The compiler doesn't understand understand that the only way ok can be true is for qstrntoll() to have been executed. qhash.cpp:158:9: error: ‘seed’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 158 | if (seed) { | ^~ Help poor GCC by initializing the variable unconditionally. Amends cc5cc3225d6a397270a6d4c615e850e43db805c4. Change-Id: Ic8387e0add2291d994f7f4d96c4bc614b2a8aa99 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFlatMap: make insertion STL-compatibleMarc Mutz2022-03-161-23/+51
| | | | | | | | | | | | | | | | | | | | | | That is, insert() doesn't overwrite an existing entry, and range insert inserts the first of equivalent keys' values, not the last. This allowed this author to optimize the implementation of makeUnique() to a O(N) algorithm (was: O(N²)). Said optimization would have been possible with the old semantics, too, but I wrote the algorithm first and only then noticed the broken insert() behavior is present on QFlatMap, too, so I decided not to let good code go to waste and to fix both problems at the same time. In order to give users a hint of the changed semantics, make the new API opt-in until Qt 6.5, so Qt 6.4 ships with the both the old and the new semantics disabled, where they contradict. Fixes: QTBUG-100092 Change-Id: Ic96d8bfe6bed9068dbe8c0d7171bd8921050fd95 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QHash: Initialize the hash seed as soon as QtCore loadsThiago Macieira2022-03-151-11/+31
| | | | | | | | | | | | | | | | | | | | Instead of lazily initializing (with some platform exceptions, see the equivalent qsimd.cpp commit). The rationale is the same as for qCpuFeatures(): this the qHashBits() function is hot and the current code generation needs to save a lot of state because of the possible call to the C++ runtime functions to enable the thread-safe initialization of the hash seed. [ChangeLog][Important Behavior Changes] QtCore now initializes the QHash global seed before the main() function is run, so it is no longer possible to use qputenv() to affect the seed value for the current process. Disabling the random global seed for the current process should be done programmatically with by calling either the 6.2 function QHashSeed::setDeterministicGlobalSeed() or, if compatibility with Qt 5 is required, by calling qSetGlobalQHashSeed() with value 0. Change-Id: I54f205f6b7314351b078fffd16cf7eae93f9e27e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QVersionNumber: Make documentation period display style consistentChristian Heimlich2022-03-151-1/+1
| | | | | | | | | | | | | | | | | | In the current documentation for this class there are two ways that the period character is referred to. Code Style: https://doc.qt.io/qt-6/qversionnumber.html#fromString Quote Style: https://doc.qt.io/qt-6/qversionnumber.html#fromString-1 The code-style version is significantly clearer and clean looking, while the quote-style version is easy to misinterpret, especially when followed by an additional period at the end of a sentence. This change updates the documentation so that the nicer style is used in all locations to improve clarity and consistency. Change-Id: I11a6d82accb923e24c00b93728ea084d27efd06d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use qstringfwd.h when forward declaring string classesSona Kurazyan2022-03-121-3/+1
| | | | | | Task-number: QTBUG-98434 Change-Id: I37b70a1b7bc164fa7dc9cb702827297ca66a6fdc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFlatMap: fix warning -Wunused-but-set-variable (GCC) in remove_if()Marc Mutz2022-03-111-1/+1
| | | | | | | | Amends 6f5c78fe3d445f1c6c8738f9cedb9dbd847645fa. Change-Id: I01a474f8ccb9de7d7b76a33a950542e38edc78e4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* CMake: add detection of x86 VAES and AVX512VBMI2 featuresThiago Macieira2022-03-081-1/+1
| | | | | | | | We have VAES code in qhash.cpp that isn't getting compiled right now. Change-Id: Ibf4acec0f166495998f7fffd16d6961261dec361 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QWeakPointer: befriend other QWeakPointersThiago Macieira2022-03-041-1/+2
| | | | | | | | | | Commit c677b3b8afcdc1d7b57353826cc01f378cd25e99 added move constructors, which introduced the issue. Pick-to: 6.2 6.3 Fixes: QTBUG-100795 Change-Id: I74249c52dc02478ba93cfffd16d2c879b923e352 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QCryptographicHash: code tidiesGiuseppe D'Angelo2022-03-041-11/+11
| | | | | | | | | | | Rename the resize() function of its internal buffer into the possibly better resizeForOverwrite(). The point is that unlike an ordinary resize the data in the buffer is NOT initialized, and therefore must be overwritten by the caller, "or else". Change-Id: I7d82821e92f59f7eeab18c51d98003826ffe164b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
* Associative containers: add a way to obtain a key/value rangeGiuseppe D'Angelo2022-03-046-0/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our associative containers' iterator's value_type isn't a destructurable type (yielding key/value). This means that something like for (auto [k, v] : map) doesn't even compile -- one can only "directly" iterate on the values. For quite some time we've had QKeyValueIterator to allow key/value iteration, but then one had to resort to a "traditional" for loop: for (auto i = map.keyValueBegin(), e = keyValueEnd(); i!=e; ++i) This can be easily packaged in an adaptor class, which is what this commmit does, thereby offering a C++17-compatible way to obtain key/value iteration over associative containers. Something possibly peculiar is the fact that the range so obtained is a range of pairs of references -- not a range of references to pairs. But that's easily explained by the fact that we have no pairs to build references to; hence, for (auto &[k, v] : map.asKeyValueRange()) doesn't compile (lvalue reference doesn't bind to prvalue pair). Instead, both of these compile: for (auto [k, v] : map.asKeyValueRange()) for (auto &&[k, v] : map.asKeyValueRange()) and in *both* cases one gets references to the keys/values in the map. If the map is non-const, the reference to the value is mutable. Last but not least, implement pinning for rvalue containers. [ChangeLog][QtCore][QMap] Added asKeyValueRange(). [ChangeLog][QtCore][QMultiMap] Added asKeyValueRange(). [ChangeLog][QtCore][QHash] Added asKeyValueRange(). [ChangeLog][QtCore][QMultiHash] Added asKeyValueRange(). Task-number: QTBUG-4615 Change-Id: Ic8506bff38b2f753494b21ab76f52e05c06ffc8b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Minor clean-ups noticed during string-parsing improvementsEdward Welbourne2022-03-031-1/+1
| | | | | | | | Simplify a conditional to save some repetition, purge some spurious parentheses. Change-Id: I727d22ce81733e765c4ee951475ccdb599063399 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QFlatMap: add remove_ifMarc Mutz2022-03-031-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing API of QFlatMap did not allow efficient removal of elements: - std::remove_if does not apply, because it works by moving elements back in the range onto those that need to be removed, which doesn't work in flat_map's case, because, like for all associative containers, the key in value_type is const. - The node-based erase-loop (over it = cond ? c.erase(it) : std::next(it)) works, but, unlike in traditional associative containers, is quadratic, because flat_map::erase is a linear operation. According to Stepanov's principle of Efficient Computational Basis (Elements of Programming, Section 1.4), we're therefore missing API. Add it. I couldn't make up my mind about the calling convention for the predicate and, despite having authored a merged paper about erase_if, can never remember what the predicate is supposed to take, so be fancy and accept all: (*it), (it.key(), it.value()), (it.key()). This means that unary predicates can either not be generic or must be properly constrained to distinguish between pair<const K, V> and K, but that's not necessarily a bad thing. There's no reason to supply a Qt-ified removeIf on top of the standard name, because this is private API and doubling the names would do nothing except double the testing overhead. Fixes: QTBUG-100983 Change-Id: I12545058958fc5d620baa770f92193c8de8b2d26 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Revert "Change third party SHA-3 implementation to use"Øystein Heskestad2022-03-011-117/+144
| | | | | | | | | | This reverts commit 6deded8bc42d5275c08039812c388a3c593244df. Reason for revert: The new SHA-3 implementation cannot generate digest noexcept, which is required by the QCryptographicHash API. Task-number: QTBUG-71327 Change-Id: I9a49acd529090d479c7d5e9583dd25e0ec669806 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Make sure all qtbase private headers include at least one otherThiago Macieira2022-02-243-4/+5
| | | | | | | | | | See script in qtbase/util/includeprivate for the rules. Since these files are being touched anyway, I also ran the updatecopyright.pl script too. Change-Id: Ib056b47dde3341ef9a52ffff13ef677e471674b6 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QHash: Fix building for i386 after "add support for VAES and AVX512VL"Martin Storsjö2022-02-241-1/+1
| | | | | | | | | | Fix a typo from da1720485eee265c40b3832dc92c19100891d86f, where mm_cvtsz_si128 was undefined when building for a 32 bit target. The code would make it seem this was a typo, with the listing of defines didn't match between 32 and 64 bit. Change-Id: Ica24d88e7f71ecd1d24ed990773711f9105f3ec8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* qHash: fix running on CPUs without AVX2Thiago Macieira2022-02-221-1/+1
| | | | | | | | | | The extra "V" accidentally enabled AVX2 code in the aeshash128() function. Fixes: QTBUG-101082 Change-Id: Ibf4acec0f166495998f7fffd16d63e220dbe02d0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Robert Löhning <robert.loehning@qt.io>
* Protect headers against min/max macrosMarc Mutz2022-02-221-2/+2
| | | | | | | | | | | | ... using the usual pattern, which, being idiomatic, doesn't need a comment explaining it. Pick-to: 6.3 Change-Id: Id6b12450495a18f89e1f83f2018b6218b03ff6a7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QHash: split the x86 AES hash into three separate functionsThiago Macieira2022-02-201-27/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of performing decisions inside the single aeshash() function, we have three implementations instead. Those decisions are permanent for each CPU, so the branch predictor should be pretty good, but hashing is somewhat performance-sensitive. We're only adding three of the four possible combinations of AVX512VL and VAES. Excluded from the implementation are the CPUs that support AVX512 but not VAES, which are the Skylake-based ones. Those are mostly found in server CPUs (Intel Xeon Scalable line) as well as top-end workstations (Intel Core i9), but never made into general desktop and laptop parts. For those, the performance will remain what it was in Qt 6.3. VAES is supported in Intel architectures codenamed Sunny Cove and Gracemont and their successors. That means it's supported in both the E and P cores of the Intel Alder Lake (12th Generation Core), as well as future Atom lines. But neither Atoms nor hybrid CPUS have AVX512 (at least when the E cores are active). AVX512+VAES is supported for Ice Lake (10th Generation Core), Tiger Lake (11th) as well as later generation with AVX512 support enabled. Like in qstring.cpp, we restricted ourselves to 256-bit operations, which don't cause performance impact and because the 512-bit VAESENC operates on the fused Ports 0 and 1, so it has the exact same throughput as two 256-bit VAESENC. Change-Id: I6fcda969a9e9427198bffffd16cece9c37dbdbd3 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QHash: invert the case that is excluded: use VAES and AVX512VLThiago Macieira2022-02-201-30/+34
| | | | | | | | | | | | | | It's not worth having both cases, since they run at the same time. The difference is which CPUs they run for: the non-VAES AVX512 code can run on the Skylake-based AVX512 CPUs, which aren't a usual target for Qt (servers and workstations), while the AVX512 and VAES case includes the Ice Lake and Tiger Lake desktop and laptop CPUs. This is not a good trade-off, but is an stepping stone for the next commit. Change-Id: I6fcda969a9e9427198bffffd16cecbe76e03c884 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QHash: add support for VAES and AVX512VLThiago Macieira2022-02-201-36/+185
| | | | | | | | | | | | | | | The strategy is explained in the aeshash() function. I've chosen to exclude the case of simultaneous VAES and AVX512VL support for len <= 32 case. Instead, the aeshash128_lt32_avx256() does not attempt to use VAES, because we wouldn't be getting sufficient benefit at the cost of code expansion (AESENC can dispatch 2 per cycle). See simulation at https://analysis.godbolt.org/z/8Y54PMWGj. The code is slightly convoluted with unexpected indentation so most of the important lines in the algorithm aren't changed by this commit. Change-Id: I6fcda969a9e9427198bffffd16ceca30f5e924b5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QByteArray: Extract Function QtMiscUtils::caseCompareAscii()Marc Mutz2022-02-191-0/+9
| | | | | | Change-Id: Id9c385f4df4f33792738cd134fabb9cc03cab809 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QColor: avoid Unicode table lookups in fromString()Marc Mutz2022-02-181-0/+5
| | | | | | | | | | | | | | All color names supported by QColor are US-ASCII. Enforce this with a static_assert, then use this fact to perform the case-folding of the input in US-ASCII instead of Unicode. Avoids lookups in the Unicode tables. Add QtMiscUtils::toAsciiLower() to foster sharing. Change-Id: Ie0e123405d772943313dc4be1808667b152770b1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QHash: fix off-by-one in assertionsMårten Nordheim2022-02-161-6/+6
| | | | | | | | | | | | | Coverity-Id: 378365 Coverity-Id: 378366 Coverity-Id: 378399 Coverity-Id: 378427 Coverity-Id: 378468 Coverity-Id: 378472 Pick-to: 6.3 6.2 Change-Id: Ib1efeacb59030b9d004320e56f560367f564d207 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change third party SHA-3 implementation to useØystein Heskestad2022-02-151-144/+117
| | | | | | | Task-number: QTBUG-71327 Change-Id: I14fef2a6f66dfb26f635cc7b6bde2b7cbf733ea7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QFlatMap: temporarily disable some codeMarc Mutz2022-02-141-0/+8
| | | | | | | | | | | | | | ... which implements or assumes something about the broken^Wnon-STL-compliant insertion behavior. Once this has integrated into all module dependencies, we can re-implement these APIs using STL-compatible semantics. Task-number: QTBUG-100092 Change-Id: I54f4f5ce7addd9543866d2c399f48aff50983b88 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QHashSeed: remove 'pure' attribute on globalSeed()Marc Mutz2022-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While 'pure' in GCC is weaker than Stepanov's Regular Procedure from Elements of Programming (equal result for equal inputs), it does not allow accesses to volatile memory: > functions declared with the pure attribute can safely read any > non-volatile objects The globalSeed() function reads from an atomic variable that can be changed at any time from another thread. Atomics, while not volatile objects in the sense of the keyword, must fall under the pure attribute doc's exclusion criterion: The difference between a volatile and an atomic access, while important for the implementation of the function, is indistinguishable to the caller of the function: both volatile and atomic objects can change value without the current thread of execution changing them, with no way for the caller of the function to distinguish which one occurred. Therefore, globalSeed() should not be pure. 5.15 is not affected, as qGlobalQHashSeed() is not marked as pure. Task-number: QTBUG-62185 Pick-to: 6.3 6.2 Change-Id: I6fc52e2bd41ef4aa3f8039072b47c7a1314b98fa Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>