Commit Graph

63363 Commits

Author SHA1 Message Date
Marc Mutz
16433a4a6e Long live Q_(U)INT128_C()!
Compilers that support 128-bit integer types usually don't have
support for 128-bit literals, so provide Q_(U)INT128_C macros and back
them with UDLs. This, of course, only works in C++, so until compilers
provide built-in literals that support C, too, that's all we get.

[ChangeLog][QtCore] Added Q_INT128_C() and Q_UINT128_C() macros to
create qint128 and quint128 literals in a platform-independent way.

Pick-to: 6.6 6.6.0
Fixes: QTBUG-116822
Change-Id: I4be645baf2e007ee1aa1a27f9b5166671806dc49
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-14 18:39:24 +02:00
Piotr Wierciński
9468ef2cfb CI: Enable some tests under corelib/thread for Wasm platform
This is part of our testing effort where we try enabling more tests for
Web Assembly platform on CI. Not all tests work out of box, so some of
them will require followup work.
This commmit also introduces a new mechanism of automatically renaming
files when they are added many times with the same filename to single
translation unit.

Change-Id: I620536494ea83aeb9b294c4a35ef72b51e85a38b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-09-14 11:58:48 +02:00
Giuseppe D'Angelo
5ac97a38e8 QObject: do not copy a ConnectionList object
The semantics of copying a ConnectionList are not defined; the type
is copiable by accident. Use a reference to the list instead (like done
in other places in the code).

Change-Id: Ifbc5d3baca992f3eb13e3781378e79ed1feb4e1c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-14 11:58:17 +02:00
Ievgenii Meshcheriakov
e49d8444dc QDBusArgumentPrivate: Disable copy and move, make constructor protected
Disable copy and move for the class because it is polymorphic.

Make the constructor protected because instances of this
class are not supposed to be created directly.

Mark drived classes final.

Change-Id: Ia6f2d640f3642ad4a6ecb3830fba152155e237b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-14 11:50:46 +02:00
Ievgenii Meshcheriakov
37af09adf0 QtDBus: Resolve libdbus functions in a thread-safe way
Use atomic pointers.

While at it, declare the function type with `using` instead
of a typedef for better readability, do the declaration
locally so that less preprocessor concatenation is needed,
use reinterpret_cast instead of C-style cast.

Change-Id: I5ed0d35b7ddfdd62ef6c12403fe7052019453f34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-14 11:50:28 +02:00
Ievgenii Meshcheriakov
bfdefa81f8 QDBusArgumentPrivate: Specify direction as argument to constructor
This avoids having direction member uninitialized by mistake. Make the
member variable const as it is never modified.

While at it, make Direction and enum class.

Change-Id: I53814ae9e1d6bcf786433674619145a1ee61e063
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-14 11:50:24 +02:00
Ievgenii Meshcheriakov
946992b9b0 QDBusArgumentPrivate: Use type-safe enum for flags
Declare flags as QDBusConnection::ConnectionCapabilities
instead of bare int. Do the same for derived classes
QDBusMarshaller and QDBusDemarshaller. Make the constructors
explicit, replacing useless `inline` where it was used.
Make flags argument default to empty flags.

Change-Id: I6caedde06b2ef41d725f15348ee780d1cc20b355
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-14 11:50:22 +02:00
Ievgenii Meshcheriakov
e4eabbf3e4 QDBusArgumentPrivate: Initialize member variables inline
For better readability and ease of modification.
Do the same for derived classes.

Change-Id: I9601f0b280feb5e3d0e71ed4a3405fdd9cca8dd2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-14 11:50:18 +02:00
Viktor Arvidsson
b2aeac9891 QTextFormat: Allow merging unset properties
There was no way to merge removal of properties which is required in
case you want to unset some property on the current selected text in a
text document. For example in case your text has font size set in pixels
and you want to change it to point size, that would be impossible before
this change. With this change you can set the font point size to what
you want and then set font pixel size to QVariant().

This is maybe not the most obvious way to do it but any other way I
could think of would require new api and quite some code duplication.

[ChangeLog][QtGui][Text] QTextFormat now allows setting properties to an
invalid QVariant to allow clearing properties via a merge. This changes
behavior slightly where code iterating over a QTextFormats properties
would never encounter invalid variants, which is now possible if
setProperty with an invalid variant was used instead of using the
clearProperty function to remove properties.

