summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
Commit message (Collapse)AuthorAgeFilesLines
* Add check for -Wcharacter-conversion supportMorten Sørvig3 days1-1/+1
| | | | | | | | | | | | | | | | | Use __has_warning() to check if -Wcharacter-conversion is supported before disabling it, in order to avoid "unknown warning" warnings. This is/was a problem when building with Emscripten 4.0.7, which uses a git snapshot of Clang 21 which does not support the warning. Amends f20f12baab1f40ec0aad2635186e7d270139509b. Pick-to: 6.10 Change-Id: I4c08e69013b36b87709295d9a3a79d8986078ef1 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Update Apple Clang/LLVM version mapping for Xcode 26.0Tor Arne Vestbø12 days1-1/+3
| | | | | | Pick-to: 6.10 6.8 6.5 Change-Id: Ib88dfd1808bd72155df4d8fb865306413c8c3d91 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* qsimd/x86: Remove detection of RDRND and RDSEEDThiago Macieira13 days4-214/+30
| | | | | | | | | | | | | | | | The previous commit removed their use from QRandomGenerator, which was the only user. This removes their detection too, which means QtCore will not refuse to load when compiled with an -march= flag that specifies the feature should be present, but is missing at runtime. See https://lore.kernel.org/all/9a27f2e6-4f62-45a6-a527-c09983b8dce4@cachyos.org/ Task-number: QTBUG-69423 Task-number: QTBUG-129193 Pick-to: 6.10 6.8 6.5 Change-Id: Ib67da873cc42acfedaeefffd56db0414bb7ea6b0 Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Partially revert "qnumeric.h: add support for C23/C++26 <stdckdint.h>"Thiago Macieira2025-11-171-33/+9
| | | | | | | | | | | | | | | This reverts commit 08ebe3465cc2fce98662b5833b75503490f66265. Reason for revert: the ckd_* functions are not constexpr. If we're going to have to keep our implementations anyway, then we may as well skip using the C23/C++26 feature. Maybe in C++29 they become constexpr. I've left behind the requirement to not use plain char, in case we want to switch to these later. That retains the old commit's changelog. Fixes: QTBUG-142028 Change-Id: I6db786946ae31be16891840b03e5120eb8915d52 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* qtdeprecationmarkers.h: add a comment on why we #undefMarc Mutz2025-11-151-0/+1
| | | | | | | | | | Not understanding these #undefs blocked me for some time while trying to introduce QT_DEPRECATED_MACRO, so make sure the next reader gets a head-start. Pick-to: 6.10 6.8 6.5 Change-Id: I77afe04beee00c1a4db65e5c160d052946f89f0a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRandomGenerator: remove direct use of HW instructionsThiago Macieira2025-11-122-6/+2
| | | | | | | | | | | | | | | | | | | | | The HWRNG instructions are not necessarily faster than what we can get from the OS. Moreover, the OS is able to collect entropy from sources other than the CPU itself. More importantly, this removes the need for Qt to deal with broken HWRNG, passing the buck to the OS (which may disable the CPUID bit, causing the application to fail to load). [ChangeLog][QtCore][QRandomGenerator] This class no longer directly uses a hardware random number generator on x86 systems, even if one is available. Instead, it will always use a generator provided by the OS (so performance will be OS-specific), though there should be no meaningful difference in the quality of the samples generated. Task-number: QTBUG-69423 Task-number: QTBUG-129193 Pick-to: 6.10 6.8 6.5 Change-Id: I5121c5a34d684983fa1dfffdbabd22de51966650 Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* [docs] Q_CONSTINIT: mention it attaches to definitionMarc Mutz2025-11-111-0/+12
| | | | | | | | | | | | | | | | | | | | The macro (like the attributes and the C++20 keyword that back it) belongs on the definition, not on the declaration, of the variable, because it's a static assertion on properties of its initialization. Some compilers apparently accept it on a non-defining declaration (or we only checked in C++17 builds with old compilers), but we have several variables in QtCore that are marked as described in this documentation addendum, and they've not caused problems in the CI all these years, so document as practiced, and ignore other combinations that theoretically may work, too (on some compilers, at least). Amends 80b6bcc385863a38d499685af9b8e857e46cbdba. Pick-to: 6.10 6.8 6.5 Change-Id: I825127ff9ade483584f399fda78b7c7082f68ed8 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Fix or remove self-referencing "see also" linksDavid Boddie2025-11-101-2/+2
| | | | | | | | | | Use a precise signature for a QMultiMap::count() overload. Remove links to QRandomGenerator64 functions as defines in the header file hide them from QDoc. Task-number: QTBUG-137048 Change-Id: I75994ae96d385d08730e3afc849fe81ea9e88dee Reviewed-by: Topi Reinio <topi.reinio@qt.io>
* Strict mode: add a note about updating the docs when adding to the listAhmad Samir2025-11-091-1/+4
| | | | | Change-Id: I451b540940bce98ae09c2855cd2b86ff9ba9bb2f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Document Q_PRESUMEThiago Macieira2025-10-261-3/+16
| | | | | | | | | | [ChangeLog][QtCore] Added Q_PRESUME macro to wrap C++23 [[assume]] and thus never evaluates the expression, replacing Q_ASSUME which could evaluate it. Change-Id: I7895364ccac9ce36ea5afffd738f60d96839bfd9 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Suppress Clang 21 -Wcharacter-conversionMarc Mutz2025-10-211-0/+4
| | | | | | | | | | | | | | | | | | The new Clang 21 warning is wreaking havoc in C++ projects that want to use modern C++, because it not only warns about char8_t → char16_t, but also about the completely harmless char16_t → char32_t conversions. It has since been fixed, but suppress the warning globally until we know which version has the fix (looks to be 21.1.4 at this point). Upstream bug report: https://github.com/llvm/llvm-project/issues/163719 More discussion in: https://github.com/llvm/llvm-project/issues/138526 Upstream fix: https://github.com/llvm/llvm-project/pull/163927 Pick-to: 6.10 6.8 6.5 Change-Id: I6409f6f6833131e3a77d81ab679125b2806e86a2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* qalloc.h: add missing <cstdlib> includeMarc Mutz2025-10-211-0/+1
| | | | | | | | | | | | | | A Clang 21 headerscheck complained that malloc() and realloc() were undefined without it, and, indeed, these functions are defined in stdlib.h. Amends 03d5daf9437d8b46db2e89e3a9763ea701fa681c. Pick-to: 6.10 Change-Id: Ibe603769c3f25106c8f97215fccead255ce687c7 Reviewed-by: Aurélien Brooke <aurelien@bahiasoft.fr> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Long live Q_PRESUMETim Blechmann2025-10-201-0/+19
| | | | | | | | | | | | | | | | | Q_PRESUME wraps a Q_ASSERT/[[assume]] and can be used as a stop-gap until [[assume]] can be used unconditionally. It has stricter semantics than the deprecated Q_ASSUME and is helpful to silence static analyzer warnings. Documentation and [ChangeLog] in the next commit so it won't be cherry-picked. Fixes: QTBUG-141074 Pick-to: 6.10 Change-Id: Id5376bcc5e9e9708c836ceff5eea982c2b0e382e Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Tim Blechmann <tim.blechmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qnumeric.h: fix build with FreeBSDThiago Macieira2025-10-191-0/+2
| | | | | | | | | | | | | | | | Their stdckdint.h is broken for C++ and Clang's implementation just falls back to it. global/qnumeric.h:280:12: error: use of undeclared identifier '_Bool' 280 | return ckd_add(r, v1, v2); | ^ /usr/include/stdckdint.h:16:3: note: expanded from macro 'ckd_add' 16 | (_Bool)__builtin_add_overflow((a), (b), (result)) | ^ Pick-to: 6.10 Change-Id: Ide6f468820478f46d21ffffdb825c8c1977a99f2 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* qfloat16.h: scope warning suppression tighterMarc Mutz2025-10-171-4/+3
| | | | | | | | | | | | | | | | | The Clang -Wc99-extensions warning was fixed for Clang 5.0, and the function causing it (_cvtss_sh()) has since been replaced in commit c817b33b45f2886c89d8a768c61ffffaa46f67a4. That leaves the -Wold-style-cast suppression needed for _mm_cvtps_ph(), so put the suppression magic around just that call, amending 89c8dd30a12bbe44f4661a1b4dd5aec079e41cae. This exposes the rest of the function to warnings again, so not picking back, in case this unearths something. Once we have had a release cycle where this has caused no problems, we can reconsider. Change-Id: Ib489fd14c2337bfe64155ed5825c23f7a53b3cdc Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Fix implicit integer conversion loses build error on Intel VxWorksKarim Pinter2025-10-161-1/+1
| | | | | | | | | | | | | | | | Building Qt on VxWorks Intel platform results in implicit conversion loses integer precision build error. According to [1] the cast should be ok. [1] https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_extract_epi16&ig_expand=2927 Amends c817b33b45f2886c89d8a768c61ffffaa46f67a4. Fixes: QTBUG-140672 Pick-to: 6.10 6.8 6.5 Change-Id: Ic99dedac0cfc97ac84a9d0c9df24259bdab23e80 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* qnumeric.h: add support for C23/C++26 <stdckdint.h>Thiago Macieira2025-10-121-10/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to have cross-platform support instead of relying on intrinsics. Though this requires banning 'char' because this type changes signedness I guess and C23 doesn't allow them. Both Clang and GCC have a C23 header for <stdckdint.h>, added for GCC 14 and LLVM 19. Both sets of headers work in earlier C versions. Neither MSVC nor MS STL have added the headers, but once they do we should get the proper constexpr and runtime-optimal content that they came close to adding[1], where I reported: > For my own codebase, I don’t plan on writing new code. Users of Visual > Studio will keep getting worse codegen for a few more years, unless > they switch to Clang or GCC. GCC's header does not work in C++ due to the use of _Bool. That is fixed by libstdc++ from GCC15, with a C++ <stdckdint.h>, so we require that version of GCC. This will fail to compile with GCC and libc++ until the bug[2] is fixed. [ChangeLog][Source-Incompatible Changes] qnumeric.h's qAddOverflow(), qSubOverFlow(), and qMulOverflow() functions no longer accept char as a template parameter type. Use quint8 or qint8. [1] https://developercommunity.visualstudio.com/t/please-implement-integer-overflow-detection/409051 [2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121811 Change-Id: I5ca93cf4166735075b1bfffdad1dcd7c20cab031 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Add qTrId() alias for qtTrId()Masoud Jami2025-10-082-2/+23
| | | | | | | | | | | | | | | | | Remove the outdated comment about qTrId() being reserved for QStringFormatter, which never materialized. Add qTrId() as an inline alias for qtTrId() to provide the more intuitive function name for id-based translations in C++ code. The support in lupdate and the tests are added in a patch for qttools: I9047cb97 The original qtTrId() function remains available for compatibility. [ChangeLog][Core] Added qTrId() alias for qtTrId(). Fixes: QTBUG-134544 Change-Id: I415797b236bff987c87e627e5e422899dda30d92 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QLogging: fix narrowing conversion assertAhmad Samir2025-10-071-1/+1
| | | | | | | | | Amends a213dca680827336cb63de743be3f019c4521808. Pointed out by Eddy in code review. Pick-to: 6.10 6.8 6.5 Change-Id: I061f9892384fe62650dfec23842686d1ba53130a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* corelib: fix clang narrowing conversion warnings -Wshorten-64-to-32Ahmad Samir2025-10-062-2/+3
| | | | | | | | | | | | | | qlogging.cpp: ::backtrace() takes an int. QLoggingSettingsParser: fgets() takes an int. QFileSystemEntry: filePath() would never exceed PATH_MAX on Unix; and on windows even with the extended long path option it should fit in an int: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation Pick-to: 6.10 6.8 6.5 Change-Id: I288f4adc71740e077ed0c11de4e38f6fddc00455 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSysInfo: don't pass QStringLiteral to QWinRegistryKey::stringValue()Marc Mutz2025-09-301-1/+1
| | | | | | | | | | | | | | | | | | | | The stringValue() function took QStringView from the initial commit of the class, so passing QStringLiteral (which creates and destroys a full QString instance, and, until recently, even injected an additional isNull() branch when converted to QStringView) was never necessary; a UTF-16 string literal would have always sufficed, and be faster. Since the API will will soon be changed to take const wchar_t*, use a wchar_t literal instead of char16_t one. For QStringView, it doesn't matter (on Windows, at least), but it keeps the call compatible with the future QWinRegistryKey API. Amends 80996d2e5d6d04b08452cf507f6ced7d8a09068c. Pick-to: 6.10 6.8 6.5 Change-Id: If88fb074c72bf3a41adf5cfb4b68f185c24481fd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Mark Qt::WindowType::Desktop deprecatedAxel Spoerl2025-09-301-1/+4
| | | | | | | | | Qt::WindowType::Desktop is no longer a valid window type in Qt6. Mark it deprecated. Fixes: QTBUG-140514 Change-Id: Ic47da86bc44fb5eb510a07150de1d07941406177 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix Android builds with QT_FORCE_BUILD_TOOLS=ONAssam Boudjelthia2025-09-301-1/+1
| | | | | | | | | | | | | Bootstrapped builds don't have streamable qCDebug() calls, so use printf style. Also, QJniObject can't be used in this build type, so guard it under QCoreApplicationPrivate::appVersion(). Fixes: QTBUG-140516 Pick-to: 6.10 6.8 Change-Id: I912e57689f758627ef6ca63405b557940adbf186 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* (QtGui) doc: Add alt text for \image tagsEren Bursali2025-09-291-1/+2
| | | | | | | | | Adding alt texts that were needed for QDoc Fixes: QTBUG-135119 Pick-to: 6.10 Change-Id: Id330b1933f56ff845fa02d91680cec27855e56e3 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Doc: Fix broken "see also" linksDavid Boddie2025-09-291-1/+1
| | | | | | Change-Id: I84828d72b67b26eb2a98050b8f74b911f228d4a0 Task-number: QTBUG-137048 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Fix self-linking "see also" linkDavid Boddie2025-09-261-1/+1
| | | | | | | Pick-to: 6.9 6.10 Change-Id: Ieb132dbd70fd0469040e6b55763df1f1b5fc4ab7 Task-number: QTBUG-137048 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Move all Q_DECL_(PURE|CONST)_FUNCTION markers to the frontMårten Nordheim2025-09-191-3/+3
| | | | | | | | | While testing defining Q_DECL_PURE_FUNCTION for MSVC I discovered it cannot handle having the marker trailing, while GCC/clang can cope with either. Change-Id: Ic9dd088996c191263e2f2a43c2f6a16533bdb9c5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* q20bit: fix checks for C++20 header includeIvan Solovev2025-09-191-1/+1
| | | | | | | | | | | | | | The file contains checks for __cpp_lib_bitops and __cpp_lib_int_pow2, but the C++20 <bit> header was only guarded by the first check. Apparently, it's possible that only one of them is defined, so extend the include guard. Amends c02289f8dc277c3f21ca181ac73a1f6e2401b1ba Change-Id: I49fdd4e2a2e999da653b4dfa551a499775b6e281 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLibraryInfo: Add MSVC 2026Mårten Nordheim2025-09-171-1/+3
| | | | | | | | Currently _MSC_VER is defined to 1950 for the preview build. Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I81a4191715307d347d17c811456ea7bd7cfa283c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Update multi-threading doc titlePaul Wicking2025-09-161-1/+1
| | | | | | | | | | | | Change title from "Thread Support in Qt" to "Multi-threading in Qt" to use more modern and precise terminology. Add target directive to preserve possible existing links and update all cross-references across the codebase. Task-number: QTBUG-140178 Pick-to: 6.10 6.10.0 6.9 6.8 Change-Id: If3457a811d71fa17e29cf5d5886fda11951c2862 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* expected: do not include qconfig.hTim Blechmann2025-09-142-2/+2
| | | | | | | | | | | | qconfig.h does not have inclusion guards, so it should no be included directly: it can break code as qcompilerdetection.h undef-ines its symbols. Pick-to: 6.10 Fixes: QTBUG-140149 Task-number: QTBUG-140150 Change-Id: Ic655a87ebeccd3cbc66286fd92279da8ca11cad3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* q20::countr_zero: add support for the TZCNT instruction with MSVCThiago Macieira2025-09-101-0/+10
| | | | | | | | | | | | | | | | This intruction introduced by Intel with the Bit Manipulation Instructions (BMI) with the Haswell generation and later adopted by AMD when they also adopted AVX2. Like LZCNT, this instruction reports the size of the input if it was zero. The processor has 8- and 16-bit forms of this instruction, but MSVC has no intrinsics for them, so we still need to check for zero input, in which case we may as well emit the old BSF instruction, for which we get the input-was-zero status from the instruction itself, saving on some code emission. Change-Id: I116169a2d8b6ae96936ffffd563084a3009f2dce Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* q20::countl_zero: add support for the LZCNT instruction with MSVCThiago Macieira2025-09-101-0/+13
| | | | | | | | | This intruction introduced by AMD with the Advanced Bit Manipulations (ABM) instruction set and adopted by Intel with the Haswell generation replaces the need to reverse the calculation and supports a zero input. Change-Id: Icf849d18b39c8dafedc4fffd7694a760f92d54fb Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Short live q20:rotl and q20::rotrThiago Macieira2025-09-102-0/+36
| | | | | | | They are also easy. Change-Id: I72120e4d97bb7fefc3a7fffd525132143e44e52b Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* q20bit.h: fix compilation in C++17 modeThiago Macieira2025-09-101-0/+2
| | | | | Change-Id: Ieefde9327d4e518720b9fffd817ae30d20ac6180 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Doc: QtCore: Add missing \headerfile topicsTopi Reinio2025-09-0915-0/+108
| | | | | | | | | | | | | | | | | | | | | A lot of functions and macros previously available under the QtGlobal header have been separated into different, specialized headers. The documentation for these were updated to refer to the new header file names using the \relates command, but a \headerfile topic was missing for a lot of them. As a consequence, QDoc automatically generated a 'proxy' page for these, which look confusing as they lack any description of what the page is. Add \headerfile topics for them, along with \brief descriptions. Fix \relates arguments for type alias QPair and the deprecated function qMakePair() to point to the correct header file. Pick-to: 6.10.0 6.10 6.9 6.8 Task-number: QTBUG-117447 Change-Id: I98114ddb71f78982e390e28e9521e264f3ecf5d0 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Respect QT_NO_INT128 in qtypes.cpp's #errorMarc Mutz2025-09-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently don't support building Qt with GCC and -ansi (or -std=c++NN as opposed to -std=gnu++NN), because in that mode, the language still recognizes __int128_t, but the C++ standard library does not, leading to bloopers such as std::is_integral_v<__int128_t> == false or std::is_signed_v<__int128_t> == false, or simply std::numerical_limits<__int128_t> not being properly specialized. But we do have QT_NO_INT128, which, when defined, disabled all the Qt extended integer support. A user requested to allow compiling with -ansi again, to which I responded that they should define QT_NO_INT128 then, too, but of course, the sanity-check in qtypes.cpp ignored QT_NO_INT128 and would fire nonetheless, so this patch fixes that. [ChangeLog][QtCore] Made it possible to compile Qt with GCC in strict C++ mode (-ansi or -std=c++NN) again, provided QT_NO_INT128 is defined, too. Amends 30e04340dac26ebd09f9bc8ceb598e873ab63ba7. Pick-to: 6.10 6.9 6.8 Task-number: QTBUG-139280 Change-Id: I3e05d1f5e11b6a0a6a49fad53846f2b9cf0663a7 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Short live q20::bit_{ceil,floor,width}Thiago Macieira2025-09-081-0/+28
| | | | | | | | | | | We use std::bit_ceil() in qNextPowerOfTwo(), this is going to be used to replace that implementation. The other two are provided because they are easy. The implementations are straight from cppreference.com. Change-Id: I04fd7ff7c72ab88c73d0fffd7e8cffdbb3a49c45 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Q_ASSERT: fix also QT_NO_DEBUG case re: Qt namespaceMarc Mutz2025-08-301-1/+2
| | | | | | | | | | | | | | | | | | | When 88f2d7aacb17119aebc701fbf10f9c89d4e9b79a added QT_PREPEND_NAMESPACE to make Qt macros usable in contexts that use a namespaced Qt, but not QT_USE_NAMESPACE, it forgot to handle qt_no_assert_x(), itself a recent addition (6069933b57a8c0175596f66fd5e28381b47d1bc5). This patch fixes the omission. Amends 88f2d7aacb17119aebc701fbf10f9c89d4e9b79a. Found in API-review. Pick-to: 6.10 Change-Id: I2d20cb502211c39d165155c35e58272de0cbbae5 Reviewed-by: Aurélien Brooke <aurelien@bahiasoft.fr> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* q20bit.h: add support for generic GCC & Clang __builtinsThiago Macieira2025-08-281-0/+16
| | | | | | | | Simplifies the implementation. I didn't add #else so the rest of the code is still compiled for checking. Change-Id: I3062fef8424fa896995cfffdb4916c194cdc7e98 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* q20bit.h: add support for 128-bit unsigned integersThiago Macieira2025-08-281-0/+18
| | | | | | | | | | | The C++20 allows these functions to operate on extended integers, which for GCC and Clang on 64-bit machines includes 128-bit ones. Not expanded to the q{Population,LeadingZero,TrailingZero}Count() functions. Therefore, not tested. Change-Id: I516b86e2a4836213aff3fffd8033220a9e3a24a0 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Short live q20::countr_zeroThiago Macieira2025-08-281-0/+72
| | | | | | | | | | | Constexpr/fallback implementations copied from qalgorithms.h. No performance loss with MSVC/x86-64 because the compiler supports is_constant_evaluated() in C++17 mode too (that's actually how MS STL implements <bit>). Change-Id: Ifca0253d1afc580abd25fffd74587cc1ffb6af17 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Short live q20::countl_zeroThiago Macieira2025-08-281-0/+69
| | | | | | | | | | | Constexpr/fallback implementations copied from qalgorithms.h. No performance loss with MSVC/x86-64 because the compiler supports is_constant_evaluated() in C++17 mode too (that's actually how MS STL implements <bit>). Change-Id: I6235e8e411ad0ad7fa10fffd7f38f8f77787d8c0 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Short live q20::popcountThiago Macieira2025-08-281-0/+102
| | | | | | | | | | | Constexpr/fallback implementations copied from qalgorithms.h. No performance loss with MSVC/x86-64 because the compiler supports is_constant_evaluated() in C++17 mode too (that's actually how MS STL implements <bit>). Change-Id: Ia6a83b74b08c6f6d5208fffd0cb21c8a499813d6 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* qTzName(): fix -ftrivial-auto-var-init=pattern performance regressionMarc Mutz2025-08-201-0/+1
| | | | | | | | | | | We don't need the compiler to write half a KiB of stack memory here, so add the opt-out macro. Amends 9ff1e6d80bbd5b44b9ec4c0a837d9a4c962698e4. Pick-to: 6.10 6.9 6.8 Change-Id: I0138bf30b451bbfeaa20582298f5cadaa85a938f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* qTzName(): eliminate some code duplicationMarc Mutz2025-08-201-5/+2
| | | | | | | | | | | | | | | | | Commit f6f68d5f8d494c313d284a8f6aa86c865a7c3611 brought the function into a form where the _UCRT and non-_UCRT paths share a common prefix and suffix (the establishing and ending of the critical section). This commit takes advantage of the new form to extract the common affixes from the platform-dependent sections, avoiding repetition. Amends said commit. Pick-to: 6.10 6.9 6.8 Change-Id: I562bfdfa0a64861003d3a5de85ba3be878e24184 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* qTzName(): fix UB (calling strlen(nullptr))Marc Mutz2025-08-201-1/+1
| | | | | | | | | | | | | | | | | | | Coverity complained that that we're calling strlen() before checking its argument for nullptr. Calling strlen(nullptr) is UB, so guard the call manually. An alternative would be to use qstrlen(), which can explicitly handle nullptr, but this is very low-level code, so we should probably stick to the bare metal here. Amends f6f68d5f8d494c313d284a8f6aa86c865a7c3611. Pick-to: 6.10 6.9 6.8 Coverity-Id: 487584 Change-Id: I8301f47179d80234408711af5f95563320bd590c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QtCore: private: use Q_UNREACHABLE in qexpectedDmitrii Akshintsev2025-08-191-1/+1
| | | | | | | | __builtin_unreachable() might not exist on some platforms, for example, integrity, use Qt API instead Change-Id: Iff2d0759b62d16d3e4acc33ce2bb6e72dbf603a3 Pick-to: 6.10 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qTzName(): Fix #endif commentMarc Mutz2025-08-181-1/+1
| | | | | | | | | | | | Since eedb715ece5beabd1db731d0d003cf8112360f7c, the #ifdef is for _UCRT instead of Q_OS_WIN, so let the endif comment reflect that. Amends said commit. Pick-to: 6.10 6.9 6.8 Change-Id: I7f9b488ed923744267a1107826ab05553f3d0267 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Correct interpretation of _get_tzname() returnEdward Welbourne2025-08-141-2/+3
| | | | | | | | | | Corrects commit b73dafbf86f14c6559f663eeb8b2b0aab6cdc297, in which I mistakenly flipped how we interpret this return value. At the same time; and use sizeof() instead of hard-coding the array's size. Pick-to: 6.10 6.9 6.8 Change-Id: Ifd805c30bcfa6fb120c20c97076fcb9d1acbb609 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>