For the windows file system engine, we add an extra macro to use
library loading if configured to do so, but avoid it on WinRT, as
none of the symbols would be found.
We also QT_REQUIRE_CONFIG(library) in the library headers and
exclude the sources from the build if library loading is disabled.
This, in turn, makes it necessary to clean up some header inclusions.
Change-Id: I2b152cb5b47a2658996b6f4702b038536a5704ec
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
QLocale::matchingLocales() simply created each locale using the basic
data, without (unless the matching conditions stipulated Language C)
applying number-options hacks that it applies everywhere else, when
creating the C locale. Thus the C locale in its returned list (if it
wasn't the only entry) ended up with the default number options,
without omiting separators in numbers. Thus QLocale::c() didn't
actually appear as an entry in the list. Discovered while
investigating QTBUG-58947.
Added a dumb autotest that checks various ways of getting the C locale
do actually give us equal locale objects. Fixed matchingLocales() to
apply the same hack as is used elsewhere for the C locale.
Change-Id: I263f31da623052b63171f5b5a83c65802383df21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The data is 256 bytes, so might as well align it on a 16-byte boundary
to facilitate copying (if that happens). We should consider similar for
QByteArrayMatcher in 6.0.
Change-Id: I74966ed02f674a7295f8fffd14a8c64526d734bb
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
For examples and documentation, use new BSD license text that
includes the commercial licenses.
Change-Id: I1cd74bd8e9c8f2746d8702df00780ee100cbebac
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
This fixes compiling an application using QVector and -Wshorten-64-to-32
on a 64-bit system without getting this warning:
... 5.8/clang_64/lib/QtCore.framework/Headers/qvector.h:695:18:
warning: implicit conversion loses integer precision: 'typename
iterator_traits<QString *>::difference_type' (aka 'long') to 'int'
[-Wshorten-64-to-32]
int offset = std::distance(d->begin(), before);
~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 5.8/clang_64/lib/QtCore.framework/Headers/qvector.h:731:35:
warning: implicit conversion loses integer precision: 'long' to
'const int' [-Wshorten-64-to-32]
const int itemsToErase = aend - abegin;
~~~~~~~~~~~~ ~~~~~^~~~~~~~
... 5.8/clang_64/lib/QtCore.framework/Headers/qvector.h:740:39:
warning: implicit conversion loses integer precision: 'long' to
'const int' [-Wshorten-64-to-32]
const int itemsUntouched = abegin - d->begin();
~~~~~~~~~~~~~~ ~~~~~~~^~~~~~~~~~~~
Change-Id: I52d85908f4aac20c7e9ac8063ac760ce52f85541
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Latest PCRE2 versions require a macro to be defined before
including pcre2.h, so do it.
Task-number: QTBUG-59226
Change-Id: I472ff557e29d1212fdcd99454778551323be4d4b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Compiler support for lambda functions and variadic templates is
required since Qt 5.7, so no need to mention in the documentation
what happens if the compiler doesn't support it.
Change-Id: I5caeaa0bd7f0edce81e22e22964e0b7dd042c719
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Change-Id: I34821150f66255df30d12572b27779e0e729ebc8
Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch>
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The FP16 extension in IEEE mode is mandatory for Aarch64, so there is
no aarch64 configuration where the tables will be needed for conversion.
Change-Id: I9804e55c193cc9b5adcaedb720d8b980624139cc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Glen Mabey <Glen.Mabey@swri.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This fixes compiling an application using QList and -Wshorten-64-to-32
on a 64-bit system without getting this warning:
... 5.8/clang_64/lib/QtCore.framework/Headers/qlist.h:897:26:
warning: implicit conversion loses integer precision: 'long' to 'int'
[-Wshorten-64-to-32]
int removedCount = e - n;
~~~~~~~~~~~~ ~~^~~
Change-Id: I688ed086805c431821c2ee6078fa5aeb631e7a07
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This fixes compiling an application using QTimer and -Wshorten-64-to-32
on a 64-bit system without getting this warning:
... 5.8/clang_64/lib/QtCore.framework/Headers/qtimer.h:171:21:
warning: implicit conversion loses integer precision: 'rep'
(aka 'long long') to 'int' [-Wshorten-64-to-32]
setInterval(value.count());
~~~~~~~~~~~ ^~~~~~~~~~~~~
Change-Id: I3e0407a7193c841308f7271c41a8dd5a2eb2a534
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Replace all QT_NO_PROCESS with QT_CONFIG(process), define it in
qconfig-bootstrapped.h, add QT_REQUIRE_CONFIG(process) to the qprocess
headers, exclude the sources from compilation when switched off, guard
header inclusions in places where compilation without QProcess seems
supported, drop some unused includes, and fix some tests that were
apparently designed to work with QT_NO_PROCESS but failed to.
Change-Id: Ieceea2504dea6fdf43b81c7c6b65c547b01b9714
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
the library has a dependency on libdl.
Task-number: QTBUG-58301
Change-Id: I36567ded32980b241ff2f01cfdec044510405a75
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
instead of having a library and a test, use a library with two sources,
the first being empty (i.e., just libc). this allows us doing away with
the "libdl" feature, and using just the "dlopen" one.
subsequently, replace all LIBS+=$$QMAKE_LIBS_DYNLOAD with
QMAKE_USE+=libdl.
the definitions of QMAKE_LIBS_DYNLOAD remain in the qmakespecs for
backwards compat only. n.b.: the only specs where it is not empty or
"-ldl" (i.e., what we support now) are the hpux ones, where the library
is called 'dld'.
technically, the "library" feature should depend on '!unix || dlopen', but
that's for a later patch.
Change-Id: Ib8546affc4b7bc757f1a76729573ddd00e152176
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Improves performance when appending temporaries, esp. since
the aliasing fix in the lvalue overload in 0f730ef made that
overload correct, but a bit slower across reallocs.
The unit tests already also pass rvalues, so the function is
covered in the existing tests.
[ChangeLog][QtCore][QVarLengthArray] Added rvalue overloads
of append() and push_back().
Change-Id: If3a6970f03a160cba5b42d33d32d3d18948f6ce3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This patch fixes 2 simple typos in QGraphicsItem and QPainter
documentation and a copy/paste error between QAbstractItemModel's
beginRemoveColumns and beginRemoveRows documentation.
Change-Id: I32bdc4dc69154a40fe30a5b8c08d0c3a001853f8
Reviewed-by: Harri Porten <porten@froglogic.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Unlike setTimeSpec, this forgot to clear the bit when detaching. So it's
possible that some further use of the flags could incorrectly conclude
that the data was short and then proceed to corrupt the pointer.
The example from QTBUG-59061 caused this because toUTC() -> toTimeSpec()
calls setMSecsSinceEpoch which left the bit set; then addDays() calls
setDateTime(), which calls checkValidDateTime() and that corrupted the
pointer. This problem was more visible on 32-bit systems because no
QDateTime was short (except for default constructed ones), but it
can happen on 64-bit with sufficiently large dates.
Task-number: QTBUG-59061
Change-Id: Ibc5c715fda334a75bd2efffd14a562a375a4e69b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Remove the dead QByteArray(data, size) fall-back. We've been
requiring lambdas since Qt 5.7.
Change-Id: I4d9023ab4583f2ee80a74a828fba0d95c2fdb0df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Fix a couple incorrect references to the integer precision classes.
Update snippet to use floating point precision classes.
Task-number: QTBUG-51630
Change-Id: I9b08cfb68937a8e1179ee414d7981956ef7bc106
Reviewed-by: Martin Koller <kollix@aon.at>
Reviewed-by: Michael Brüning <michael.bruning@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
The call to trimmed() makes sense for URLs typed in a browser's location bar,
but its use in every code path made it impossible to open a file with a trailing
space in command-line tools that uses fromUserInput(cwd) to handle command-line
arguments, as recommended. For instance kde-open5 "file.txt " would fail.
Change-Id: Ie61182684521d91f077d3e76f95b7240965ab405
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's only used in the autotests, and it private API, so
downgrade from Q_CORE_EXPORT to Q_AUTOTEST_EXPORT.
Fix a use of QTimeZonePrivate functions unprotected by
QT_BUILD_INTERNAL in tst_qtimezone.cpp.
Change-Id: I70eaea06f8fcf2983aeafb6894c3a5d2a4b272a7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This adds the tabletTracking property in the same way that mouseTracking already
existed: there is a WA_TabletTracking attribute, and a TabletTrackingChange event
to notify when it changes. So for widget applications it's an opt-in feature.
QtQuick applications don't yet make use of tablet events, but when they do
in the future, we don't yet have a mechanism to turn the move events off;
it remains to be seen whether that will be necessary.
[ChangeLog][QtWidget] QWidget now has a tabletTracking property, analogous
to mouseTracking, which will enable TabletMove events while the stylus is
hovering, even if no button is pressed. This allows applications to show
feedback based on the other tablet event properties such as rotation and tilt.
Task-number: QTBUG-26116
Change-Id: Ie96e8acad882b167e967796cdd17f1ad747a2771
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
The QSystemLocale constructor remembers the most-recently-constructed
instance - a dodgy enough proposition at the best of times - and
shares it with much of the rest of QLocale. There is a global static
instance, actually of a derived singleton class, to which it is
usually set on program start-up. However, the constructor deleted the
remembered instance before remembering any new instances; there was no
way this could not lead to bad consequences. So let's not do that.
Change-Id: Ie8f3d655c9d4f75f6ec00a5861d98d6020ecc633
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There's nothing wrong with cloning a const QTimeZonePrivate, so make
clone() const.
Also, if you're cloning a QTzTimeZonePrivate, you already know that
you get a QTzTimeZonePrivate back. C++ supports covariant return types
for this reason, so use them.
Change-Id: I60e19e89b1b7bad080c552f1baca314ab0a6295e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
- Don't init m_icu with 0. It's a QSharedDataPointer, which inits to
nullptr anyway.
- The copy ctor didn't do anything out of the ordinary, so = default it.
It's also only used in the implementation of clone(), so make it private.
Removes three #if QT_CONFIG blocks.
We can't use ctor delegation here, because systemTimeZoneId() is a
virtual function.
Change-Id: I2cd06c3349686b6f21c897acb5c12185a36d5b9f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
MSVC 2013 complained:
src/corelib/tools/qbytearraymatcher.h(143) : warning C4351: new behavior: elements of array 'QStaticByteArrayMatcher<6>::m_pattern' will be default initialized
Fix the same way as 9a07ab9234: by suppressing
the warning.
Change-Id: Ic41f7eabe7e39709d76e6062f5891cdcfaa6e1ed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This is one of the pillars of my static container checking toolbox,
one of the main checks being that every type put into a Qt container
has been marked up with Q_DECLARE_TYPEINFO.
Obviously, we cannot upstream such a checker and inflict it upon the
world, but we can put some foundations in. This is the most central
one.
Change-Id: I9185facb2f37ba9fcc12c9aae5675eed454d755c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
RunLoopModeTracker as one of Qt Cocoa classes was not wrapped
in namespace which limited its use in Objective-C single symbol space.
Change-Id: Ida2c62c6f543a3bf5107f28c78d27435bcb3470d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This is still not a great place for it, but this way we can
Q_REQUIRE_CONFIG(library) in qlibrary_p.h and qfactoryloader_p.h is the
only private header that doesn't require library support in plugin.pri.
Change-Id: Ia6c1ac8799822eca1e0cbeca98d1c1b8de74beae
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
The cancel() function added in 5b11e43e for Qt 5.5 suffers from a
number of problems:
First, if runnable->autoDelete() is true, then the function suffers
from the ABA problem (see documentation written for trytake()).
Second, if runnable->autoDelete() is false, due to cancel() throwing
away crucial information instead of returning it, the caller cannot
know whether the runnable was canceled (and thus has to be deleted),
wasn't found or is currently executing (and thus mustn't be deleted),
or has finished executing (and can be used to extract the result).
Deprecate this dangerous API and replace it with the much more useful
Private::stealRunnable(), promoted to public API and renamed to
tryTake() for consistency with the rest of Qt.
Described the various caveats in the function's documentation.
[ChangeLog][QtCore][QThreadPool] The cancel() function suffers from
several subtle issues and has been replaced with a new tryTake()
function.
Change-Id: I93125935614087efa24b3e3969dd6718aeabaa4f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
We fully specialize QTypeInfo for most C++ built-in types,
but enums and extended integral types (like GCC's int128_t)
were not covered.
Now that we depend on <type_traits>, we can stop pessimizing
enums and extended integral types in QVector and QVLA by
defaulting QTypeInfo::isComplex to true for such types.
Fix a test that checked that enums were complex types. This should
have been a XFAIL test. Enums are not complex types.
Change-Id: Ibb0fb38cc83e980a428b5573d1db5666593418ae
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
... except in QList.
When dafa3618 introduced isRelocatable and QTypeInfoQuery, the
intention was to decouple the memory layout of QList from the
reallocation optimizations in QVector. This never happened, as
QVector (and QVarLengthArray) continue to use isStatic to this
day.
Fix by porting both QVector and QVLA to QTypeInfoQuery and
isRelocatable.
Change-Id: I6951f2cf21f0cbb24e2dbd38f80f1bd82007d394
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... but default-initialization instead.
This bug may have rendered the diverse Qt::Uninitialized ctors
we have in Qt containers ineffective.
Change-Id: I5a369fa8527f19b6f8cc1a9f36512f6a0058839a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... as a replacement for QPair<QString, int>, and move some
repsonsibilities into it.
This avoids the repeated use of the magic number INT_MIN to indicate
absence of an offset and does away with the confusing .first and
.second, replacing them instead with proper names, .name and .offset.
Change-Id: I0f6906467b8efa16bed2bf5677f2bbbd534da1ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Pass classname 'exefile' to ShellExecuteEx() for UAC prompt.
This allows running executable files that do not have a .exe extension.
Task-number: QTBUG-59008
Change-Id: I88d669481e893db50edccd7b30259e5366477556
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
also actually deletes qfeatures.txt, which was already claimed by
a668c6a6, but not actually done.
Task-number: QTBUG-58411
Change-Id: I686760632fee7c10b01bd2e83f2481b01bc2b774
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
QObject::connect will extract the QArgumentType for first the signal,
then the slot. The QArgumentType with a string constructor will query
the metatype system to get the meta type id. But it might happen that
between the extraction of the signal's argument and the slot's argument,
qRegisterMetaType was called in another thread. For this reason, it's
possible that one QArgumentType has a type id while the other does not.
For this reason, we should fall back to compare the string if any of
the argument's type is 0.
Task-number: QTBUG-50901
Change-Id: I260ca662ff00a773ae519f78bb633e05fde0ea81
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
These days, QTypeInfoQuery and isRelocatable should be used.
Change-Id: Ieac2d7fcef6b1d5466b14bbd1066901d6e751a55
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The this pointer cannot be null, so we can't do d->staticFunction while
d is a null pointer. This was caught by Clang 3.8's ubsan.
Change-Id: I3c0d39b88cca83d827a69ed1544a4412b18ac907
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The 'rules' vector is made up of all the individual {env,config,...}Rules
vectors under mutex protection whenever init() is called (only from the
QCoreApplication ctor) or, at any time, by a call to QLoggingCategory::
setFilterRules().
Yet, the writes to the individual *Rules vectors were never protected by
registryMutex, racing against the reads of the same vectors in the
updateRules() function.
Fix by protecting all access of all member variables with registryMutex.
Add some strategic comments to make analysis easier for the next guy.
Change-Id: If68d15a553ec7038693574a34f10a39f4cd480e8
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
AİİA.pdf takes 8 QChars, but after lowercasing it takes 10, so the code cannot
assume the length to be the same.
Task-number: QTBUG-58822
Change-Id: Id6fbb99f6afd08ee420099cd66372732d7598d9e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
An Acquire barrier in QReadWriteLocker::unlock was missing to synchronize
with the testAndSetOrdered on d_ptr in the lock functions.
The race is between the write of d->writerCount in tryLockForWrite,
and the read in unlock. The acquire on d->mutex is not enough because
it is not on the same object. While that race could be fixed by taking
the newly-allocate()ed d's mutex before publishing it with testAndSet,
there's another race, on 'recursive', between a newly-minted Private*
with recursive == false in tryLockForWrite(), and the read of 'recursive'
in unlock().
Task-number: QTBUG-58917
Change-Id: I10ba36573c0e57468d11e9b77d85045711feaea1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The _next variable need the acquire and release fence in next()
to synchronize with the equivalent operations in release() (which
already have the them)
The ordering on the _v[block] is not enough as this does not
synchronize the same object.
Task-number: QTBUG-58917
Change-Id: I17cc39e6791433348b6227363dbea92bcf03700d
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Like the lvalue QVector::append() overload, when we reallocate,
we need to take a copy of the function's argument because the
reference will get stale upon reallocation.
Add a test.
[ChangeLog][QtCore][QVarLengthArray] Fixed a bug involving
appending an item already in the container to the container
again.
Change-Id: I06eeed6cb383dd5924e47a302bb3d1666d04c8e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Automount filesystems like /home on many operating systems (QNX and
OpenIndiana, at least) don't like if you try to mkdir in them, even if
the file path already exists. OpenIndiana even gives you an ENOSYS
error.
So instead, let's try to mkdir our target, if we fail because of ENOENT,
we try to create the parent, then try again.
Task-number: QTBUG-58390
Change-Id: Ibe5b1b60c6ea47e19612fffd149cce81589b0acd
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
Reviewed-by: David Faure <david.faure@kdab.com>
A default-constructed static QBasicAtomicInt at function scope
will be dynamically initialized. It will still be zero-initialized,
but at least GCC adds guard variables for such objects.
When using aggregate initialization, the guard disappears.
Amends 04d6495bf7.
Change-Id: Id9335cffdd43094cafb231fdde2523d013abe1d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The library feature already covers this. As library depends on the
dlopen compile check, we can assume dlopen to be available, also on
vxworks.
Change-Id: Idcdb07ab4688c6158651d9a5ad5e2ba126bd7d9e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
It is never written after initialization, and accessed concurrently
outside mutex protection, so make sure that it never changes by
marking it as const.
Change-Id: Ib28b2e8b3067d596a95d1699165a6ebfb15fe674
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Adding 0 each time will obviously not produce a new identifier each
time...
Also use static initialization for QBasicAtomicInt.
A default-constructed static QBasicAtomicInt at function scope
will be dynamically initialized. It will still be zero-initialized,
but at least GCC adds guard variables for such objects.
When using aggregate initialization, the guard disappears.
Amends 265db5ad9b.
Change-Id: Ia71290cf26c486dcbcc74381f12cd0c4712d6019
Reviewed-by: David Faure <david.faure@kdab.com>
Use F16C or ARM FP16 if available at compile time.
Configure check added because older clang compilers have F16C defines
and flags but not all the intrinsics.
Change-Id: I71f358b8fd003e70ab8fcf35097414591e485112
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
By making the destructor (usually the first non-inline, non-pure,
virtual function, and therefore the trigger for most compilers to emit
the vtable and type_info structures for the class in that TU)
out-of-line, vtables and, more importantly, type_info structures for
the class are pinned to a single TU. This prevents false-negative
dynamic_cast and catch evaluation.
Since the classes are already exported, users of these classes are
unaffected by the change, and since it's private API, we don't need to
avoid adding code to the out-of-line destructor until Qt 6.
While at it, de-inline also the empty default implementations of
virtual (non-dtor) functions.
Task-number: QTBUG-45582
Change-Id: I3e6f37eab1dee0db445f6c13638a43ca3bf6ac62
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We require lambda support in the compiler since Qt 5.7, so drop
the guard macro.
Apart from MSVC 2013, all our supported compiler also support
char16_t:
- VxWorks uses GCC 4.8, which supports char16_t since 4.5.
- ICC supports char16_t since v12.1; we require v14+.
- ONX uses a GCC which supports char16_t in the compiler,
but is equipped with a stdlib that does not sport char16_t
support, which is why we revoke its Q_C_UNICODE_STRINGS in
qcompilerdetection.h. But we don't need stdlib support, we
only need the core language feature.
This is the only platform where this patch actually changes
something. It removes the, rather unfair, pessimization of
the platform which could have supported the static-storage-
duration implementation of QStringLiteral instead of the
fallback, which uses dynamic memory (QString::fromUtf8()).
- GCC and Clang support char16_t since 4.5 and 3.0, resp.,
which is far below our minimum compiler requirements in
effect since Qt 5.7.
- On Windows, MSVC supports char16_t since 2015 only, and we
still support 2013, but on Windows, wchar_t is the same size
as char16_t, so instead of u"str" we can fall back to L"str".
So simplify the implementation of QStringLiteral by assuming
that all these feature are present, adding noexcept to the
lambda to make noexcept() queries return true.
This allows us to guarantee:
[ChangeLog][QtCore] QStringLiteral is now guaranteed to be
evaluated at compile-time. The last platform (QNX) to use the
QString::fromUtf8() fallback has been ported to allocate the
string data statically, too.
Change-Id: I7920d7a77001e5c5550e7c7d57ceb7c51c9eb443
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A variable of static storage duration that is not zero-initialized
takes up space in the DATA segment of the executable. By making the
counters start at zero and adding the initial value afterwards, we
move them over to the BSS segment, which does not take up space in
the executable.
Wrap atomics used across function boundaries into small functions,
to avoid code duplication and to increase readability.
Change-Id: Ida6ed316ecb8fe20da62a9577161349e14de5aed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Systematic testing in tst_QStringApiSymmetry revealed a bug in
QStringRef::toLatin1(): a null input did not result in a null output,
but an empty one. This is fixed, for consistency with
QString::toLatin1(), and QString(Ref)::toUtf8(), which behaved
correctly already.
The same bug was found in QString(Ref)::toLocal8Bit(), which is
particularly hideous, as it's documented to fall back to toLatin1(),
which preserves null inputs. Fixed, too.
[ChangeLog][QtCore][QString] toLocal8Bit() now preserves nullness of
the input QString (outputs null QByteArray).
[ChangeLog][QtCore][QStringRef] toLocal8Bit() and toLatin1() now
preserve nullness of the input QStringRef (output null QByteArrays).
Change-Id: I7026211922c287e03d07e89edbad2987aa646e51
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
3e9db01a2e4be5034d10d6eeafd65d0a8609615b entered dev after the 5.8
branch.
Change-Id: I4139d5f93dcb4b429ae9fffd14a349e85e62a298
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
It was unnecessary, since we only cached the static types, which are all
generated by the macro anyway. The way it was implemented, this produced
data races that are strictly-speaking UB, even if all the threads were
writing the same values to the same data locations.
This commit changes a little the code to simplify, since we're changing
those lines anyway.
Task-number: QTBUG-58851
Change-Id: Idc5061f7145940f987dffffd14a30047846e3113
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
GHS compiler is not fully compliant with iec559.
Therefore we need to replace is_iec559 assertion
with separate checks to build quint16.
Change-Id: I88c57e394b8d4e7899ee7d4a13cbfbac9436b2fc
Reviewed-by: Rolland Dudemaine <rolland@ghs.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If the QSemaphore::tryAcquire() call times out, we mustn't
touch *res, because there was no happens-before relation
established between *res = result in the lambda and our
returning *res;
Fix by returning a default-constructed hash in that case.
Add a strategic std::move().
The same problem exists in runOnAndroidThreadSync(), but
I have no idea how to solve it, because there the shared
object is the runnable itself.
Change-Id: I9a2c431144c169fbd545763555d96153143a11bf
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
The code obtained an iterator into a QHash under mutex protection,
then dropped the lock, dereferenced the iterator several times and
only retook the lock to erase the element from the QHash.
This is very smelly. QHash provides no official iterator validity
guarantees, and the container isn't const, either (which would imply
thread-safety). In particular, the dereference into the container
outside the critical section is cause for concerns.
Simplify the code, removing any doubts about its race-freedom, by
taking the payload item out of the hash before dropping the lock, and
using only the local strong reference in the remainder of the
function.
The only other references to g_pendingPermissionRequests are
insertions with unique-by-construction keys in QtAndroidPrivate's
requestPermissions(), so there was no reason to keep the item in the
hash for the whole duration of the sendRequestPermissionsResult()
call.
Change-Id: I39fe0803b13b3046d1f0fd9c8e96c531406d57da
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Solves a data race found by TSan.
Since thread and threadId are QAtomicPointer, I've removed the explicit
initialization in the QThreadData constructor
Task-number: QTBUG-58855
Change-Id: I4139d5f93dcb4b429ae9fffd14a34082f2683f76
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
1. Do not use Q_GLOBAL_STATIC to hold QAtomicInt or QMutex, use
file-static QBasicAtomicInt and QBasicMutex instead. They are
zero-initialized PODs.
2. Use only QMutexLocker to lock mutexes.
Also wrap the atomic counter into a next...() function, as done
elsewhere.
Change-Id: I4b14ac0de9d4cb6780b1f1372c2b5fc88e918e4c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
$ git grep -we futexFlagSupport
src/corelib/thread/qmutex_linux.cpp:static QBasicAtomicInt futexFlagSupport = Q_BASIC_ATOMIC_INITIALIZER(-1);
The last user of this variable was removed in 9ef59b5.
Change-Id: I818a13a481ad25baa5ff7d389a737b8801adcfcc
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
All implementations of QCollator::sortKey() can benefit from
moving their CollatorKeyType into the QCollatorSortKeyPrivate
on construction.
So make the QCollatorSortKeyPrivate ctor a perfect forwarder
for its m_key member, and add std::move() calls where they
were missing (in all but one case, lvalues were passed).
Make the ctor explicit, as it should have been from the
beginning.
Change-Id: I2a1cdda5fd23990ace019b963df895c621a1fa85
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
QThreadPool maintains three containers of QThreadPoolThread*:
- allThreads, a QSet
- waitingThreads, a QQueue
- expiredThreads, also a QQueue
None of the operations on allThreads make use of QSets fast lookup.
The only functions called on it are isEmpty(), count(), insert(),
and swap().
Since therefore QSet adds nothing but overhead, causes indeterminism
(e.g. when deleting threads in Private::reset()) and code bloat, use
the same container for allThreads that underlies QQueue: QList.
Port insert() to append(). Add an assert to verify that we're not
running into an ABA problem here (but this should never fire, since
we're never deleting threads except in Private::reset(), where we
do remove them from allThreads), just in case.
Saves ~0.5KiB in text size on optimized Linux AMD64 GCC 7.0 builds.
Change-Id: I53a4d5ef2c204420f7c8852f1e72ab3d6ea43d08
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add proper support for 'so' and 'bundle' suffixes. Qt wrongly assumes
.so libraries are not versioned on Apple platforms, which is
wrong. Also, the shared library .bundle which is what Apple recommends
instead of .so, are also versioned (not to be confound with the
different Core Foundation bundles, which are directory hierarchy).
For more info, see http://docstore.mik.ua/orelly/unix3/mac/ch05_03.htm.
Especially the part that reads:
"Loadable modules, called bundles in Mac OS X, have the file type
MH_BUNDLE. Most Unix-based software ports usually produce bundles with a
.so extension, for the sake of consistency across platforms. Although
Apple recommends giving bundles a .bundle extension, it isn't
mandatory."
Task-number: QTBUG-50446
Change-Id: Iacd5136397a12d65d83821434f332eb602550b4b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
And if __AES__ or __PCLMUL__ is defined, then we expect wmmintrin.h to
exist.
Change-Id: I445bb15619f6401494e8fffd149db77dc513e071
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
We have observed that MSVC 2013 gets lost with the overloads that this
header adds, causing compilation bugs. This is believed to be a compiler
bug, but it's not something we can work around.
Task-number: QTBUG-58555
Change-Id: I536c32a88bff44dab37afffd14a1bad1d31dc16d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Glen Mabey <Glen.Mabey@swri.org>
Since 5.7, QIODevice::peek() implementation is based on transaction
mechanism. While technically it's correct, seeking backward on a
buffered random-access device clears the internal buffer that affects
the performance of reading.
To solve the problem, this patch implements peek mode directly inside
the reading procedure.
Task-number: QTBUG-56032
Change-Id: Ic5269f76e44c491a0309e13aba87fa7cf7b9259f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Move device-dependent part of the code into the private function for
further reusing by peek() procedure.
Task-number: QTBUG-56032
Change-Id: Iedceafe4b0bab109ca5c64ad274d779efe87c27b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
We're already using it, for example in qpaintengine_pic.cpp:502:
d->s << p << ti.text() << fnt << ti.renderFlags() << [...]
^
[ChangeLog][QtCore][QFlags] Added operator<< and operator>> for
streaming QFlags into and out of QDataStreams.
Change-Id: I33dc971f005a4848bb8ffffd1478e79d6102d1bc
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
the file contains no code.
this avoids complaints from ar/ranlib in static/bootstrapped builds.
Change-Id: Iee22ffc61a5f9ea8c25f5455b7e8e017ac521624
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since they are all used in a typical application, this reduces the
number of memory allocations (thus, the overhead) as well as the
state-keeping in the libc atexit() functions.
Change-Id: Ifaee7464122d402991b6fffd14a0e59457ad9cb7
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
If these lists weren't created in the first place, then they are empty.
We don't need to create it in order to conclude that. Unlike most
Q_GLOBAL_STATICS, these are almost never used and yet they were
always created due to where they were checked.
Since we're calling exists() before, there are two consequences: first,
since the list already exists, we're not allocating memory so it cannot
throw std::bad_alloc when being accessed. Second, since we've just
checked it exists, we can use QGlobalStatic's operator*(), which is
slightly faster than operator()(). The weird &(*list) syntax is only to
avoid changing the rest of the code that used a pointer
Change-Id: Ifaee7464122d402991b6fffd14a0e44f533dc3d9
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Seems to be a write-only variable and QThread::currentThreadId has no
side-effects.
Change-Id: Ifaee7464122d402991b6fffd14a0c8666968dfe4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Give QCollator access to QLocalePrivate::bcp47Name(), to avoid
both the latin-1 -> UTF-16 conversion in QLocale::bcp47Name(),
as well all as
- the replace('-', '_').toLatin1() call in ICU
- the toLocal8Bit() call in macOS
- the toUtf8() call in Windows
implementations of QCollatorPrivate::init().
This is safe, since, according to https://tools.ietf.org/html/bcp47,
a BCP47 name only contains US-ASCII (ALPHA used, which is defined by
https://tools.ietf.org/html/rfc5234 to be [a-zA-Z] only).
Change-Id: Id56befb1b5a7983494d848cdabf7ebeda377cf9f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
When a non-QString-backed mode (via the (QChar*, int) ctor) was added
for Qt 4.5, the author forgot to adjust the setCaseSensitivity()
function. It still uses q_pattern instead of (p.uc, p.len) as the
pattern for which to create the skip-table. Since there is no
setPattern() overload for this mode, the correctness of the matcher is
not harmed by this, but its performance degrades to that of a linear
scan: the skip-table, being filled from an empty pattern, will be
all-zeros, sending bm_find() into the 'possible match' case at every
character.
Since matching is still correct, but slow, it's not possible to write
a test for this. I did, however, leave my attempts in the auto-test,
for when we add QStringView overloads of setPattern() which will then
be able to expose the bug.
Change-Id: I7b803e8624b0352a0a974900affbbfc0c260d93b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The intention when using an overload that takes (const QChar*, int)
instead of a QString is probably to avoid creating a QString in the
first place. If the implementation stabbs the user in the back by
internally creating a QString just so it can call QString::compare()
on it, then that is rather unacceptable.
QCollator is already a friend of QString, so, absent QStringView,
resolve to calling compare_helper().
Change-Id: Ia7de1a095e3e310bd1b9957ed67291cc9cc95b32
Reviewed-by: David Faure <david.faure@kdab.com>
The key is immutable except for assignment and swap,
so don't run the risk of auto-detaching and use the
explicit-detach version of QSharedDataPointer.
Change-Id: Ib2cfe5981e6dfe375d6208289ff58247ef9d4870
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
... by not creating three temporary QVectors just to concatenate them.
There's no QVectorBuilder, so what works well with QStrings doesn't
work well at all with QVectors. The chaining of op+ causes three
temporary QVectors to be created and thrown away.
Instead, use clear() (which preserves the vector's capacity these days),
followed by four op+=.
Change-Id: I300bd35544ea41037d28db0f48f210c33c826b85
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Fix warnings:
src/network/access/qhstspolicy.cpp:158: warning: Undocumented parameter 'expiry' in QHstsPolicy::setExpiry()
src/network/access/qhstspolicy.cpp:178: warning: Undocumented parameter 'include' in QHstsPolicy::setIncludesSubDomains()
src/network/access/qhstspolicy.cpp:178: warning: Can't link to 'includeSubdomains()'
src/widgets/kernel/qsizepolicy.cpp:402: warning: Cannot find 'transposed(...)' in '\fn' QSizePolicy QSizePolicy::transposed()
src/widgets/kernel/qsizepolicy.h:165: warning: No documentation for 'QSizePolicy::transposed()'
src/widgets/util/qundostack.cpp:164: warning: Undocumented parameter 'obsolete' in QUndoCommand::setObsolete()
Fix the signature of the QStaticByteArrayMatcher member functions. The warnings
src/corelib/tools/qbytearraymatcher.cpp:372: warning: Cannot find 'indexIn(...)' in '\fn' QStaticByteArrayMatcher::indexIn(const char *haystack, int hlen, int from)
src/corelib/tools/qbytearraymatcher.cpp:382: warning: Cannot find 'indexIn(...)' in '\fn' QStaticByteArrayMatcher::indexIn(const QByteArray &haystack, int from)
remain, though since apparently qdoc is thrown off by the constructor.
Change-Id: I157359a881ff3fbc80d2eeb52dd5c27249d009c4
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This is private API, and used nowhere else except in qcollator*,
so don't export these classes.
Change-Id: I217fde97c60ab0a3e19774ed5a6eed8b156fff1d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When a QFile object is reused, the atEnd() method may return incorrect
values. The reason for this is that QFileDevicePrivate::cachedSize is
not cleared. Setting cachedSize = 0 in the close() method fixes this issue.
Task-number: QTBUG-57698
Change-Id: I828a2cf844e98d581098f2c781fa47d2cd3275ce
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
QDateTimeEdit (QtWidgets) inherits its Private class from
QDateTimeParser.
By making the destructor (usually the first non-inline, non-pure,
virtual function, and therefore the trigger for most compilers to
emit the vtable and type_info structures for the class in that TU)
out-of-line, vtables and, more importantly, type_info structures for
the class are pinned to a single TU. This prevents false negative
dynamic_cast and catch evaluation.
Since the class is already exported, users of these classes are
unaffected by the change, and since it's private API, we don't need
to avoid adding code to the out-of-line destructor until Qt 6.
Task-number: QTBUG-45582
Change-Id: Id57289a7eff13564dddeca0af1c45a6180c36c48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
On macOS, the code that read the plist is using
QByteArray::fromRawCFData. When we return the data directly
we need to detach the QByteArray so that it does not point
CFData's data that will get deallocated just after the call.
Task-number: QTBUG-58531
Change-Id: If829a304b986c99c8fc2aeeb992f2d539a4eef3a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
qcore_foundation.mm:
- Can't link to 'fromCGPoint()'
- Undocumented parameter 'point' in QPointF::fromCGPoint()
- Can't link to 'fromCGRect()'
- Undocumented parameter 'rect' in QRectF::fromCGRect()
- Can't link to 'fromCGSize()'
- Undocumented parameter 'size' in QSizeF::fromCGSize()
Change-Id: Ie48f04c7b990634f8c5a836100b1be7854848bb4
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Previously, the flags were replaced rather than appended to, losing -I
flags and causing `#include` directives to fail.
Change-Id: I74609e891ea327a8136c8075ab13176fc85ab111
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Which allows us to remove the #include. The qfloat16 operator overloads
in the global namespace are giving some trouble on some compilers, for
reasons unknown (could be compiler bug, could be real). So don't #include
the header anywhere else: let the user choose it.
Task-number: QTBUG-58555
Change-Id: I4c9f691516694b90b08ffffd149ef7dff27d0f6a
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Chinese locale means Code Page 936 here. It's also related with
removing C4819 warnings.
And it's also following Conventions in Qt source code: All code
is ascii only (7-bit characters only, run man ascii if unsure)
See also http://wiki.qt.io/Coding_Conventions
Task-number: QTBUG-56155
Task-number: QTBUG-58161
Change-Id: I37fa7a0e6a82a16eaf80e1cc99be801099ab87de
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: jian liang <jianliang79@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
MSVC < 1800 (older than 2013) is no longer supported, so we can simplify
the code. And the implementation for C never worked -- "if it's not C++,
let's use a namespace!"
Change-Id: Iaeecaffe26af4535b416fffd148c2c6788c43881
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
The last use of qWinMain was removed in commit
390598cb43, "Winmain: Remove Windows CE."
It used to be used on non-WinCE, but that was dropped in commit
9b121e5579.
Change-Id: Idc347fbb462f4122b044fffd1490a210358a61b1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
There was a test that tested this, but was wrong.
[ChangeLog][QtCore][QVariant] Fixed a bug that caused wrong results for
comparisons of QVariants containing either NaN or infinite numbers.
Task-number: QTBUG-56073
Change-Id: I33dc971f005a4848bb8ffffd1475d29d00dd1b7f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This constitutes a fairly complete submission of an entirely new
floating point type which conforms to IEEE 754 as a 16-bit storage
class. Conversion between qfloat16 and float is currently performed
through a sequence of lookup tables. Global-level functions
qRound(), qRound64(), qFuzzyCompare(), qFuzzyIsNull(), and
qIsNull() each with a qfloat16 parameter have been included
for completeness.
[ChangeLog][QtCore] Added new qfloat16 class.
Change-Id: Ia52eb27846965c14f8140c00faf5ba33c9443976
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Although it's permitted to specify the project name together with
a version number for \since, it's unnecessary for Qt classes and
functions.
This change also normalizes the version formatting: '<major>.<minor>'
Change-Id: Ie5a43662077d13c31e241bcde8a7a2849d27d330
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
It's included by qglobal.h, so we get it for free in other headers.
Change-Id: I90072156e313271a5354a39cbf78a83a6885c431
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of
result += QString(string builder expression);
forcing a QString creation incl. memory allocation, do
result += string builder expression;
using the overloaded QString += QStringBuilder operator.
Change-Id: I23023c76620fa6bb7bf9f2786c22f6a2ec0d87c2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The crc32() functions take a size_t length, but the hash() functions
wrapping them took int lengths.
That makes no sense and actively hurts adding hash functions for STL
types or QStringView, so port the hash() interface to size_t.
Change-Id: Id303d6df4b698560fce656cec8ed693b01daac1c
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of using the actual compiler version to determine which C++11
features to enable, let's just use the Mirosoft compiler version that
the actual compiler is claiming compatibility with. That is because the
limiting factor is often the standard library, not the compiler itself.
This will cause some features that do not depend on the library to also
be disabled, but oh well. Better upgrade your Visual Studio version
instead.
Task-number: QTBUG-57696
Change-Id: I3e4e5051937c40319d6efffd14912cd4fdab25fb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
The __popcnt family of intrinsics with MSVC generates directly the
POPCNT instruction and are documented to do so:
https://msdn.microsoft.com/en-us/library/bb385231.aspx
So we can't use __popcnt unless the target processor supports it.
[ChangeLog][Windows] Fixed a bug that caused applications to crash with
"Illegal instruction" faults when compiled with Visual Studio and run on
some older processors.
Task-number: QTBUG-58446
Change-Id: I445bb15619f6401494e8fffd149d83bd2a7e3376
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This ensures at compile-time that Qt libraries do not use any APIs that
are not safe for use in application extensions, and fixes warning
messages that appear when linking to Qt libraries that are not built
with this flag, when used in an application extension.
This is especially important on watchOS where *all* "applications" are
actually application extensions, and on other Apple platforms if
application extensions are developed using Qt.
Task-number: QTBUG-40101
Change-Id: I022046f2584e0222253d33052b0abc221d7c93d6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The patch fixes a number of bugs in code, and removes dead logic
clarifying that MIPS DSP, like ARM NEON, has no runtime detecton.
Change-Id: If2f4eea68da5b2eaa80b8e9c8258206d8c1b7173
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There was an off-by-one error in the while loop for aarch64: we start
counting at 0 for the first position, so the last valid input position
is "a+7", not 8.
This wasn't covered by the tests, nor was the SSE2 version, so now there
are also tests for both versions.
Change-Id: I7eb8c5708e6179f45ea56885b0e66e1a37969c1d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
It was automatically merged from 5.6 branch. Qt 5.8 does not support
Windows CE.
Change-Id: I6968f50ef568035c224851d595d6c057128491a7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
error: base class ‘class QBasicAtomicPointer<void>’ should be explicitly initialized in the copy constructor [-Werror=extra]
Change-Id: I2bc52f3c7a574209b213fffd149b4b71f3006be5
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Implements isNull for QVariants of a nullptr so they always return
true to isNull(), instead of depending on how they were constructed.
Task-number: QTBUG-58296
Change-Id: Ibddec795cdadedef7e17d22c265c29e752d8f99f
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This patch replaces QRegExp by QString search and replace.
Change-Id: I11165afa45f8f9a856e6fb9b64929e4bdacb913d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This corrects an issue converting dates and times to strings which would
use the "default" time zone (CFTimeZoneCopyDefault) in contrast to the
rest of Qt which uses the system time zone in such contexts.
[ChangeLog][QtCore][QLocale] Qt functions now always use the system
time zone on Apple platforms, the same that low-level C APIs like
localtime() does. Previously, converting dates and times to strings
would use the "default" time zone (which is almost always the same as
the "system" time zone but could be changed with the Apple API).
Change-Id: I2942c3c1c8aa01a0130f1b7280371a72bdb01b1c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: I62448507f80daf6be72994ee99f0fb1aa107eb78
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
while compiling class template member function 'QVarLengthArray<T,Prealloc>::QVarLengthArray(std::initializer_list<T>)'
Change-Id: I36f5ef65ec1f511eac7f3ad1a4717d18f7dc9ce4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Gcc defines neither _MIPS_ARCH_MIPS32 nor __mips32 on MIPS32
architectures, instead __mips is defined to 32.
This fix exposed bit-rot in qdrawhelper where qt_memfill32 was set as
a function pointer despite not being one since Qt4.
Change-Id: I87461823e54fa3166223ebf97175fd05d2f2fd16
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QString::fromRawData code sample still shows the use of QRegExp. This
patch updates it for QRegularExpression and cleans the code.
Change-Id: Iff0f736cdbdd7d35c65fde1496ce9f838a8f5c6d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The documentation of QStringList is missing some mention of
QRegularExpression as well as still using QRegExp in some sample code.
This patch fixes that.
Change-Id: I4a7c9fe8e5ae7c73497192bb71d1fa66ee864bd2
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
There should be no blank lines in \value content, otherwise qdoc
ends the list and starts a new one.
Change-Id: Idddc7992317894487445aea36397136df40b9691
Reviewed-by: Martin Smith <martin.smith@qt.io>
INTEGRITY doesn't support self-extending stack. The default stack
size for a pthread on INTEGRITY is too small so we have to increase
the default size.
Change-Id: I0787d14938cf5e7e96c35df204212c8e83aa8893
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Nikola Velinov <nvelinov@ghs.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
[ChangeLog][QtCore][QFileSelector] Removed the requirement for an unused
default base file in case you want to load only a variant.
When the base file (e.g. /image.jpg) was missing, no selectors were
considered and it was not possible to load variants of this file (e.g.
/+android/image.jpg, /+android/+tablet/image.jpg) without specifying the
directory as well.
As a work around, one previously had to place a default file in
the base location, which is undesirable in some cases because:
1. The extra file consumes unnecessary space.
2. It is impossible to encapsulate platform-specific implementation
details by hiding files in a subdirectory.
Task-number: QTBUG-51230
Change-Id: I4c7f9ec952bff6e5b7738d8cabe3c762c208a38e
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
This is a version of QByteArrayMatcher that calculates the
Boyer-Moore skip table at compile-time instead of at run-time,
making this class more generally applicable than QByteArray-
Matcher itself, at least for statically-known strings.
The compile-time part requires C++14 constexpr support, but
the class should compile and work even in C++98 mode, just
with runtime initialization of the skip-table.
While touching tst_qbytearraymatcher, clean up the static
global QByteArrayMatchers there and add tests with needles
longer than 255 characters for QByteArrayMatcher, too.
[ChangeLog][QtCore] Added QStaticByteArrayMatcher.
Change-Id: I0662f262ab19b79ae4096f3ab384d5b3ada72347
Reviewed-by: David Faure <david.faure@kdab.com>
QHostAddress is one of the few classes in Qt which is pimpl'd but not
implictly shared, making it suprisingly expensive to copy around, return
by value and so on. Being pimpl'd it is also still lacking a move
constructor, like most of such types in Qt.
Remove a bit of the surprise factor and make it implictly shared. In
practice this means making it eagerly parse host addresses from strings.
Since it was entirely implemented out of line, replacing it with a
implictly shared implementation is binary compatible.
[ChangeLog][QtNetwork][QHostAddress] QHostAddress is now implicitly
shared.
Change-Id: Ia7ff94efcb74e7321b7607cd690c5c162f685605
Reviewed-by: Richard J. Moore <rich@kde.org>
[ChangeLog][QtBase][General] Removed support for WinRT/Windows Phone 8.1.
Task-number: QTBUG-57288
Change-Id: Ifd6d6780cbbdb710d99556ba3d2fb2e514d4f789
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
operator== and operator!= have been disabled, as they are likely to be
misused and are not particularly useful in practice. The same goes for
the QVersionNumber conversion convenience functions.
The constructor normalizes version component values so that invalid
versions like [5, -1, 3] cannot be constructed and made to wreak havoc
on assumed logic.
Change-Id: Iabb6876bd5dc11522032837f78cf825b921a49b2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
C++17 adopts P0021R1[1], which makes noexcept be part of the function
pointer's type and thus be overloadable. It contains some provisions for
allowing a noexcept function pointer to cast implicitly to a non-
noexcept function pointer, but that fails in the presence of templates
and additional overloads that could match the type in question.
Fortunately, the paper proposed a test macro, so we can change our
sources now and be compatible with both C++14 and C++17 rules.
This first failed with Clang 4.0 trunk. This source incompatibility is
not our fault, it's the language's doing.
[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html
Task-number: QTBUG-58054
Change-Id: I2bc52f3c7a574209b213fffd14988cf0b875be63
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
clang/g++ still warn when encountering the implementation of a
deprecated function.
Follows up 21a247adb4
Change-Id: I6ab1695acb520ef7ce7cb1896545d02607c3ce29
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
So that QFlags can use an (un)signed int matching the
underlying type as identified by the compiler and not by us.
Requires fixing a few warnings about sign conversion due to
QFlags misusages in qtbase that were either plain wrong, or
were relying on the enum being backed by an (un)signed int
when it wasn't.
Keep qtypetraits.h in the source tree in order to prevent
source breaks if some downstream #includes it (note however
that it did not contain any public API).
Change-Id: Ib3a92b98db7031e793a088fb2a3b306eff4d7a3c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... instead of sequential .arg(const QString &) callings.
It saves memory allocations and prevents unexpected results
if replacing strings contain place markers.
Found with clazy's qstring-arg check.
Change-Id: I3912275a6e11c6fb7559ff5623f2e8cde9b7f07a
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... along with the two matching unused methods of QDateTime's test.
Change-Id: Id11a4b1b0132587f0df451d49c0043e9425d87ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's supposed to be a full alignment (like Top | Right), not
just one flag.
Change-Id: I656adda83742d7e4f31955322e937e979b32747c
Reviewed-by: David Faure <david.faure@kdab.com>
[ChangeLog][QtCore] QCoreApplication::applicationVersion now defaults to
an appropriate platform-specific value. On Windows, it defaults to the
PRODUCTVERSION parameter of the VERSIONINFO resource for classic desktop
apps, and the version attribute of the application package manifest for
Univeral Windows Platform apps. On Apple Platforms (macOS, iOS, tvOS,
watchOS), it defaults to the CFBundleVersion property of the information
property list (Info.plist) file. On Android, it defaults to the
android:versionName attribute of the AndroidManifest.xml manifest
element. On other platforms, the default remains an empty string.
Task-number: QTBUG-57715
Change-Id: I26f83dd00737e06f4321cf962aa5fab8398104ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This avoids so many complications. The prior code, using
SystemTimeToTzSpecificLocalTime(), lead to unhelpful results when the
QDateTime() implementation used MS-POSIX's defective mktime().
Although SystemTimeToTzSpecificLocalTime() is actually more correct,
we were getting inconsistent results by mixing the two: and
eliminating the use of mktime() turns out to be decidedly tricky. So,
to avoid inconsistency, stick with a UTC time (which is what FILETIME
is defined as). Change QFileInfo's methods to explicitly convert
.toLocalTime() where appropriate and document that these methods do
indeed return local time (as we conjecture has been taken for granted
by callers).
Also added a regression test for the reported case of this going
wrong. A time-stamp from before Russia's (permanent, not DST) change
of TZ could end up inconsistently handled between file-system
meta-data and raw date-time APIs, due to cross-talk between different
MS-Win time APIs.
[ChangeLog][QtCore][QFileInfo] Made sure that all file lifecycle times
are in local time. This was probably true before, but is now explicit.
Task-number: QTBUG-48306
Change-Id: Ic0b99d25c4168f623d31967bc60665c0c4f38a14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For language "Traditional Chinese" on iOS with region "US",
the logic was formerly to attempt a match on country/language/script (fail),
followed by country/language (which would result in script defaulting to
"Simplified"). Now, the logic is to try language/script first if script is
specified. Failing that, language/country will be attempted.
Task-number: QTBUG-39639
Change-Id: I75a774b1e66686e95167ff221458a97a7ea2660d
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jason Erb <jason.erb@sparist.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If we use QLatin1String we should include qstring.h.
Change-Id: Iebd761b98e515e9cd9cd34b96a0f8a602d00f086
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Initial support for INTEGRITY to build QtBase
Change-Id: I18f36b4dea9107f01e1c281e4b62880590c777a1
Reviewed-by: Tuukka Turunen <tuukka.turunen@theqtcompany.com>
Reviewed-by: Nikola Velinov <nvelinov@ghs.com>
Reviewed-by: Risto Avila <risto.avila@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Honor the rule of five. Copy assignment was already disabled.
Disable also copy construction, but re-enable the move special
member functions.
This requires making the container non-const; to avoid detaches
and keep compatibility with containers that only have begin/end
(but not cbegin/cend), use qAsConst. This requires moving qAsConst
definition a bit up in the file.
Change-Id: I19cd74437cf69baceada9483920a21e96d7b1727
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Don't use Dinkum choices when the C++ library is libC++ (QNX 7.0).
Change-Id: I18c3f716ccfb0c02dbfdc01eac4b707d3ae9aab6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A directory is empty when it doesn't contain files or folders.
We can exploit QDirIterator::hasNext() to check whether this is the
case. This is efficient since it doesn't list the whole folder (in the
non-empty case).
Test cases are added for both the empty and non-empty cases.
Change-Id: I0f7e26782c0f97f9c16f928dab6cae37927875d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
StripTrailingSlash removes trailing slashes from the path, but not the
entire URL.
Task-number: QTBUG-47607
Change-Id: Id62b971e563e290b7ca000576bcc328616a3f1a2
Reviewed-by: David Faure <david.faure@kdab.com>
qmutex.h is updated to let clangqdoc document the threads case,
because the no-threads case is not interesting, and clang can
handle everything declared in qmutex.h. This change required
that a few minor qdoc errors be corrected in qmutex.cpp as well.
Change-Id: Icb4122f2179d6aad39dc68376498364820143297
Reviewed-by: Martin Smith <martin.smith@qt.io>
turns out that just appending builtin-qt.conf isn't a good idea:
executable-editing tools (objcopy, prelink, etc.) will happily drop the
"attachment".
a safe method would be adding a proper section to the executable, but
there doesn't appear to be an objcopy equivalent in msvc, and using
entirely different methods of embedding the file with different
toolchains seems like a rather bad idea.
so instead go back to the old method of building qmake with a generated
qconfig.cpp. of course, as said file is now created by qmake itself, we
have to compile qlibraryinfo.cpp a second time, and link a second qmake
executable.
Task-number: QTBUG-57803
Change-Id: I9e232693550aa870cec154e49cc06add13017cc2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Most of these involved moving or removing extraneous
aide-memoir comments left by programmers between qdoc
comments and their functions. There were also some
cases where Q_CLANG_QDOC had to be tested to make
something visible to clangqdoc. And there were a few
functions that should not have been documented at all.
Change-Id: I3bf7c397a9e5ddbffc40cc1fee7f19cad71a1ae7
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
We have to enable qt_safe_ftok with either sharedmemory or
systemsemaphore. In order to make the resulting QT_CONFIG work with the
bootstrap library we switch the features off for bootstrapping. Some
tests and examples have to be excluded when sharedmemory is not
available.
Change-Id: I3fc3926d160202b378be2293fba40201a4bf50c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This update undefines Q_GADGET when clangqdoc is running.
With Q_GADGET defined, clangqdoc expects documentation for
QtGadgetHelper in each class where Q_GADGET is used.
Note that the documentation for the Q_GADGET macro is still
generated.
Change-Id: I3e6e6644c2c537c00c44ae77664892e125046daa
Reviewed-by: Martin Smith <martin.smith@qt.io>
Commit 9ca635482d renamed the configure
feature from pcre to pcre2, which unfortunately means that people would
have to change their build scripts to pass -qt-pcre2 instead of
-qt-pcre. As the configure check already verifies the correct PCRE
version for use (when using the system library), it seems more
convenient for our users to retain compatibility and call the configure
feature "pcre" again.
Change-Id: If26e7888814d8204d43baf7298d9916a4f856a48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
In this case, the issue was ICC, when compiling QtQml:
qv4sequenceobject.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QList<class QItemSelectionRange>::replace(int,class QItemSelectionRange const &)" (__imp_?replace@?$QList@VQItemSelectionRange@@@@QEAAXHAEBVQItemSelectionRange@@@Z)
referenced in function "public: static bool __cdecl QV4::QQmlSequence<class QItemSelection>::deleteIndexedProperty(struct QV4::Managed *,unsigned int)" (?deleteIndexedProperty@?$QQmlSequence@VQItemSelection@@@QV4@@SA_NPEAUManaged@2@I@Z)
This applies the same fix as qvector.h has had for ages due to QPolygon.
Change-Id: I15b62e0f9cec482fbb40fffd1490d791db5056bc
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
getMaximum() and getMinimum(), called during parsing, create new
QDateTime instances, which on Linux end up calling mktime().
Making these static (for the common case of LocalTime spec)
improves performance dramatically, when parsing several date/times.
tests/benchmarks/corelib/tools/qdatetime/ (after fixing it to
actually parse a valid date/time) says:
RESULT : tst_QDateTime::fromString():
- 36,742,060 instruction reads per iteration (total: 36,742,060, iterations: 1)
+ 24,230,060 instruction reads per iteration (total: 24,230,060, iterations: 1)
Change-Id: I0c3931285475bf19a5be8cba1486ed07cbf5e134
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's quite a simple addition and required for the ahead of time compilation
tool for qtdeclarative.
Change-Id: Iba85ae5182919cdb5ab15a0b643e57c103eae632
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This allows the Dptr parameter of the Q_DECLARE_PRIVATE_D macro to be
a smart pointer, not just a raw pointer.
Change-Id: Iaf27352e327e9aedea149461d47f2f11460a42dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The article does answer the questions asked in the bug.
Task-number: QTBUG-56629
Change-Id: Ib8bac0acf45bc10598fc47feb6dd73005b5ad040
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The "qYouForgotTheQ_OBJECT_Macro" function hasn't been used in
qobject_cast since commit 7d7e8ae3fa (Qt
5.2), when Olivier made the error use Q_STATIC_ASSERT instead.
Change-Id: I15b62e0f9cec482fbb40fffd1490d7c050084369
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This reverts commit 91a2c8630b. We
promised in the Qt 5.6.2 changelog to do it in Qt 5.8. It was a
temporary compatibility hack.
[ChangeLog][QtCore][QUrl] The temporary compatibility in
QUrl::resolved() that treated the base URL as relative if its scheme
matched the current URL's scheme has been removed.
Change-Id: I3e4e5051937c40319d6efffd1490eb9a5a948481
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Two sentences that read like author notes likely added by accident.
Task-number: QTBUG-56630
Change-Id: I7a0b114e128f95e54e9e8f26b43493f67747d650
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This code always intended to follow the recommended checking order from
the spec, which says "if multiple globs match, use file contents".
But if the globs had different weights, it would discard globs with
lower weights, and then wrongly conclude, if there is only one glob
left, that there was no ambiguity.
The correct way is rather: remember that multiple globs matched,
do determination from contents, and if that didn't work, *then* use
(one of) the highest-weight glob(s).
This fixes PGP-encrypted *.asc files being detected as text/plain rather
than application/pgp-encrypted.
(https://bugs.kde.org/show_bug.cgi?id=346754)
Change-Id: I734459daf9f502baa95ebb89432819964e0ce304
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>