Change-Id: Ie8290088d457bf19d9c4785cfe91ae6a1de572c4
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-09-14 00:44:49 +02:00
Albert Astals Cid
ae83f327cd ios: Fix crash when closing app while showing a native screen
Fixes: QTBUG-117021
Pick-to: 6.6 6.5
Change-Id: Icebae0e815b42c6e0bf39e727fd1a16db5752d78
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-09-13 22:09:54 +00:00
David Faure
549ed4fb24 QMimeType: simplify implementation of filterString
As suggested by Ahmad Samir

Change-Id: I7f3ef29436a7725b6dceab72bd0f8b01756bf930
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 23:27:44 +02:00
David Faure
071a9c9061 QMimeDatabase: introduce QMimeMagicResult to accumulate magic results
Better than two pointer parameters. However it can't be a return
value as we initially thought, it's an in/out parameter, in order to
compare the results in the current directory with those found in earlier
directories.

Change-Id: Ic6137f2627703f8d6930c3f7dd1a1102187eef30
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 23:27:44 +02:00
David Faure
1f0bc1ade3 QMimeDatabase: fix glob-deleteall support for the binary providers
This fixes the recently added QEXPECT_FAIL about glob-deleteall
in a local directory (with a binary cache). Before adding a glob match
we ask the more-local (higher-precedence) directories if they have
a glob-deleteall for that mimetype, and skip it then. This "asking"
is a virtual method, implemented for both XML and binary providers.

Change-Id: I6e4baf0120749f3331fd2d9254bea750a322b72d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 23:27:44 +02:00
Santhosh Kumar
42e164f5ad Update version for QPalette::accent API in documentation
Follow up patch to 3c391c159ce0e29a9a654edee45bd64bcde6ccd2.

Pick-to: 6.6
Change-Id: I23235ae8516a53cf09c00b0daedc054df2f0cfa8
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-09-13 21:41:22 +02:00
Rym Bouabid
dcc0844056 Revamp Wait Conditions Example: Revisit the documentation
Change the title.

Remove the first \brief as there are two briefs in the document
so that the new title makes sense with the second brief in
"All Qt Examples" doc page.

Task-number: QTBUG-108860
Pick-to: 6.6 6.5
Change-Id: I1dec2ad107e3f9ff9b4203960ba54ae6d0d8c7b6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
2023-09-13 20:45:18 +02:00
Rym Bouabid
0132ad0fde Revamp Shared Memory Example: Revisit the documentation
Remove "Example" from the title.
Extend the \brief.

Task-number: QTBUG-108858
Pick-to: 6.6 6.5
Change-Id: Ie8bd0c808503861027f80493c430e8ac1baada5f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-13 20:45:17 +02:00
Rym Bouabid
976f30dc59 Revamp Shared Memory Example: Change the used QSharedMemory constructor
Use QSharedMemory(const QNativeIpcKey &key) constructor to port away
from the deprecated QSharedMemory(const QString &) constructor.

Task-number: QTBUG-108858
Pick-to: 6.6
Change-Id: I05615100f77f571fe32a3cf627c3df46baaa7f7a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-13 20:45:17 +02:00
Rym Bouabid
0a62d4e4c0 Revamp Shared Memory Example: Fix formatting of the dialog.h header
"dialog.h" has inconsitent indentation.

Task-number: QTBUG-108858
Pick-to: 6.6 6.5
Change-Id: Id029d5ec63f3831e5ffcfe2b61d7e86896d4afb5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-13 20:45:17 +02:00
Rym Bouabid
70815d31fe Revamp Semaphores example: Revisit the documentation
Change the title.

Remove the first \brief as there are two briefs in the document
so that the new title makes sense with the second brief in
"All Qt Examples" doc page.

Task-number: QTBUG-108859
Pick-to: 6.6 6.5
Change-Id: I8b0370c9a85179e172918231ae48a3c52845bf21
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-13 20:45:17 +02:00
Rym Bouabid
8643b52467 Revamp Shared Memory Example: Fix include order
Fix include order to respect the Coding Conventions.

Task-number: QTBUG-108858
Pick-to: 6.6 6.5
Change-Id: Ifecf7c60ca7135104631587b25e907cb1d39e25b
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-13 20:45:17 +02:00
Rym Bouabid
c4a1c171a3 Revamp Semaphores example: Replace const by constexpr when applicable
Replace const by constexpr when the value of the variable can be
calculated at compile-time.

