summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qversionnumber.h
Commit message (Collapse)AuthorAgeFilesLines
* QVersionNumber: use new comparison helper macrosTatiana Borisova3 days1-18/+14
| | | | | | | | | | Replace public friend operators operator==(), operator!=(), operator<(), etc of QVersionNumber to friend methods comparesEqual() / compareThreeWay(). Task-number: QTBUG-120304 Change-Id: Ib94a1a28ca9843ca5d5a8d07f41c63de9fe584bb Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Port QVersionNumber to QSpanMarc Mutz2024-04-181-5/+7
| | | | | | | | | | | | | | | | | | | | | | The new ctor could replace all existing ones. However, keep the QList ctors to participate in implicit sharing, but mark them as weak overloads in order to break the ambiguity for arguments that convert to both QList and QSpan. Also keep the initalizer_list ctor because it's implicit, and should be. [ChangeLog][Potentially Source-Incompatible Changes] We have begun to port APIs to QSpan, replacing overload sets of concrete container classes. This breaks code that relied on concrete container class overloads and passed types that implicitly convert to such a container, but not to QSpan. The backwards-compatible fix is to make the conversion explicit. [ChangeLog][QtCore][QVersionNumber] Added construction from QSpan, replacing the QVarLengthArray constructor. Fixes: QTBUG-121480 Change-Id: I9be173d0471872ddc449c876465c6a01abc49ff4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVersionNumber: apply LWG 3346 work-aroundMarc Mutz2024-02-081-0/+2
| | | | | | | | | | | | QtWebEngine builds using GCC 10.2 have hit the GCC < 10.4 problem with containers that define both element_type and value_type, so lift the work-around from QList to QVersionNumber, too. Amends 2188ca2c5df6f21a953c002edbe5b2d2cc2c2d2c. Fixes: QTBUG-122037 Change-Id: Idb59b5325ab6308cfd7d1a5559e45a01a5802099 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QVersionNumber: make iterableMarc Mutz2024-01-311-0/+73
| | | | | | | | | | | Since QVersionNumber doesn't have an existing way to modify individual segments, provide only const_iterator. [ChangeLog][QtCore][QVersionNumber] Added (const) iterators over segments (begin()/end(), incl. c- and r- variants). Change-Id: Ia9af70c2a9c59f630123894ad2c9f38031ef5b8f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Dissociate QTypeRevision from QVersionNumberMarc Mutz2024-01-101-153/+3
| | | | | | | | | | | | | | | | They have nothing to do with each other, so give QTypeRevision its own header and implementation file instead of piggy-backing on QVersionNumber's. Picking back to current LTS to incur the merge conflict only once, not per (expected) follow-up change. Amends ed080c64ae21d22115d16780a5903d7cc4fd1546. Pick-to: 6.7 6.6 6.5 Change-Id: I2fa5d0e68f95864126bc95e3d8154134eee85553 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Use SPDX license identifiersLucie Gérard2022-05-161-40/+4
| | | | | | | | | | | | | 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 Mutz2022-05-131-12/+13
| | | | | | | | | | | | | | | | | | | 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>
* QtCore: Replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-03-261-1/+1
| | | | | | | Task-number: QTBUG-98434 Change-Id: Ib7c5fc0aaca6ef33b93c7486e99502c555bf20bc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Make one QT_REMOVED_SINCE/QT_BUILD_REMOVED_API per moduleMarc Mutz2022-02-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A single global QT_REMOVED_SINCE will start hurting us once more modules downstream of QtCore start using the mechanism. With every use of feature, the set of code that needs to compile under QT_BUILD_REMOVED_API increases. Since we use QT_REMOVED_SINCE in situations where overloading the new and the old function don't work in general, this means all code included by any removed_api.cpp needs to be very carefully written to ensure that any calls to the overload set formed by the combination of old and new function(s) don't create ambiguities. Likewise, the set of APIs that change semantics under QT_BUILD_REMOVED_API also increases. At some point, the combination of removed_api.cpp including almost every module header and almost every header exposing source-incompatibilities when included in removed_api.cpp will make maintenance a headache. By making QT_REMOVED_SINCE and QT_BUILD_REMOVED_API per-module (QT_CORE_REMOVED_SINCE, ...), easy now that we generate the export macros using CMake, we limit the scope of this problem to the module using the feature. Downstream modules (say, QtWidgets) will now see the QtCore API like every other user, even in the widgets/compat/removed_api.cpp TU. Pick-to: 6.3 Change-Id: I177bc7bd5aa8791639f97946c98e4592d2c7f9d9 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QVersionNumber: remove the "pure" attribute from commonPrefix()Thiago Macieira2022-01-281-1/+1
| | | | | | | | This function can allocate memory, so it's not pure. Pick-to: 5.15 6.2 6.3 Change-Id: I6fcda969a9e9427198bffffd16ce7fcff3ae021d Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QVersionNumber: remove "pure" declaration from fromString()Thiago Macieira2022-01-281-4/+4
| | | | | | | | | | | | | | GCC doesn't like that we modify the contents of passed by pointer in the pure function. Reading the description of this attribute in the GCC manual was ambiguous then, but I can see the GCC maintainers' interpretation. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104243 Fixes: QTBUG-62185 Pick-to: 5.15 6.2 6.3 Change-Id: I6fcda969a9e9427198bffffd16cdf815d059d252 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Prevent repeated instantiations of some qRegisterNormalizedMetaType<>s [1/N] ↵Marc Mutz2022-01-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (QtGui) Create macros that wrap the magic developed in 7d63efc16f65f98c657caa90e0d7e9b72a879ade and apply it to all Q_DECLARE_METATYPE invocations that show up in Clang -ftime-trace for a PCH'ed QtGui build. Effects on compile times: Clang 10 -ftme-trace: $ ClangBuildAnalyzer --analyze qtgui-before.trace | head -n6 Analyzing build trace from 'qtgui-before.trace'... **** Time summary: Compilation (523 times): Parsing (frontend): 628.3 s Codegen & opts (backend): 304.5 s $ ClangBuildAnalyzer --analyze qtgui-after.trace | head -n6 Analyzing build trace from 'qtgui-after.trace'... **** Time summary: Compilation (523 times): Parsing (frontend): 546.0 s Codegen & opts (backend): 304.4 s GCC 11 time (bash builtin): before: $ time for ((i=0; i < 3; ++i)) do touch src/gui/painting/qpolygon.h ; ninja libQt6Gui.so; done real 4m13,539s user 49m24,416s sys 3m18,177s after: $ time for ((i=0; i < 3; ++i)) do touch src/gui/painting/qpolygon.h ; ninja libQt6Gui.so; done real 3m55,697s user 45m19,941s sys 3m7,370s Task-number: QTBUG-97601 Pick-to: 6.3 Change-Id: Ia8e37a58937568a7ed21cfeb4b27274deca4d53b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtCore: replace qSwap with std::swap/member-swap where possibleMarc Mutz2022-01-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qSwap() is a monster that looks for ADL overloads of swap() and also detects the noexcept of the wrapped swap() function, so it should only be used when the argument type is unknown. In the vast majority of cases, the type is known to be efficiently std::swap()able or to have a member-swap. Call either of these. For the common case of pointer types, circumvent the expensive trait checks on std::swap() by providing a hand-rolled qt_ptr_swap() template, the advantage being that it can be unconditionally noexcept, removing all type traits instantiations. Don't document it, otherwise we'd be unable to pick it to 6.2. Effects on Clang -ftime-trace of a PCH'ed libQt6Gui.so build: before: **** Template sets that took longest to instantiate: [...] 27766 ms: qSwap<$> (9073 times, avg 3 ms) [...] 2806 ms: std::swap<$> (1229 times, avg 2 ms) (30572ms) after: **** Template sets that took longest to instantiate: [...] 5047 ms: qSwap<$> (641 times, avg 7 ms) [...] 3371 ms: std::swap<$> (1376 times, avg 2 ms) [qt_ptr_swap<$> does not appear in the top 400, so < 905ms] (< 9323ms) As a drive-by, remove superfluous inline keywords and template ornaments. Task-number: QTBUG-97601 Pick-to: 6.3 6.2 Change-Id: I88f9b4e3cbece268c4a1238b6d50e5712a1bab5a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QVersionNumber: don't detach() in rvalue QList/QVector ctorMarc Mutz2022-01-191-2/+2
| | | | | | | | | | | | Qt 5 uses begin() so the fix there will be to use cbegin(). Found by Clang -ftime-trace pin-pointing repeated instantiations of QList<int>::data(). Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-97601 Change-Id: I6410e5b303766fdbc7e158a9ac1263adec973099 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QVersionNumber: don't allocate in fromString() in the common caseMarc Mutz2022-01-181-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use QVarLengthArray instead of QList to avoid allocations in the case where the result fits into inline storage. Of course, we now perform one allocation more when we need the QList backend, but a) that should be the rarer case and b) we use 32 (more than InlineSegmentsCount) Prealloc for the QVarLengthArray to reliably skip the first few QList non-reserved capacity jumps (measured to be {4, 12, 28} for back-insertion, not all of which is probably available for append()s) to come out ahead either way. Reviewers may object, saying that we could just reserve(32) the QList, too, but while that would skip over the first few QList reallocations alright, it means we'd be carrying the extra capacity around for the duration of the QVersionNumber's lifetime (unless we'd shrink it at the end, bringing back the additional allocation and that solution back to par compared to this one). As a consequence: [ChangeLog][QtCore][QVersionNumber] Can now be also be constructed from QVarLengthArray. Change-Id: I4016367f64f6cefa6ed9147d33b06636f36b02cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVersionNumber: port fromString() to QAnyStringViewMarc Mutz2022-01-181-6/+20
| | | | | | | | | | | | | | | | | We can handle the UTF-8 case by reinterpreting it as Latin-1. This way, the suffixIndex stays valid as a return value. As a drive-by, optimize away toLatin1() calls by using a QVLA. We really need a better way of converting UTF-16 -> L1 than qt_to_latin1()... [ChangeLog][QtCore][QVersionNumber] fromString() now takes QAnyStringView (was: QString, QStringView, QLatin1String) and a qsizetype pointer (was: int pointer). Change-Id: I86abaadba2792658fbf93ccd1e0b86e3302c697c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVersionNumber: change int to qsizetype in fromString()Thiago Macieira2022-01-171-3/+9
| | | | | | | | | This completes the update to qsizetype in this class, adding a couple of methods that need to be removed in Qt 7. They're only required where int is not qsizetype (i.e., 64-bit platforms). Change-Id: I0e5f6bec596a4a78bd3bfffd16c9de29bec4c637 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QVersionNumber: change int to qsizetype for index and lengthThiago Macieira2022-01-161-18/+22
| | | | | | | | | | | | | | | | | | This class is not exported, so we can change the non-exported methods. None of the exported methods required change; notably, QVersionNumber::Segments::setVector didn't because it's only called with values 1, 2, and 3. [ChangeLog][Potentially source-incompatible changes] Updated the QVersionNumber API to use qsizetype where length and index values were used. This change retains binary compatibility and the vast majority of users will not experience a source compatibility problem. It could occur with ambiguous overloads when passing results from QVersionNumber to other API not using either int or qsizetype. There could also be new warnings from compilers about converting 64-bit types to 32-bit ones. Change-Id: I0e5f6bec596a4a78bd3bfffd16c9984b61c9b55b Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QVersionNumber: fix iterator/pointer mistakeGiuseppe D'Angelo2021-09-171-6/+6
| | | | | | | | | | | | The dataFitsInline and setInlineData functions take a pointer/size pair, not an iterator/size pair. The code was working because QList iterators implicitly convert to pointers -- but that's sloppy, just use the list's data() function instead. Do a similar change for the constructor taking an initializer_list, for symmetry. Change-Id: I2cec191620185b3b08169c4051296eb610f14ecf Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-11-301-2/+2
| | | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this patch should have no impact on users. Pick-to: 6.0 Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Hide QTypeRevision comparison operators from ADLVolker Hilsheimer2020-10-301-46/+46
| | | | | | | | | | | | | | Make them hidden friends, follow up on 72ccb4fa7b88243064867b23713384e14cef6087 which did the same for QVersionNumber. Also add [[nodiscard]]. The operators are not documented, so nothing to adjust. Adding documentation should be done in a separate commit. Task-number: QTBUG-87973 Change-Id: I65e889a2d0a222f3318b77965e84f3220f1542c7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Make QVersionNumber and QArrayDataPointer comparisons hiddenAllan Sandfeld Jensen2020-10-271-18/+19
| | | | | Change-Id: I8de0407843103b49877621534c14046e3a7d1b2f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Whitespace cleanup in corelib/toolsAllan Sandfeld Jensen2020-10-211-7/+8
| | | | | Change-Id: Ibe796c398a8e5488b7203abb07aa54740744f1ab Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Centralize the implementation of move assignment operatorsGiuseppe D'Angelo2020-10-031-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment we have two main strategies for dealing with move assignment in Qt: 1) move-and-swap, used by "containers" (in the broad sense): containers, but also smart pointers and similar classes that can hold user-defined types; 2) pure swap, used by containers that hold only memory (e.g. QString, QByteArray, ...) as well as most implicitly shared datatypes. Given the fact that a move assignment operator's code is just boilerplate (whether it's move-and-swap or pure swap), provide two _strictly internal_ macros to help write them, and apply the macros across corelib and gui, porting away from the hand-rolled implementations. The rule of thumb when porting to the new macros is: * Try to stick to the existing code behavior, unless broken * if changing, then follow this checklist: * if the class does not have a move constructor => pure swap (but consider ADDING a move constructor, if possible!) * if the class does have a move constructor, try to follow the criteria above, namely: * if the class holds only memory, pure swap; * if the class may hold anything else but memory (file handles, etc.), then move and swap. Noteworthy details: * some operators planned to be removed in Qt 6 were not ported; * as drive-by, some move constructors were simplified to be using qExchange(); others were outright broken and got fixed; * some contained some more interesting code and were not touched. Change-Id: Idaab3489247dcbabb6df3fa1e5286b69e1d372e9 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Replace Q_REQUIRED_RESULT with [[nodiscard]]Allan Sandfeld Jensen2020-09-251-22/+22
| | | | | | | It was already used many places directly making the code inconsistent. Change-Id: I3b14bc6c333640fb3ba33c71eba97e78c973e44b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix an annoying compiler warning on MSVCLars Knoll2020-09-021-1/+1
| | | | | | | | Fix a warning about truncating a const through a static_cast on MSVC. Change-Id: I381ce806d602c006ef6f14eb4fc89716bc5403ae Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix truncation warning in qversionnumber.hMarcel Krems2020-08-231-1/+1
| | | | | | | qversionnumber.h(390): warning C4310: cast truncates constant value Change-Id: I26f525db84d1c3691d9ac3f91f67be0bc4034b41 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use QList instead of QVector in corelibJarek Kobus2020-06-251-17/+13
| | | | | | | | | | Applied to headers only. Source file to be changed separately. Omitted statemachine for now to avoid conflicts. Omitted qmetatype.h for now - to be handled later. Task-number: QTBUG-84469 Change-Id: I317376037a62467c313467d92955ad0b7473aa97 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Improve castingAllan Sandfeld Jensen2020-06-251-1/+1
| | | | | | | Make a handful of narrowing casts explicit Change-Id: I318e9778840f2437963377b6b97f269d569909dc Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Port Q_STATIC_ASSERT(_X) to static_assertGiuseppe D'Angelo2020-06-191-2/+2
| | | | | | | | | | | | | | | | | There is no reason for keep using our macro now that we have C++17. The macro itself is left in for the moment being, as well as its detection logic, because it's needed for C code (not everything supports C11 yet). A few more cleanups will arrive in the next few patches. Note that this is a mere search/replace; some places were using double braces to work around the presence of commas in a macro, no attempt has been done to fix those. tst_qglobal had just some minor changes to keep testing the macro. Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix a few size_t / int conversion warningsFriedemann Kleint2020-04-101-1/+1
| | | | | | | | Change the hash function of QTypeRevision and QtFontFallbacksCacheKey to use size_t and add a few casts. Change-Id: I89a8fc617abbe8b0c67529ec41795691c99b0574 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Change qHash() to work with size_t instead of uintLars Knoll2020-04-091-2/+2
| | | | | | | | | | | This is required, so that QHash and QSet can hold more than 2^32 items on 64 bit platforms. The actual hashing functions for strings are still 32bit, this will be changed in a follow-up commit. Change-Id: I4372125252486075ff3a0b45ecfa818359fe103b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QTypeRevision: Fix warnings about max macro from windows.hFriedemann Kleint2020-03-041-1/+2
| | | | | | | | | | Similar to def272750cdb7810bca4f4815ed1183ba2bd6df9, put parentheses around std::numeric_limits<Integer>::max, fixing: qversionnumber.h(339): warning C4003: not enough arguments for function-like macro invocation 'max' Change-Id: Id574f3a08973cf1408e015f155c8e658b04bd170 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QTypeRevision: Disallow floats and doubles as argumentsUlf Hermann2020-02-171-3/+4
| | | | | | | | | Previously those would be implicitly casted to qint8, with interesting results. Change-Id: I145a737a7ef7a6f5212461b9f6a1fcb5d7780558 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Core: Provide comparison functions for QTypeRevisionUlf Hermann2020-02-071-0/+36
| | | | | | | | | | | The unspecified segment is between 0 and 1. This is because QTypeRevision::zero(), as the default revisision needs to be smaller than any other. At the same time we want explicitly specified non-zero revisions to be larger than unspecified ones. Breaking this down on a per segment level gives us the order shown here. Change-Id: I1cca12f1180eb6f77563fb5b22c3400e118dc5e9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* qversionnumber.h: Stay compatible with C++11Ulf Hermann2020-01-311-9/+9
| | | | | | | | | Avoiding relaxed constexpr support is a small change that doesn't hurt and it allows us to progress in qtdeclarative without waiting for general C++17 support in qtbase. Change-Id: I234276036292346d60d6da3a75bcabbdec9ddde8 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Core: Add a QTypeRevision classUlf Hermann2020-01-301-0/+115
| | | | | | | | | | | | | | | | QTypeRevision is needed to encode the value of the new two-argument Q_REVISION(major, minor) macros. Those, in turn are necessary because the minor version resets to 0, and we need to take the major version into account when stating revisions for Qt classes. Task-number: QTBUG-71278 Change-Id: I63eff6eab7d6e4f8f32b359a216767c98947a106 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Remove handling of missing Q_COMPILER_INITIALIZER_LISTSAllan Sandfeld Jensen2019-05-021-4/+0
| | | | | | Change-Id: Id65b39c787235a051262544932e6717d076f1ea0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove handling of missing Q_COMPILER_RVALUE_REFSAllan Sandfeld Jensen2019-05-011-4/+0
| | | | | | | | Remove remaining handling of missing support for rvalue refs. Change-Id: I78bab8bccfeeb9c76f464f345874364a37e4840a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace Q_DECL_NOEXCEPT with noexcept in corelibAllan Sandfeld Jensen2019-04-031-21/+21
| | | | | | | In preparation of Qt6 move away from pre-C++11 macros. Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-1/+1
| | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-201-16/+16
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.h src/corelib/tools/qdatetime.h src/corelib/tools/qstring.h src/corelib/tools/qversionnumber.h src/plugins/platforms/android/qandroidplatformintegration.cpp tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp Change-Id: Iefd92a435e687a76cd593099e40d9a9620a1454d
| * Move Q_REQUIRED_RESULT to its correct positionThiago Macieira2017-04-201-14/+14
| | | | | | | | | | | | | | | | | | | | | | That's before the return type or static, inline, constexpr or such keywords (if any). Perl Script: s/^(\s+)(.*) Q_REQUIRED_RESULT(;)?(\s*\/\/.*)?$/\1Q_REQUIRED_RESULT \2\3\4/ Change-Id: I7814054a102a407d876ffffd14b6a16182f159e2 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QVersionNumber: add fromString(QStringView/QLatin1String) overloadsMarc Mutz2017-04-081-0/+4
|/ | | | | | | | | | | | | | | The parsing code anyway operated on a QByteArray created from toLatin1(), so expose this to the user by providing a QLatin1String overload. Also provide a QStringView overload, since we can. Port one user (in qmake) to the new overload. [ChangeLog][QtCore][QVersionNumber] Added QStringView and QLatin1String overloads of fromString(). Change-Id: Idbff44c3997f5cfa86ea1bce8b3da4b700a3d9cc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
| | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QVersionNumber: compile with -Wzero-as-null-pointer-constantMarc Mutz2015-09-131-1/+1
| | | | | | Change-Id: I1514864f1c7ae0d260aad368e2dc4de84061732c Reviewed-by: Keith Gardner <kreios4004@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add a quick optimization for QVersionNumber's constructorsThiago Macieira2015-07-301-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the data fits inline, let's store it using the dummy member. GCC, Clang and ICC optimize the code on all architectures I tested to one single store. Previously, the function for "return QVersionNumber(5,4,0);" was: x86-64: movb $7, (%rdi) movb $5, 1(%rdi) movb $4, 2(%rdi) movb $0, 3(%rdi) x86: movb $7, (%eax) movb $5, 1(%eax) movb $4, 2(%eax) movb $0, 3(%eax) ia64: addl r17 = 7, r0 adds r16 = 1, in0 adds r15 = 2, in0 adds r14 = 3, in0 st1 [in0] = r17 addl r17 = 5, r0 ;; st1 [r16] = r17 addl r16 = 4, r0 ;; st1 [r15] = r16 st1 [r14] = r0 armv7a: mov r1, #7 mov r2, #5 strb r1, [r0] mov r1, #4 strb r2, [r0, #1] mov r2, #0 strb r1, [r0, #2] strb r2, [r0, #3] mips32: li $3,7 # 0x7 sb $3,3($4) li $3,5 # 0x5 sb $3,0($4) li $3,4 # 0x4 sb $3,1($4) sb $0,2($4) mips64: li $3,7 # 0x7 sb $3,7($4) li $3,5 # 0x5 sb $3,0($4) li $3,4 # 0x4 sb $3,1($4) sb $0,2($4) ppc32: li 10,7 stb 10,3(3) li 10,5 stb 10,0(3) li 10,4 stb 10,1(3) li 10,0 stb 10,2(3) ppc64: li 10,7 stb 10,7(3) li 10,5 stb 10,0(3) li 10,4 stb 10,1(3) li 10,0 stb 10,2(3) Now it is: x86-64: movq $263431, (%rdi) x86: movl $263431, (%eax) ia64: addl r14 = 263431, r0 ;; st8 [in0] = r14 armv7a: movw r3, #1287 movt r3, 4 str r3, [r0] mips32: li $3,84148224 # 0x5040000 addiu $3,$3,7 sw $3,0($4) mips64: li $3,321 # 0x141 dsll $3,$3,50 daddiu $3,$3,7 sd $3,0($4) ppc64: lis 9,0x504 sldi 9,9,32 ori 9,9,7 std 9,0(3) ppc32: lis 9,0x504 ori 9,9,7 stw 9,0(3) All assembly listings from GCC 4.8.1, but the Clang and ICC outputs are identical or at least very similar (I tested Clang for ARM, MIPS and PowerPC). Both MIPS and PowerPC were compiled in big-endian mode and this listing shows that the 64-bit implementation is correct. Additionally, the output is also the same for GCC when using brace initialization (that is, return QVersionNumber{5,4,0}). Clang and ICC couldn't optimize that. Change-Id: I9a4a4c9fc83f1182401f63fd2da829c935a8c9da Reviewed-by: Keith Gardner <kreios4004@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Refactor QVersionNumber so it stores values in-classThiago Macieira2015-07-291-10/+157
| | | | | | | | | | | | | | | | | | | | | | | | | The common case of QVersionNumber is that there are few segments and each segment is a small integers. So instead of allocating a QVector<int>, just store those numbers in the class itself if possible. Think of this as a "Small String Optimization" for QVersionNumber. QVector<int> costs 16 + 4*N bytes, plus malloc overhead. After this change, QVersionNumber(5,4,0) will have an overhead of zero. The memory layout is explained in the header. I've coded it so big endian also works, but I have not tested it at all. Aside from the special functions for QVersionNumber and operator>>, all the rest of the algorithm could have been left unchanged. I only updated segments(), normalized(), compare(), commonPrefix() and fromString() to take advantage of the smaller implementation in a more efficient way. Note: QVersionNumber's constructors often leave half of the object or more uninitialized. That's not a problem. Change-Id: I4a2a0ce09fce2580f02d678e2f80b1dba74bac9d Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Remove the ref-qualified versions of segments and normalizedThiago Macieira2015-07-161-40/+3
| | | | | | | | | | They can't be ref-qualified if the QVersionNumber object doesn't actually hold a QVector<int>, as the next commit will make it: for segments(), there might not be a QVector to be moved; for normalized(), the common case will be that there's no gain in ref-qualifying. Change-Id: I4bfb8b8765a502c0de6aed693752217106e575a2 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>