If '-G<generator type>' is passed to configure script we should respect
this argument but not override it by the autodetected generator type.
'-cmake-generator' option will still have higher priority, but if
generator is set using CMake argument it will not be auto-detected by
other build config specific options, like '-debug-and-release'.
Change-Id: I75b49e33fa717f90bbd74045948fccb9f5350e8d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Headers must be free of Q_FOREACH uses if we want to white-list only
those .cpp files that still use Q_FOREACH in order to enable
QT_NO_FOREACH by default.
In common.h, the situation is pretty clear: the loop bodies clearly
don't modify the container being iterated over.
In MyServer, the situation is not clear at all, and this author
doesn't have the time to investigate, so take a copy and iterate over
that (eactly what Q_FOREACH does), and leave a comment.
As a drive-by, fix missing {} around multi-line loop bodies.
Task-number: QTBUG-115839
Change-Id: I06311a641c83daeee25f45522c694ac355ee86b6
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
The density of Q_FOREACH uses is high here, too high for this author
to tackle in a short amount of time. But they're concentrated in just
a few TUs, so pick a different strategy:
Mark the whole plugin with QT_NO_FOREACH, to prevent new uses from
creeping in, and whitelist the affected TUs by #undef'ing
QT_NO_FOREACH locally, at the top of each file. Since the TUs are part
of a larger executable, this requires these files to be compiled
separately, so add them to NO_PCH_SOURCES (which implies
NO_UNITY_BUILD_SOURCES, too).
Task-number: QTBUG-115839
Change-Id: I42c26cb5d95add115e57cc484a0e1a93ed368ddd
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
The QSystemSemaphore::platformSafeKey was intended to truncate oversized
keys on Windows, but didn't. The fix is to make sure MAX_PATH is defined
when compiling on Windows.
Change-Id: I03f3bee901203d901bda05a841451c8a2d2f3924
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This reverts commit 4c1df115ec.
We cannot guarantee that there are no more QMetaType
instances that reference the interfaces being destroyed.
All such instances will become invalid after the interface
destruction with no way to verify that.
Pick-to: 6.6 6.5
Change-Id: Iad17fe88753143734b8b817dda184e3c3818575c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Combine the lock and the custom types list into one struct
so that the check code does not have to be duplicated.
Pick-to: 6.6
Task-number: QTBUG-58732
Change-Id: Ib61d5be3a3cb6465acc5834e5dcbc735fb8b4d8e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Found in API-review.
Pick-to: 6.6
Change-Id: I261aa450d25288e7a3e8caa033ce5000e5dd77f2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
When QT_NO_DEPRECATED_WARNINGS is defined, we undefine
Q_DECL_ENUMERATOR_DEPRECATED as it's used raw (rather than via an
intermediary or version-variant). The same is true of its _X()
variant, so do the same for this - which involves redefining it to a
still function-like macro, so that its parameter gets ignored.
This amends commit 59b03992ab (and shall
get conflicts on older branches, before the defines in question moved
to qtdeprecationmarkers.h in 6.5).
Pick-to: 5.15 6.2 6.5 6.6
Change-Id: If85c135cddbb33e93cb90f400af123c74e0298ac
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
The assertion is triggered when a timer cannot be started. This
is normal occurrence when an application exits before all pending
D-Bus calls are processed. And there is a code handling such failure
in the same function. Qt also prints a warning message in this
case:
QEventDispatcherGlib::registerTimer: invalid arguments
Task-number: QTBUG-58732
Pick-to: 6.6
Change-Id: I37859443fa90ae1bf7da1572ac9b02a54c8e1b99
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QSqlDatabase uses a Q_APPLICATION_GLOBAL and so should not be used
without QCoreApplication instance. The test crashes if the existence
of an application instance is asserted in Q_APPLICATION_GLOBAL
code.
Pick-to: 6.6
Change-Id: Iaa3f4dff7b2722257735680dd3885aeed0ac810b
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Add asserting verifying that a QCoreApplication exists when
the application static variable is dereferenced. This is a
requirement described in the documentation. Added assertion
makes invalid use much more visible. Without the assertion
only a message about invalid nullptr used with QObject::connect()
is emitted. This message is much less informative and does
not cause tests to fail.
Pick-to: 6.6
Change-Id: Id9d4a34679ca5aca93ee45ca2318d4ccf849887b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
QEventDispatcherGlib: it used the out-parameter timespec to set a
timeout in milliseconds, making timerWait() return milliseconds is more
straightforward. Also timerWait() returns the time rounded to
milliseconds, so the code in QEventDispatcherGlib that rounded up the
timespec::tv_nsec part was no-op, tv_nsec was always 0 IIUC.
In QEventDispatcherGlib, guard against overflow with qt_saturate.
Change-Id: Ie6f78374d00cbe8a6adf7b50ed67c8c86ab4d29d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
First lookup with value(key), second lookup with remove(key). Use
constFind() to get an iterator and use that instead.
Pick-to: 6.6 6.5
Change-Id: Idce585ad2269be91eda0381aeb2f2d164033f71f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This makes the rest of the code slightly cleaner.
Change-Id: I67606b369f00d54fc24f7d6f41c004a728d37b5f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Introduce a mutex that protects access to the spy hooks list.
Also don't pass around raw pointers to the spy hook list,
those can change when new hooks are added and storage is
reallocated. Change the type of the hooks list to QList
to take advantage of copy-on-write in common case.
Check whether the global static is destroyed in qDBusAddSpyHook().
Change-Id: I440a88ce088d6fb5817660c8e1e02901281b842f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
operator=(~) and assign(~) share similar names but, until now, have not
shared the same functionality. This patch introduces the usage of
QByteArray::assign() within the non-sharing assignment operator to
effectively boost efficiency by reusing the available capacity.
Since these assignment operators are frequently used in many places,
both within Qt and non-Qt code, this patch comes with benchmarks.
The preview of the benchmark results are compared with this patch and
before this patch. The findings indicate a slight enhancement in
performance associated with the assignment operator. Despite the results
displaying only a minor improvement, progress has been made. Therefore
use assign(QByteArrayView) as replacement.
(x86_64-little_endian-lp64 shared (dynamic) release build (O3); by
gcc 13.2.1, endeavouros ; 13th Gen Intel(R) Core(TM) i9-13900K
benchmarks executed with -perf -iterations 1000000
* The last value at the EOL represent the string size.
QByteArray &operator=(const char *ch) (current)
65 cycles/iter; 317 instructions/iter; 16.0 nsec/iter (5)
71.7 cycles/iter; 383 instructions/iter; 13.0 nsec/iter (10)
59.8 cycles/iter; 318 instructions/iter; 10.9 nsec/iter (20)
70.8 cycles/iter; 340 instructions/iter; 12.9 nsec/iter (50)
80.2 cycles/iter; 419 instructions/iter; 14.6 nsec/iter (100)
164.2 cycles/iter; 899 instructions/iter; 29.9 nsec/iter (500)
260.5 cycles/iter; 1522 instructions/iter; 45.6 nsec/iter (1'000)
QByteArray &operator=(const char *ch) (before)
66.8 cycles/iter; 317 instructions/iter; 16.9 nsec/iter (5)
76.5 cycles/iter; 383 instructions/iter; 13.9 nsec/iter (10)
63.7 cycles/iter; 318 instructions/iter; 11.6 nsec/iter (20)
71.6 cycles/iter; 344 instructions/iter; 13.0 nsec/iter (50)
77.5 cycles/iter; 419 instructions/iter; 14.1 nsec/iter (100)
143.4 cycles/iter; 893 instructions/iter; 26.1 nsec/iter (500)
270.8 cycles/iter; 1516 instructions/iter; 48.2 nsec/iter (1'000)
Task-number: QTBUG-106201
Change-Id: I0745c33f0f61f1d844a60960cc55f565320d5945
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This makes the API symmetric again (fromBytes()/toBytes(),
fromString()/toString(), fromUInt128()/toUInt128()), but also gives us
the option to remove the QUuid(quint128), should we so choose, because
of its overly-broad argument matching range.
Found in API review.
Pick-to: 6.6
Change-Id: I91bd2450d62ed565ec3b8e46c875f4983bd9dc73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It matches any integral type, any unscoped enum and any FP type, so we
can't allow it to be implicit. In fact, it's probably better to only
have a named contructor, fromUint128().
Found in API review.
Pick-to: 6.6
Change-Id: I9b250e0b5e74a449b6df4efe3ea38b750c9744ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
MSVC seems to emit warnings failing the build in some situations where a
return statement comes after a Q_UNREACHABLE. This does not seem to
happen on other compilers. The Q_UNREACHABLE_RETURN macro already exists to deal with this situation. Define it for MSVC.
Change-Id: Iad06f4048e2829b1eac4f78a1053041ef72c21e7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
If user attempt to build Qt using multi-config generator set Release
and Debug configurations by default if they are not set, instead of
relying on what CMake suggests as default value for a platform.
Pick-to: 6.6
Change-Id: I4bdb33e56818984c189b737acccc9ac50659db96
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Description added to the html tags for accessibility in wasm through the
aria-description property
Change-Id: Ic1976d5c4c64ea45298f24b660807adeda6fdb64
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Move the SlotObjUniquePtr directly into the QMetaCallEvent, without
having to up and down the ref-count.
Pick-to: 6.6 6.5
Change-Id: I029f71c60defce71ac8778547efe999ce0cf7b4b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Only const members of the object are used inside the function body.
This addresses a review comment for 0f37c47713
Change-Id: I873d87104eb2483c4388929487d750d4a7d44bf3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Using Q_FUNC_INFO has an advantage that at least GCC includes
the variable type and name into the string. This makes it much
easier to understand access to which global static is causing
an assertion.
Pick-to: 6.6
Change-Id: Ie6ce992921c0969df262fed22024a22650783f93
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Test sendEventsOnProcessEvents has been noticed to fail when
qgtk3 (Glib) is loaded - Should be fixed in QTBUG-87137
Moving test from blacklist to use QEXPECT_FAIL as it's more
recommended until test is fixed in the relevant configurations.
QEXPECT_FAIL is selected to use as original investigator
reported also some cases when glib is working. Therefore
this approach is giving us more insight for further
investigation is it always failing with glib or not.
It was also reported linkage to zeroTimer test QTBUG-84291,
but not sure why removing that has affected to this one.
Update to QEXPECT_FAIL documentation to tell in first place
that XPASS is not only marking it as XPASS but also failing
the test. Same is mentioned in different location but it
needs more searching or testing how it works in real test.
Task-number: QTBUG-115155
Change-Id: I7fb4ef28dba8adb7009be528f88fc758a12e9006
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Defining USE_LEXEM_STORE breaks compilation, and the commit that
introduce it (in the pre-public history) does not shed any light on its
usage.
Change-Id: Ic616bf9f2584151dab3f654d64025fcdc0ade25c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Instead of copying a list, sorting it just to check it's sorted, and
making a QSet out of it just to check the size is the same as that of
the list (thereby checking there were no duplicates), simply apply
adjacent_find with greater_equal. If none of the elements is ≥ their
successor, that means all elements are < their successor, and _that_
means the range is sorted and has no duplicates. q.e.d.
Pick-to: 6.6 6.5
Change-Id: Id73c674ad4e29117370e8fc6af9fdfc690a3fba9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The density of Q_FOREACH uses isn't very high here, but at this time,
this author just goes through the code-base and white-lists TUs that
still use Q_FOREACH in order to globally enable QT_NO_FOREACH.
Mark the whole plugin with QT_NO_FOREACH, to prevent new uses from
creeping in, and whitelist the affected TU by #undef'ing QT_NO_FOREACH
locally, at the top of each file. Since the TU is part of a larger
executable, this requires the file to be compiled separately, so add
it to NO_PCH_SOURCES (which implies NO_UNITY_BUILD_SOURCES, too).
Task-number: QTBUG-115839
Change-Id: If731d02f65131c94afa8beb51679ed2ff7d2cdaa
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
As a header, it would otherwise make all TUs that include it (with
PCH: all) incompatible with QT_NO_FOREACH.
Without deeper analysis (which economy of time forbids in this case,
given this is just a manual test that's probably run 10 times per
year), and seeing as this is in an event handler, I opted to play it
safe and iterate over a copy (which is exactly what Q_FOREACH
does). Added a comment to indicate it may not be needed.
Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: I7db75321dd34888f6dd7a64cccb7462ff35935fa
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
First include the common tst_qmimedatabase.cpp (and nothing else),
then implement the differing
tst_QMimeDatabase::initTestCaseInternal().
This will allow adding #undef QT_NO_FOREACH to tst_qmimedatabase.cpp
in the next step.
Pick-to: 6.6 6.5
Change-Id: Icc1890229e9443bd35c81d4f0440ba7df5da906c
Reviewed-by: David Faure <david.faure@kdab.com>
The single Q_FOREACH use here is simple, as it's over a local variable
that just isn't marked as const due to the way it's constructed, and
the loop body clearly doesn't modify the container, so the protective
copy that Q_FOREACH performs is not needed. But std::as_const() is, to
prevent a detach() (attempt). Add that.
Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: If228f649efd87388f6e312078b24a5b46ac8dc36
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Drag the QCOMPARE (which even dynamically allocated a QString
fromLatin1()) out of the QBENCHMARK loop. Testing performance of
QString::fromLatin1() and/or qCompare() is not pertinent to the task
at hand, which, ideally, doesn't involve any memory allocations, so
there's at least the chance that this skewed the result noticably.
Didn't run the benchmark as this was developed on an asan build.
Yes, this breaks comparability with the stone-age measurements
reported in comments there, so sue me.
As a drive-by, replace the fromLatin1() with a u_s UDL.
Pick-to: 6.6 6.5
Change-Id: I9b2a8b2e3596ec9b07c6b4ea369257b1a86e09db
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
QDate's constructor can see maxJd() and minJd() without namespace prefix.
QDateTimeParser::SectionNode's name() inherits visibility from
QDateTimeParser of its Section enum's members.
Change-Id: I6315c4ede8875ef725d5b778eebac1e2027cd8b1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The code of a class doesn't need that class's prefix to access members
of the class.
Change-Id: I4cc2f72c90cff48b331dc12d390c45c0639606b3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Simplifies the code at the call site.
Even though QDebug has support for streaming std::list (SpanList), the
format of the output would be different than what's already used here,
hence the custom operator<<().
Drive-by, port from Q_FOREACH to ranged-for
Task-number: QTBUG-115803
Change-Id: I30953c92e0c9febc01497c1117fa472b4718820e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Now that the "and" is only seen in enumdata.py and comments, we can
s/And/and/ in all the various territory names that used it.
Change-Id: Ic376d5904b6f5ab54931f96230c1dd5b7f357b8d
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Various comments need to continue using the enumdata.py names, as they
associate data with particular enum members, but we can now correctly
use the en.xml versions of their names when we report them, rather
than the enum-friendly names we use in the code. Since this now means
the data may stray outside plain ASCII - it'll be UTF-8-encoded - this
implies replacing the QLatin1StringView()s of the code that formerly
read this data with QString::fromUtf8().
Fixes: QTBUG-94460
Change-Id: Id3b08875a46af58c0555c3e303b0e15a19441509
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We could already use dashes in some, rather than spaces, and now no
longer need to capitalize each word. This changes the *_name_list[]
entries for affected languages to more closely match what CLDR gives
as their names. It also amends various comments. Added tests for the
QLocale::*ToString() functions to cover the entries changed.
Task-number: QTBUG-94460
Change-Id: I0163795cb282881f15a97be00a5311c1936c3a09
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Test names and output need to be UTF-8 for the XML data formats to not
end up malformed - which would upset Coin's testrunner, when it
validates the XML as part of checking - and the few other uses of
toLatin1() were to ASCII content anyway, so can harmlessly (this being
test code, where the slight performance advantage of Latin-1 doesn't
matter) use toUtf8() as well, for the sake of uniformity.
Use of toLatin1() broke an imminent commit in which some territory,
script and language names depart from ASCII, leading to malformed
UTF-8 when they appear in test-data-row names.
Task-number: QTBUG-94460
Change-Id: Ifb826b1e417ba24fd862b93d24d0e7a38858a17f
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>