Fixes: QTBUG-108859
Pick-to: 6.6 6.5
Change-Id: I4abf5162d521fc5dca0286a6254f86c57a473367
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-13 20:45:17 +02:00
Rym Bouabid
2a2275756b Revamp Mandelbrot example: Declare slots as methods instead
Declare zoom as a method because it's never used as a slot.

Declare updatePixmap as a method because it's used as a slot
as pointer-to-member-function, so it doesn't need help from moc.

Q_OBJECT is not needed anymore as the MandelbrotWidget class
doesn't contain signals ans slots anymore. It's replaced by
Q_DECLARE_TR_FUNCTIONS because we are using tr() function.

Fixes: QTBUG-108861
Pick-to: 6.6 6.5 6.6.0
Change-Id: I9a1d66711cdc9f0ca5a1bc6645f7e0ed3395645c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-13 20:45:17 +02:00
Rym Bouabid
73a1ae6ea9 Revamp Mandelbrot example: Revisit the documentaton
Remove "Example" from the title.

Edit the link (title) to the documentation of Mandelbrot in QThread
documentation.

Delete the foreach related sentence as we are trying to port away from
this Qt pseudo-keyword.

Task-number: QTBUG-108861
Pick-to: 6.6 6.5 6.6.0
Change-Id: I6d04f24ac9c1fa1efe30a947c2da2ec7475edc80
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-13 20:45:16 +02:00
Rym Bouabid
7903a52d46 Revamp Mandelbrot example: Add const/constexpr when applicable
Add const in front of local variables when applicable.

Replace const by constexpr when the value of the variable can be
calculated at compile-time.

Task-number: QTBUG-108861
Pick-to: 6.6 6.5 6.6.0
Change-Id: I2cd1bc97aaa07d6d564731d9ccddba9a74e96fef
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-13 20:45:16 +02:00
Orkun Tokdemir
32e2a910f1 CMake: Enable depfile for Makefiles generators
Since https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8570 introduces AUTOMOC to use depfile with the Makefile generators, the depfile usage can be enabled for them in qtbase.

Change-Id: Ie18460fd2c4703ad75eb88662445ebe961d4e895
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-09-13 20:45:16 +02:00
Alexandru Croitor
d1a17d9655 CMake: Fix reconfiguration when -no-opengl is specified
In a previous change, we ensured that all INPUT_foo cache variables are
unset at the end of configuration, so they don't influence feature
re-evaluation in case if a command line flag like -no-gui is not
specified upon second reconfiguration and a FEATURE_foo is manually
toggled in the CMakeCache.txt, effectively getting rid of
stale INPUT_foo values.

Unfortunately that causes an issue when configuring with -no-opengl
and then trying to reconfigure with 'cmake .'

Specifically various feature options like ENABLE / DISABLE use
INPUT_foo variables in their expressions.
qt_configure_add_report_entry CONDITIONs also use them.

These expect the INPUT_foo variables to be persisted, and if they are
removed, the expressions might be re-evaluated to a different value,
and cause re-configuration to fail or unexpectedly toggle features.

To support both cases described above, instead of removing all INPUT
variables when configuration ends, only unset those INPUT variables
whose corresponding FEATURE_foo variable has been manually toggled in
CMakeCache.txt or via an IDE.

Toggling a FEATURE_foo manually is intentional, which means the
INPUT_foo value should be discarded. Whereas pre-existing INPUT_bar
variables will persist, thus not breaking cases like the -no-opengl
report CONDITION.

Amends 2799391703

Pick-to: 6.6
Fixes: QTBUG-116973
Task-number: QTBUG-112957
Change-Id: I5851255bfa41a9a1d116630a5d9f7b9a74aa93ed
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-09-13 20:09:19 +02:00
Alexey Edelev
47a42b9c6a Show the allowed values for configure arguments
Just some help to users, so they can spot the allowed values without
looking into docs.

Pick-to: 6.6
Change-Id: I22ad9533104949286de447a05a6e875e8d933bf6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-09-13 20:09:18 +02:00
Edward Welbourne
569dc0de50 Support the TZDIR environment variable
On Linux / glibc, this overrides the default system location for the
zone info. So check for files there first. Break out a function to
manage the trying of (now three) zoneinfo directories when opening a
file by name relative to there.

