Commit Graph

27321 Commits

Author SHA1 Message Date
Mark Brand
c738e637b8 update bundled sqlite to 3.11.1.0
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>
2016-03-13 22:15:47 +00:00
Liang Qi
59a3ca679e Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7 2016-03-13 19:27:21 +00:00
Anton Kudryavtsev
447a508d00 QHostInfo: optimize container usage
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>
2016-03-13 17:00:44 +00:00
Anton Kudryavtsev
a3def2869d QtGui: de-duplicate calls and cache results
Change-Id: Iaf232c31d6780b49dc6a3d0faafb9717f3c36e65
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-13 17:00:31 +00:00
Volker Krause
434f2b8968 Don't quote newlines in multi-line shader linker errors.
Change-Id: I055758b73a9992786b6c4542396dc82fda1444b5
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2016-03-13 13:28:25 +00:00
Marc Mutz
e5ebf95bba QMimeTypeParser: plaster error paths with Q_UNLIKELY
... 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>
2016-03-13 07:02:14 +00:00
Marc Mutz
2379bcac32 QHttpNetworkConnection: fix spelling in qWarning()
Change-Id: I87dcdc1b81e90d4bac180731fd78d0fea38191b6
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
2016-03-12 17:29:46 +00:00
Marc Mutz
79c0cbf7a2 QOpenWFDDevice: fix BrE spelling and grammar in qDebug() output
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>
2016-03-12 17:29:41 +00:00
Marc Mutz
6417bbde85 QtBase (remainder): use printf-style qWarning/qDebug where possible (I)
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>
2016-03-12 17:29:36 +00:00
Olivier Goffart
8c0ae00dd6 Fix documentation of QFlags::setFlag
The function is not const

Change-Id: Ibe6f774058efd5ed5de021ff024d023b3cfc7e04
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
2016-03-11 20:18:01 +00:00
Liang Qi
50d0f57b77 Merge remote-tracking branch 'origin/5.6' into 5.7
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
2016-03-11 20:08:50 +01:00
Anton Kudryavtsev
df909d8b1f QItemSelectionModel: refactoring of internal functions
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>
2016-03-11 13:34:03 +00:00
Olivier Goffart
343e5d066a Optimized implementation of QReadWriteLock
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>
2016-03-11 13:32:13 +00:00
Marc Mutz
71548ba4a0 ibus: remove some unneeded member init'ing
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>
2016-03-11 10:56:35 +00:00
Marc Mutz
134cad32d7 QtCore: use printf-style qWarning/qDebug where possible (I)
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>
2016-03-11 10:56:15 +00:00
Marc Mutz
5bc54c878f QIBusEngineDesc: initialize all members when deserializing from older versions
De-duplicated code using, as suggested in
previous review, strategic gotos.

Change-Id: I4550dd8eff99789a41d8bb0b015bc4f51e3969fe
Reviewed-by: Takao Fujiwara <takao.fujiwara1@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-10 22:42:40 +00:00
Marc Mutz
adb377c89e ibus: mark some types as movable
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>
2016-03-10 22:42:34 +00:00
Marc Mutz
747b39db66 ibus: de-virtualize QIBusSerializable hierarchy
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>
2016-03-10 22:42:29 +00:00
Friedemann Kleint
45dc347a95 tst_QStaticText: Output verbose message for test failures.
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>
2016-03-10 12:37:47 +00:00
Marc Mutz
1fd0d57ce3 qmake: fix UB in QMakeParser::putHashStr()
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>
2016-03-10 12:30:46 +00:00
Oswald Buddenhagen
f3487308e4 fix file separators in target.targets INSTALLS
Task-number: QTBUG-51775
Change-Id: I8d9442bfd5084f1670b79dfdd422638bc62780aa
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-03-10 12:21:57 +00:00
Allan Sandfeld Jensen
5655d061b2 Xft antialias settings must not override requested NoAntialias
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>
2016-03-10 12:11:26 +00:00
Eskil Abrahamsen Blomfeldt
713282dfe4 Deobfuscate SFNT tag creation on Windows
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>
2016-03-10 11:58:53 +00:00
Eskil Abrahamsen Blomfeldt
437f5662d3 Allow overriding Android NDK host on Windows
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>
2016-03-10 11:57:39 +00:00
Marc Mutz
fb196e8807 QMimeMagicRule: fix UB (misaligned load) in matchNumber<T>()
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>
2016-03-10 10:57:53 +00:00
Friedemann Kleint
62e0a98282 Fix debug operators for QPageSize/QPageLayout.
Remove placeholder formatting and add noquote.

