summaryrefslogtreecommitdiff
path: root/src/corelib/global
Commit message (Collapse)AuthorAgeFilesLines
* QPartialOrdering: update docs and change parameter namesDennis Oberst2023-05-172-59/+87
| | | | | | | | | | Let's be more explicit with QPartialOrdering's showcase of its functionality in the docs and define a possible function-declaration. Also change all parameter names to lhs and rhs, respectively. Pick-to: 6.5 6.2 5.15 Change-Id: Ibc5c0b418bff3278e10e415c7f5bfa86227fc066 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* q20chrono: Fix feature test macro checkFabian Kosmale2023-05-161-2/+2
| | | | | | | | | | | | | | | | | While the comment behind the else already had the correct value, the actual check and the comment behind the endif had the wrong one. This would cause build /headers clean check failures when using older compilers in C++20/2a mode. Also, remove the check for __cplusplus: A sufficiently high enough value of __cpp_lib_chrono already implies __cplusplus > 201703L; the only thing the check did was to hide the issue on more modern compilers. Fixes compilation with e.g. gcc 9.3. Amends bde5eeecaf35f7b7a94b7878289a8e7fcd057afa Change-Id: I74e761d9dc4048e9abf9cea9ea7e63260ea1111e Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Enable [[noreturn]] attribute for non-MSVC compilers on WindowsPeter Varga2023-05-123-6/+6
| | | | | | | | | | | | | | Avoids -Wsometimes-uninitialized warnings with clang-cl. Also do not allow to return qt_message_fatal() if built with other compiler than MSVC. Amends 97b32fa0b661c5dd89d525122427496132abb54a Fixes: QTBUG-113351 Change-Id: I9ce87057e764af1e25de93388ae983891df66d2e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Unconditionally use Q_NORETURN for qAbort()Kai Köhne2023-05-091-4/+1
| | | | | | | | | The exception for MSVC was probably added due to similar logic in qlogging.h, but in this case, qAbort never returns also with MSVC. Change-Id: Ica2155c34d4b32b20af5b1fcb5af35bb3ff6f668 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* q20: add C++20 chrono days/weeks/months/yearsAhmad Samir2023-05-051-0/+62
| | | | | Change-Id: Ie2a167cbe6672694e15b7810daf7fad3fe0656a1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Deprecate Q_ASSUMEThiago Macieira2023-05-042-20/+11
| | | | | | | | | | | | No replacement provided because we didn't agree on how to do it. But the current implementation is bad (with GCC, at least), so tell people to stop using it. [ChangeLog][Deprecations] The Q_ASSUME macro is now deprecated. Do not use it in new code and consider removing it from existing code. Change-Id: Idd5e1bb52be047d7b4fffffd175322ee3402756b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* fix wrong and strange indentationYuhang Zhao2023-05-021-22/+22
| | | | | Change-Id: I803d85eb83ec8e6ea532095c34fa8b0ae104705d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Short live Q_NODISCARD_CTORIvan Solovev2023-04-301-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore] Introduced Q_NODISCARD_CTOR which resolves to [[nodiscard]] attribute for constructors on compilers that support it, and does nothing on other compilers. Using [[nodiscard]] attribute on a constructor is a C++20 feature, however in practice it is supported on most of the compilers that we use in Qt 6. Clang generates a [-Wunused-value] warning, GCC and MinGW generate a [-Wunused-result] warnings, and MSVC generates a C4834 warning. However, there are some exceptions. The Integrity compiler provides the following warning: "tst_qglobal.cpp", line 699: warning #3435-D: the "nodiscard" attribute doesn't apply to constructors, destructors, or routines with void return type [[nodiscard]] explicit Test(int val) : m_val(val) {} The QNX compiler (QCC 8.3.0) and GCC 9.3.1 on OpenSUSE generate the [-Wattributes] warning: tst_qglobal.cpp: In member function 'void tst_QGlobal::nodiscardConstructor()': tst_qglobal.cpp:699:44: warning: 'nodiscard' attribute applied to 'tst_QGlobal::nodiscardConstructor()::Test::Test(int)' with void return type [-Wattributes] [[nodiscard]] explicit Test(int val) : m_val(val) {} These warnings will lead to build failures when compiled with -warnings-are-errors flag, so for these compilers the macro does not do anything. An attempt to use __attribute__((__warn_unused_result__)) was also unsuccessful on these compilers, so this patch goes for an easy solution, and simply checks __has_cpp_attribute(nodiscard) >= 201907L to decide if the attribute is supported or not. This commit also introduces a syntax-only test, and also applies the new macro to QMutexLocker, because not all platforms in the CI build and run unit tests. Fixes: QTBUG-104161 Change-Id: Ib4230661a5ad5e8af0d67b21b034486ebcd67562 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove old clang-cl workaroundYuhang Zhao2023-04-301-5/+0
| | | | | | | | | | According to the upstream bug report [1], this bug has been fixed already. So remove the now useless workaround. [1] https://bugs.llvm.org/show_bug.cgi?id=41226 Change-Id: I7e17750f9e47fb9a0f8315ca15f89b741b107a35 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QContainerInfo: Detect presence of reserve()Ulf Hermann2023-04-191-0/+5
| | | | | | | | | This is handy if you want to reserve if possible or just fill the container right away if not. Task-number: QTBUG-112227 Change-Id: I3d085c1ce2448150bc044c3513572e02161244f4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* corelib/global/*.h: use static_assert instead of Q_STATIC_ASSERT_XAhmad Samir2023-04-162-2/+6
| | | | | | | | | | | | | | qtconfigmacros: Otherwise we'd need to include <QtCore/qassert.h> before using QT_REQUIRE_CONFIG. It cannot be added here as qassert.h itself uses QT_CONFIG, i.e. qassert.h needs to include this header. And Q_STATIC_ASSERT_X is only kept around to keep old code working. _Static_assert is deprecated in C23: https://en.cppreference.com/w/c/language/_Static_assert Change-Id: Ie60a02274cc5be8bd1c6dc3819ccfbc2e7864a21 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix some narrowing conversion warningsAhmad Samir2023-04-081-1/+1
| | | | | | | | | ioctl call for FIONREAD takes an int arg, it won't work correctly otherwise. Cast the return of the read() call to int, because it won't read more than buffSize (which is an int). Change-Id: I130202a732684257bbb0e79c9358b60a61010c46 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix some extra semicolon warningsJoni Poikelin2023-04-051-2/+2
| | | | | | | Fixes: QTBUG-112648 Pick-to: 6.5 Change-Id: I71446459c7fd6018ecb4deb60a7b9b412c0972ba Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Short live q20::to_address!Marc Mutz2023-03-311-1/+44
| | | | | | | | | | | | An implementation of C++20 std::to_address, a prerequesite for QSpan<>. The test cases are inspired by libstdc++'s test suite, just to avoid missing some cases, but the to_address implementation is white-room. Fixes: QTBUG-108430 Change-Id: I4c092fdd7a56c0b279068e341bbf91a725ca3b1f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Short live QT_ENABLE_P0846_SEMANTICS_FOR!Marc Mutz2023-03-221-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In C++17, unqualified lookup doesn't find function templates that require ADL from a call with explicit template arguments, unless another function template of that name is in scope (otherwise, the < is parsed as operator less-than instead). P0846, merged for C++20, fixes this to repeat the name lookup, parsing the < as indicating a template. We have API in Qt (Tuple Protocol for some types, e.g. QPoint) that work for the purpose of Structured Bindings, but don't work for manual unqualified calls when P0846 semantics are missing, and we're adding more, to QVariant, so add a macro to handle the issue. The macro simply declares a function template overload of the given name for a throw-away struct, thereby bringing, for that one name, P0846 semantics into C++17. When we require C++20, we can drop this again. Amends: - fb6b7869e8bdda94f7e791db7f281f3bb6e0e004 for QPoint(F) - 8ae9431c792f14a32909ac013a1383547d6bcfa8 for QMargins(F) - 0e22001a3bb070d4e9956e89543ec0e5ac6f23f8 for the rest [ChangeLog][QtCore][QSize/F, QMargins/F, QPoint/F] Fixed manual get<I>() calls (Tuple Protocol) in C++17 mode. Task-number: QTBUG-111598 Change-Id: I2ffaef12c5bb6d82f75ce78a7c03c6789dfa0691 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Corelib: s/Q_OS_MAC/Q_OS_DARWIN/wg except for doc and definitionEdward Welbourne2023-03-201-1/+1
| | | | | | | | | | 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>
* qcompilerdetection: all supported compilers have visibility attributesAhmad Samir2023-03-151-1/+1
| | | | | | | | | | | | | | | | | | Remove a redundant QT_VISIBILITY_AVAILABLE check. Pointed out by Thiago in review. Note that this is going to help with breaking include cycles between qglobal.h and qcompilerdetection.h (otherwise we'd have to include qtconfiginclude.h in qcompilerdetection.h as the former includes qconfig.h which defines QT_VISIBILITY_AVAILABLE; without QT_VISIBILITY_AVAILABLE defined, Q_DECL_EXPORT/IMPORT expands to nothing on Linux and co., and tools linking to qtcore (with bootstrap) can't find exported methods. Change-Id: Ib1244d43e606a6c80e122adea631305f6d8c51d3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Misc: Fix qsizetype-related narrowing coversionsAhmad Samir2023-03-112-7/+6
| | | | | | Task-number: QTBUG-102461 Change-Id: I96757abc50fc45756bc1271a970f819a48021663 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make it possible to use QObjectPrivate::connect in private codeVolker Hilsheimer2023-03-101-1/+10
| | | | | | | | | | | | | | | | | | | | In most QObjectPrivate-subclasses, the Q_DECLARE_PUBLIC macro is used in the private segment of the class declaration. In that case, the q_ptr becomes a private member of the private class, and then the QObjectPrivate::connect function can no longer be used, as it needs to access the d_ptr. Fix this by declaring QObjectPrivate, and the static-assert-helper, as friends of the class using the Q_DECLARE_PUBLIC macro. Adapt the QObject test by moving the Q_DECLARE_PUBLIC macro into the private section of the test-private, and add a compile test. Pick-to: 6.5 6.5.0 Change-Id: Ifc04be3b305221e138b1e08bb3a3838d871f4fcb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QTypeInfo: move helpers in QtPrivate namespaceGiuseppe D'Angelo2023-03-101-4/+8
| | | | | | | | | qIsRelocatable and qIsValueInitializationBitwiseZero are not public API, hide them away. Pick-to: 6.5 6.5.0 Change-Id: Ib4eeaab46d01759098e96091b700e9a28fd50962 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Short live q23::forward_like!Marc Mutz2023-03-052-0/+100
| | | | | | | | | | | | | | Following https://eel.is/c++draft/forward#lib:forward_like step-by-step. Temporarily add a q23utility.cpp to contain the static_assert() tests. There's no point in establishing a tst_q23utility just to run six static assertions. Should remove the .cpp again once an in-tree user exercises the function with the same coverage. Task-number: QTBUG-111598 Change-Id: Icb18eae089d65ca4e555921dbb71e74a7e255645 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCompilerDetection: fix compiler warning about undefined macroAhmad Samir2023-03-051-4/+5
| | | | | | | | | | | | | | | build/include/QtCore/../../../src/corelib/global/qcompilerdetection.h:546:7: warning: '__cplusplus' is not defined, evaluates to 0 [-Wundef] # if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) ^ build/include/QtCore/../../../src/corelib/global/qcompilerdetection.h:648:7: warning: '__cplusplus' is not defined, evaluates to 0 [-Wundef]. # if __cplusplus > 201103L ^ Change-Id: I8ed8e0c4b93977238986df0b3339ffae4d1d0fda Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qsimd_p.h: remove LZCNT feature from the ARCH_HASWELL listThiago Macieira2023-03-041-2/+2
| | | | | | | | | | | | | | | | | And for good measure, I'm also removing BMI2. The one we really care about ensuring gets enabled instead of -mavx2 is FMA anyway. Complements commit 29d3938aa56663f09666a0ac58b33e70e00abff2 (which in turn complemented commit a98cf15ed1b57aee695de01b04a974637b2cd44a), which removed BMI1 because AMD introduced it before AVX2. Looks like they also introduced LZCNT in some earlier processor too (family 10h) or GCC 12 began emitting __LZCNT__ for that family -- IIRC the AMD feature list was bigger than just the lzcnt instruction. Fixes: QTBUG-111698 Pick-to: 6.4 6.4.3 6.5 6.5.0 Change-Id: I7f354474adce419ca6c2fffd1748f5b24f69a692 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Doc: Remove duplicate wordsAndreas Eliasson2023-02-281-1/+1
| | | | | | Change-Id: Ia7a38a1035bd34d00f20351a0adc3927e473b2e7 Pick-to: 6.5 6.4 6.2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Mark variable only used in Q_ASSERT as unusedMårten Nordheim2023-02-271-0/+1
| | | | | Change-Id: Idee2a4772c7c12e293838a647ed768295612f794 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Logging: fix crash when decoding a symbol that isn't a functionThiago Macieira2023-02-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Saw this on my FreeBSD VM. The backtrace() function thought the nearest symbol to something was "_ZTSNSt3__110__function6__baseIFbPvS2_EEE", which decoded to typeinfo name for std::__1::__function::__base<bool (void*, void*)> The function pointer type inside parameter threw the decoder for a loop and caused it to crash with the failed assertion in qbytearray.h: inline char QByteArray::at(qsizetype i) const { Q_ASSERT(size_t(i) < size_t(size())); return d.data()[i]; } I noticed this - because tst_qtimer hung - because qFormatLogMessage deadlocked acquiring QMessagePattern::mutex - because the logging recursed - because qCleanupFuncinfo failed an assertion while formatting the backtrace (my QT_MESSAGE_PATTERN has %{backtrace}) - because QTimer::~QTimer -> QObject::killTimer printed a warning - because tst_QTimer::moveToThread produces warnings Pick-to: 5.15 6.2 6.4 6.5 Change-Id: Ieec322d73c1e40ad95c8fffd17464f86e9725991 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* QMessagePattern: don't use strncpy()Marc Mutz2023-02-221-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When Qt is configured to return nullptr from isNull() QStrings (QT5_NULL_STRINGS != 1), then we'd be feeding a nullptr src into strncpy(), which is UB. I couldn't rule the case of a null QString lexeme out with local reasoning, seeing as the code is in the else branch of an if (lexeme.startsWith(~~~) && lexeme.endsWith(~~~)), so it might be null. Instead of porting to qstrncpy(), which can deal with a nullptr src (albeit up to recently, badly), note that the strncpy + the char[] allocation is a qstrdup(), so use that instead. This also does away with the queasiness of taking the size() of a UTF-16 string to limit strncpy() for the L1-recoded version (which, in this instance is safe, as toLatin1().constData() is NUL-terminated, but in some other instances was not). As a drive-by, make sure we don't leak the strdup()'ed string if the emplace_back() fails. Amends be98fa32c7d56ea91359b647a329356fa44eca04. Qt 5 is not affected, as constData() never returns nullptr there. Pick-to: 6.5 6.4 6.2 Change-Id: I178d356e560d2749cd6ce0b9364c710a2d117304 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add missing deprecation guardsYuhang Zhao2023-02-211-0/+14
| | | | | | | | | | | | The deprecated implementation of QSharedMemory and QSystemSemaphore are not correctly guarded by the deprecation macros, and thus it's causing compilation errors when we disable deprecated code. As a drive-by, change the deprecate version from 6.9 to 6.10 as requested. Change-Id: Icfed181c27248b9e1381101a64523419097dd1da Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move access to tzname[] to under the env.var access logEdward Welbourne2023-02-202-0/+30
| | | | | | | | | | | | | | | | | Replace qlocaltime.cpp's qt_tzname() with qTzName() in qtenvironmentvariables{_p.h,.cpp} so as to put the access to the standard library global under the control of the same lock as controls all Qt's calls to tzset() and functions that behave as if they called it. This avoids UB on access to the global during a call to any of these functions. Take care to use the lock only for the shortest time needed. This simplifies both callers and lets a QDTParser method escape to qdatetimeparser.cpp to become a simple local static function instead of a class method defined in a separate compilation unit. Change-Id: I5ddee5641f2ed7b5676ece10375a1d5232eb7f22 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix QString from ASCII warning in qoperatingsystemversion_darwin.mmTor Arne Vestbø2023-02-201-1/+1
| | | | | | | | Introduced in d05f2fb2d567. Pick-to: 6.5 6.4 6.2 Change-Id: Ifa308be3be9c817c6304f634a53da62e631f54af Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Resolve actual macOS version despite process running in compatibility modeTor Arne Vestbø2023-02-183-26/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the application executable was built against a pre-macOS 11 SDK, macOS will report its version as 10.16 on every OS from macOS 11 and up, for compatibility reasons. From Qt 6.2 and up, we require at least Xcode 12 with the macOS 11 SDK to build Qt applications, so normally this should not be an issue, but in the case where the Qt 'app' is a plugin library hosted by a third party host application, the host application determines the behavior, and we might end up in the compatibility situation after all. However, since the Qt app was built against at least the macOS 11 SDK, we know that it can/should handle the new version number scheme, and we can resolve the real version number for QOperatingSystemVersion. We do that by launching the sysctl binary with the SYSTEM_VERSION_COMPAT environment variable set to 0, which is the supported way of disabling the compatibility mode. Now that we have the real version number we can use that for the deployment target check via qt_apple_check_os_version(), but we still need to account for possible failures in reading the plist file. We can also simplify the QOperatingSystemVersion::MacOSBigSur definition, now that we always know the app the should be able to handle major versions above 10. Pick-to: 6.5 6.4 6.2 Task-number: QTBUG-111114 Change-Id: I2a2756381c31b195f7b8800c5008a87b37114080 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Update qtrace_p.h commentsAntti Määttä2023-02-141-0/+8
| | | | | | | | | | -Update supported types -Add how to autogenerate metadata. Pick-to: 6.5 Change-Id: I1a88ff137760f7d348b841275cc00a2c63771927 Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
* Rename Qt::Appearance to Qt::ColorSchemeTor Arne Vestbø2023-02-132-8/+1
| | | | | | | | | | | | Based on discussions in the 6.5 API review, where we concluded that 'appearance' is too general. Instead, we follow the CSS standard and use the term 'color scheme'. Pick-to: 6.5 Change-Id: I8ceaf4138ecadff5ccd962480e8e5beb39b556ec Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Jonas Kvinge <jonas@jkvinge.net> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Remove time-related functions from qglobal_p.hEdward Welbourne2023-02-131-1/+0
| | | | | | | | Recently removed to qtenvironmentvariables_p.h, so #included that while qtdeclarative adjusted its one client's #include. Change-Id: I4ed8f69f009996d6a2856e2f4e0bb861a104931c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Trace: Convert qtcore module to use tracepointgen toolAntti Määttä2023-02-101-0/+4
| | | | | | | | 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>
* Prepare for replacing Qt::Appearance with Qt::ColorSchemeTor Arne Vestbø2023-02-091-0/+7
| | | | | | | | | | | | | | Based on discussions in the 6.5 API review, where we concluded that 'appearance' is too general. Instead, we follow the CSS standard and use the term 'color scheme'. This patch is a first step, only introducing the new API, so that submodules can port over. The next step will be to remove the old API and transition the docs and platform themes. Pick-to: 6.5 Change-Id: I43cdb6bb1ccb49c535c06b1897821467fd83ca60 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QSysInfo: Work around erroneous warning output from WindowsMårten Nordheim2023-02-091-1/+14
| | | | | | | | | | | | | | | | | | | gethostname is in no way labeled deprecated, but it _tries_ to query some deprecated functionality, thus some warning like this is printed: "" LogHr(1) tid(6e14) 8007277C No such service is known. The service cannot be found in the specified name space. "" By using GetComputerNameEx we work around that. Bonus side effect is that it gives us UTF-16 right away so we save a conversion. Fixes: QTBUG-110468 Pick-to: 6.5 Change-Id: I3a370354d9cce50e3d89d125ce61fc9b619294cc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Qt::Appearance: don't assign values to enumeratorsMarc Mutz2023-02-081-3/+3
| | | | | | | | | | | | The compiler does that for us. This makes the enum look like an enum again. A non-flags enum shouldn't have intializers of the form 0xNNNN, as that makes it looks like flags. Found in API review. Pick-to: 6.5 Change-Id: If49e94cdad719b7dc9e8a7b17f6883dc789e62d6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Deprecate QTypeInfo::isPointer and isIntegralGiuseppe D'Angelo2023-02-081-10/+10
| | | | | | | | | | | They're completely superseded by standard traits, and there are no more users in-tree. I'm not hiding them behind a QT_DEPRECATED_SINCE, because these are private APIs, so there's no source compatibility guarantees here. I'm also using [[deprecated]] directly to avoid an extra inclusion after the QtGlobal split. Change-Id: If649e52ffe51c5eba1c51da25b6fe0621a0b17b3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add/enable Alpha detectionPino Toscano2023-02-071-3/+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>
* Move qtLocalTime() to qtenvironmentvariables.cpp as qLocalTime()Edward Welbourne2023-02-033-16/+83
| | | | | | | | | | | | | | | The new name better matches the names of existing functions there. A comment on the old code noted that such a move should really be done, so as to correctly share the environment-mutex locking. In the process, move the (now three) time-related internal functions from qglobal_p.h to a new qtenvironmentvariables_p.h since that's the natural place for them given where they're defined (and the fact that they're for internal use only). Change-Id: Ib028baebaf31a806a2c0c97caaaba0a466c11cea Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* q20::construct_at(): fix various issuesMarc Mutz2023-02-021-6/+10
| | | | | | | | | | | | | | | | Fix several issues in 72c2cdbc572f8b8b45a57a451e2bc19bb1c53b0c, which I was too slow to review before it went in: - use the correct feature macro, not __cplusplus - use the correct signature (return T*, not void) - don't make the function static - add a comment mentioning the material difference to std::construct_at - drop unneeded <qxptype_traits.h> include Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I39d1908f565b1c1a31d5741924ac173447ec9057 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtCore: Disambiguate static variablesFriedemann Kleint2023-02-021-0/+4
| | | | | | | | | They cause clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I5f1fbee07872a742a78adc9864fe00c710ca24d0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Short live q20::construct_at()!Friedemann Kleint2023-02-011-0/+46
| | | | | | | | | | | Move the helper from qsystemsemaphore.cpp to q20memory.h to prevent clashes in CMake Unity (Jumbo) builds. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Id0127af1f0d51c87a5887090cc90ab232eff8093 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* qcompilerdetection.h: add Q_COMPILER_MANGLES_ACCESS_SPECIFIERMarc Mutz2023-01-231-0/+1
| | | | | | | | | | | | | | | | | | | | | This is similar to Q_COMPILER_MANGLES_RETURN_TYPE, except that the other such compiler, SunPro CC, at least by my cursory reading of https://archive.org/download/SunWorkshopVol5No1/Sun%20WorkShop%E2%84%A2%20for%20Solaris%202.x%20Volume%205%20Number%201.iso/SPROmrcpl%2Freloc%2FSUNWspro%2FSC4.2%2FREADMEs%2Fmangling.ps doesn't appear to mangle the access specifier. So it's only MSVC. It's still better to have a properly-named macro for this than to work with Q_CC_MSVC and, hopefully, an explanatory code comment. May come in handy to maintain BC when we find the need to change an access specifier in the future. The original use-case, in QtPositioning, was fixed differently. If nothing else, let's have it to raise awareness of the issue. Pick-to: 6.5 Change-Id: Ia8b789d2713ec19487a21c6bb0a12cf285e6ba83 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix build with GCC 13: target specific option mismatchThiago Macieira2023-01-191-7/+13
| | | | | | | | | | | | | range_access.h:274:5: error: inlining failed in call to ‘always_inline’ ‘constexpr std::size_t std::size(const _Tp (&)[_Nm]) noexcept [with _Tp = short unsigned int; long unsigned int _Nm = 34]’: target specific option mismatch qsimd.cpp:367:35: note: called from here Pick-to: 6.5 Change-Id: Ide4dbd0777a44ed0870efffd1739097c71991822 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add CTF tracing backendAntti Määttä2023-01-131-1/+1
| | | | | | | | | | | | | | | | | | | | Implement platform independent tracing backend in Common trace format. This allows tracing in platforms without own/existing backend and analysing all platforms with the same tooling. The backend is the basis for further work in application level profiling area. The backend is implemented as a plugin that is loaded immediately when the application starts in order to process all trace events. The backend avoids using Qt classes so that it doesn't generate trace events itself. Adds plumbing to configure the new backend. Modifies the tracegen and tracepointgen tools to support the new backend. Task-number: QTBUG-106399 Pick-to: 6.5 Change-Id: I80711be52d4d48e1acbc72edffbdf3f379fce52a Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
* Add metadata support to tracegen and tracepointgen toolsAntti Määttä2023-01-131-0/+45
| | | | | | | | | | | Adds ability to add textual metadata for enumerations and flags to the traces so that they provide more information to the user instead of just numbers. Implement these for both existing backends. Task-number: QTBUG-106399 Pick-to: 6.5 Change-Id: Ibab00dd370d019891cf9ad6e65e6f9d868e32dce Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
* Add tracepointgen tool and convert qtgui to use itAntti Määttä2023-01-131-0/+76
| | | | | | | | | | | | | | | | | | | | | Allows automatically generating tracepoint files by scanning source files for instrumentation macros. This makes it easier to add tracepoint support to modules and also ensures that the tracepoint files do not get out of sync with the functions they are tracing. Q_TRACE_INSTRUMENT generates entry/exit tracespoints for a function it is set. Q_TRACE_PARAM_REPLACE is used to change a function parameter for these functions to convert it to supported parameter type. Q_TRACE_POINT can be used to create a standalone tracepoint. Q_TRACE_PREFIX can be used to add prefix for generated tracing backend for example to add includes for types used in the trace points.. Task-number: QTBUG-107238 Pick-to: 6.5 Change-Id: Ib395b80838434ceb72683dac0545ca20c4d09455 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
* Move q20::remove_cvref to q20type_traits.hMarc Mutz2023-01-123-14/+44
| | | | | | | | The original is defined in <type_traits>, not <functional>. Pick-to: 6.5 Change-Id: I596e56f64d2eed609ad2f7e6f03ae006afaa2fa9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>