Pick-to: 6.6 6.5
Task-number: QTBUG-116017
Change-Id: I1f97107aabd9015c0a5543639870f1d70654ca67
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 19:51:47 +02:00
Edward Welbourne
c0cb616c1d Use the modern name for zone Asia/Kolkatta
The old name Asia/Calcutta is being phased out. We can't assign
QTzTZP, so select between new name and old using a reference variable.
In the process, fix a QCOMPARE() against bool to a QVERIFY().

Pick-to: 6.6 6.5
Change-Id: I7cd8a813f8a88c8ae4ba07213f04f4ad0860cec0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 19:51:47 +02:00
Morten Sørvig
bd79ebb6d0 wasm: simplify calling runOnMainThread()
Add a static runOnMainThread() function to QEventDispatcherWasm
which looks at QT_CONFIG(thread) and calls the correct
qstdweb overload. Then, we don't have to use a #define to
enable or disable the proxyingQueue argument.

Use the <void> version of qstweb::runTaskOnMainThread,
like before the 141f0ca33 change.

Change-Id: Id8324a17c27ffce8db7acf235ad4c9e465790e0b
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2023-09-13 17:51:47 +00:00
Morten Sørvig
37dde96e5f wasm: fix "'QString' is deprecated" warnings
Use the _L1 operator from Qt::Literals::StringLiterals

Pick-to: 6.6
Change-Id: I3d8dc0b7219879a1907e67b539e047ae7f7aae87
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-09-13 19:51:47 +02:00
Timothée Keller
8dbc482489 Windows QPA: Adjust margins for Windows App SDK compatibility
If using the ExtendsContentIntoTitleBar() method from the Windows App
SDK, the top margin becomes zero. The current approach does not account
for this, since it relies on the AdjustWindowRectExForDpi function.
Do a manual check after and correct if necessary, by comparing the
window and client sizes.

Fixes: QTBUG-113736
Pick-to: 6.6 6.5
Change-Id: I62e0338b3ff7af47f5525dcccd0f9acfe9691819
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-09-13 18:24:47 +02:00
Tor Arne Vestbø
cdf64b0e47 qmake: Don't error out if QMAKE_DEFAULT_LIBDIRS is empty on macOS
The new linker in Xcode 15 doesn't provide any default linker or
framework paths when requested via -v, but still seems to use the
default paths documented in the ld man page.

We trust that linker will do the right thing, even if we don't
know of its default linker paths.

We also need to opt out of the default fallback logic to
set the libdirs to /lib and /usr/lib.

This may result in UnixMakefileGenerator::findLibraries finding
different libraries than expected, if additional paths are
passed with -L, which will then take precedence for qmake,
even if the linker itself will use the library from the
SDK's default paths. This should hopefully not be an issue
in practice, as we don't turn -lFoo into absolute paths in
qmake, so the only risk is that we're picking up the wrong
prl files and adding additional dependencies that the lib
in the SDK doesn't have.

Pick-to: 6.6 6.6.0
Change-Id: I2347b26e2df0828471373b0e15b8c9089274c65d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-09-13 16:22:03 +00:00
Axel Spoerl
4bc8f54822 QOpenGLCompositorBackingStore: ensure backing store on flushed windows
When the first QEglFSWindow got created for a QWindow, a backing store
was created with it and associated to the new QEglFSWindow. When the
window was hidden on the platform screen, the QEglFSWindow got deleted
and re-created when it was supposed to be shown.
The re-created QEglFSWindow was no longer associated to the backing
store. It was therefore not rendered on the screen.

=> ensure that the backing store is re-associated to the QEglFSWindow,
corrsponding to the QWindow argument passed to flush().

No autotest is added, because the fix is purely visual.
The widgets/menus example can be used to test the functionality
manually (see bug reports).

Fixes: QTBUG-115196
Fixes: QTBUG-116769
Pick-to: 6.6 6.5 6.2
Change-Id: I92ce2e8f7e76bd2d26e713a4d20612d079fb4717
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-09-13 16:06:33 +02:00
Anton Kudryavtsev
e26e6d6725 qtextlist::itemText: reduce allocations
Don't create tmp QBA, just append to QString directly

Change-Id: Ib7c469ef7b9b459fbc2df662adbe613c8d74d88a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-13 17:06:32 +03:00
Artem Dyomin
60113056bc Optimize cond var notification
Notification of a conditional variable shouldn't be under the locked
mutex, as it may affect extra mutex contentions.