Change-Id: I4a89f88778caf007ce42bbf57edfb514fe76bcdb
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
2016-03-10 10:53:51 +00:00
Marc Mutz
807240a883 QJsonParser: fix UB (misaligned store) in Parser::parseNumber()
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>
2016-03-10 09:45:34 +00:00
Marc Mutz
f647375275 Fix signed integer overflows in tst_QAtomicInteger
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>
2016-03-10 07:17:55 +00:00
Gabriel de Dietrich
85a57f7a2e Wheel event widget: Harden logic an extra bit
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>
2016-03-09 23:46:50 +00:00
Marc Mutz
2020d2cb63 QObject: fix GCC 6 warning about qt_static_metacall's 'hidden' attribute use
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>
2016-03-09 20:11:28 +00:00
Dyami Caliri
f8f1bac3f0 Accept LFCRLF to mark end of HTTP Headers
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>
2016-03-09 15:47:18 +00:00
Shawn Rutledge
d7db6c6c19 xcb: mark mouse events from tablet devices as synthesized
Task-number: QTBUG-51617
Change-Id: Ic1d258c56165947ff821b1bf4d044bcf29b41a3b
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2016-03-09 14:42:30 +00:00
Friedemann Kleint
d29443c9c8 Manual touch test: Remove QDebug operator for QTouchDevice.
It now exists in QtGui.

Task-number: QTBUG-48849
Change-Id: I9107c96e0010252bc50bcb02ef006cb46bd942df
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-03-09 14:26:04 +00:00
Volker Krause
ce7fa976aa Add device mkspec for NVIDIA Jetson TK1 development boards.
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>
2016-03-09 13:53:34 +00:00
Jarek Kobus
cb24903ef4 Generate QVariant::fromValue(enum_value) for enum values
Instead of just QVariant(enum_value).

Task-number: QTBUG-49383
Change-Id: Id57c65b68d4328816046bc35301dc6afba47b727
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-03-09 13:51:39 +00:00
Friedemann Kleint
7d374b7ba6 QString::vasprintf(): Use quintptr when casting pointer for %p.
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>
2016-03-09 13:45:26 +00:00
Marc Mutz
62e89f4745 tst_QMetaType: fix misleading indention
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>
2016-03-09 13:18:26 +00:00
Marc Mutz
3856099d9a QGestureManager: fix UB in filterEvent()
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>
2016-03-09 13:18:19 +00:00
Marc Mutz
1bfc7f680f QString, QJson, QHash: Fix UBs involving unaligned loads
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>
2016-03-09 13:16:19 +00:00
Anton Kudryavtsev
9dcbffabbd CoreLib: replace Java-style iterators
... 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>
2016-03-09 09:57:28 +00:00
Marc Mutz
1b441c3941 Q*Application: fix UB caused by accessing QGuiApplication from QCoreApplication ctor
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>
2016-03-09 07:42:50 +00:00
Marc Mutz
fb7ef2b9f5 QCosmeticStroker: fix out-of-bounds access in drawPixel()
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>
2016-03-09 05:41:41 +00:00
Peter Seiderer
e69e695196 Disable c++ standard compiler flags for the host build
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>
2016-03-08 19:30:04 +00:00
Erik Verbruggen
27a2a02559 iOS: Disable usage of crc32 intrinsics.
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>
2016-03-08 17:55:14 +00:00
Erik Verbruggen
15ddb7f841 ARMv8: fix crc intrinsic usage.
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>
2016-03-08 17:55:13 +00:00
Friedemann Kleint
4ef990ce4a tst_QKeyEvent: Fix MSVC warning about 64bit shift.
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>
2016-03-08 14:57:14 +00:00
Friedemann Kleint
37cfcfb2b5 configure: Remove Windows CE.
The platform has been removed in Qt 5.7.

Task-number: QTBUG-51673
Change-Id: Id0b26e94bd8a673a35bfa5e02a5ba1c30891764a
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-03-08 14:41:14 +00:00
Edward Welbourne
2d276b3ada Use booleans as booleans; don't compare == true to do so !
Change-Id: Ic900bf000cec52b3ebf0fd0fc61f42252f3200e6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-03-08 13:37:27 +00:00
Edward Welbourne
5834f5a509 Purge a verbose no-op.
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>
2016-03-08 13:34:03 +00:00
Edward Welbourne
b366530f58 Simplified repeated #if-ery and entangled conditionals.
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>
2016-03-08 15:50:07 +00:00