summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
Commit message (Collapse)AuthorAgeFilesLines
...
* QPluginLoader: modernize static plugin instance codeThiago Macieira2023-03-281-6/+5
| | | | | | | | | | - don't create the QGlobalStatic if it doesn't exist yet - remove int-based iteration in favor of range-based for Pick-to: 6.2 6.5 Change-Id: Idd5e1bb52be047d7b4fffffd174fb99f4557defe Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Corelib: s/Q_OS_MAC/Q_OS_DARWIN/wg except for doc and definitionEdward Welbourne2023-03-205-11/+11
| | | | | | | | | | I got tired of being told off by the inanity 'bot for faithfully reflecting existing #if-ery in new #if-ery. Retain only the documentation and definition of the deprecated define. Change-Id: I47f47b76bd239a360f27ae5afe593dfad8746538 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Darwin: Ensure encrypted library is loaded before parsing plugin metadataTor Arne Vestbø2023-02-173-8/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Application delivered via the macOS or iOS App Store might have their libraries encrypted, in which case we can not read any of the sections of the binary until it has been dlopened. This was causing issues for our plugin loading code, which assumed we could read the .qtmetadata section of a yet to be loaded plugin to determine its suitability, before loading it. We now detect whether a library is encrypted during the Mach-O parsing, and propagate this back to QLibraryPrivate::updatePluginState(), which can handle the case by explicitly loading the library before continuing with metadata validation. We still ensure that the library has a .qtmetadata section, so that we don't need to dlopen any random library in our path. This does mean that we will potentially load more plugins than we need, and since the Qt version validation happens as part of meta data validation, we might dlopen() incompatible plugins, but it's expected that in an App Store deployment scenario you control both the versioning and set of shipped plugins, so this should not be an issue in practice. As encrypted libraries are only produced for apps that are fully published to the App Store, and then deployed via MDM, VPP, or Apple Configurator 2, we don't have an easy way to test this, but the existing code paths should be unaffected, and hopefully this patch improves the situation for the encrypted library case. Pick-to: 6.5 6.4 6.2 5.15 Change-Id: Iff733505f7067ce5571854ea978bc95e8376e347 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* wasm: don't call dlopen() on static buildsMorten Sørvig2023-02-141-0/+5
| | | | | | | | | | | | | | | | Make QLibraryPrivate::load_sys() return false on static wasm builds. Emscripten does not support dlopen() in this configuration; calling it will abort the program. By returning false we give QLibrary users an opportunity to handle the error. Task-number: QTBUG-109076 Pick-to: 6.5 Change-Id: I32d1fde04cc54d1622e0743712b6372b023aa006 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
* Trace: Convert qtcore module to use tracepointgen toolAntti Määttä2023-02-102-0/+5
| | | | | | | | Pick-to: 6.5 Change-Id: I379896280a16cd0b94d7ee9d0cfcca4afe64b9fe Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
* Add/enable Alpha detectionPino Toscano2023-02-071-0/+3
| | | | | | | | | | | - uncomment the Alpha detection defining Q_PROCESSOR_ALPHA, which is already used/documented in few places - set the right machine type in QElfParser for Alpha ELF files Pick-to: 6.5 Change-Id: I072bdee8b73ad3c86591c764aa7075c114967fd9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lisandro Damián Nicanor Pérez Meyer <perezmeyer@gmail.com>
* QUuid: add the ability to specify the byte order for 128-bit IDsThiago Macieira2022-12-162-15/+35
| | | | | | | | Some more modern protocols like Bluetooth LE transmit data in little endian. QtBluetooth will benefit from this. Change-Id: Id8e48e8f498c4a029619fffd1728c94ddd444537 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QUuid: add a trivial structure to support exactly 128 bitsThiago Macieira2022-12-162-39/+94
| | | | | | | | This is inspired by QBluetoothUuid's quint128, but with a better name. It also matches systemd's sd_id128. Change-Id: Id8e48e8f498c4a029619fffd172893dc1545adda Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QUuid: use NSDMI to initialize the membersThiago Macieira2022-12-161-5/+5
| | | | | Change-Id: Id8e48e8f498c4a029619fffd172893c31bb0aba1 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Add LoongArch detectionWANG Xuerui2022-12-041-0/+5
| | | | | | | | | | - detect the LoongArch architecture, define Q_PROCESSOR_LOONGARCH and Q_PROCESSOR_LOONGARCH_{32,64} appropriately - document the macros as being available starting from 6.5 - add LoongArch ELF support in QElfParser Change-Id: I438146af49ec3adacacec84c27c9f4abaa542830 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* corelib: Support ELFOSABI_LINUX in qelfparserNiclas Rosenvik2022-11-041-0/+5
| | | | | | | | | | ELFOSABI_LINUX is the old name for ELFOSABI_GNU and some systems (NetBSD 9) with an old elf.h still use that define instead of ELFOSABI_GNU. Pick-to: 6.4 6.4.1 Change-Id: I3d18efe117ea21f13831df5293b4efce99694294 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace usages of Q_CLANG_QDOC with Q_QDOCLuca Di Sera2022-10-212-5/+5
| | | | | | | | | | | | | | | | | | | | | | | To allow the user to customize the C++ code that QDoc sees, so as to be able to work-around some limitations on QDoc itself, QDoc defines two symbols: Q_QDOC and Q_CLANG_QDOC, both of which are "true" during an entire execution of QDoc. At a certain point in time, QDoc allowed the user the choice between a custom C++ parser and a Clang based one. The Q_QDOC symbol would always be defined while the Q_CLANG_QDOC symbol would be defined only when the Clang based parser was chosen. In more recent times, QDoc always uses a Clang based parser, such that both Q_CLANG_QDOC and Q_QDOC are always defined, making them equivalent. To avoid using different symbols, and the possible confusion and fragmentation that derives from it, all usages of Q_CLANG_QDOC are now replaced by the equivalent usages of Q_QDOC. Change-Id: I5810abb9ad1016a4c5bbea99acd03381b8514b3f Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* QLibrary: fix loading multiple versions of a libraryThiago Macieira2022-10-201-5/+9
| | | | | | | | | | | | | | | | | The libraryMap only stored the file path, so we couldn't load two versions of the same library as we'd find the other version already loaded. Change the map to index by file name and version (using a NUL as separator, since that can't appear in file names). [ChangeLog][QtCore][QLibrary] Fixed a bug that caused QLibrary to be unable to load two different versions of a library of a given name at the same time. Note that this is often inadviseable and loading the second library may cause a crash. Pick-to: 6.4 Change-Id: I12a088d1ae424825abd3fffd171ce3bb0590978d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QLibrary: fix load() after a failed load()Thiago Macieira2022-10-181-2/+4
| | | | | | | | | | | Regression introduced by commit 8d4eb292b2e8fc14437db97febdc2eebe36ed3ce in 6.0, when QTaggedPointer was introduced. We set the tag even when the loading failed and failed to reset it because d = {} retains the tag. Pick-to: 6.2 6.4 Fixes: QTBUG-103387 Change-Id: Ie4bb662dcb274440ab8bfffd170a07aa9c9ecfca Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QLibrary::setFileNameAndVersion: reset the tag after findOrCreateThiago Macieira2022-10-171-2/+3
| | | | | | | | | If the library we've found is already loaded, set the tag to Loaded. Pick-to: 6.4 Change-Id: I12a088d1ae424825abd3fffd171ce3831b884eee Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QLibrary: merge duplicated setFileName{,AndVersion} codeThiago Macieira2022-10-141-14/+2
| | | | | | | | | The code was in triplicate. Once is enough. Pick-to: 6.4 Change-Id: I12a088d1ae424825abd3fffd171ce375892457fc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-115-7/+7
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* [Linux] Remove workaround for glibc to actually unload a libraryFushan Wen2022-10-101-6/+1
| | | | | | | | | | | | | | The workaround was added to fix a bug in glibc prior to 2.25, which was released on 2017-02-05. Since the supported platforms of Qt6 at least have glibc 2.26 (SUSE Linux Enterprise Server 15 SP2), it's time to remove the workaround. See also: http://sourceware.org/bugzilla/show_bug.cgi?id=11941 Pick-to: 6.4 Change-Id: Ia2aab5b0a512c44d4a4312877a0177b6b5df6428 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add M68k detectionPino Toscano2022-10-091-0/+3
| | | | | | | | | - detect the M68k architecture (Motorola 68000) and define Q_PROCESSOR_M68K - set the right machine type in QElfParser for M68k ELF files Change-Id: Ie5694abbe1ae2bfeb5692defba0ca6062c1d60ac Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QPluginMetaData: replace manual loop with q20::copy_nMarc Mutz2022-10-081-3/+3
| | | | | | Pick-to: 6.4 Change-Id: I7061b18efd2ff905cc36df41d680c0612a505a76 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add HPPA detectionPino Toscano2022-10-071-0/+3
| | | | | | | | - detect the HPPA architecture (PA-RISC) and define Q_PROCESSOR_HPPA - set the right machine type in QElfParser for HPPA ELF files Change-Id: I5214ce64ef1fdd0ecca3d6c1694c5db9b2852a22 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix build with SPARC SolarisMårten Nordheim2022-10-061-2/+0
| | | | | | | | Change-Id: I8969d7950f7c5b6164f87ab37f1089b7bc8cae8b Done-by: Petr Šumbera Pick-to: 6.4 Fixes: QTBUG-107178 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace qExchange calls with std::exchangeFabian Kosmale2022-09-281-1/+1
| | | | | | | | | | | | | | | | | | | | | qExchange is one of the few remaining functionalities that have not been moved out of qglobal. Given that std::exchange exists in the standard, we can simply move to it everywhere... ...if it weren't for the fact that std::exchange is only constexpr in C++20, and only has its noexceptness specified in (most likely) C++23. Still, we want to move to the existing std functionality where possible, to allow the removal of qglobal includes in lieu of something more fine-grained in the future. So leave any constexpr calls[1] alone for now (and observe that none of our current usages cares about the conditional noexceptness), but replace everything else. [1] QScopedValueRollback' ctor and QExplicitlySharedDataPointerV2::take Task-number: QTBUG-99313 Change-Id: I599cb9846cf319c7ffd3457130938347a75aad25 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QPluginLoader: Fix the expected machine word for Windows on ARMMartin Storsjö2022-09-271-1/+1
| | | | | | | | | | | | This fixes loading plugins on Windows on ARM since 892d5607d0b1c9e010ea10a1123e68741c46c21e. IMAGE_FILE_MACHINE_ARM was used for older Windows targets on ARM, in particular Windows CE. Pick-to: 6.4 6.3 Change-Id: I61ef7a6b5920af9192c55209f2641a6c469ad1d2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QSystemLibrary: Use Windows functionality directlyYuhang Zhao2022-08-251-8/+8
| | | | | | | | | | Passing LOAD_LIBRARY_SEARCH_SYSTEM32 to LoadLibraryEx() can also only load libraries from the system directory, so in this case we can use it directly instead of doing all the work ourself. Change-Id: I4971781e55c9f1476861d599d58233114c280bc9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Remove qmake-only reference in Q_IMPORT_PLUGIN descriptionKai Köhne2022-08-241-5/+3
| | | | | | | | | | The Static Plugins page describes handling of qmake and CMake already in greater detail. No need to replicate it here. Pick-to: 6.4 Task-number: QTBUG-88044 Change-Id: I2cae85c0b0d20585b563bab9e263121181adeb8c Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QSystemLibrary: Cache the system directory pathYuhang Zhao2022-08-231-9/+11
| | | | | | | | | | The system directory path won't change during the lifetime of the application, so cache it to avoid querying it for multiple times. Change-Id: I302285794d491d581d74a93e7ba9affc6379c681 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSystemLibrary: Use in-class initializationYuhang Zhao2022-08-231-7/+4
| | | | | | | | Initialize the member variables in class. It's more modern and also saves some typing in some constructor functions. Change-Id: Ib4d942610a57e0af3f22248c00207d7cdb683763 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QSystemLibrary: Replace 0 with nullptrYuhang Zhao2022-08-212-7/+7
| | | | | | | Use modern C++ more. Change-Id: I8ba2a6e95187976b7e4077bb39f05eab04a8575f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add the qt_class pragma to file listed in sync.profile classnames mapAlexey Edelev2022-06-221-0/+4
| | | | | | | | | This makes header files self-contained and reduces the number of 'sources of truth' for syncqt procedure. Change-Id: I7f5865abc69934603139d23e1b5452da46ccb110 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLibrary: fix use of deprecated QByteArrayMatcher::indexIn(p, n)Marc Mutz2022-06-141-1/+1
| | | | | | | | | | Use the QByteArrayView overload instead. Deprecated since 6.3, so backporting: Pick-to: 6.4 6.3 Change-Id: I529104cad59260eed371cedb1ae84a7e9086bbf6 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-1624-909/+57
| | | | | | | | | | | | | 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>
* Fix build on CentOS 7Ilya Fedin2022-04-131-0/+2
| | | | | | | | This little change fixes the build on CentOS 7 Pick-to: 6.3 Change-Id: Ic9717147c10ca78e36d6311944de417c6420211d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Allow brace initialization for some of QLatin1StringView constructorsSona Kurazyan2022-04-011-1/+1
| | | | | | | | | | | | | | | Removed "explicit" keyword from constructors taking (const char *, qsizetype) and (const char *, const char *). Switched to using brace initialization for creating QLatin1StringView in QtCore. [ChangeLog][QtCore][QLatin1StringView] The (const char *, qsizetype) and (const char *, const char *) constructors are no longer explicit. Change-Id: I4f6760692e4df60fe4231e86a25f6ea03cd1bf82 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Short live Q_CONSTINIT!Marc Mutz2022-03-261-3/+3
| | | | | | | | | | | | | | | | | | It expands to the first available of - constinit (C++20) - [[clang::require_constant_initialization]] (Clang) - __constinit (GCC >= 10) Use it around the code (on and near static QBasicAtomic; this patch makes no attempt to find all statics in qtbase). [ChangeLog][QtCore][QtGlobal] Added macro Q_CONSTINIT. Fixes: QTBUG-100484 Change-Id: I11e0363a7acb3464476859d12ec7f94319d82be7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QtCore: Replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-03-268-18/+18
| | | | | | | 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-2510-55/+73
| | | | | | | | | | | 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 a few more {QString, QByteArray}::count() deprecation warningsSona Kurazyan2022-03-171-1/+1
| | | | | Change-Id: I0be2d5e7a8f6af3bc1077ae6d1f20cc5da8f2266 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QLibrary: restore translated stringMarc Mutz2022-03-171-6/+6
| | | | | | | | | | | | | | | | | We want to pick this change to LTS branches, so we cannot change the translated string. Instead of fixing the order of placeholders, use multi-arg, which performs only a single pass over the input and doesn't suffer from placeholder injection by interpolation the way .arg() chaining does. Requires to use QString::number(), though. Amends 3636325946b471d48043540e309bf6f52be45331. Pick-to: 6.3 6.2 5.15 Change-Id: I6484a052115096c609edfea27dfd36b196efc1b6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLibrary: fix possible arg() format clobberingMarc Mutz2022-03-151-3/+3
| | | | | | | | | | | | | The fileName could potentially contain the string "%n", n ≤ 5, in which case the following .arg() calls would interpolate their arguments at the wrong position. Fix by interpolating fileName last. Pick-to: 6.3 6.2 5.15 Change-Id: I1a75a7671cbfe85ba3b2df240c3ef74482fc848d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix Q_FLAG declaration over enumerationsGiuseppe D'Angelo2022-03-021-1/+1
| | | | | | | | | | One should use Q_ENUM, not Q_FLAG, to mark an enumeration. Q_FLAG should go on the respective flag type. Change-Id: I16cd5c0d405c3db1951569b72805fdae18898c45 Pick-to: 5.15 6.2 6.3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QPluginParsedMetaData: avoid the indirection through QCborMapThiago Macieira2022-02-161-1/+1
| | | | | | | | | | | value[x] is the same as value.toMap()[x] but avoids the refcounting up and down just to call the operator[] overload. We're calling the operator[] overload taking an integer, which means it could match an array, but we know the data member won't be one because of how QPluginParsedMetaData::parse() parses. Change-Id: I2cffe62afda945079b63fffd16bd5c690b2bfee4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QCborArray: use QCborValueConstRefThiago Macieira2022-02-151-3/+3
| | | | | Change-Id: I5e52dc5b093c43a3b678fffd16b6077e5c4abd63 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QLibrary: add a #warning if the fall-back plugin-meta-data parser is usedMarc Mutz2022-02-161-0/+2
| | | | | Change-Id: I4b42f8dbc9fb03fc6e7243ed4914acfb1bdfe62a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLibrary: use QStaticByteArrayMatcherMarc Mutz2022-02-151-2/+10
| | | | | | | | | | | | Because of code-after-return style, I don't actually know what the code is used for, but since it's compiled, make sure to not leave a dynamically-initialized static variable lying around, even if control never reaches it. Pick-to: 6.3 Change-Id: I6ce30d8c060f96a2d819ed85f79d18a7ef7e9b05 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLibrary: Suppress GCC 12 warning about dangling pointer accessThiago Macieira2022-02-111-12/+13
| | | | | | | | | | | | | | | | | | | | | | Introduced in commit d07742f333df89dc399fc5d9cabf2bdef0b346c5. Reported by GCC 12: qlibrary.cpp:672:9: error: dangling pointer to ‘candidates’ may be used [-Werror=dangling-pointer=] 672 | if (isValidSuffix(*it++)) | ^~ qlibrary.cpp:634:29: note: ‘candidates’ declared here 634 | const QLatin1String candidates[] = { | ^~~~~~~~~~ This is a false positive report because the lambda does not return a pointer or iterator. But it's a good update anyway to keep the array outside the lambda, so it won't be recreated every time. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104492 Pick-to: 6.3 Change-Id: I74249c52dc02478ba93cfffd16d230abd1bf6166 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QPluginLoader: report the right load hintsGiuseppe D'Angelo2022-02-031-3/+10
| | | | | | | | | | | | | | | A default-constructed QPluginLoader erroneously reports that the load hints are empty. However, setting a filename would then automatically set the PreventUnload hint, surprising the user. Return the correct flags instead. Amends 494376f980e96339b6f1eff7c41336ca4d853065 Change-Id: I7a95964cb680afd3adf2f71ed73d2f93023238f2 Fixes: QTBUG-100416 Pick-to: 5.15 6.2 6.3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCoffPeParser: simplify std::optional checkMarc Mutz2022-02-011-1/+1
| | | | | | | | | | | | | | | | | | | Even in C++98 one could declare variables in if statements and contextually convert them to bool: if (D* d = dynamic_cast<D*>(base)) ~~~ else if (D2* d = dynamic_cast<D2*>(base)) ~~~ std::optional is contextually convertible to bool, so we don't need C++17 if initializers. Just use if (auto optional = ~~~~) Pick-to: 6.3 Change-Id: Ie64c2c1ceb7b608eda0534d837f46d3c4be49bf8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make one QT_REMOVED_SINCE/QT_BUILD_REMOVED_API per moduleMarc Mutz2022-02-011-2/+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>
* QFactoryLoader: merge the global statics into a single structThiago Macieira2022-01-211-12/+21
| | | | | | | | Drive-by update one more for to ranged-for and make sure we don't create the global statics on destruction. Change-Id: I5e52dc5b093c43a3b678fffd16b5ff674dfd17ae Reviewed-by: Marc Mutz <marc.mutz@qt.io>