Pick-to: 6.5 6.6
Change-Id: Ie8429eca3f36e9a6e8e5ad2e0337bbf508f5b326
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 13:45:04 +02:00
David Faure
4e9944e6c8 QMimeDatabase: collect glob patterns from all locations
A QMimeTypePrivate used to belong to a single provider, which would
provide the complete data for it.
But since the redesign in commit 7a5644d648, each provider
represents is a single mime directory, and the merging happens at the
QMimeDatabase level. So we need a QMimeType[Private] to be just a name
(a "request" for information about this mimetype) and the information
for that mimetype is retrieved on demand by querying the providers
and either stopping at the first one (e.g. for icons) or merging
the data from all of them (e.g. for glob patterns).

The XML provider was using QMimeTypePrivate as data storage,
give it its own struct QMimeTypeXMLData for that purpose instead.

Task-number: QTBUG-116905
Change-Id: Ia0e0d94aa899720dc0b908f40c25317473005af4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 13:45:04 +02:00
David Faure
994311a66b tst_qmimedatabase: move local override to the specific test method
When running tst_qmimedatabase with the full shared-mime-info test suite
(which unfortunately requires local setup so this is easy to overlook),
we need *.webm to still be associated with video/webm.

So to test glob-deleteall, do that in installNewLocalMimeType(), with
other similar tests.

This however unearthed the following bug: the handling of glob-deleteall
is only correct when the local dir has no binary cache. It's broken
when using a binary cache. Added a QEXPECT_FAIL for now because this is
going to be fixed as part of a major redesign, coming up.
I also found out that neither xdgmime nor gio do this correctly...

Change-Id: Ib075fcdb792f60a859f23db8c2d7e1c6524f9050
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 13:45:04 +02:00
David Faure
251ab925fe tst_qmimedatabase: separate xml files for Global and Local tests
For historic reasons, the test had a single list of override xml files
to copy first into the global dir, and then into the local dir.
But glob-deleteall only makes sense in the local dir (as per the MIME
spec). Having two definitions for the same mimetype in the same dir
is undefined behavior, so the test was working by chance only, and
my upcoming refactoring/fixes caught that.

Change-Id: I4717683b4b3f9ba69f1fd815669460789700e877
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 13:45:04 +02:00
Eskil Abrahamsen Blomfeldt
6ab362a7ea Mark feature API in QFont as preliminary
Using ints for the tags is not ideal. There is no type safe
way to do conversions from strings, and how the int corresponds
to the four-byte tag is not clear from the API, so user code
can end up being less readable due to this.

Especially since this type of tag is a data type used several
places in fonts, and we will need them again for implementing
support for variable axes, it's worth giving this an extra
round of polish.

Since it was not addressed in a timely manner and we don't want
this to delay the upcoming release, we mark the API as
preliminary for now, to give ourselves the option of changing it
to something.

Pick-to: 6.6
Fixes: QTBUG-116929
Change-Id: I498478785dcd5ece954151f01f1a017828d6b8b8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-09-13 11:58:35 +02:00
Kaj Grönholm
743c1cf96b Round the image scaling when not antialiased
When painting an image with antialiasing not turned on, round the
target area to closest integers (pixels).

Task-number: QTBUG-116297
Pick-to: 6.6
Change-Id: I64e78a9087ee042aef0ea297c48b5ead36697d10
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
2023-09-13 12:05:59 +03:00
Marc Mutz
104a0a9ecd Long live Q_(U)INT128_MIN/MAX!
Since compilers don't provide such macros, do it ourselves.

In order to test these macros, add ad-hoc specializations of
QTest::toString() for qint128 and quint128 locally to the test. Turns
out it's not too hard to write them, so we might move them to a public
header, yet.

Pick-to: 6.6
Change-Id: I1483f3af2ccec6038e1c780649f9ffe413bb59ef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 09:18:40 +02:00
Marc Mutz
454636afec Document q(u)int128 and QT_SUPPORTS_INT128
[ChangeLog][QtCore] Added qint128 and quint128 typedefs on platforms
that support them.

Pick-to: 6.6
Fixes: QTBUG-116925
Change-Id: Ibd55cb0b1931b48a91598d3165e5911e3a4079f2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-09-13 09:18:40 +02:00
Marc Mutz
32f66f7008 Add some tests for q(u)int128
Check that QIntegerForSize<16> and std::numeric_limits<quint128> work
and that q(u)int128 are available in C mode, too.

