summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* QDateTimePrivate: replace out parameters with return-by-value in getDateTime()Marc Mutz2015-03-252-35/+35
| | | | | | | | | | | | Compilers don't like out parameters. Effects on Linux GCC 4.9 stripped release builds: text -584B data +-0B relocs +-0 Change-Id: Ie00c89b9edaced3a6adeb2707734c8f5238e67c1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDateTime: prevent aggressive inliningMarc Mutz2015-03-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function getDateFromJulianDay() is simple arithmetic, but still ~400 bytes in executable size. Yet GCC inlines this everywhere I looked, which makes some sense, as different users of the class only use parts of the return value and the optimizer has a field day removing all that dead code. However, that function has only one conditional, so presumably it executes at full pipeline speed and it doesn't matter that it calculates too much in some cases. More important is to use the I-cache more conservatively. That's what not inlining the function achieves. The function returns its result in registers and doesn't spill registers when called (at least on AMD64), so the effect on runtime should be negligible. Effects on Linux GCC 4.9 stripped release builds: text -1536B data +-0B relocs +-0 Change-Id: Ia16838102d29ad67ee5efdc8b7b0a26f2f921df1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTime: optimize toString()Marc Mutz2015-03-251-3/+1
| | | | | | | | | | | | | Instead of using a QString::arg() cascade, which creates tons of temporaries, use good 'ol sprintf(). Effects on Linux GCC 4.9 stripped release builds: text -308B data +-0B relocs +-0 Change-Id: I348577491d1399b5040f7ed9e9f6b111a9528e5d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Micro-optimize QDate::{long,short}{Day,Month}Name()Marc Mutz2015-03-251-32/+28
| | | | | | | | | Save one return statement per function. I don't see why the compiler can't fuse these itself, but apparently it cannot, since this transformation saves 72B in text size. Change-Id: I3a661456554bf451ed53110ad546946ff7b84ec5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDate: don't spend code size covering the impossible caseMarc Mutz2015-03-251-1/+1
| | | | | | | | | | | | All other similar functions in QDate just return an empty string in case none of the switch labels would trigger (which would now cause a compiler warning, after removing the default case label), so do that here, too. Saves 44B in text size. Change-Id: I80ee4975082706adcd15fe89511d08c67e149324 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDate: remove some useless default case labelsMarc Mutz2015-03-251-8/+0
| | | | | | | | | | | | They're pure whitespace, since in each case there is a fallback after the switch, anyway, and their presence prevents compiler warnings about unhandled enumeration values in switch statements, which is nice-to-have, when adding to the enum, eventually. No change in executable code size. Change-Id: I77aecaeff990601f957ec9ee827eff5ead25aaa1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVarLengthArray: Do not require operator!= for element comparisonKai Koehne2015-03-231-5/+4
| | | | | | | | | | The documentation claims that operator== is needed, not operator!=. While at it, we can also replace the loop with std::equal, which might even allow STL implementations to choose a hand-optimized version of the algorithm for C++ builtin types ... Change-Id: I988b326d6af3b767526952e303468e18ff6594f9 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QVarLengthArray: Add initializer_list constructorKai Koehne2015-03-232-0/+22
| | | | | | | | | | | | | | | | | Implement an initializer_list constructor, which was probably just forgotten so far. Technically this is a SC incompatible change, since QVarLengthArray<int> array = {10}; will now create an array with one element 10, instead of an empty array with a reserved size of 10. Anyhow, keeping the inconsistency with the STL / other Qt containers here would certainly do more harm than good in the long run. Task-number: QTBUG-45047 Change-Id: I4675880f93e141181250939942fa32300916b0e3 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Report a correct Unicode version used by QtKonstantin Ritt2015-03-232-3/+3
| | | | | | | The version bump was forgotten in edfce46a6c0406af749ca7ef659df6315e36cd5d Change-Id: I99501bb314baab68f037417db4b3b14e11f2de02 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Build bundled PCRE copy as qt_helper_libKonstantin Ritt2015-03-201-6/+2
| | | | | | | We already have an infrastructure for that. Change-Id: I9110b74dcf7f93362586687da6f112e72cb663a4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Introduce icu_dependency.priKonstantin Ritt2015-03-201-13/+2
| | | | | | | Simply to hide the magic bahind the scenes. Change-Id: I69a159eb14712e68117f10e78745bdfbad46b6f2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Sort the entries in QDir by using the QDateTime::msecsTo()Andy Shaw2015-03-201-1/+1
| | | | | | | | | By using the QDateTime::msecsTo to do the sorting it means that if there is support for a precise time on the file system then this ensures it sorts correctly. Change-Id: I00528596908bba7b586aeffe5b0aa81019ff5722 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Fix QVector constructor documentationKai Koehne2015-03-191-1/+1
| | | | | Change-Id: Ib16df599553e482e981573afadf3c3f4e70ed5b1 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
* Make sure remove() doesn't corrupt the json objectLars Knoll2015-03-181-1/+1
| | | | | | | | | When using non latin keys, remove() could cause corruption of the json object. Task-number: QTBUG-42270 Change-Id: I7305e57ebb78630a9bf68bc4f831a6d1646abb79 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix support for iso8859-16 when compiling with ICULars Knoll2015-03-182-2/+5
| | | | | | | | | ICU doesn't support iso8859-16, so we need to fall back to the Qt codec for this encoding. Task-number: QTBUG-45053 Change-Id: I9754cf098c906fe8a75363a3d090029543cd0e35 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix QCollator::compare documentationLars Knoll2015-03-182-8/+8
| | | | | | | | | We don't guarantee -1, 0 and 1, but simply negative 0 or positive numbers. This is in line with e.g. QString::compare() Task-number: QTBUG-42860 Change-Id: I6009b2eb732ae3b4726cec06ec0eacc2c46a3c93 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QJsonValueRef::toVariant()Lars Knoll2015-03-182-0/+6
| | | | | | | | to better mirror the API of QJsonValue Task-number: QTBUG-43686 Change-Id: I83edecf5226d44980a8a442a512a13ab9b2ac6a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix source incompatibility while connecting signals with forward declared ↵Olivier Goffart2015-03-181-4/+4
| | | | | | | | | | | | | | | | | | | arguments QObject::connect tries to determine if the arguments are registered metatypes. This used to work even for arguments that were forward declared. But now, the metatype system tries to call QtPrivate::IsQEnumHelper<T>::Value to know if it is registered. That fails on gcc if T is forward declared. Apparently gcc needs to know the full type of T to pass it in the ellipsis function, even within a sizeof expression. So change the ellipsis expression to a template one. Task-number: QTBUG-44496 Change-Id: I7fa07bd3cde470b134c2ec53b0d581333d16a6f1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDebug operator for Q_FLAG when the QFlags itself is registeredOlivier Goffart2015-03-181-2/+8
| | | | | | | | | | | | Currently, IsQEnumHelper<T> returns true also if QFlags<T> is registered as a Q_FLAG. But this is going to be changed in the next commit. For the QDebug operator to continue to work even when the QFlags<T> is registered and not the T, we need to take it into account in the QEnableIf condition Change-Id: If1fcffd133aa20ba95a07e2bfaaa308896ab01b0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Windows: Don't cause a malloc before calling GetLastError()Andy Shaw2015-03-166-11/+11
| | | | | | | | | | When creating a string it would cause a malloc which would reset GetLastError() so we need to ensure that GetLastError() is the first thing it calls if a Windows API call fails. Task-number: QTBUG-27765 Change-Id: I5cc4ce59aa1f03a0ec978fe54949a7931a225d52 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QLockFile: use QCoreApplication::applicationName.David Faure2015-03-162-2/+2
| | | | | | | | | | | Unlike qAppName, it doesn't require a QCoreApplication instance, making QLockFile usable in destructors of global statics. This also uses the value passed to setApplicationName if called rather than always argv[0]. Change-Id: I40446aba410db42d7cfe6b4408878faf435246f7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix build of forkfd_qt.cpp on FreeBSDAlex Richardson2015-03-151-1/+1
| | | | | | | | | | | | | | | | | | | It no longer compiled after 614f37c8b559a722538c58dd1f65229cfca7d35b due to the following: - forkfd_qt.cpp set _XOPEN_SOURCE to 500 - It then includes qatomic.h which include sys/cdefs.h (the FreeBSD header that parses and sets _POSIX_C_SOURCE, _XOPEN_SOURCE and other macros) - sys/cdefs.h redefines _POSIX_C_SOURCE to 199506 due to _XOPEN_SOURCE's value - Several libc symbols expected to exist by libc++ are hidden due to _POSIX_C_SOURCE's value and the build fails Setting _XOPEN_SOURCE to 700 ensures that _POSIX_C_SOURCE is set to 200809 which is required for libc++ to work correctly Task-number: QTBUG-45006 Change-Id: Iac93220d19ca5ab9ba8ac61a79748252283c3c47 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: Don't force unrolling of the tail loop if optimizing for sizeThiago Macieira2015-03-151-7/+7
| | | | | | | | | | | | | This is quite good if space isn't a constraint: the unrolling ensures faster execution and limits the number of iterations. But it's long. Both Clang and GCC set the predefined macro __OPTIMIZE_SIZE__ if -Os is in effect. ICC does not; MSVC is untested but there are no macros for this effect listed in its documentation. Change-Id: I1a800c709d3543699131ffff13c48919a9a79ec3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* forkfd: make only one of forkfd or spawnfd be compiledThiago Macieira2015-03-141-0/+7
| | | | | | | We only ever use one, never both. Change-Id: Iee8cbc07c4434ce9b560ffff13caf94c05dba338 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* QVariant: Fix wrong return type in toPersistentModelIndex()Gabriel de Dietrich2015-03-122-2/+2
| | | | | | Change-Id: I53afa712d38ec6a41fce77474acccf9c587ea6a8 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Fix quadratic behavior when parsing very large objectsLars Knoll2015-03-121-2/+4
| | | | | | | | | | QVarlengthArray is not a good data structure when you need to dynamically append to it without knowing its size in advance, as it reallocates on every append. Use a QVector instead. Task-number: QTBUG-44737 Change-Id: I68eab11eacd8368e94943511874aead823a149ab Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add missing \since tag for the documentation for loopLevel()Andy Shaw2015-03-121-0/+1
| | | | | Change-Id: Ib5e23c40d9258db7986ddb892def207808ac89c7 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Track modifications of white space in QString::simplified().Friedemann Kleint2015-03-121-4/+6
| | | | | | | | | | The existing check fails to detect the case where white space characters other than the space character are replaced by space characters without the length actually changing and returns the original string. Task-number: QTBUG-44936 Change-Id: Ice6faa975f8b41f185c76f6d0d4ff81603e25eb3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make Q_ASSERT_X also check its argument for validityThiago Macieira2015-03-122-2/+1
| | | | | | | | | | | | Commit ebef2ad1360c80ad62de5f4a1c4e7e4051725c1c did it for Q_ASSERT, but I somehow forgot to do it for Q_ASSERT_X. Do it now. This includes the fix from 9a3d7adaad367417aaa2e1ee1f996185a881a4b5 to silence a Clang warning. Change-Id: Iee8cbc07c4434ce9b560ffff13ca066a5b5ab5d4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Doc: Json classes added to list of implic.shared classesNico Vertriest2015-03-115-0/+5
| | | | | | Task-number: QTBUG-44053 Change-Id: I52a1b6c413aaa594bfee9bf7484c3d0ce7e9c9fa Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Clarify limitations of QCoreApplication::libraryPaths()Ulf Hermann2015-03-111-5/+16
| | | | | | | | | If you call libraryPaths() before constructing a QCoreApplication, intersting things may happen. Task-number: QTBUG-38598 Change-Id: I2861746277e391ede9e921e4a8ad825007e25fa0 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Clean up QLibraryInfoPrivate::findConfiguration()Ulf Hermann2015-03-111-22/+22
| | | | | | | | | | | | | | The QFile::exists() check in the end was redundant if one of the !QFile::exists() had returned false before. By always doing the positive check we can get rid of it and also avoid excessive nesting. Also, on OSX the isEmpty() clause probably never evaluated to true, with the effect that qt.conf in an applicationDirPath was never found. Change-Id: I750735741b707d3e98c4bf6c6b9558618e1fcc59 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Doc: corrected snippet issue in Defining Plugins docNico Vertriest2015-03-112-2/+3
| | | | | | Task-number: QTBUG-44629 Change-Id: I70e20209b6b33f7adcbcafc6b7d959660cdc2e87 Reviewed-by: Martin Smith <martin.smith@digia.com>
* Doc: QDataStream Serializing doc errorNico Vertriest2015-03-111-2/+12
| | | | | | Task-number: QTBUG-44707 Change-Id: I0ccfb47fe0b2464c5b7331040ea658ace3442366 Reviewed-by: Martin Smith <martin.smith@digia.com>
* CMake: Fix regression with quoted OPTIONS parameterAndré Klitzing2015-03-111-1/+1
| | | | | | | If a parameter contains quotes the check for "-binary" fails. Change-Id: I27148b590d85291a93f1992dfd277fb857bec6e2 Reviewed-by: Stephen Kelly <steveire@gmail.com>
* QDateTime: ensure we always use the daylight status if knownThiago Macieira2015-03-111-19/+28
| | | | | | | | | Refactor the code so that the localMSecsToEpochMSecs function always gets the daylight status as input. The calculation can be very wrong if we forget to set it. Change-Id: I39e2a3fa6dc7c4a417f23288f10b303e450b8b98 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
* Fix regression in time zone handlingFrederik Gladhorn2015-03-111-0/+1
| | | | | | | | | | | | In QtScript we use the msecs since epoch conversion (JS date is based on the concept). After a8c74ddcf78604c9038ba2a2bea81e445e4b3c58 the date conversion test in qtscript started to fail. Instead of relying on the code working by chance, simply update the date when setting it with setMSecsSinceEpoch. Task-number: QTBUG-44885 Change-Id: I9f95c9cdccea52e7d1f808f3cb9e18570ef0df13 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Simplify calculation of week numberLars Knoll2015-03-101-50/+17
| | | | | | | This also removes a dependency to 3rd party licensed code. Change-Id: Ia4818a5cf306501bdb7192265edc4bcba8e597d8 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Detect qt.conf in bundle on OSX without QCoreApplicationUlf Hermann2015-03-101-2/+4
| | | | | | | | | | On OSX we don't need the applicationDirPath to find a qt.conf located in the application bundle. Let's take advantage of this and allow findConfiguration to use it. Task-number: QTBUG-24541 Change-Id: I38c349a3bcd140fcf91352c88c24ca662e6e6f2e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Reload QLibraryInfo's settings when QCoreApplication becomes availableUlf Hermann2015-03-101-2/+21
| | | | | | | | | | | | Some of the paths may only be resolvable if the application path is known. On some platforms we can only figure out the application path if argv[0] is known. Thus, if the paths have been queried before the QCoreApplication is created, the cached settings may be wrong. We have to reload them after creating the QCoreApplication. Task-number: QTBUG-38598 Change-Id: Idf5822be87aa0872b099480040acd7b49939a22c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* QIODevice: Fix some 64-bit issuesAlex Trotsenko2015-03-101-38/+38
| | | | | Change-Id: I77354a3069b256135c5792975a1445bcbe816e20 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* (Re)introduce loopLevel into QThreadAndy Shaw2015-03-092-0/+14
| | | | | | | | | | | This function used to reside in QEventLoop in Qt 3 and was deprecated in Qt 4. However this is useful for those who want to know how many event loops are running within the thread so we just make it possible to get at the already available variable. Change-Id: Ia6a7d94ff443a1d1577633363694bc2fa8eca7e4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Doc: corrected doc QString::operator[]Nico Vertriest2015-03-091-2/+2
| | | | | | | Task-number: QTBUG-43337 Change-Id: I379dfe3f6909de5a63a67261834ea0edff875f9d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Martin Smith <martin.smith@digia.com>
* QStringAlgorithms::simplified_helper: add missing check for detachedThiago Macieira2015-03-071-1/+1
| | | | | | | | Otherwise, we modify shared strings that happened to be rvalues. Task-number: QTBUG-44706 Change-Id: Ia0aac2f09e9245339951ffff13c85bfc912f03d1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Fix race condition in QDateTime::timeZone() and other methodsThiago Macieira2015-03-073-35/+36
| | | | | | | | | | | | | | | | | | | | When timezone support for QDateTime was added, we decided it was a good idea to delay creating the QTimeZone object and checking that the time is valid in that timezone (including for local time) until the user requested that information. Unfortunately, QExplicitlySharedDataPointer returns a non-const T* in operator->(), which meant we were accidentally modifying the d pointer's contents in const methods, which in turn means those const methods were not thread-safe when operating on the same object. This commit changes the d pointer to QSharedDataPointer, which is safer in this regard and pointed out where the issues with constness were located. Since we can't lazily calculate QTimeZone anymore, we need to do it whenever the date, time or offset changes. Task-number: QTBUG-43703 Change-Id: Ic5d393bfd36e48a193fcffff13b9686ef4ef1454 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Silence bogus MSVC warning about variable not usedThiago Macieira2015-03-071-0/+1
| | | | | | | | | | | | The compiler is wrong: the variable was used in the previous line. However, the line had no effect for a type T that has a trivial destructor, so the optimizer must have discarded the line and the reference to the variable before the checker for used variables. qsharedpointer_impl.h(247) : warning C4189: 'that' : local variable is initialized but not referenced Change-Id: Ia0aac2f09e9245339951ffff13c8bde02bb46816 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* iOS: Define QT_NO_PROCESS, as the platform doesn't allow fork/execTor Arne Vestbø2015-03-061-0/+4
| | | | | | Change-Id: I0928c4aaa0c308ee86b9611beeba3937b61e226c Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* Make QPersistentModelIndex an internal meta-typeGabriel de Dietrich2015-03-066-6/+59
| | | | | | | | | | | It was already a user meta-type, so it only gets promoted to internal. [ChangeLog][QtCore] QPersistentModel index becomes an built-in meta-type, including QVariant support. Change-Id: I63d733d1eb66aa61691e7afce27fe7372a83ac00 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Fix -Wunreachable-code warning from clang in preprocessed Q_ASSERTThiago Macieira2015-03-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Q_ASSERT expands to: do {} while (false && (<your condition>)) Which is fine for Clang as long as it's a macro. However, when you compile as a preprocessed source, the macro is gone and Clang prints the warning: warning: code will never be executed [-Wunreachable-code] do {} while (false && (f())); ^ note: silence by adding parentheses to mark code as explicitly dead So add the parentheses that it's asking about. The changelog refers to the full Q_ASSERT change from ebef2ad1360c80ad62de5f4a1c4e7e4051725c1c. [ChangeLog][Important Behavior Changes] Q_ASSERT will now expand the condition even in release mode when asserts are disabled, albeit in an unreachable code path. This solves compiler warnings about variables and functions that were unused in release mode because they were only used in assertions. Unfortunately, codebases that hid those functions and variables via #ifndef will need to remove the conditionals to compile with Qt 5.5. Change-Id: Ia0aac2f09e9245339951ffff13c8aa70229254d0 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Make QCoreApplication::applicationName available after app destruction.David Faure2015-03-051-8/+14
| | | | | | | | | | | | | | | | Calling applicationName() in the destructor of a global static (e.g. via QLockFile) was working when calling setApplicationName explicitly but otherwise it would suddenly return an empty string. This led to inconsistencies, the application name switching from non-empty to empty at saving-on-destruction time. There was already a global static, used when setting the app name explicitly before construction. Use it now to store the app name in all cases (explicitly set, or fallback). Change-Id: I71d3a0c40158f8bfd022c385b198346a2594b1cb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>