summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7Liang Qi2016-03-1325-106/+163
|\
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-1125-106/+163
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * QMimeMagicRule: fix UB (misaligned load) in matchNumber<T>()Marc Mutz2016-03-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * QJsonParser: fix UB (misaligned store) in Parser::parseNumber()Marc Mutz2016-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * QObject: fix GCC 6 warning about qt_static_metacall's 'hidden' attribute useMarc Mutz2016-03-091-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * QString::vasprintf(): Use quintptr when casting pointer for %p.Friedemann Kleint2016-03-091-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * QString, QJson, QHash: Fix UBs involving unaligned loadsMarc Mutz2016-03-095-6/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * Q*Application: fix UB caused by accessing QGuiApplication from ↵Marc Mutz2016-03-093-26/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * Ensure QTextStream doesn't modify the Text flag on the underlying iodeviceLars Knoll2016-03-081-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An empty read or a failed write on the underlying QIODevice of the text stream would lead to an early return where we wouldn't correctly restore the QIODevice::Text flag of the io device. Change-Id: I5b632f45dea6ede3f408113556c3dad1b96574e2 Task-number: QTBUG-47176 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| | * Clean up WINVER, _WIN32_WINNT macros for MinGW.Friedemann Kleint2016-03-073-27/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Define WINVER, _WIN32_WINNT as 0x501 (Windows XP) in qt_windows.h. Remove definitions of the same/lower versions and unneeded definitions in other places. Remove definition for Borland compiler. Task-number: QTBUG-51673 Change-Id: I2a344a7f7cf78b2afbf45dcdf8bf2a19b93f0a07 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
| | * QtTest: fix UB in QSpontaneKeyEvent::setSpontaneous()Marc Mutz2016-03-071-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found by UBSan: src/testlib/qtestspontaneevent.h:95:38: runtime error: member call on address 0x7ffc33019650 which does not point to an object of type 'QSpontaneKeyEvent' 0x7ffc33019650: note: object is of type 'QMouseEvent' 83 2b 00 00 98 e8 fa 8e 83 2b 00 00 00 00 00 00 00 00 00 00 02 00 04 00 00 00 00 00 00 00 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QMouseEvent' src/testlib/qtestspontaneevent.h:95:38: runtime error: member call on address 0x7ffc330196e0 which does not point to an object of type 'QSpontaneKeyEvent' 0x7ffc330196e0: note: object is of type 'QKeyEvent' 00 00 00 00 f8 e8 fa 8e 83 2b 00 00 00 00 00 00 00 00 00 00 07 00 04 00 00 00 00 00 00 00 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QKeyEvent' Fix by providing setSpontaneous() on QEvent as a private function and befriending QSpontaneKeyEvent. Make setSpontaneous() always-inline to avoid BiC between 5.6.0 and 5.6.1. Change-Id: Ic60d82ed6a858f4f13f41fa3d2d1db6e808896b7 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
| | * QNX: Fix logging of QtDebugMsg in slog2 backendKai Koehne2016-03-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the introduction of QtInfoMsg in commit ef6279fd we also changed the mapping of Qt to slog2 levels: QtInfoMsg now ends up as SLOG2_DEBUG1, instead of SLOG2_INFO. Anyhow, we didn't change the default buffer verbosity level accordingly. Task-number: QTBUG-51378 Change-Id: Ia464f9e5a31e19413902e877d4f2be0ba6d340db Reviewed-by: Dan Cape <dcape@qnx.com> Reviewed-by: Janne Koskinen <janne.p.koskinen@theqtcompany.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
| | * consistently put {qt,qml}_{module,plugin} at the end of project filesOswald Buddenhagen2016-03-071-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | this fixes static builds by ensuring that all dependencies are exported. Task-number: QTBUG-51071 Change-Id: Icbce502dcbcb4d4b4d922c42679f44e2cc930bf3 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
| | * Revert "Don't add qmutex_xxx.cpp to SOURCES, as qmutex.cpp #include's them"Oswald Buddenhagen2016-03-071-19/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 40cbf1927bdd2fa9f531a047d1ba66f68c35d170 - the qmake parser bug this worked around has been fixed. As a side effect, the platform conditionals were simplified. Change-Id: Ibfc1253e3c2252ab954c725a9effd6e719cb691c Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
| | * Check if WINAPI_FAMILY_PC_APP is defined before using itOliver Wolff2016-03-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not all Windows compilers (e.g. MinGW 4.9.2) have WINAPI_FAMILY_PC_APP defined in their headers and report build failures in several Qt modules including QtActiveQt. This is fixed by defining the needed values before they are used. Task-number: QTBUG-49971 Change-Id: Ib7bac1fe07eb76c64d66fa152427918ee39a2eef Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
| | * Remove QT_MOC_COMPAT from deprecated QProcess::error signalKai Koehne2016-03-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QT_MOC_COMPAT has the unfortunate behavior that it generates a warning at runtime, which also cannot be disabled. This is too draconic. Task-number: QTBUG-51517 Change-Id: I80af8b8b482671e4c9567281c3b1c504d737e202 Reviewed-by: hjk <hjk@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
| | * QMimeBinaryProvider::loadMimeTypePrivate(): Make name check case insensitive.Friedemann Kleint2016-03-021-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RFC 2045 mandates case-insensitive comparison for MIME type and subtype. Fixes numerous warnings appearing when dumping the database on Ubuntu 14.04.1 LTS: Got name "application/vnd.ms-excel.sheet.binary.macroenabled.12" in file "application/vnd.ms-excel.sheet.binary.macroEnabled.12.xml" expected "application/vnd.ms-excel.sheet.binary.macroEnabled.12" Got name "application/vnd.ms-excel.sheet.macroenabled.12" in file "application/vnd.ms-excel.sheet.macroEnabled.12.xml" expected "application/vnd.ms-excel.sheet.macroEnabled.12" Got name "application/vnd.ms-excel.template.macroenabled.12" in file "application/vnd.ms-excel.template.macroEnabled.12.xml" expected "application/vnd.ms-excel.template.macroEnabled.12" Got name "application/vnd.ms-powerpoint.presentation.macroenabled.12" in file "application/vnd.ms-powerpoint.presentation.macroEnabled.12.xml" expected "application/vnd.ms-powerpoint.presentation.macroEnabled.12" Got name "application/vnd.ms-powerpoint.template.macroenabled.12" in file "application/vnd.ms-powerpoint.template.macroEnabled.12.xml" expected "application/vnd.ms-powerpoint.template.macroEnabled.12" Got name "application/vnd.ms-word.document.macroenabled.12" in file "application/vnd.ms-word.document.macroEnabled.12.xml" expected "application/vnd.ms-word.document.macroEnabled.12" Got name "application/vnd.ms-word.template.macroenabled.12" in file "application/vnd.ms-word.template.macroEnabled.12.xml" expected "application/vnd.ms-word.template.macroEnabled.12" Change-Id: Ie2a427069024080302a95ac46a456288787542c4 Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: David Faure <david.faure@kdab.com>
| | * Fixed reading REG_SZ without terminating \0 delivers garbageDavid Weisgerber2016-03-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When reading from the registry, sometimes the string is not null terminated. In order to fix this, the preallocated QByteArray size is increased, so that there are guaranteed enough terminating \0 [Windows] Not null terminated strings are now read properly from the registry Change-Id: I95fdf42cbbb7074fcf010dd14d0241f02d3c412b Task-number: QTBUG-51382 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
| | * Doc: Add the missing \l command and the target section titleVenugopal Shivashankar2016-03-011-1/+2
| | | | | | | | | | | | | | | | | | | | | Change-Id: I8478467a074ecff9834850c36961ae8e218cea02 Task-number: QTBUG-51290 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com> Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
| | * QJsonPrivate::q_littleendian: mark as primitive/movable, depending on TMarc Mutz2016-03-011-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inherit the type-classification from the underlying type. This amends commit 4889269ff0fb37130b332863e82dd7c19564116c, which introduced a QVector<QJsonPrivate::offset>, but failed to mark the payload as primitive. Change-Id: I525a0456a550e0694b33b36b4aa71475aeac192b Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
| | * Fix crash in QProcess::waitForFinished on WindowsJoerg Bornemann2016-02-291-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suppose the user connects QProcess::readyReadStandardOutput with a slot that calls QCoreApplication::processEvents. Assume the event loop did not handle events between QProcess::start and QProcess::waitForFinished. The process writes to stdout and exits. QProcessPrivate::waitForFinished calls drainOutputPipes which calls QWindowsPipeWriter::waitForReadyRead. This in turn will trigger _q_processDied via the readyRead signal and processEvents. _q_processDied will delete the pid object and set pid to null. After drainOutputPipes returns, _q_processDied is called again but it must not be called if pid is already destroyed. Prevent calling _q_processDied if pid is null. Task-number: QTBUG-48697 Change-Id: Iee047938ee1529057a1a43d71f4e882750903c7e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | | QMimeTypeParser: plaster error paths with Q_UNLIKELYMarc Mutz2016-03-132-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... 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>
* | | Fix documentation of QFlags::setFlagOlivier Goffart2016-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | | The function is not const Change-Id: Ibe6f774058efd5ed5de021ff024d023b3cfc7e04 Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* | | QItemSelectionModel: refactoring of internal functionsAnton Kudryavtsev2016-03-111-16/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Optimized implementation of QReadWriteLockOlivier Goffart2016-03-115-192/+401
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | QtCore: use printf-style qWarning/qDebug where possible (I)Marc Mutz2016-03-1115-37/+37
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | CoreLib: replace Java-style iteratorsAnton Kudryavtsev2016-03-092-9/+6
| | | | | | | | | | | | | | | | | | ... 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>
* | iOS: Disable usage of crc32 intrinsics.Erik Verbruggen2016-03-081-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: fix crc intrinsic usage.Erik Verbruggen2016-03-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Drop hand-rolled ASCII conversion from QAbstractConcatenable::convertFromAscii()Marc Mutz2016-03-041-15/+1
| | | | | | | | | | | | | | | | | | | | QUtf8::convertToUnicode() contains a SIMD-enabled ASCII fast-path already which is likely faster than what the compiler will emit for the old code here. Change-Id: I6afae9689424eb53a9f7c01359cc4f57ffcead26 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | iOS: rely on built-in compiler macros to check for CPU featuresErik Verbruggen2016-03-041-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | iOS cannot do runtime feature detection, and querying the CPU is only allowed in kernel mode (or beyond), so we have to decide the features at compile time, in which case we might as well use the fallback code path that uses the built in __ARM_* macros to point out which features are supported, instead of hard-coding the features for iOS. Change-Id: Ie507c0d8e962a7bdab16508c8b8122645276512e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* | QStringBuilder: don't allocate memory in convertFromAscii()Marc Mutz2016-03-033-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use new QUtf8::convertToUnicode(QChar*, const char*, int) overload instead of QString::fromUtf8(). The QUtf8 overload allocates no memory, and is therefore marked as nothrow. Using this function in convertFromAscii() allows to mark this function nothrow, too. All functions of QAbstractConcatenable can now be marked as nothrow. Since QUtf8::convertToUnicode() does not deal with lengths of -1, insert a strlen() call when the len == -1 ASCII fast path fails due to non-ASCII chars. Saves 1.1KiB in text size on optimized GCC 5.3 Linux AMD64 builds of QtCore (other libraries are compiled without exceptions, so this change should not have an effect on those). Change-Id: I7333e35844033831eae2a04203d13d9792c5d460 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Fix detectProcessorFeatures() fallback path on ARMTor Arne Vestbø2016-03-011-2/+2
| | | | | | | | | | | | | | Change-Id: Ifcad547caf2d2a7ad7aa1ccb4fbed08810905cee Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-293-2/+6
|\| | | | | | | | | | | | | Conflicts: tests/auto/corelib/io/qprocess/tst_qprocess.cpp Change-Id: Ib6955eb874b516b185b45d6c38cec646fbaa95f4
| * Track target widget when wheel events are receivedGabriel de Dietrich2016-02-292-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This issue is reproducible on OS X when using a Magic Mouse or a combination of Magic Trackpad and regular mouse. In these cases it's possible to start a scrolling gesture on one widget and move the mouse cursor over another widget. Although we send the wheel event phase information, we never made any use of it. This means that a widget would start scrolling even though it never received a ScrollBegin event. In this patch, we make sure the scrolling cycle is respected and that once a widget starts scrolling, it'll be recieving all the wheel events until a ScrollEnd event reaches the application. For those input devices not supporting a proper phase cycle, we introduce a new (undocumented) phase value, NoScrollPhase. If the wheel event phase is NoScrollPhase, then we ignore the current scroll widget and proceed as usual. This value is the default for wheel events. It's up to the platform plugin to set the proper phase value according to the data received from the OS. Finally, we fix a few of QWheelEvent constructors to properly initialize the phase and source properties. Task-number: QTBUG-50199 Change-Id: I3773729a9c757e2d2fcc5100dcd79f0ed26cb808 Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
| * Win: Prevent crash in qt_message_fatal()Kai Koehne2016-02-261-1/+2
| | | | | | | | | | | | | | | | | | The source argument can be nullptr, e.g. if debug information has been stripped out. Task-number: QTBUG-51195 Change-Id: Ie229c82278c420200cad33c19e8c3f52ab7f12c3 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QVector: preserve capacity in clear()Marc Mutz2016-02-295-10/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is what std::vector implementations usually do, because it minimizes memory fragmentation and useless allocations since no user will call clear() unless she intends to append new data afterwards. Fix calls to resize(0) that show how existing code tried to work around the issue. Adjust test. Port from QVERIFY(==) to QCOMPARE as a drive-by. [ChangeLog][QtCore][QVector] clear() now preserves capacity. To shed capacity, call squeeze() or swap with a default-constructed QVector object, see the documentation for an example. Change-Id: I9cebe611a97e027a89e821e64408a4741b31f1f6 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | ItemModels: replace QLatin1String with QStringLiteralAnton Kudryavtsev2016-02-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | ... wherever it allocates memory. Since the string literal is used in more than one function, to avoid duplication of .rodata, wrap the QStringLiteral in an inline function. Change-Id: If4fca7443b3150b1c8360c850da32f5c567c1065 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Add QResource to the bootstrap libraryErik Verbruggen2016-02-252-0/+3
| | | | | | | | | | | | | | | | | | It's very useful for bootstrapped tools to be able to include resources. Those can now be accessed through the QResource API. Change-Id: Ie8247877a9a4a81cec006bab2b58331270487aef Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | QtCore: replace QStringLiteral with QLatin1String when appendingMarc Mutz2016-02-255-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It makes little sense to use QStringLiteral for strings which are immediately appended to, or which are appended to other strings, because no dynamic memory allocation is saved by doing so. But if the only advantage of QStringLiteral does not apply, all its disadvantages dominate, to wit: injection of calls to qstring dtor, non-sharability of data between C strings and QStringLiterals and among QStringLiterals, and doubled storage requirements. Fix by replacing QStringLiteral with QLatin1String. Saves 1156B in text size on stripped optimized Linux AMD64 GCC 4.9 builds. Change-Id: If805e431f570ec1d2ac62c548f516f1b17390c3a Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Perfect (almost) Qt on Android splash screen.BogDan Vatra2016-02-242-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | There is no need to show the splash image immediately when the application starts, because it will be removed shortly in QtActivityDelegate.java, therefore show the splash in QtActivityDelegate.java. This patch also adds a new option to AndroidManifest.xml which keeps the splash screen visible until user to decides to hide it, by using the QtAndroid::hideSplashScreen() function. Change-Id: I8a29a5a757d626c4c9d6a2748a60ca3091ebf82d Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* | QMimeTypeParser: scope a variable betterMarc Mutz2016-02-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The variable being a QVector, this means replacing default construction followed by one move-assignment per loop iteration with a StartElement state with RVO-catching a return value. Saves ~320b in text size on optimized GCC 5.3 Linux AMD64 builds. Change-Id: I618d31ad0816f9ad1a89a6b2e39481258f1e0878 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QMimeTypeParser: don't use the heap to create QMimeMagicRulesMarc Mutz2016-02-241-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function createMagicMatchRule() returned a heap-allocated QMimeMagicRule, and the caller code did not check the return value for nullptr, but copied the rule into a container before deleting the original again. Fix by returning by-value instead. Every C++ compiler will use RVO for this. On top, add an optimistic std::move() when inserting the rule into the container (currently QList, so no rvalue-push_back, yet). While touching the return value, also remove an unholy out-parameter with just local effects by returning a Result struct instead. The rest of the code remains full of out- parameters, of course. Add one Q_UNLIKELY and two qUtf16Printable() as drive-bys. Saves ~300b in text size on optimized GCC 5.3 Linux AMD64 builds. Change-Id: I4374ab41f38502cd5c64ac37d106ca4bc6e00327 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QMimeTypeParser: use QStringBuilder moreMarc Mutz2016-02-242-11/+7
| | | | | | | | | | | | | | | | | | | | | | Replace QString::arg() with QStringBuilder, use QStringLiteral where appropriate, and remove it where it isn't (e.g. in QStringBuilder expressions). Saves ~750b in text size on optimized GCC 5.3 Linux AMD64 builds. Change-Id: I2471c849db79f477677213f9a155053248800590 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QMimeTypeParser: use QStringRef moreMarc Mutz2016-02-243-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keep the return values of QXmlStream*::value() around as QStringRefs for as long as possible. Avoids conversions to QString, among other things, for: - comparison to another string - conversion to int - conversion to UTF-8 or Latin-1 byte arrays Add a pair of Q_UNLIKELY as a drive-by. Saves ~900b in text size on optimized GCC 5.3 Linux AMD64 builds. Change-Id: I17d440a11aeb8675979483f89e66d0a088ccc605 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7Liang Qi2016-02-242-13/+14
|\ \
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-242-13/+14
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java src/plugins/platforms/windows/qwindowsfontengine.cpp src/plugins/platforms/windows/qwindowsnativeimage.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I649b32b260ce0ed2d6a5089021daa0d6a8db85f7
| | * Make public headers compile with -Wzero-as-null-pointer-constantMarc Mutz2016-02-191-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... or similar. This amends previous commits that converted the majority of cases. Task-number: QTBUG-45291 Change-Id: I219cdeddca7063a56efeb4fee0e5bb2cbdc7732b Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| | * doc: Clean up old references to QApplication for GUI applicationEskil Abrahamsen Blomfeldt2016-02-191-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Qt 5.0, there's been a separation between QGuiApplication for generic GUI applications, and QApplication for applications using Qt Widgets. The docs in QCoreApplication has not reflected this, however, and was still recommending QApplication for any GUI app. Change-Id: I7b2b166170d1e20755889767cda3d555fbbc666a Reviewed-by: Martin Smith <martin.smith@theqtcompany.com> Reviewed-by: Nico Vertriest <nico.vertriest@theqtcompany.com>
* | | QRingBuffer::read(): remove unneeded byte array allocationAlex Trotsenko2016-02-241-1/+0
|/ / | | | | | | | | | | | | QRingBuffer already works fine with empty list of arrays. Change-Id: I5cd388709686d2980efa3d5129c726e75c0b5c09 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>