Pick-to: 6.6
Change-Id: I44af8282399c78f6e74a8268af53bad64407ca34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-13 09:18:40 +02:00
Thiago Macieira
39d3af0c29 qsimd_p.h: rework the check for x86-64-v3 features
Instead of checking that all the features be present if any of them are
-- which is not an acceptable proposition, because each of them were
productized in at least one processor before -- let's simply insist that
they all be present if AVX2 is. That's what we can guarantee: all AVX2-
capable processors are capable of:

- AVX and earlier SSE (architecturally implied, so not checked)
- BMI1
- BMI2
- F16C
- FMA
- LZCNT
- POPCNT

This restores the original set of features that were checked in commit
ad65bbe4c0 when this was introduced, but
only if AVX2 is set. It also POPCNT, which was introduced with the
Nehalem architecture (which matches x86-64-v2) but aren't implied by
AVX.

GCC's -march=x86-64-v3 implies CRC32, but -march=haswell does not
because there were SKUs lacking CRC32, AES and PCLMULQDQ. This is
probably a bug in GCC.

Fixes: QTBUG-116357
Task-number: QTBUG-111698
Task-number: QTBUG-107072
Pick-to: 6.5 6.6
Change-Id: Ifa1111900d6945ea8e05fffd177e113eaa506dde
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-12 19:05:47 -07:00
Marc Mutz
6da6a17de9 Fix qHash(qfloat16) to match Qt 6.4 behavior
There were two problems:

- On platforms where QFLOAT16_IS_NATIVE == true, a qHash(qfloat16{})
  call has become ambiguous between the three FP qHash() overloads
  (float, double, long double), where it was unambiguously calling the
  float one in Qt 6.4. This SiC was caused by the replacement of
  operator float() by operator __fp16() in
  99c7f0419e, which is in Qt 6.5.

- On platforms where QFLOAT16_IS_NATIVE == false, qHash(qfloat16{})
  would produce a different value from qHash(float{}), and therefore
  Qt 6.4, when the seed was != 0, because the former would go via the
  one-arg-to-two-arg qHash adapter while the latter one would
  not. Since participating functions are inline, this causes old and
  new code to produce different hash values for the same qfloat16,
  leading to a BiC possibly corrupting QHash etc.

Fix both by adding an explicit qHash(qfloat16). This function is
inline, so it doesn't add a new symbol to 6.5.x.

[ChangeLog][QtCore] Fixed qHash(qfloat16) which was broken from 6.5.0
to 6.5.3, inclusive. If you compiled against one of the affected Qt
versions, you need to recompile against either Qt 6.4 or earlier or
6.5.4 or later, because the problematic code is inline.

Pick-to: 6.6 6.5
Fixes: QTBUG-116064
Fixes: QTBUG-116076
Change-Id: Id02bc29a6c3ec463352f4bef314c040369081e9b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-12 21:12:50 +00:00
Marc Mutz
5503b47893 Qt UDLs: avoid the deprecated form of UDL definitions
cppreference.com says¹ that the space after the "" is deprecated now,
so remove the space. Let's just hope all our compilers support this,
otherwise it will get ugly².

¹ https://en.cppreference.com/w/cpp/language/user_literal#Literal_operators
² https://github.com/yhirose/cpp-httplib/issues/953

Pick-to: 6.6 6.5 6.2
Change-Id: Ic8e4939e3ba713023c5a5c020305c96b521dbda9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-12 23:12:13 +02:00
Anton Kudryavtsev
83c2c50554 QBA::replace: avoid unconditional detach
Let's find needle and then do detach
While touching code, replace raw loop with algorithm
and add early out: compare before and after args

Change-Id: I22403fd3d6920d941b65e79f44b46e49a9777dc5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-12 22:53:57 +03:00
Anton Kudryavtsev
20980df293 QTextDocument::toPlainText: avoid unconditional detach
Let's find replaceable chars and then do detach

Change-Id: I4a4360d73a97af2388f4f2f284949ffcfbc48836
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-09-12 22:53:57 +03:00
Piotr Wiercinski
068f19ea39 wasm: Drop using deprecated function
The `emscripten_main_browser_thread_id()` has been deprecated
in favor of `emscripten_main_runtime_thread_id()`.
Using the deprecated one generates a warning during compilation.

Change-Id: I1154bd8ff78f13e6425fdc65ac39763569360da6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-09-12 19:20:07 +00:00