Since Qt 5.7 has dropped WinCE, including WEC2013, the patch for WinCE
is no longer needed.
The source code for the sqlite3 shell, shell.c, is not required for
building the qsqlite driver or anything else in Qt, so there is no
reason to keep bundling it with Qt sources.
Change-Id: Id0b03945451f9e843a0424c9fe510d79555717fc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Gunnar Roth <gunnar.roth@gmx.net>
Replace Java-style iterators with STL-style iterators.
Java-style iterators have overhead.
Use std::stable_partition with erase() instead of using remove()
in a loop, with quadratic complexity.
Introduce local template homebrew any_of (analog of std::any_of from C++11)
to simplify current code. Also it's needed for following changes
in this class.
Change-Id: I2b11889ccc7630597c72aa20cdb266ae6ca2471a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
... when more than a return would be executed, to
prompt the compiler to move it out of the way of
the normal execution path.
Unexpectedly costs ~200b in text size on optimized
GCC 5.3 Linux AMD64 builds.
Change-Id: I0ebfb56af7c2262f64271a1b0ec46533e6000bc9
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Also print the failing type.
Sanity Bot complained about the spelling and Friedemann about
the grammar and missing type information in the output.
Change-Id: I7f38c56e569312e082e7b6baf9d556f5e7e40f80
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
The printf-style version of QDebug expands to a lot less code than the
std::ostream-style version. Of course, you pay in type safety (but
compilers warn about it these days), you cannot stream complex Qt
types and streaming QStrings is awkward, but in many cases you
actually improve on readability.
But the main reason is that something that's not supposed to be
executed under normal operation has no business bloating executable
code size.
This is not an attempt at converting all qWarnings() to printf-style,
only the low-hanging fruit.
In this first part, replace
qWarning() << ""
with
qWarning("...").
Had to fix broken qImDebug() definition. Instead of defining it as
a nullary macro in the QT_NO_DEBUG case and as a variadic macro in
the other, define it in both cases, as is customary, as a non-function
macro so that overload selection works without requiring variadic
macro support of the compiler.
Saves e.g. ~250b in text size in QtPrintSupport on optimized GCC 5.3
AMD64 builds.
Change-Id: Ie30fe2f7942115d5dbf99fff1750ae0d477c379f
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
This change partially reverts 1bfc7f68 about QT_HAS_BUILTIN define
and undef in src/corelib/tools/qsimd_p.h.
This change is also squashed with "Fall back to c++11 standard
compiler flag for host builds" which is done by Peter Seiderer.
Conflicts:
mkspecs/features/default_post.prf
src/3rdparty/sqlite/0001-Fixing-the-SQLite3-build-for-WEC2013-again.patch
src/3rdparty/sqlite/sqlite3.c
src/corelib/tools/qsimd_p.h
src/gui/kernel/qevent.cpp
src/gui/kernel/qwindowsysteminterface.cpp
src/gui/kernel/qwindowsysteminterface_p.h
src/plugins/bearer/blackberry/blackberry.pro
src/plugins/platforms/cocoa/qcocoasystemsettings.mm
src/plugins/platformthemes/gtk2/gtk2.pro
src/plugins/styles/bb10style/bb10style.pro
src/sql/drivers/sqlite2/qsql_sqlite2.cpp
tools/configure/configureapp.cpp
Task-number: QTBUG-51644
Done-with: Peter Seiderer <ps.report@gmx.net>
Change-Id: I6100d6ace31b2e8d41a95f0b5d5ebf8f1fd88b44
Introduce template helper function qSelectionIndexes().
Template argument is container. Now we have the same code for
QVector and QList.
Also it's needed for a follow-up change in this file:
add method QModelIndex QItemSelection::index().
Change-Id: I7f86a9b96e5feac9873cf0df7a1cbca74f9191ec
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
QReadWriteLock is supposed to be a better alternative to QMutex when there
are only a few writers but potentially lots of reads. However, in practice
the previous implementation was much slower, unless you really do a lot of
work with the lock for read and you have lots of contention.
Indeed, the previous implementation was locking a QMutex both for lock, and
unlock (making it already at least twice as slow as QMutex).
This new implementation brings QReadWriteLock back to the same level as QMutex:
- No memory allocations in the uncontended case (almost no overhead allowing to
create many of them in classes)
- Lock-free if there is no contention
Should support up to 2^31 concurrent readers on 64 bit platforms, and 2^28
on 32 bit platforms
Change-Id: Ifa2fc999075cbb971088f4ee8e6fde78ce262da3
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
I was surprised this compiled at all, since I thought
QT_NO_CAST_FROM_ASCII was in effect in Qt, but
apparently it isn't.
Change-Id: Id77743a2ca1b7f865960dc78d169584741f18d43
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
The printf-style version of QDebug expands to a lot less code than the
std::ostream-style version. Of course, you pay in type safety (but
compilers warn about it these days), you cannot stream complex Qt
types and streaming QStrings is awkward, but in many cases you
actually improve on readability.
But the main reason is that something that's not supposed to be
executed under normal operation has no business bloating executable
code size.
This is not an attempt at converting all qWarnings() to printf-style,
only the low-hanging fruit.
In this first part, replace
qWarning() << ""
with
qWarning("...").
Saves ~750b in text size on optimized GCC 5.3 AMD64 builds.
Change-Id: I8bf3e46cd5a6b2cae0ceb3e355a50f61925c63d3
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
These types are held in QVariant, and QIBusAttribute is also
held in QVector. Now that they are no longer polymorphic,
they can be marked as movable.
Remove user-defined dtors to unlock the implicit move special
member functions, which I enforce in my local tree for all
Q_MOVABLE_TYPEs. Add std::move() when appending QIBusAttribute.
QVector has rvalue-push_back().
Change-Id: Ibb359939d5c11b5ef1f8ceced9a051cdde452dd5
Reviewed-by: Takao Fujiwara <takao.fujiwara1@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
These types don't inherit to be reused, they inherit to reuse.
Consequently, change the inheritance to private, remove the
virtual ~QIBusSerializable and rewrite the streaming operators
as member functions.
Remove the now-unused QIBusSerializable streaming operators and
meta-type registration.
Change-Id: Icf7a89174592ba62b39f73f0f016c8296cab5993
Reviewed-by: Takao Fujiwara <takao.fujiwara1@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Factor out function to check on the pixel color that
outputs a verbose message on failure.
Change-Id: I2331fe45f35327d1ff8ae547a58d93a2e6fe9184
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Found by UBSan:
qmake/library/qmakeparser.cpp:278:33: runtime error: null pointer passed as argument 2, which is declared to never be null
Guard the call.
Change-Id: I99341ab439a511f366dae9344ddcc8727c33b9b6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
If Xft enabled font antialiasing, QFont::NoAntialias would have no
effect as it would be overridden.
Change-Id: I4dae264bc6674ae81f181cc9ce85851174d42544
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
The fact that we override the big endian MAKE_TAG macro
(from qfontengine_p.h) with a little endian version on Windows
caused some confusion and was a bug waiting to happen. This patch
renames it instead to avoid future confusion.
Change-Id: I6224a4bfbd80eafc849ecd82e7fe5f83ee1953af
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
The -android-ndk-host argument to configure existed in the shell
script, but not in the Windows version. When using a 64-bit NDK
but a 32-bit host compiler (which is what we bundle with our
SDK), we would not detect the correct NDK host, making it impossible
to build Qt with this combo.
[ChangeLog][Android] Added -android-ndk-host configure option on
Windows.
Change-Id: Ie6a92b66e6875ed53f46fe41ecced70c3ec67585
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Found by UBSan:
qmimemagicrule.cpp:166:53: runtime error: load of misaligned address 0x00000124bcb9 for type 'const short unsigned int', which requires 2 byte alignment
qmimemagicrule.cpp:166:53: runtime error: load of misaligned address 0x00000124bcb9 for type 'const unsigned int', which requires 4 byte alignment
Fix by using new qUnalignedLoad<T>() instead of a
load through a type-punned pointer and misaligned
pointer.
Change-Id: I6b876f1ce7e01369fbb25a51263d1ad04be07d52
Reviewed-by: David Faure <david.faure@kdab.com>
Found by UBSan:
qjsonparser.cpp:741:30: runtime error: store to misaligned address 0x0000019b1e94 for type 'quint64', which requires 8 byte alignment
Fix by using the qToLittleEndian() overload that can
store to misaligned memory.
Change-Id: Ib84bd30b13c68f7fdb8870c9fbbfac15cff0112d
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Signed integer overflows and underflows are undefined
behavior. A test that invokes UB tests nothing, because
the standard permits any outcome.
Fix by guarding the respective operations so
they are not executed if they would overflow
or underflow.
Change-Id: I40354ee88f40e4b47b70eac7790dc3a79ac70a57
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This is quite an unlikely scenario, but not impossible.
It could be that the wheel widget is destroyed during
an update phase event. In that case, wheel_widget would
be a dangling pointer for any subsequent wheel event.
We protect against this with a QPointer.
However, that would mean that if the next wheel event
were to be an end phase event, that event would be lost.
So we go through the usual code path, except that we won't
set wheel_widget in the case of an end phase event.
Change-Id: I59a912b845dcc249e1edc60b4dc28bf308d807d9
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
This warning is triggered when we try to apply the Q_DECL_HIDDEN
attribute to a class in an unnamed namespace. Such classes are
already not exported.
qobjectdefs.h:175:108: warning: ‘visibility’ attribute ignored [-Wattributes]
qobjectdefs.h:198:108: warning: ‘visibility’ attribute ignored [-Wattributes]
Added a test on gadgets (and QObjects) in unnamed namespaces,
because qtbase currently does not contain such Q_GADGETs.
Done-with: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: Ic747cc2ab45e4dc6bb70ffff1438c747b05c5672
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Some embedded servers use LF to mark the end of an individual header,
but use CRLF to mark the end of all the headers. The GoPro WiFi
interface does this, as an example.
Change-Id: I227ab73622c84f439a6cf8703d020393c4d8bf69
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
It now exists in QtGui.
Task-number: QTBUG-48849
Change-Id: I9107c96e0010252bc50bcb02ef006cb46bd942df
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Despite the very similar name and hardware, the software stack is
completely different compared to the Jetson TK1 Pro we already have
a mkspec for.
Change-Id: I45353ece195035e961ff47df55d6361569aabb04
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Previously, the macro Q_OS_WIN64 was checked, causing warnings:
tools\qstring.cpp(6183): warning C4311: 'reinterpret_cast': pointer truncation from 'void *' to 'unsigned long'
tools\qstring.cpp(6183): warning C4302: 'reinterpret_cast': truncation from 'void *' to 'unsigned long'
when compiling WinRT/64bit, where it is not defined.
Change-Id: Ib9d8405108c85170aba18b13f9c64083136bc5ee
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
As found by GCC 6:
tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:1476:9: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
tn += ">";
^~
tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:1474:5: note: ...this ‘if’ clause, but it is not
if (tn.endsWith('>'))
^~
Fix += argument from char[2] to char as a drive-by.
Change-Id: I814dc58830934cac7fcf81eb7fd7564b2abeb631
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
The code infers from the presence of an address in a
QHash<QGesture *, ...> that the address belongs to a
QGesture. So far that is fine enough.
But in order to perform the lookup, it static_cast<>s
the QObject* argument to a QGesture* for the QHash::
contains() call. Even though the pointer is not
dereferenced, the cast is UB. Says UBSan:
qgesturemanager.cpp:558:73: runtime error: downcast of address 0x2ab83364f3a0 which does not point to an object of type 'QGesture'
0x2ab83364f3a0: note: object is of type 'QDBusConnectionManager'
which is a particularly hideous error message because
of the constantly-changing completely-unrelated actual
type in the second line of the message:
52 QDBusConnectionManager
19 QSocketNotifier
14 QFusionStyle
13 QAction
6 QApplication
3 QGraphicsWidget
1 Window
1 TestRunnable
1 RectWidget
1 QTimer
1 QSingleShotTimer
1 QOffscreenSurface
1 QGraphicsProxyWidget
1 QDefaultAnimationDriver
1 QDBusPendingCallWatcherHelper
This error is also _very_ common, triggered 116 times
in a single run of make -C tests/auto check.
Fix by using qobject_cast first and then doing the
lookup only when the cast succeeded.
Depending on the performance of qobject_cast<>, this
may actually perform better, too.
Change-Id: I884ec7d885711acc3c1d004ce93c628268d8fc18
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Found by UBSan:
src/corelib/tools/qstring.cpp:587:42: runtime error: load of misaligned address 0x2acbf4b7551b for type 'const long long int', which requires 8 byte alignment
src/corelib/json/qjson_p.h:405:30: runtime error: store to misaligned address 0x0000019b1e52 for type 'quint64', which requires 8 byte alignment
src/corelib/tools/qhash.cpp:116:27: runtime error: load of misaligned address 0x2b8f9ce80e85 for type 'const qlonglong', which requires 8 byte alignment
src/corelib/tools/qhash.cpp:133:26: runtime error: load of misaligned address 0x2b8f9ce80e8d for type 'const ushort', which requires 2 byte alignment
Fix by memcpy()ing into a local variable. Wrap this trick in
template functions in qsimd_p.h. These are marked as always-
inline and use __builtin_memcpy() where available in an
attempt to avoid the memcpy() function call overhead in debug
builds.
While this looks prohibitively expensive, from the pov of the
C++ abstract machine, it is 100% equivalent, except for the
absence of undefined behavior. In one case, the cast produces
a local temporary which is then copied into the function, and
in the other case, that local variable comes from return value
of qUnalignedLoad().
Consequently, GCC compiles these two versions into identical
assembler code (only verfied for ucstrncmp, but there's no
reason to believe that it wouldn't hold for the other cases,
too).
Task-number: QTBUG-51651
Change-Id: Ia50d4a1d7580b6f803e0895c9f3d89c7da37840c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
... with STL-style iterators or with algorithms.
Java-style iterators have overhead.
Change-Id: Ibeace7357c205a39dff3ca3fc0c835a026a15cac
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
As reported by ubsan:
src/gui/kernel/qplatformintegration.cpp:463:10: runtime error: downcast of address 0x7ffdc2942490 which does not point to an object of type 'QGuiApplication'
0x7ffdc2942490: note: object is of type 'QCoreApplication'
src/gui/kernel/qplatformintegration.cpp:466:14: runtime error: downcast of address 0x7ffdc2942490 which does not point to an object of type 'QGuiApplication'
0x7ffdc2942490: note: object is of type 'QCoreApplication'
src/gui/kernel/qplatformintegration.cpp:466:43: runtime error: member call on address 0x7ffdc2942490 which does not point to an object of type 'QGuiApplication'
0x7ffdc2942490: note: object is of type 'QCoreApplication'
to name just a few which are reported when running gui and widget
auto-tests; there're definitely more where these came from.
This is caused by QCoreApplication::init() being called from the
QCoreApplication ctor, calling virtual functions on Q*AppPrivate,
which happen to attempt, in this case, to emit QGuiApp signals.
At that point in time, the QGuiApplication ctor has not entered
the constructor body, ergo the object is still a QCoreApplication,
and calling the signal, as a member function on the derived class,
invokes UB.
Fix by cleaning up the wild mix of initialization functions used in
this hierarchy. The cleanup restores the
1. Q*ApplicationPrivate::Q*ApplicationPrivate()
2. Q*ApplicationPrivate::init(), calling each base class'
init() as the first thing
two-stage construction pattern commonly used elsewhere in Qt to make
sure that the public class' object is fully constructed by the time
each level's Private::init() is called.
Change-Id: I290402b3232315d7ed687c97e740bfbdbd3ecd1a
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Found by UBSan:
src/gui/painting/qcosmeticstroker.cpp:150:55: runtime error: index -1 out of bounds for type 'QT_FT_Span_ [255]'
src/gui/painting/qcosmeticstroker.cpp:150:99: runtime error: index -1 out of bounds for type 'QT_FT_Span_ [255]'
src/gui/painting/qcosmeticstroker.cpp:151:55: runtime error: index -1 out of bounds for type 'QT_FT_Span_ [255]'
That code path makes no sense if no span has been populated
yet, so skip the whole block if current_span == 0.
Change-Id: I832b989e89c118dc48ab5add3a28bb44c1936a76
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
There is no test for c++ standard support for the host build
(only for the target compiler/build) which leads to trouble
in some cross compiling environments (old host compiler, new
cross compiler):
g++: error: unrecognized command line option ‘-std=c++1z’
So disable c++ standard compiler flags unconditionally for host builds.
Task-number: QTBUG-51644
Change-Id: Ifb3042e125fe199a7e081740d1171d26ccacf0c5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
To quote http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160222/151168.html :
> AArch64: fix Cyclone CPU features list.
> It turns out we don't have CRC after all. Who knew?
So clang did define __ARM_FEATURE_CRC32, while the CPU didn't support
the crc32 instructions, resulting in EXC_BAD_INSTRUCTION.
Change-Id: I4b0123ac5e7fd04696c05bfe7dacce205cffac8f
Task-number: QTBUG-51168
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
ARMv8 defines the crc32 instructions as optional features. Even though
the target might be ARMv8, the compiler might have been told that the
target CPU doesn't support it, in which case __ARM_FEATURE_CRC32 is not
defined. Subsequently, the arm_acle.h header might only define the
intrinsics when __ARM_FEATURE_CRC32 is defined.
Change-Id: I85efcf9efdd2e152e3f3e72310122eebf543ca3b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
tst_qkeyevent.cpp(140): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
Change-Id: Id3e0eea125f7f7ec13f9b9428e034b922d2ce204
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
The platform has been removed in Qt 5.7.
Task-number: QTBUG-51673
Change-Id: Id0b26e94bd8a673a35bfa5e02a5ba1c30891764a
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
An if with no side-effects in its test and an empty body is a no-op.
An else block with nothing but a no-op in it is a no-op.
A no-op without even pedagogic value is just a distraction.
Change-Id: I224831a325e6b770d0a99d726d96f73da4b8c11f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Three checks of the same #if managed to save repetition of (if I felt
charitable) three shared lines, compared to combining the three into
one, which leaves the code easier to read (and obviates the need for
one of the "shared" lines). Split a long line while moving it.
Change-Id: I762d10ae1df1224c749206b8eb490bafd7ea4900
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>