Fix some warnings that are flagged as errors on clang10.
Change-Id: I906634c8b2bd94db42d74a7f3d10efb086e373cc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The windows and macOS implementations where still using QRegExp
in one place.
Change-Id: Iaf6c6ead10f7f061ff0edce889abe18751b9d308
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Expand $$MODULE_BASE_DIR to ${QT_BUILD_DIR}.
Add library mappings for Hunspell.
Add test mappings for QtVirtualKeyboard regarding 3rdparty Hunspell and
T9Write.
Change-Id: Ief007456d0471cbcf9a03d819291edec5f63680f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use P0608's trick to detect convertibility without narrowing;
and now that we can depend on C++17, use its features.
First, this moves the burden of detecting a narrowing conversion on
the compiler, rather than us maintaining a complicated series
of checks. Of course, this exposes
* bugs in compilers (e.g. GCC < 9 thinks that float->bool is not
narrowing;
* behavior still not (widely) implemented (pointer to bool
conversions are narrowing, P1957);
* interesting compiler choices, e.g. GCC 9 thinks that unscoped
enumerations are non-narrowing convertible to a datatype big
enum to contain all the _enumerators_, even if the underlying
type of the enum (and/or its sizeof()) is wider than the target
datatype.
Second, it allows to detect conversions that have a narrowing
conversion as an intermediate step. Given a type like
struct Bad { operator double() const; };
then an object of type Bad is implictly convertible to a type
like int via a narrowing conversion. Therefore, a connection
is possible between a signal carrying a Bad and a slot accepting
an int. We can now detect and block this.
Tests regarding scoped enumerations have been dropped,
for the simple reason that a scoped enumeration is not
implictly convertible to an integral type, so we don't have
that detection (it would constantly fail). Scoped enumerations
do not take part in narrowing conversions anyhow, cf. [dcl.init.list].
[ChangeLog][QtCore][QObject] The detection of narrowing conversions
when calling QObject::connect() when
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT now takes also
into account user-defined implicit conversions that undergo
through a narrowing conversion.
Change-Id: Ie09d59203fe6283378b36dfbc54de1d58098ef51
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Mention that . matches newlines in QRegExp, but not by
default in QRegularExpression.
Change-Id: I9663fe30c7b7e068d673aa8d51884f6828e0ee59
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
It used to live in QRegularExpression, but as QRegExp gets removed from
Qt Core, the better place for it is to live in the QRegExp docs.
Also marked QRegExp as deprecated in the docs.
Change-Id: Id5b0e3040e4d46f5d806022b58fbd5b5efd58911
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Map setFilterWildcard() and setFilterFixedString() to now use
QRegularExpression.
Change-Id: I2dff2015234decb2badfd306975dcff8553cdd7f
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Change-Id: I7a4259ac43e59a8f50ee1c5072a3da5b977d8bfe
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
There are cases, where the conversion from a wildcard pattern to
a regular expression should not lead to an anchored pattern. Allow
this, but adding an optional second argument to
wildcardToRegularExpression, that allows tuning the conversion.
Change-Id: Ida7a32d65ee49bf58d5f8d9906c0a0cd8954a02a
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
The CMAKE_INSTALL_RPATH cache var had the PATH type, which made
CMake transform the value into an absolute path, getting rid of the
$ORIGIN value.
Fix that by changing the cache var type to STRING.
Also clean up the all-caps commands, add a usage example and print
the install RPATH.
Change-Id: Ibf40cfde4283369ddfcf52609143799cc8e47d68
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* support lambda expressions
* remove the need to specify result_type
* use std::invoke to apply map|filter function
* remove usage of FunctionWrapper* and createFunctionWrapper
Task-number: QTBUG-33735
Task-number: QTBUG-82646
Change-Id: Ibcbe4278f0742c29182bd506081db0abb516f85f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
This is required to support QtVirtualKeyboard's third party OpenWnn
library.
Change-Id: I64b6a2b6b6b0259bea5aa249a8c901def31f916c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
It doesn't exist in every instantiation of the template; this becomes
evident when attempting to build QQuickListView:
error: 'using Chain = struct QHashPrivate::MultiNodeChain<FxViewItem*>'
{aka 'struct QHashPrivate::MultiNodeChain<FxViewItem*>'} has no member named 'size'
Change-Id: I24748c15f3995083eec06d86a3c0dced2209c303
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
It doesn't make sense to lose precision, and that's a fatal warning
when used on a 32-bit platform:
implicit conversion loses integer precision: 'quint64' (aka 'unsigned long long')
to 'quint32' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
Also fix coding style.
Amends 7ef3826497
Change-Id: I2c8f51883d74f0c6dc1b5faefe7b3ace1d9c15b9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
As a drive-by, also fix spelling of architecture.
Change-Id: Ibeaa6b611ddbb75b9492deb5d97a64ed8b030c3a
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This allows us to use regular expressions in bootstrapped tools
such as moc and tracegen.
Change-Id: I4310dd15bf26651aac6ab30c884e025ca06b3099
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Change the hash function of QTypeRevision and QtFontFallbacksCacheKey
to use size_t and add a few casts.
Change-Id: I89a8fc617abbe8b0c67529ec41795691c99b0574
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This change adds the setWinTabEnabled() function to Qt Platform Headers,
which allows an application to set at run-time whether the WinTab API will
be used for tablet input instead of the native Windows Ink API.
[ChangeLog][Windows] The setWinTabEnabled() function added to Qt Platform
Headers now allows an application to set at run-time whether the WinTab API
will be used for tablet input instead of the native Windows Ink API.
Fixes: QTBUG-83218
Change-Id: I51d3c7316baeda136763cf37c2f54295905450ec
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Some test cases are sensitive to the exact ordering inside
QHash, and need adjustments when we change QHash or the
hashing functions.
Some rcc tests now also need 32bit specific data, as the hashing
functions for 32 and 64 bit are different now (as we use size_t).
Change-Id: Ieab01cd55b1288336493b13c41d27e42a008bdd9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Requires one more branch inside the loop, but that should not
really matter performance wise. And it should expand to less code.
Change-Id: I4619dd2a2e6fedf8d109009a5b6d7410ed89f1fb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit replaces MurmurHash with SipHash for all strings longer than
the size of a pointer. The most important difference between those
algorithms is that MurmurHash has this unwelcome property: for two
byte sequences x and y, if you know that x and y have the same hashing
for a given seed, then they have the same hashing for all seeds.
SipHash has no such issue. If the seed changes, the strings that used to
compute to the same hash are no longer likely to do so.
We've chosen to implement a SipHash-1-2 algorithm instead of the regular
2-4 as that has roughly the same performance as the old DJB33XA
algorithm. It's around 50% slower than MurmurHash, which is
acceptable given the added security.
Task-number: QTBUG-47566
Change-Id: I09100678ff4443e6be06fffd14819c8878d223e2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The old implementation was either using CRC32 on modern processors
or a trivial, but rather slow implementation.
We can't continue with CRC32, as that implementation can only
give us 32bit hashes, where we now need to support 64bit in Qt 6.
Change the implementation to use MurmurHash, as public domain
implementation that is both very fast and leads to well distributed hashes.
This hash function is about as fast as the SSE optimized CRC32 implementation
but works everywhere and gives us 64 bit hash values.
Here are some numbers (time for 10M hashes):
14 char 16 char
QByteArray QString float
old qHash (non CRC32) 127ms 134ms 48ms
old qHash (using SSE CRC32 instructions 60ms 62ms 46ms
new qHash 52ms 43ms 46ms
Unfortunately MurmurHash is not safe against hash table DoS attacks, as
potential hash collisions are indepenent of the seed. This will get
addressed in followup commit, where we use SipHash or an SSE optimized
AES based hashing algorithm that does not have those issues.
Change-Id: I4fbc0ac299215b6db78c7a0a2a1d7689b0ea848b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
At the same time use the opportunity to refactor the
insertion code inside the implementation of QHash to
avoid copy and move constructors as much as possible
and always construct nodes in place.
Change-Id: I951b4cf2c77a17f7db825c6a776aae38c2662d23
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This is required, so that QHash and QSet can hold more
than 2^32 items on 64 bit platforms.
The actual hashing functions for strings are still 32bit, this will
be changed in a follow-up commit.
Change-Id: I4372125252486075ff3a0b45ecfa818359fe103b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This is used by QSet to avoid storing extra data for the value
in the Hash. Re-implement the optimization after the changes to QHash.
Change-Id: Ic7eba53d1c0398399ed5b25fef589ad62567445f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Make use of the new features available in QHash and do a more
performant implementation than the old one.
Change-Id: Ie74b3cdcc9871cd241aca205672093dc395d04a7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A brand new QHash implementation using a faster and more memory efficient data
structure than the old QHash.
A new implementation for QHash. Instead of a node based approach as the old
QHash, this implementation now uses a two stage lookup table. The total
amount of buckets in the table are divided into spans of 128 entries.
Inside each span, we use an array of chars to index into a storage area
for the span.
The storage area for each span is a simple array, that gets (re-)allocated
with size increments of 16 items. This gives an average memory overhead of
8*sizeof(struct{ Key; Value; }) + 128*sizeof(char) + 16 for each span.
To give good performance and avoid too many collisions, the array keeps its
load factor between .25 and .5 (and grows and rehashes if the load factor goes
above .5).
This design allows us to keep the memory overhead of the Hash very small, while
at the same time giving very good performance. The calculated overhead for a
QHash<int, int> comes to 1.7-3.3 bytes per entry and to 2.2-4.3 bytes for
a QHash<ptr, ptr>.
The new implementation also completely splits the QHash and QMultiHash classes.
One behavioral change to note is that the new QHash implementation will not
provide stable references to nodes in the hash when the table needs to grow.
Benchmarking using https://github.com/Tessil/hash-table-shootout shows
very nice performance compared to many different hash table implementation.
Numbers shown below are for a hash<int64, int64> with 1 million entries. These
numbers scale nicely (mostly in a linear fashion with some variation due to
varying load factors) to smaller and larger tables. All numbers are in seconds,
measured with gcc on Linux:
Hash table random random random random reads full
insertion insertion full full after iteration
(reserved) deletes reads deletes
------------------------------------------------------------------------------
std::unordered_map 0,3842 0,1969 0,4511 0,1300 0,1169 0,0708
google::dense_hash_map 0,1091 0,0846 0,0550 0,0452 0,0754 0,0160
google::sparse_hash_map 0,2888 0,1582 0,0948 0,1020 0,1348 0,0112
tsl::sparse_map 0,1487 0,1013 0,0735 0,0448 0,0505 0,0042
old QHash 0,2886 0,1798 0,5065 0,0840 0,0717 0,1387
new QHash 0,0940 0,0714 0,1494 0,0579 0,0449 0,0146
Numbers for hash<std::string, int64>, with the string having 15 characters:
Hash table random random random random reads
insertion insertion full full after
(reserved) deletes reads deletes
--------------------------------------------------------------------
std::unordered_map 0,4993 0,2563 0,5515 0,2950 0,2153
google::dense_hash_map 0,2691 0,1870 0,1547 0,1125 0,1622
google::sparse_hash_map 0,6979 0,3304 0,1884 0,1822 0,2122
tsl::sparse_map 0,4066 0,2586 0,1929 0,1146 0,1095
old QHash 0,3236 0,2064 0,5986 0,2115 0,1666
new QHash 0,2119 0,1652 0,2390 0,1378 0,0965
Memory usage numbers (in MB for a table with 1M entries) also look very nice:
Hash table Key int64 std::string (15 chars)
Value int64 int64
---------------------------------------------------------
std::unordered_map 44.63 75.35
google::dense_hash_map 32.32 80,60
google::sparse_hash_map 18.08 44.21
tsl::sparse_map 20.44 45,93
old QHash 53.95 69,16
new QHash 23.23 51,32
Fixes: QTBUG-80311
Change-Id: I5679734144bc9bca2102acbe725fcc2fa89f0dff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add a new QRangeCollection type to store and manage
multiple page ranges. This moves out the parser and validator
logic from the platform dependent (UNIX) dialog and makes it
publicly available from QPrinter.
This improves the usability of QPrinter in those applications
which doesn't use print dialog to configure printer.
(e.g.: QTextDocument, QWebEnginePage)
Change-Id: I0be5a8a64781c411f83b96a24f216605a84958e5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>