Commit Graph

7378 Commits

Author SHA1 Message Date
Ulf Hermann
d6330a19b2 Use QT_CONFIG(library) instead of QT_NO_LIBRARY
For the windows file system engine, we add an extra macro to use
library loading if configured to do so, but avoid it on WinRT, as
none of the symbols would be found.

We also QT_REQUIRE_CONFIG(library) in the library headers and
exclude the sources from the build if library loading is disabled.
This, in turn, makes it necessary to clean up some header inclusions.

Change-Id: I2b152cb5b47a2658996b6f4702b038536a5704ec
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-03-06 11:27:20 +00:00
Edward Welbourne
a1c27748d2 Make QLocale consistent about special handling of the C locale
QLocale::matchingLocales() simply created each locale using the basic
data, without (unless the matching conditions stipulated Language C)
applying number-options hacks that it applies everywhere else, when
creating the C locale.  Thus the C locale in its returned list (if it
wasn't the only entry) ended up with the default number options,
without omiting separators in numbers.  Thus QLocale::c() didn't
actually appear as an entry in the list.  Discovered while
investigating QTBUG-58947.

Added a dumb autotest that checks various ways of getting the C locale
do actually give us equal locale objects.  Fixed matchingLocales() to
apply the same hack as is used elsewhere for the C locale.

Change-Id: I263f31da623052b63171f5b5a83c65802383df21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-06 09:51:49 +00:00
Thiago Macieira
3a2f4bde14 QStaticByteArrayMatcher: enforce alignment
The data is 256 bytes, so might as well align it on a 16-byte boundary
to facilitate copying (if that happens). We should consider similar for
QByteArrayMatcher in 6.0.

Change-Id: I74966ed02f674a7295f8fffd14a8c64526d734bb
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-06 09:42:45 +00:00
Thiago Macieira
03b3f7a3af Make new QtCore code conform to the coding style
Change-Id: I74966ed02f674a7295f8fffd14a8c6389da538c1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-06 09:42:23 +00:00
Kai Koehne
4460b9c843 Replace outdated BSD license text
For examples and documentation, use new BSD license text that
includes the commercial licenses.

Change-Id: I1cd74bd8e9c8f2746d8702df00780ee100cbebac
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2017-03-03 07:26:11 +00:00
Stig Bjørlykke
62e6aa6195 QVector: Avoid implicit conversion warnings
This fixes compiling an application using QVector and -Wshorten-64-to-32
on a 64-bit system without getting this warning:

 ... 5.8/clang_64/lib/QtCore.framework/Headers/qvector.h:695:18:
 warning: implicit conversion loses integer precision: 'typename
 iterator_traits<QString *>::difference_type' (aka 'long') to 'int'
 [-Wshorten-64-to-32]
    int offset = std::distance(d->begin(), before);
        ~~~~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 ... 5.8/clang_64/lib/QtCore.framework/Headers/qvector.h:731:35:
 warning: implicit conversion loses integer precision: 'long' to
 'const int' [-Wshorten-64-to-32]
    const int itemsToErase = aend - abegin;
              ~~~~~~~~~~~~   ~~~~~^~~~~~~~

 ... 5.8/clang_64/lib/QtCore.framework/Headers/qvector.h:740:39:
 warning: implicit conversion loses integer precision: 'long' to
 'const int' [-Wshorten-64-to-32]
    const int itemsUntouched = abegin - d->begin();
              ~~~~~~~~~~~~~~   ~~~~~~~^~~~~~~~~~~~

Change-Id: I52d85908f4aac20c7e9ac8063ac760ce52f85541
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-02 20:03:03 +00:00
Giuseppe D'Angelo
8cd99d24a8 QRegularExpression: build fix
Latest PCRE2 versions require a macro to be defined before
including pcre2.h, so do it.

Task-number: QTBUG-59226
Change-Id: I472ff557e29d1212fdcd99454778551323be4d4b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-03-02 16:25:17 +00:00
Olivier Goffart
b41492d53e Doc: Remove references to pre-C++11 recommendations
Compiler support for lambda functions and variadic templates is
required since Qt 5.7, so no need to mention in the documentation
what happens if the compiler doesn't support it.

Change-Id: I5caeaa0bd7f0edce81e22e22964e0b7dd042c719
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-03-01 19:30:10 +00:00
Kai Koehne
a62d8ab993 Doc: Use canonical contact URL in license header
Change-Id: I34821150f66255df30d12572b27779e0e729ebc8
Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch>
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-28 15:33:49 +00:00
Allan Sandfeld Jensen
6dc7e468df Do not include qfloat16 tables in arm64 builds
The FP16 extension in IEEE mode is mandatory for Aarch64, so there is
no aarch64 configuration where the tables will be needed for conversion.

Change-Id: I9804e55c193cc9b5adcaedb720d8b980624139cc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Glen Mabey <Glen.Mabey@swri.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-28 12:01:18 +00:00
Thiago Macieira
04b8db3d57 Fix parsing of day-of-week names that start with another name
Task-number: QTBUG-59159
Change-Id: I95c9e502ccc74af3bcf0fffd14a69e0cd27ce96b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-28 10:40:40 +00:00
Stig Bjørlykke
2ae8292d03 QList: Avoid implicit conversion warning
This fixes compiling an application using QList and -Wshorten-64-to-32
on a 64-bit system without getting this warning:

 ... 5.8/clang_64/lib/QtCore.framework/Headers/qlist.h:897:26:
 warning: implicit conversion loses integer precision: 'long' to 'int'
 [-Wshorten-64-to-32]
           int removedCount = e - n;
               ~~~~~~~~~~~~   ~~^~~

Change-Id: I688ed086805c431821c2ee6078fa5aeb631e7a07
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-02-28 09:57:03 +00:00
Stig Bjørlykke
17d780ad45 QTimer: Avoid implicit conversion warnings
This fixes compiling an application using QTimer and -Wshorten-64-to-32
on a 64-bit system without getting this warning:

 ... 5.8/clang_64/lib/QtCore.framework/Headers/qtimer.h:171:21:
 warning: implicit conversion loses integer precision: 'rep'
 (aka 'long long') to 'int' [-Wshorten-64-to-32]
         setInterval(value.count());
         ~~~~~~~~~~~ ^~~~~~~~~~~~~

Change-Id: I3e0407a7193c841308f7271c41a8dd5a2eb2a534
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-02-28 09:56:13 +00:00
Nico Vertriest
657bea873b Doc: added info about return type for function QMutex::try_lock()
qmutex.cpp:266: warning: Undocumented return value

Change-Id: Ib93a5a2505f663f266871dbe5582fb5856096889
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-02-28 09:34:05 +00:00
Ulf Hermann
44af54419e Properly use the "process" feature
Replace all QT_NO_PROCESS with QT_CONFIG(process), define it in
qconfig-bootstrapped.h, add QT_REQUIRE_CONFIG(process) to the qprocess
headers, exclude the sources from compilation when switched off, guard
header inclusions in places where compilation without QProcess seems
supported, drop some unused includes, and fix some tests that were
apparently designed to work with QT_NO_PROCESS but failed to.

Change-Id: Ieceea2504dea6fdf43b81c7c6b65c547b01b9714
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-02-27 15:44:46 +00:00
Giuseppe D'Angelo
9d82b1586d QEasingCurve: mark as shared
Requires no further changes.

Change-Id: Ib280fa69a752aefa1c29fc5f0eb292e99b96270a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-02-27 15:35:59 +00:00
Oswald Buddenhagen
85b30fda7c fix detection of static icu under unix
the library has a dependency on libdl.

Task-number: QTBUG-58301
Change-Id: I36567ded32980b241ff2f01cfdec044510405a75
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-02-27 12:20:50 +00:00
Oswald Buddenhagen
0d7ed8f5f3 streamline libdl detection and linking
instead of having a library and a test, use a library with two sources,
the first being empty (i.e., just libc). this allows us doing away with
the "libdl" feature, and using just the "dlopen" one.

subsequently, replace all LIBS+=$$QMAKE_LIBS_DYNLOAD with
QMAKE_USE+=libdl.
the definitions of QMAKE_LIBS_DYNLOAD remain in the qmakespecs for
backwards compat only. n.b.: the only specs where it is not empty or
"-ldl" (i.e., what we support now) are the hpux ones, where the library
is called 'dld'.

technically, the "library" feature should depend on '!unix || dlopen', but
that's for a later patch.

Change-Id: Ib8546affc4b7bc757f1a76729573ddd00e152176
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2017-02-27 12:20:44 +00:00
Marc Mutz
1d31f23ce9 QVarLengthArray: add rvalue overload of append/push_back
Improves performance when appending temporaries, esp. since
the aliasing fix in the lvalue overload in 0f730ef made that
overload correct, but a bit slower across reallocs.

The unit tests already also pass rvalues, so the function is
covered in the existing tests.

[ChangeLog][QtCore][QVarLengthArray] Added rvalue overloads
of append() and push_back().

Change-Id: If3a6970f03a160cba5b42d33d32d3d18948f6ce3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-25 21:04:01 +00:00
Christian Gagneraud
e3bcab935c Fix documentation typos
This patch fixes 2 simple typos in QGraphicsItem and QPainter
documentation and a copy/paste error between QAbstractItemModel's
beginRemoveColumns and beginRemoveRows documentation.

Change-Id: I32bdc4dc69154a40fe30a5b8c08d0c3a001853f8
Reviewed-by: Harri Porten <porten@froglogic.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-02-25 00:16:28 +00:00
Liang Qi
de49839df8 Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
	mkspecs/features/moc.prf

Change-Id: Ia71c8e3b3185f7c999bf226d0675051b10b8740b
2017-02-24 20:01:42 +01:00
Thiago Macieira
07fffa6010 QDateTime: Fix clearing the ShortData flag in setMSecsSinceEpoch
Unlike setTimeSpec, this forgot to clear the bit when detaching. So it's
possible that some further use of the flags could incorrectly conclude
that the data was short and then proceed to corrupt the pointer.

The example from QTBUG-59061 caused this because toUTC() -> toTimeSpec()
calls setMSecsSinceEpoch which left the bit set; then addDays() calls
setDateTime(), which calls checkValidDateTime() and that corrupted the
pointer. This problem was more visible on 32-bit systems because no
QDateTime was short (except for default constructed ones), but it
can happen on 64-bit with sufficiently large dates.

Task-number: QTBUG-59061
Change-Id: Ibc5c715fda334a75bd2efffd14a562a375a4e69b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-24 16:17:03 +00:00
Marc Mutz
f4495d29e5 Clean up QByteArrayLiteral definition
Remove the dead QByteArray(data, size) fall-back. We've been
requiring lambdas since Qt 5.7.

Change-Id: I4d9023ab4583f2ee80a74a828fba0d95c2fdb0df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-24 08:03:32 +00:00
Aaron Linville
c4f122927a Doc: Fix minor typos in QRectF
Fix a couple incorrect references to the integer precision classes.

Update snippet to use floating point precision classes.

Task-number: QTBUG-51630
Change-Id: I9b08cfb68937a8e1179ee414d7981956ef7bc106
Reviewed-by: Martin Koller <kollix@aon.at>
Reviewed-by: Michael Brüning <michael.bruning@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-02-23 20:55:10 +00:00
David Faure
9ffc9e306f QUrl::fromUserInput(with cwd) fix handling of files with trailing spaces
The call to trimmed() makes sense for URLs typed in a browser's location bar,
but its use in every code path made it impossible to open a file with a trailing
space in command-line tools that uses fromUserInput(cwd) to handle command-line
arguments, as recommended. For instance kde-open5 "file.txt " would fail.

Change-Id: Ie61182684521d91f077d3e76f95b7240965ab405
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-23 18:12:35 +00:00
Marc Mutz
62e15093ff Unexport QTimeZonePrivate
It's only used in the autotests, and it private API, so
downgrade from Q_CORE_EXPORT to Q_AUTOTEST_EXPORT.

Fix a use of QTimeZonePrivate functions unprotected by
QT_BUILD_INTERNAL in tst_qtimezone.cpp.

Change-Id: I70eaea06f8fcf2983aeafb6894c3a5d2a4b272a7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-23 10:42:51 +00:00
Shawn Rutledge
6aaf853222 make TabletMove hover events conditional on QWidget::tabletTracking
This adds the tabletTracking property in the same way that mouseTracking already
existed: there is a WA_TabletTracking attribute, and a TabletTrackingChange event
to notify when it changes.  So for widget applications it's an opt-in feature.
QtQuick applications don't yet make use of tablet events, but when they do
in the future, we don't yet have a mechanism to turn the move events off;
it remains to be seen whether that will be necessary.

[ChangeLog][QtWidget] QWidget now has a tabletTracking property, analogous
to mouseTracking, which will enable TabletMove events while the stylus is
hovering, even if no button is pressed.  This allows applications to show
feedback based on the other tablet event properties such as rotation and tilt.

Task-number: QTBUG-26116
Change-Id: Ie96e8acad882b167e967796cdd17f1ad747a2771
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2017-02-23 10:42:42 +00:00
Edward Welbourne
2c13070162 Do not delete someone else's QSystemLocale when constructing another
The QSystemLocale constructor remembers the most-recently-constructed
instance - a dodgy enough proposition at the best of times - and
shares it with much of the rest of QLocale.  There is a global static
instance, actually of a derived singleton class, to which it is
usually set on program start-up.  However, the constructor deleted the
remembered instance before remembering any new instances; there was no
way this could not lead to bad consequences.  So let's not do that.

Change-Id: Ie8f3d655c9d4f75f6ec00a5861d98d6020ecc633
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-23 09:39:23 +00:00
Marc Mutz
4d92712a2c QTimeZonePrivate: make clone() const, use covariant return types
There's nothing wrong with cloning a const QTimeZonePrivate, so make
clone() const.

Also, if you're cloning a QTzTimeZonePrivate, you already know that
you get a QTzTimeZonePrivate back. C++ supports covariant return types
for this reason, so use them.

Change-Id: I60e19e89b1b7bad080c552f1baca314ab0a6295e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-23 05:45:53 +00:00
Marc Mutz
4cd002402f Simplify QTzTimeZonePrivate implementation
- Don't init m_icu with 0. It's a QSharedDataPointer, which inits to
  nullptr anyway.
- The copy ctor didn't do anything out of the ordinary, so = default it.
  It's also only used in the implementation of clone(), so make it private.

Removes three #if QT_CONFIG blocks.

We can't use ctor delegation here, because systemTimeZoneId() is a
virtual function.

Change-Id: I2cd06c3349686b6f21c897acb5c12185a36d5b9f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-23 05:45:49 +00:00
Marc Mutz
2cda991ab1 QStaticByteArrayMatcher: fix MSVC warning
MSVC 2013 complained:

  src/corelib/tools/qbytearraymatcher.h(143) : warning C4351: new behavior: elements of array 'QStaticByteArrayMatcher<6>::m_pattern' will be default initialized

Fix the same way as 9a07ab9234: by suppressing
the warning.

Change-Id: Ic41f7eabe7e39709d76e6062f5891cdcfaa6e1ed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-02-23 05:44:58 +00:00
Marc Mutz
3ac8b8c696 QTypeInfo: record whether it was specialized
This is one of the pillars of my static container checking toolbox,
one of the main checks being that every type put into a Qt container
has been marked up with Q_DECLARE_TYPEINFO.

Obviously, we cannot upstream such a checker and inflict it upon the
world, but we can put some foundations in. This is the most central
one.

Change-Id: I9185facb2f37ba9fcc12c9aae5675eed454d755c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-23 05:44:47 +00:00
Pavol Markovic
dd4465f57c Wrap RunLoopModeTracker into Objective-C namespace
RunLoopModeTracker as one of Qt Cocoa classes was not wrapped
in namespace which limited its use in Objective-C single symbol space.

Change-Id: Ida2c62c6f543a3bf5107f28c78d27435bcb3470d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-02-22 20:16:59 +00:00
Ulf Hermann
4e9f7807fb Move qJsonFromRawLibraryMetaData into qfactoryloader_p.h
This is still not a great place for it, but this way we can
Q_REQUIRE_CONFIG(library) in qlibrary_p.h and qfactoryloader_p.h is the
only private header that doesn't require library support in plugin.pri.

Change-Id: Ia6c1ac8799822eca1e0cbeca98d1c1b8de74beae
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-02-22 17:36:32 +00:00
Marc Mutz
494ee2aa8d QThreadPool: supersede cancel() with tryTake()
The cancel() function added in 5b11e43e for Qt 5.5 suffers from a
number of problems:

First, if runnable->autoDelete() is true, then the function suffers
from the ABA problem (see documentation written for trytake()).

Second, if runnable->autoDelete() is false, due to cancel() throwing
away crucial information instead of returning it, the caller cannot
know whether the runnable was canceled (and thus has to be deleted),
wasn't found or is currently executing (and thus mustn't be deleted),
or has finished executing (and can be used to extract the result).

Deprecate this dangerous API and replace it with the much more useful
Private::stealRunnable(), promoted to public API and renamed to
tryTake() for consistency with the rest of Qt.

Described the various caveats in the function's documentation.

[ChangeLog][QtCore][QThreadPool] The cancel() function suffers from
several subtle issues and has been replaced with a new tryTake()
function.

Change-Id: I93125935614087efa24b3e3969dd6718aeabaa4f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-22 16:37:07 +00:00
Marc Mutz
7c647edae9 QTypeInfo: don't treat enums and (extended) integral types as complex
We fully specialize QTypeInfo for most C++ built-in types,
but enums and extended integral types (like GCC's int128_t)
were not covered.

Now that we depend on <type_traits>, we can stop pessimizing
enums and extended integral types in QVector and QVLA by
defaulting QTypeInfo::isComplex to true for such types.

Fix a test that checked that enums were complex types. This should
have been a XFAIL test. Enums are not complex types.

Change-Id: Ibb0fb38cc83e980a428b5573d1db5666593418ae
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-22 09:21:57 +00:00
Marc Mutz
19085350fb Do not use QTypeInfo::isStatic anymore
... except in QList.

When dafa3618 introduced isRelocatable and QTypeInfoQuery, the
intention was to decouple the memory layout of QList from the
reallocation optimizations in QVector. This never happened, as
QVector (and QVarLengthArray) continue to use isStatic to this
day.

Fix by porting both QVector and QVLA to QTypeInfoQuery and
isRelocatable.

Change-Id: I6951f2cf21f0cbb24e2dbd38f80f1bd82007d394
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-22 08:04:12 +00:00
Marc Mutz
4df229ce50 QArrayDataOps: don't use value-initialization
... but default-initialization instead.

This bug may have rendered the diverse Qt::Uninitialized ctors
we have in Qt containers ineffective.

Change-Id: I5a369fa8527f19b6f8cc1a9f36512f6a0058839a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-22 08:03:46 +00:00
Marc Mutz
adca47cbc1 QTzTimeZonePrivate: introduce PosixZone class
... as a replacement for QPair<QString, int>, and move some
repsonsibilities into it.

This avoids the repeated use of the magic number INT_MIN to indicate
absence of an offset and does away with the confusing .first and
.second, replacing them instead with proper names, .name and .offset.

Change-Id: I0f6906467b8efa16bed2bf5677f2bbbd534da1ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-22 07:58:19 +00:00
Stephan Reiter
1d44b6bedb QProcess::startDetached(): Support privilege elevation for non-.exe files
Pass classname 'exefile' to ShellExecuteEx() for UAC prompt.
This allows running executable files that do not have a .exe extension.

Task-number: QTBUG-59008
Change-Id: I88d669481e893db50edccd7b30259e5366477556
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-02-22 07:47:18 +00:00
Oswald Buddenhagen
7509ccc0f7 add configure -list-features
also actually deletes qfeatures.txt, which was already claimed by
a668c6a6, but not actually done.

Task-number: QTBUG-58411
Change-Id: I686760632fee7c10b01bd2e83f2481b01bc2b774
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-22 07:46:05 +00:00
Olivier Goffart
5426e689f9 Fix a race condition between QObject::connect and qRegisterMetaType
QObject::connect will extract the QArgumentType for first the signal,
then the slot. The QArgumentType with a string constructor will query
the metatype system to get the meta type id. But it might happen that
between the extraction of the signal's argument and the slot's argument,
qRegisterMetaType was called in another thread. For this reason, it's
possible that one QArgumentType has a type id while the other does not.
For this reason, we should fall back to compare the string if any of
the argument's type is 0.

Task-number: QTBUG-50901
Change-Id: I260ca662ff00a773ae519f78bb633e05fde0ea81
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-22 07:37:51 +00:00
Marc Mutz
e0a9a0e217 QArrayDataOps: do not use QTypeInfo::isStatic anymore
These days, QTypeInfoQuery and isRelocatable should be used.

Change-Id: Ieac2d7fcef6b1d5466b14bbd1066901d6e751a55
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-22 07:12:13 +00:00
Marc Mutz
809cef1732 QTimeZone: do not access static functions through this->
The this pointer cannot be null, so we can't do d->staticFunction while
d is a null pointer. This was caught by Clang 3.8's ubsan.

Change-Id: I3c0d39b88cca83d827a69ed1544a4412b18ac907
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-22 07:00:43 +00:00
Marc Mutz
567abeaa04 QLoggingRegistry: fix potential data race
The 'rules' vector is made up of all the individual {env,config,...}Rules
vectors under mutex protection whenever init() is called (only from the
QCoreApplication ctor) or, at any time, by a call to QLoggingCategory::
setFilterRules().

Yet, the writes to the individual *Rules vectors were never protected by
registryMutex, racing against the reads of the same vectors in the
updateRules() function.

Fix by protecting all access of all member variables with registryMutex.
Add some strategic comments to make analysis easier for the next guy.

Change-Id: If68d15a553ec7038693574a34f10a39f4cd480e8
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-20 07:23:59 +00:00
David Faure
6c9b558153 QMimeDatabase: fix matching of filenames with different length when lowercase
AİİA.pdf takes 8 QChars, but after lowercasing it takes 10, so the code cannot
assume the length to be the same.

Task-number: QTBUG-58822
Change-Id: Id6fbb99f6afd08ee420099cd66372732d7598d9e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-17 18:52:50 +00:00
Olivier Goffart
8d6d68d3d3 QReadWriteLocker: Fix race in unlock
An Acquire barrier in QReadWriteLocker::unlock was missing to synchronize
with the testAndSetOrdered on d_ptr in the lock functions.

The race is between the write of d->writerCount in tryLockForWrite,
and the read in unlock. The acquire on d->mutex is not enough because
it is not on the same object. While that race could be fixed by taking
the newly-allocate()ed d's mutex before publishing it with testAndSet,
there's another race, on 'recursive', between a newly-minted Private*
with recursive == false in tryLockForWrite(), and the read of 'recursive'
in unlock().

Task-number: QTBUG-58917
Change-Id: I10ba36573c0e57468d11e9b77d85045711feaea1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-02-17 16:21:20 +00:00
Paul Olav Tvete
d995f0fe09 Build fix for new feature -qt-no-processenvironment
Change-Id: I6d1c5d122761d239d96b943a9abf7af12195a3eb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-02-17 14:41:34 +00:00
Paul Olav Tvete
983ffeb9ff Build fix for -no-feature-datestring
Change-Id: I09c7bc360956aef44f4137a093b6329a08a099ee
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-17 14:41:19 +00:00
Liang Qi
e5c3700a61 Merge "Merge remote-tracking branch 'origin/5.8' into 5.9" into refs/staging/5.9 2017-02-17 10:36:32 +00:00
Olivier Goffart
dd7f62059c Fix a race in QFreeList
The _next variable need the acquire and release fence in next()
to synchronize with the equivalent operations in release() (which
already have the them)
The ordering on the _v[block] is not enough as this does not
synchronize the same object.

Task-number: QTBUG-58917
Change-Id: I17cc39e6791433348b6227363dbea92bcf03700d
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-17 09:28:44 +00:00
Marc Mutz
0e3d6fe4f6 QVarLengthArray: fix appending an already-contained item
Like the lvalue QVector::append() overload, when we reallocate,
we need to take a copy of the function's argument because the
reference will get stale upon reallocation.

Add a test.

[ChangeLog][QtCore][QVarLengthArray] Fixed a bug involving
appending an item already in the container to the container
again.

Change-Id: I06eeed6cb383dd5924e47a302bb3d1666d04c8e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-17 07:35:31 +00:00
Thiago Macieira
d9a2dd8d3b QDir::mkpath: don't try to mkdir in automount filesystems
Automount filesystems like /home on many operating systems (QNX and
OpenIndiana, at least) don't like if you try to mkdir in them, even if
the file path already exists. OpenIndiana even gives you an ENOSYS
error.

So instead, let's try to mkdir our target, if we fail because of ENOENT,
we try to create the parent, then try again.

Task-number: QTBUG-58390
Change-Id: Ibe5b1b60c6ea47e19612fffd149cce81589b0acd
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2017-02-16 21:08:32 +00:00
Liang Qi
c577f6edaf Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
	src/corelib/plugin/qlibrary_unix.cpp
	src/plugins/platforms/xcb/qxcbconnection.cpp
	tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp

Change-Id: I632c400d909f8c204f55743aadc7886af2f15dfb
2017-02-16 21:51:11 +01:00
Marc Mutz
cad9c7cbc9 Use static initialization for QBasicAtomics
A default-constructed static QBasicAtomicInt at function scope
will be dynamically initialized. It will still be zero-initialized,
but at least GCC adds guard variables for such objects.

When using aggregate initialization, the guard disappears.

Amends 04d6495bf7.

Change-Id: Id9335cffdd43094cafb231fdde2523d013abe1d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-16 19:26:46 +00:00
Ulf Hermann
1aaf45e106 Eliminate QT_NO_DYNAMIC_LIBRARY
The library feature already covers this. As library depends on the
dlopen compile check, we can assume dlopen to be available, also on
vxworks.

Change-Id: Idcdb07ab4688c6158651d9a5ad5e2ba126bd7d9e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-02-16 15:06:26 +00:00
Marc Mutz
0f730ef7b6 QReadWriteLock: make field 'recursive' const
It is never written after initialization, and accessed concurrently
outside mutex protection, so make sure that it never changes by
marking it as const.

Change-Id: Ib28b2e8b3067d596a95d1699165a6ebfb15fe674
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-16 14:34:22 +00:00
Marc Mutz
f05d2764b0 QJNIHelpers: unbreak runnables counter
Adding 0 each time will obviously not produce a new identifier each
time...

Also use static initialization for QBasicAtomicInt.

A default-constructed static QBasicAtomicInt at function scope
will be dynamically initialized. It will still be zero-initialized,
but at least GCC adds guard variables for such objects.

When using aggregate initialization, the guard disappears.

Amends 265db5ad9b.

Change-Id: Ia71290cf26c486dcbcc74381f12cd0c4712d6019
Reviewed-by: David Faure <david.faure@kdab.com>
2017-02-16 14:30:27 +00:00
Allan Sandfeld Jensen
925a3c6529 Use native support for fp16 where available
Use F16C or ARM FP16 if available at compile time.

Configure check added because older clang compilers have F16C defines
and flags but not all the intrinsics.

Change-Id: I71f358b8fd003e70ab8fcf35097414591e485112
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-16 12:03:45 +00:00
Marc Mutz
5486882b52 Android: De-duplicate vtables of exported private classes
By making the destructor (usually the first non-inline, non-pure,
virtual function, and therefore the trigger for most compilers to emit
the vtable and type_info structures for the class in that TU)
out-of-line, vtables and, more importantly, type_info structures for
the class are pinned to a single TU. This prevents false-negative
dynamic_cast and catch evaluation.

Since the classes are already exported, users of these classes are
unaffected by the change, and since it's private API, we don't need to
avoid adding code to the out-of-line destructor until Qt 6.

While at it, de-inline also the empty default implementations of
virtual (non-dtor) functions.

Task-number: QTBUG-45582
Change-Id: I3e6f37eab1dee0db445f6c13638a43ca3bf6ac62
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-16 05:02:34 +00:00
Marc Mutz
bf2160e72c Clean up QStringLiteral definition
We require lambda support in the compiler since Qt 5.7, so drop
the guard macro.

Apart from MSVC 2013, all our supported compiler also support
char16_t:

- VxWorks uses GCC 4.8, which supports char16_t since 4.5.
- ICC supports char16_t since v12.1; we require v14+.
- ONX uses a GCC which supports char16_t in the compiler,
  but is equipped with a stdlib that does not sport char16_t
  support, which is why we revoke its Q_C_UNICODE_STRINGS in
  qcompilerdetection.h. But we don't need stdlib support, we
  only need the core language feature.
  This is the only platform where this patch actually changes
  something. It removes the, rather unfair, pessimization of
  the platform which could have supported the static-storage-
  duration implementation of QStringLiteral instead of the
  fallback, which uses dynamic memory (QString::fromUtf8()).
- GCC and Clang support char16_t since 4.5 and 3.0, resp.,
  which is far below our minimum compiler requirements in
  effect since Qt 5.7.
- On Windows, MSVC supports char16_t since 2015 only, and we
  still support 2013, but on Windows, wchar_t is the same size
  as char16_t, so instead of u"str" we can fall back to L"str".

So simplify the implementation of QStringLiteral by assuming
that all these feature are present, adding noexcept to the
lambda to make noexcept() queries return true.

This allows us to guarantee:

[ChangeLog][QtCore] QStringLiteral is now guaranteed to be
evaluated at compile-time. The last platform (QNX) to use the
QString::fromUtf8() fallback has been ported to allocate the
string data statically, too.

Change-Id: I7920d7a77001e5c5550e7c7d57ceb7c51c9eb443
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-15 20:14:56 +00:00
Marc Mutz
04d6495bf7 Make some atomic counters zero-based
A variable of static storage duration that is not zero-initialized
takes up space in the DATA segment of the executable. By making the
counters start at zero and adding the initial value afterwards, we
move them over to the BSS segment, which does not take up space in
the executable.

Wrap atomics used across function boundaries into small functions,
to avoid code duplication and to increase readability.

Change-Id: Ida6ed316ecb8fe20da62a9577161349e14de5aed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-15 20:14:27 +00:00
Marc Mutz
a5febadac5 QString(Ref): make toLatin1()/toLocal8Bit() null handling consistent
Systematic testing in tst_QStringApiSymmetry revealed a bug in
QStringRef::toLatin1(): a null input did not result in a null output,
but an empty one. This is fixed, for consistency with
QString::toLatin1(), and QString(Ref)::toUtf8(), which behaved
correctly already.

The same bug was found in QString(Ref)::toLocal8Bit(), which is
particularly hideous, as it's documented to fall back to toLatin1(),
which preserves null inputs. Fixed, too.

[ChangeLog][QtCore][QString] toLocal8Bit() now preserves nullness of
the input QString (outputs null QByteArray).

[ChangeLog][QtCore][QStringRef] toLocal8Bit() and toLatin1() now
preserve nullness of the input QStringRef (output null QByteArrays).

Change-Id: I7026211922c287e03d07e89edbad2987aa646e51
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-15 20:12:36 +00:00
Thiago Macieira
798819bb87 Correct \since for QStorageInfo::subvolume()
3e9db01a2e4be5034d10d6eeafd65d0a8609615b entered dev after the 5.8
branch.

Change-Id: I4139d5f93dcb4b429ae9fffd14a349e85e62a298
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-02-15 16:33:20 +00:00
Thiago Macieira
fb376e0fcc Remove the name cache from QMetaType::typeName
It was unnecessary, since we only cached the static types, which are all
generated by the macro anyway. The way it was implemented, this produced
data races that are strictly-speaking UB, even if all the threads were
writing the same values to the same data locations.

This commit changes a little the code to simplify, since we're changing
those lines anyway.

Task-number: QTBUG-58851
Change-Id: Idc5061f7145940f987dffffd14a30047846e3113
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-15 16:25:38 +00:00
Frederik Schwarzer
1e7143cff8 Fix minor typos in apidoc
Change-Id: I5ce9599a60ea336b469807df075e491f0e6df680
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-02-15 15:01:45 +00:00
Samuel Gaist
280225495d Doc: fixed explanation in Qt::Tool documentation
Clarify the the macOS implication of the flag.

Change-Id: Ic68e1ac668cfa68abf868ba6bdd46241dfa9b9a7
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
2017-02-15 14:45:18 +00:00
Kimmo Ollila
a0a9e8b2d7 Fix is_iec559 assert on GHS compiler
GHS compiler is not fully compliant with iec559.
Therefore we need to replace is_iec559 assertion
with separate checks to build quint16.

Change-Id: I88c57e394b8d4e7899ee7d4a13cbfbac9436b2fc
Reviewed-by: Rolland Dudemaine <rolland@ghs.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-15 13:52:26 +00:00
Marc Mutz
03903ec783 QJNIHelpers: make mutexes static
Amends 265db5ad9b.

Change-Id: I707bb88285531ee9f82efec46901871d53413eb3
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2017-02-15 13:06:12 +00:00
Frederik Schwarzer
9e888e633b Fix indentation of source code example in docs
Change-Id: Icf94c9adc55d16acd26831cce331054a8c49652d
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2017-02-15 11:58:12 +00:00
Marc Mutz
af8771867c Fix UB (data race) in QtAndroidPrivate::requestPermissionsSync()
If the QSemaphore::tryAcquire() call times out, we mustn't
touch *res, because there was no happens-before relation
established between *res = result in the lambda and our
returning *res;

Fix by returning a default-constructed hash in that case.

Add a strategic std::move().

The same problem exists in runOnAndroidThreadSync(), but
I have no idea how to solve it, because there the shared
object is the runnable itself.

Change-Id: I9a2c431144c169fbd545763555d96153143a11bf
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2017-02-15 11:24:18 +00:00
Marc Mutz
39820cf8c3 QJNIHelper: fix a potential race in sendRequestPermissionsResult()
The code obtained an iterator into a QHash under mutex protection,
then dropped the lock, dereferenced the iterator several times and
only retook the lock to erase the element from the QHash.

This is very smelly. QHash provides no official iterator validity
guarantees, and the container isn't const, either (which would imply
thread-safety). In particular, the dereference into the container
outside the critical section is cause for concerns.

Simplify the code, removing any doubts about its race-freedom, by
taking the payload item out of the hash before dropping the lock, and
using only the local strong reference in the remainder of the
function.

The only other references to g_pendingPermissionRequests are
insertions with unique-by-construction keys in QtAndroidPrivate's
requestPermissions(), so there was no reason to keep the item in the
hash for the whole duration of the sendRequestPermissionsResult()
call.

Change-Id: I39fe0803b13b3046d1f0fd9c8e96c531406d57da
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2017-02-15 11:23:28 +00:00
Heikki Haveri
aebf66d242 Enable QtAndroid::runOnAndroidThread in a Service
Change-Id: I214f5dc70c52011a5e1712ea70f97f8b564fb664
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2017-02-15 10:04:17 +00:00
Thiago Macieira
b58af67d7b Turn QThreadData::threadId into a QAtomicPointer
Solves a data race found by TSan.

Since thread and threadId are QAtomicPointer, I've removed the explicit
initialization in the QThreadData constructor

Task-number: QTBUG-58855
Change-Id: I4139d5f93dcb4b429ae9fffd14a34082f2683f76
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-02-15 08:08:58 +00:00
Friedemann Kleint
0b30a6e6aa QElfParser: Fix plural form in error message
Amends change dcec1420ea.

Change-Id: I54c7db012d87a55c310141debac19118e7cb284a
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-15 07:18:55 +00:00
Marc Mutz
265db5ad9b QJNIHelper: clean up atomic int and mutex handling
1. Do not use Q_GLOBAL_STATIC to hold QAtomicInt or QMutex, use
   file-static QBasicAtomicInt and QBasicMutex instead. They are
   zero-initialized PODs.
2. Use only QMutexLocker to lock mutexes.

Also wrap the atomic counter into a next...() function, as done
elsewhere.

Change-Id: I4b14ac0de9d4cb6780b1f1372c2b5fc88e918e4c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-14 21:11:03 +00:00
Marc Mutz
c4a5307a3e QMutex/Linux: remove unused QBasicAtomic
$ git grep -we futexFlagSupport
  src/corelib/thread/qmutex_linux.cpp:static QBasicAtomicInt futexFlagSupport = Q_BASIC_ATOMIC_INITIALIZER(-1);

The last user of this variable was removed in 9ef59b5.

Change-Id: I818a13a481ad25baa5ff7d389a737b8801adcfcc
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-14 13:30:05 +00:00
Liang Qi
27432d40f2 Merge remote-tracking branch 'origin/5.8' into 5.9
Change-Id: I2bd2e61bae1eab4fc74fa6accd741ed9ae1f0669
2017-02-14 11:33:02 +01:00
Oswald Buddenhagen
e3e2bc2109 announce 'temporaryfile' feature in bootstrap library
qmldevtools refers to it.

Task-number: QTBUG-58819
Change-Id: Id88265bb17e4d2e9c61f77409c4163eacc4a13f3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-13 09:20:07 +00:00
Marc Mutz
0d2791c5f6 QCollatorSortKey: add some std::move
All implementations of QCollator::sortKey() can benefit from
moving their CollatorKeyType into the QCollatorSortKeyPrivate
on construction.

So make the QCollatorSortKeyPrivate ctor a perfect forwarder
for its m_key member, and add std::move() calls where they
were missing (in all but one case, lvalues were passed).

Make the ctor explicit, as it should have been from the
beginning.

Change-Id: I2a1cdda5fd23990ace019b963df895c621a1fa85
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-13 08:42:46 +00:00
Marc Mutz
a85b4d79db QThreadPool: replace a QSet with a QList
QThreadPool maintains three containers of QThreadPoolThread*:

- allThreads, a QSet
- waitingThreads, a QQueue
- expiredThreads, also a QQueue

None of the operations on allThreads make use of QSets fast lookup.
The only functions called on it are isEmpty(), count(), insert(),
and swap().

Since therefore QSet adds nothing but overhead, causes indeterminism
(e.g. when deleting threads in Private::reset()) and code bloat, use
the same container for allThreads that underlies QQueue: QList.

Port insert() to append(). Add an assert to verify that we're not
running into an ABA problem here (but this should never fire, since
we're never deleting threads except in Private::reset(), where we
do remove them from allThreads), just in case.

Saves ~0.5KiB in text size on optimized Linux AMD64 GCC 7.0 builds.

Change-Id: I53a4d5ef2c204420f7c8852f1e72ab3d6ea43d08
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-13 08:42:41 +00:00
Filipe Azevedo
9db8c171e7 Fix QLibrary::isLibrary on Apple platforms
Add proper support for 'so' and 'bundle' suffixes.  Qt wrongly assumes
.so libraries are not versioned on Apple platforms, which is
wrong. Also, the shared library .bundle which is what Apple recommends
instead of .so, are also versioned (not to be confound with the
different Core Foundation bundles, which are directory hierarchy).

For more info, see http://docstore.mik.ua/orelly/unix3/mac/ch05_03.htm.
Especially the part that reads:

"Loadable modules, called bundles in Mac OS X, have the file type
MH_BUNDLE. Most Unix-based software ports usually produce bundles with a
.so extension, for the sake of consistency across platforms. Although
Apple recommends giving bundles a .bundle extension, it isn't
mandatory."

Task-number: QTBUG-50446
Change-Id: Iacd5136397a12d65d83821434f332eb602550b4b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-12 18:25:42 +00:00
Thiago Macieira
418184c2a0 Update the __xxx__ macros due to MSVC and ICC not defining them all
And if __AES__ or __PCLMUL__ is defined, then we expect wmmintrin.h to
exist.

Change-Id: I445bb15619f6401494e8fffd149db77dc513e071
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-02-12 08:16:05 +00:00
Thiago Macieira
68b21690e2 Use QBasicMutex in qthread_win.cpp
It's QtCore, so we're fine.

Change-Id: Ifaee7464122d402991b6fffd14a0d7ad9c09e2f2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-11 05:06:33 +00:00
Thiago Macieira
8a410f60ae Don't include qfloat.h in the QtCore master include
We have observed that MSVC 2013 gets lost with the overloads that this
header adds, causing compilation bugs. This is believed to be a compiler
bug, but it's not something we can work around.

Task-number: QTBUG-58555
Change-Id: I536c32a88bff44dab37afffd14a1bad1d31dc16d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Glen Mabey <Glen.Mabey@swri.org>
2017-02-09 21:23:31 +00:00
Alex Trotsenko
6e8fcab7e0 Improve QIODevice::peek() performance on buffered devices
Since 5.7, QIODevice::peek() implementation is based on transaction
mechanism. While technically it's correct, seeking backward on a
buffered random-access device clears the internal buffer that affects
the performance of reading.

To solve the problem, this patch implements peek mode directly inside
the reading procedure.

Task-number: QTBUG-56032
Change-Id: Ic5269f76e44c491a0309e13aba87fa7cf7b9259f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-09 18:46:24 +00:00
Alex Trotsenko
60563855e5 Refactor QIODevice::read()
Move device-dependent part of the code into the private function for
further reusing by peek() procedure.

Task-number: QTBUG-56032
Change-Id: Iedceafe4b0bab109ca5c64ad274d779efe87c27b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-09 18:46:15 +00:00
Thiago Macieira
7314c53d31 Add QDataStream streaming operator for QFlags
We're already using it, for example in qpaintengine_pic.cpp:502:
         d->s << p << ti.text() << fnt << ti.renderFlags() << [...]
                                             ^

[ChangeLog][QtCore][QFlags] Added operator<< and operator>> for
streaming QFlags into and out of QDataStreams.

Change-Id: I33dc971f005a4848bb8ffffd1478e79d6102d1bc
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-09 17:46:11 +00:00
Oswald Buddenhagen
b052d0cffd rename qvector.cpp => qvector.qdoc
the file contains no code.

this avoids complaints from ar/ranlib in static/bootstrapped builds.

Change-Id: Iee22ffc61a5f9ea8c25f5455b7e8e017ac521624
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-09 14:56:01 +00:00
Thiago Macieira
136c5b9338 Merge several Q_GLOBAL_STATICs in qresource.cpp into one
Since they are all used in a typical application, this reduces the
number of memory allocations (thus, the overhead) as well as the
state-keeping in the libc atexit() functions.

Change-Id: Ifaee7464122d402991b6fffd14a0e59457ad9cb7
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-02-09 01:22:54 +00:00
Thiago Macieira
4f3ea30922 Avoid unnecessary creation of some Q_GLOBAL_STATIC
If these lists weren't created in the first place, then they are empty.
We don't need to create it in order to conclude that. Unlike most
Q_GLOBAL_STATICS, these are almost never used and yet they were
always created due to where they were checked.

Since we're calling exists() before, there are two consequences: first,
since the list already exists, we're not allocating memory so it cannot
throw std::bad_alloc when being accessed. Second, since we've just
checked it exists, we can use QGlobalStatic's operator*(), which is
slightly faster than operator()(). The weird &(*list) syntax is only to
avoid changing the rest of the code that used a pointer

Change-Id: Ifaee7464122d402991b6fffd14a0e44f533dc3d9
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-02-09 01:22:12 +00:00
Liang Qi
dd756011da Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
	configure.json
	mkspecs/win32-icc/qmake.conf

Change-Id: Ibf40546b024d644c7d9ed490bee15b82597f4d3f
2017-02-08 15:49:18 +01:00
Thiago Macieira
8798d03e7e Remove unused qt_application_thread_id variable
Seems to be a write-only variable and QThread::currentThreadId has no
side-effects.

Change-Id: Ifaee7464122d402991b6fffd14a0c8666968dfe4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-02-08 00:02:44 +00:00
Marc Mutz
0c50edbe84 QCollator: don't pipe bcp47Name() through QString
Give QCollator access to QLocalePrivate::bcp47Name(), to avoid
both the latin-1 -> UTF-16 conversion in QLocale::bcp47Name(),
as well all as

- the replace('-', '_').toLatin1() call in ICU
- the toLocal8Bit() call in macOS
- the toUtf8() call in Windows

implementations of QCollatorPrivate::init().

This is safe, since, according to https://tools.ietf.org/html/bcp47,
a BCP47 name only contains US-ASCII (ALPHA used, which is defined by
https://tools.ietf.org/html/rfc5234 to be [a-zA-Z] only).

Change-Id: Id56befb1b5a7983494d848cdabf7ebeda377cf9f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-07 19:40:10 +00:00
Marc Mutz
9e5e30fa13 QStringMatcher: fix setCaseSensitivity() on a non-QString-backed matcher
When a non-QString-backed mode (via the (QChar*, int) ctor) was added
for Qt 4.5, the author forgot to adjust the setCaseSensitivity()
function.  It still uses q_pattern instead of (p.uc, p.len) as the
pattern for which to create the skip-table. Since there is no
setPattern() overload for this mode, the correctness of the matcher is
not harmed by this, but its performance degrades to that of a linear
scan: the skip-table, being filled from an empty pattern, will be
all-zeros, sending bm_find() into the 'possible match' case at every
character.

Since matching is still correct, but slow, it's not possible to write
a test for this. I did, however, leave my attempts in the auto-test,
for when we add QStringView overloads of setPattern() which will then
be able to expose the bug.

Change-Id: I7b803e8624b0352a0a974900affbbfc0c260d93b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-07 16:31:00 +00:00
Marc Mutz
18e6e81059 QCollator/ICU: fix a rather hair-raising performance bug in compare(QChar*, int, QChar*, int)
The intention when using an overload that takes (const QChar*, int)
instead of a QString is probably to avoid creating a QString in the
first place. If the implementation stabbs the user in the back by
internally creating a QString just so it can call QString::compare()
on it, then that is rather unacceptable.

QCollator is already a friend of QString, so, absent QStringView,
resolve to calling compare_helper().

Change-Id: Ia7de1a095e3e310bd1b9957ed67291cc9cc95b32
Reviewed-by: David Faure <david.faure@kdab.com>
2017-02-07 12:01:08 +00:00
Marc Mutz
9aaaa8427d QCollatorSortKey: use QExplicitlySharedDataPointer as pImpl
The key is immutable except for assignment and swap,
so don't run the risk of auto-detaching and use the
explicit-detach version of QSharedDataPointer.

Change-Id: Ib2cfe5981e6dfe375d6208289ff58247ef9d4870
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-07 09:50:16 +00:00
Marc Mutz
1401225330 QLoggingRegistry: optimize updateRules()
... by not creating three temporary QVectors just to concatenate them.

There's no QVectorBuilder, so what works well with QStrings doesn't
work well at all with QVectors. The chaining of op+ causes three
temporary QVectors to be created and thrown away.

Instead, use clear() (which preserves the vector's capacity these days),
followed by four op+=.

Change-Id: I300bd35544ea41037d28db0f48f210c33c826b85
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2017-02-07 09:50:00 +00:00
Friedemann Kleint
4bf0ddb3f1 Fix some qdoc warnings for 5.9
Fix warnings:
src/network/access/qhstspolicy.cpp:158: warning: Undocumented parameter 'expiry' in QHstsPolicy::setExpiry()
src/network/access/qhstspolicy.cpp:178: warning: Undocumented parameter 'include' in QHstsPolicy::setIncludesSubDomains()
src/network/access/qhstspolicy.cpp:178: warning: Can't link to 'includeSubdomains()'
src/widgets/kernel/qsizepolicy.cpp:402: warning: Cannot find 'transposed(...)' in '\fn' QSizePolicy QSizePolicy::transposed()
src/widgets/kernel/qsizepolicy.h:165: warning: No documentation for 'QSizePolicy::transposed()'
src/widgets/util/qundostack.cpp:164: warning: Undocumented parameter 'obsolete' in QUndoCommand::setObsolete()

Fix the signature of the QStaticByteArrayMatcher member functions. The warnings
src/corelib/tools/qbytearraymatcher.cpp:372: warning: Cannot find 'indexIn(...)' in '\fn' QStaticByteArrayMatcher::indexIn(const char *haystack, int hlen, int from)
src/corelib/tools/qbytearraymatcher.cpp:382: warning: Cannot find 'indexIn(...)' in '\fn' QStaticByteArrayMatcher::indexIn(const QByteArray &haystack, int from)
remain, though since apparently qdoc is thrown off by the constructor.

Change-Id: I157359a881ff3fbc80d2eeb52dd5c27249d009c4
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-02-06 16:58:04 +00:00
Marc Mutz
47a275c0ba Un-export QCollator{SortKey,}Private
This is private API, and used nowhere else except in qcollator*,
so don't export these classes.

Change-Id: I217fde97c60ab0a3e19774ed5a6eed8b156fff1d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-06 09:42:35 +00:00
Aleksey Lysenko
f53ab9d736 Reset QFileDevicePrivate::cachedSize on file close
When a QFile object is reused, the atEnd() method may return incorrect
values. The reason for this is that QFileDevicePrivate::cachedSize is
not cleared. Setting cachedSize = 0 in the close() method fixes this issue.

Task-number: QTBUG-57698
Change-Id: I828a2cf844e98d581098f2c781fa47d2cd3275ce
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-06 07:36:24 +00:00
Marc Mutz
5923fb966d QDateTimeParser: de-duplicate vtable
QDateTimeEdit (QtWidgets) inherits its Private class from
QDateTimeParser.

By making the destructor (usually the first non-inline, non-pure,
virtual function, and therefore the trigger for most compilers to
emit the vtable and type_info structures for the class in that TU)
out-of-line, vtables and, more importantly, type_info structures for
the class are pinned to a single TU. This prevents false negative
dynamic_cast and catch evaluation.

Since the class is already exported, users of these classes are
unaffected by the change, and since it's private API, we don't need
to avoid adding code to the out-of-line destructor until Qt 6.

Task-number: QTBUG-45582
Change-Id: Id57289a7eff13564dddeca0af1c45a6180c36c48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-05 18:29:47 +00:00
Thierry Bastian
b8dbde10a0 Fix data corruption when reading byte arrays from QSettings
On macOS, the code that read the plist is using
QByteArray::fromRawCFData. When we return the data directly
we need to detach the QByteArray so that it does not point
CFData's data that will get deallocated just after the call.

Task-number: QTBUG-58531
Change-Id: If829a304b986c99c8fc2aeeb992f2d539a4eef3a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-02-03 15:37:58 +00:00
Nico Vertriest
538ef73664 Doc: corrected minor link issues
qcore_foundation.mm:
- Can't link to 'fromCGPoint()'
- Undocumented parameter 'point' in QPointF::fromCGPoint()
- Can't link to 'fromCGRect()'
- Undocumented parameter 'rect' in QRectF::fromCGRect()
- Can't link to 'fromCGSize()'
- Undocumented parameter 'size' in QSizeF::fromCGSize()

Change-Id: Ie48f04c7b990634f8c5a836100b1be7854848bb4
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-02-02 09:55:03 +00:00
Ben Boeckel
1b59966021 Qt5CoreMacros: append the --compiler-flavor=msvc flag
Previously, the flags were replaced rather than appended to, losing -I
flags and causing `#include` directives to fail.

Change-Id: I74609e891ea327a8136c8075ab13176fc85ab111
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-01 23:11:42 +00:00
Oswald Buddenhagen
dcd5cb9736 Merge remote-tracking branch 'gerrit/dev' into HEAD 2017-02-01 21:00:55 +01:00
Thiago Macieira
3ac806b76d De-inline qfloat16 streaming operators in QDataStream
Which allows us to remove the #include. The qfloat16 operator overloads
in the global namespace are giving some trouble on some compilers, for
reasons unknown (could be compiler bug, could be real). So don't #include
the header anywhere else: let the user choose it.

Task-number: QTBUG-58555
Change-Id: I4c9f691516694b90b08ffffd149ef7dff27d0f6a
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2017-02-01 10:32:35 +00:00
Liang Qi
3cd1c3cb70 Fix libs build with msvc on Chinese locale on Windows
Chinese locale means Code Page 936 here. It's also related with
removing C4819 warnings.

And it's also following Conventions in Qt source code: All code
is ascii only (7-bit characters only, run man ascii if unsure)

See also http://wiki.qt.io/Coding_Conventions

Task-number: QTBUG-56155
Task-number: QTBUG-58161
Change-Id: I37fa7a0e6a82a16eaf80e1cc99be801099ab87de
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: jian liang <jianliang79@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-01 08:35:42 +00:00
Thiago Macieira
3d0f62de8b qnumeric_p.h: Simplify code to match currently-supported platforms
MSVC < 1800 (older than 2013) is no longer supported, so we can simplify
the code. And the implementation for C never worked -- "if it's not C++,
let's use a namespace!"

Change-Id: Iaeecaffe26af4535b416fffd148c2c6788c43881
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-01-31 23:13:47 +00:00
Thiago Macieira
71b54cc244 QtCore & winmain: Remove dead code
The last use of qWinMain was removed in commit
390598cb43, "Winmain:  Remove Windows CE."
It used to be used on non-WinCE, but that was dropped in commit
9b121e5579.

Change-Id: Idc347fbb462f4122b044fffd1490a210358a61b1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-01-31 19:09:31 +00:00
Thiago Macieira
14f0964344 QVariant: don't do fuzzy comparisons with NaN and infinities
There was a test that tested this, but was wrong.

[ChangeLog][QtCore][QVariant] Fixed a bug that caused wrong results for
comparisons of QVariants containing either NaN or infinite numbers.

Task-number: QTBUG-56073
Change-Id: I33dc971f005a4848bb8ffffd1475d29d00dd1b7f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-31 19:09:28 +00:00
Glen Mabey
3ab7016632 New qfloat16 class
This constitutes a fairly complete submission of an entirely new
floating point type which conforms to IEEE 754 as a 16-bit storage
class.  Conversion between qfloat16 and float is currently performed
through a sequence of lookup tables.  Global-level functions
qRound(), qRound64(), qFuzzyCompare(), qFuzzyIsNull(), and
qIsNull() each with a qfloat16 parameter have been included
for completeness.

[ChangeLog][QtCore] Added new qfloat16 class.

Change-Id: Ia52eb27846965c14f8140c00faf5ba33c9443976
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-31 14:21:42 +00:00
Topi Reinio
07218826e5 Doc: Normalize \since usage
Although it's permitted to specify the project name together with
a version number for \since, it's unnecessary for Qt classes and
functions.

This change also normalizes the version formatting: '<major>.<minor>'

Change-Id: Ie5a43662077d13c31e241bcde8a7a2849d27d330
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2017-01-31 08:59:50 +00:00
Giuseppe D'Angelo
1b488d8b49 Streamline #include <type_traits>
It's included by qglobal.h, so we get it for free in other headers.

Change-Id: I90072156e313271a5354a39cbf78a83a6885c431
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-31 08:24:03 +00:00
Marc Mutz
d258d6962a QLocale(Win): fix pessimizing use of QStringBuilder
Instead of

   result += QString(string builder expression);

forcing a QString creation incl. memory allocation, do

   result += string builder expression;

using the overloaded QString += QStringBuilder operator.

Change-Id: I23023c76620fa6bb7bf9f2786c22f6a2ec0d87c2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-01-31 08:06:37 +00:00
Marc Mutz
6a9cd5604e Don't narrow lengths in qHash() implementations
The crc32() functions take a size_t length, but the hash() functions
wrapping them took int lengths.

That makes no sense and actively hurts adding hash functions for STL
types or QStringView, so port the hash() interface to size_t.

Change-Id: Id303d6df4b698560fce656cec8ed693b01daac1c
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-31 00:38:37 +00:00
Thiago Macieira
c20fa2879e Regroup the x86 QT_FUNCTION_TARGET_STRING_xxxx macros
Easier to have an overview of them.

Change-Id: I445bb15619f6401494e8fffd149db6dec4851f6d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-01-30 18:16:56 +00:00
Thiago Macieira
0159cbb1a2 Move the declaration of SSE3 & newer macros above their use
Change-Id: I445bb15619f6401494e8fffd149db66da3405b48
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-01-30 18:16:50 +00:00
Liang Qi
246799d8a7 Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	examples/network/network-chat/peermanager.cpp
	src/widgets/util/qsystemtrayicon.cpp
	src/widgets/util/qsystemtrayicon_qpa.cpp
	src/widgets/util/qsystemtrayicon_win.cpp
	src/widgets/util/qsystemtrayicon_x11.cpp

Change-Id: I1c026df83818c0ccaf956980370e7522960627db
2017-01-30 12:46:20 +01:00
Thiago Macieira
77b33e4b85 Re-fix Clang-cl and ICC support on Windows
Instead of using the actual compiler version to determine which C++11
features to enable, let's just use the Mirosoft compiler version that
the actual compiler is claiming compatibility with. That is because the
limiting factor is often the standard library, not the compiler itself.

This will cause some features that do not depend on the library to also
be disabled, but oh well. Better upgrade your Visual Studio version
instead.

Task-number: QTBUG-57696
Change-Id: I3e4e5051937c40319d6efffd14912cd4fdab25fb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
2017-01-30 01:29:12 +00:00
Thiago Macieira
72f49ef46a MSVC: Fix use of POPCNT instruction without CPU check
The __popcnt family of intrinsics with MSVC generates directly the
POPCNT instruction and are documented to do so:
  https://msdn.microsoft.com/en-us/library/bb385231.aspx

So we can't use __popcnt unless the target processor supports it.

[ChangeLog][Windows] Fixed a bug that caused applications to crash with
"Illegal instruction" faults when compiled with Visual Studio and run on
some older processors.

Task-number: QTBUG-58446
Change-Id: I445bb15619f6401494e8fffd149d83bd2a7e3376
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-01-27 23:04:52 +00:00
Jake Petroules
944110089d Build Qt libraries with -fapplication-extension
This ensures at compile-time that Qt libraries do not use any APIs that
are not safe for use in application extensions, and fixes warning
messages that appear when linking to Qt libraries that are not built
with this flag, when used in an application extension.

This is especially important on watchOS where *all* "applications" are
actually application extensions, and on other Apple platforms if
application extensions are developed using Qt.

Task-number: QTBUG-40101
Change-Id: I022046f2584e0222253d33052b0abc221d7c93d6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-01-27 22:10:01 +00:00
Allan Sandfeld Jensen
099f286870 Fix MIPS DSP configuration
The patch fixes a number of bugs in code, and removes dead logic
clarifying that MIPS DSP, like ARM NEON, has no runtime detecton.

Change-Id: If2f4eea68da5b2eaa80b8e9c8258206d8c1b7173
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-27 15:08:57 +00:00
Alexander Volkov
30d0e1770c Use std::enable_if instead of QEnableIf
Change-Id: Ideca8283141484cb6da47c50333f5c96e416f082
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-27 10:30:31 +00:00
Erik Verbruggen
fa15162700 Fix QString comparison on Aarch64
There was an off-by-one error in the while loop for aarch64: we start
counting at 0 for the first position, so the last valid input position
is "a+7", not 8.

This wasn't covered by the tests, nor was the SSE2 version, so now there
are also tests for both versions.

Change-Id: I7eb8c5708e6179f45ea56885b0e66e1a37969c1d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-26 09:34:46 +00:00
Alex Trotsenko
3b8f3fb327 QEventDispatcherWin32: remove tailings of Windows CE code
It was automatically merged from 5.6 branch. Qt 5.8 does not support
Windows CE.

Change-Id: I6968f50ef568035c224851d595d6c057128491a7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-01-26 07:47:28 +00:00
Thiago Macieira
dfd7a0e411 Doc: add a note that UniqueConnection does not work for lambdas
Task-number: QTBUG-52438
Change-Id: I3e4e5051937c40319d6efffd1491bef6feb6776e
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-26 07:45:11 +00:00
Thiago Macieira
deef2d4e70 Fix warning about not calling the base class copy constructor
error: base class ‘class QBasicAtomicPointer<void>’ should be explicitly initialized in the copy constructor [-Werror=extra]

Change-Id: I2bc52f3c7a574209b213fffd149b4b71f3006be5
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-01-26 07:44:33 +00:00
Liang Qi
398a7e736c Merge "Merge remote-tracking branch 'origin/5.8' into dev" into refs/staging/dev 2017-01-26 00:37:14 +00:00
Liang Qi
318b58562a Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	.qmake.conf
	mkspecs/common/msvc-desktop.conf
	mkspecs/common/msvc-version.conf
	mkspecs/common/winrt_winphone/qmake.conf
	mkspecs/features/mac/default_post.prf
	mkspecs/features/mac/sdk.prf
	mkspecs/features/qt.prf
	mkspecs/features/uikit/default_post.prf
	mkspecs/features/winrt/default_pre.prf
	mkspecs/winphone-arm-msvc2013/qmake.conf
	mkspecs/winphone-x86-msvc2013/qmake.conf
	mkspecs/winrt-arm-msvc2013/qmake.conf
	mkspecs/winrt-x64-msvc2013/qmake.conf
	mkspecs/winrt-x86-msvc2013/qmake.conf
	qmake/generators/win32/msvc_vcproj.cpp
	src/gui/kernel/qwindowsysteminterface.cpp
	src/network/kernel/qhostaddress.cpp
	src/plugins/platforms/mirclient/qmirclientplugin.cpp
	src/plugins/platforms/mirclient/qmirclientplugin.h
	src/widgets/util/qsystemtrayicon.cpp
	tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
	tools/configure/Makefile.mingw
	tools/configure/Makefile.win32

Done-with: Jake Petroules <jake.petroules@qt.io>
Done-with: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Change-Id: I4be3262d3994e11929d3b1ded2c3379783797dbe
2017-01-25 20:06:06 +01:00
Allan Sandfeld Jensen
f823af43f2 QVariant of nullptr should always be null
Implements isNull for QVariants of a nullptr so they always return
true to isNull(), instead of depending on how they were constructed.

Task-number: QTBUG-58296
Change-Id: Ibddec795cdadedef7e17d22c265c29e752d8f99f
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-25 17:05:18 +00:00
Alexander Volkov
69e233d2ba Avoid detaching temporary objects
Found with clazy [detaching-temporary]:
- don't call QList::first() on temporary
- don't call QString::operator[]() on temporary
- don't call QByteArray::data() on temporary

Change-Id: I390962ef6020e4fcb0b0e447a63eed1e314d18a4
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
2017-01-25 14:28:34 +00:00
Jake Petroules
dfa8894bd3 Add missing documentation for QOperatingSystemVersion::segmentCount
Change-Id: I6d24fbbaf60e07377a463ea1f72588812caaf4a7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-25 07:19:45 +00:00
Tasuku Suzuki
64e977cfac Fix build without features.temporaryfile
Change-Id: I3f26f122a20aa8e59baaf3f33b89cc776865ff8b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-01-25 04:54:58 +00:00
Friedemann Kleint
fec5405f4d Fix some qdoc-warnings for 5.9
qtbase/src/corelib/global/qoperatingsystemversion.cpp:119: warning: Cannot find 'QOperatingSystemVersion(...)' in '\fn' QOperatingSystemVersion::QOperatingSystemVersion(int maj, int min, int mic)
qtbase/src/corelib/io/qdir.cpp:1852: warning: Unknown command '\p'
qtbase/src/corelib/kernel/qabstracteventdispatcher.cpp:482: warning: Cannot find 'registerEventNotifier(...)' in '\fn' bool QAbstractEventDispatcher::registerEventNotifier(QWinEventNotifier *notifier);
qtbase/src/corelib/kernel/qabstracteventdispatcher.cpp:495: warning: Cannot find 'unregisterEventNotifier(...)' in '\fn' bool QAbstractEventDispatcher::unregisterEventNotifier(QWinEventNotifier *notifier);
qtbase/src/corelib/global/qoperatingsystemversion.cpp:268: warning: Can't link to 'macro()'
qtbase/src/corelib/global/qoperatingsystemversion.cpp:296: warning: Can't link to 'typeName()'
qtbase/src/corelib/io/qdir.cpp:1845: warning: Undocumented parameter 'filters' in QDir::isEmpty()
qtbase/src/corelib/kernel/qobject.cpp:1636: warning: No such parameter 'interval' in QObject::startTimer()
qtbase/src/network/bearer/qnetworkconfiguration.cpp:343: warning: Undocumented parameter 'timeout' in QNetworkConfiguration::setConnectTimeout()
qtbase/src/gui/kernel/qoffscreensurface.cpp:337: warning: Undocumented parameter 'handle' in QOffscreenSurface::setNativeHandle()
qtbase/src/platformheaders/xcbfunctions/qxcbwindowfunctions.qdoc:109: warning: Unknown command '\role'
qtbase/src/widgets/util/qundostack.cpp:727: warning: Command '\li' outside of '\list' and '\table' ...

Change-Id: I57bff895a8e1afd94b582a6a72a06771514ee27e
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-01-25 04:50:16 +00:00
Samuel Gaist
9170cf9f1d Remove use of deprecated QRegExp from QLibraryInfo
This patch replaces QRegExp by QString search and replace.

Change-Id: I11165afa45f8f9a856e6fb9b64929e4bdacb913d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-01-24 20:27:58 +00:00
Jake Petroules
bd78f57463 Apple: always use the system time zone instead of the default time zone
This corrects an issue converting dates and times to strings which would
use the "default" time zone (CFTimeZoneCopyDefault) in contrast to the
rest of Qt which uses the system time zone in such contexts.

[ChangeLog][QtCore][QLocale] Qt functions now always use the system
time zone on Apple platforms, the same that low-level C APIs like
localtime() does. Previously, converting dates and times to strings
would use the "default" time zone (which is almost always the same as
the "system" time zone but could be changed with the Apple API).

Change-Id: I2942c3c1c8aa01a0130f1b7280371a72bdb01b1c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-24 19:40:45 +00:00
Jake Petroules
c1cece8e54 Fix deprecated API usage
Change-Id: I62448507f80daf6be72994ee99f0fb1aa107eb78
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2017-01-24 19:40:40 +00:00
Jesus Fernandez
6a3e728e9b Fix possible loss of data warning
warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
while compiling class template member function 'QVarLengthArray<T,Prealloc>::QVarLengthArray(std::initializer_list<T>)'

Change-Id: I36f5ef65ec1f511eac7f3ad1a4717d18f7dc9ce4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2017-01-24 15:10:21 +00:00
Allan Sandfeld Jensen
b0649df7d6 Fix MIPS32 processor detection
Gcc defines neither _MIPS_ARCH_MIPS32 nor __mips32 on MIPS32
architectures, instead __mips is defined to 32.

This fix exposed bit-rot in qdrawhelper where qt_memfill32 was set as
a function pointer despite not being one since Qt4.

Change-Id: I87461823e54fa3166223ebf97175fd05d2f2fd16
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-24 11:34:30 +00:00
Samuel Gaist
cbd7dea83e Doc: updated QString::fromRawData documentation to QRegularExpression
QString::fromRawData code sample still shows the use of QRegExp. This
patch updates it for QRegularExpression and cleans the code.

Change-Id: Iff0f736cdbdd7d35c65fde1496ce9f838a8f5c6d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-23 23:05:56 +00:00
Samuel Gaist
acacca859c Doc: update QStringList doc with missing QRegularExpression reference
The documentation of QStringList is missing some mention of
QRegularExpression as well as still using QRegExp in some sample code.
This patch fixes that.

Change-Id: I4a7c9fe8e5ae7c73497192bb71d1fa66ee864bd2
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
2017-01-23 22:52:50 +00:00
Jake Petroules
4b507e8257 Add conversion functions for QTimeZone and CFTimeZone/NSTimeZone
Change-Id: I3a2e18d69577296bf612e13e40414bce1daa6a71
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-23 21:55:22 +00:00
Dmitry Shachnev
186a5af82b Doc: do not break the values list by blank lines in qnamespace.qdoc
There should be no blank lines in \value content, otherwise qdoc
ends the list and starts a new one.

Change-Id: Idddc7992317894487445aea36397136df40b9691
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-01-23 11:47:57 +00:00
Tasuku Suzuki
92eafefb5a Fix build without features.textcodec
Change-Id: Ia9636db509270db93c2f9e46adaf1def0f157344
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-23 09:23:42 +00:00
Kimmo Ollila
f346d0e2b0 Increase the default stack size on INTEGRITY
INTEGRITY doesn't support self-extending stack. The default stack
size for a pthread on INTEGRITY is too small so we have to increase
the default size.

Change-Id: I0787d14938cf5e7e96c35df204212c8e83aa8893
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Nikola Velinov <nvelinov@ghs.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-23 06:25:12 +00:00
Sebastian Lösch
da0241a2e7 Make variant selection possible if base is missing
[ChangeLog][QtCore][QFileSelector] Removed the requirement for an unused
default base file in case you want to load only a variant.

When the base file (e.g. /image.jpg) was missing, no selectors were
considered and it was not possible to load variants of this file (e.g.
/+android/image.jpg, /+android/+tablet/image.jpg) without specifying the
directory as well.

As a work around, one previously had to place a default file in
the base location, which is undesirable in some cases because:
1. The extra file consumes unnecessary space.
2. It is impossible to encapsulate platform-specific implementation
   details by hiding files in a subdirectory.

Task-number: QTBUG-51230
Change-Id: I4c7f9ec952bff6e5b7738d8cabe3c762c208a38e
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
2017-01-20 05:25:19 +00:00
Marc Mutz
04dc59d989 QStringListModel: default data()s 'role' argument
... the way it's done elsewhere, too.

Change-Id: Icbb6802c2244469cda7db7eb9e088cf3b7729c89
Task-number: QTBUG-58160
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-19 23:58:01 +00:00
Marc Mutz
3af5cab054 Long live QStaticByteArrayMatcher!
This is a version of QByteArrayMatcher that calculates the
Boyer-Moore skip table at compile-time instead of at run-time,
making this class more generally applicable than QByteArray-
Matcher itself, at least for statically-known strings.

The compile-time part requires C++14 constexpr support, but
the class should compile and work even in C++98 mode, just
with runtime initialization of the skip-table.

While touching tst_qbytearraymatcher, clean up the static
global QByteArrayMatchers there and add tests with needles
longer than 255 characters for QByteArrayMatcher, too.

[ChangeLog][QtCore] Added QStaticByteArrayMatcher.

Change-Id: I0662f262ab19b79ae4096f3ab384d5b3ada72347
Reviewed-by: David Faure <david.faure@kdab.com>
2017-01-19 21:37:46 +00:00
Giuseppe D'Angelo
a6cdfacf8d QHostAddress: make it implictly shared
QHostAddress is one of the few classes in Qt which is pimpl'd but not
implictly shared, making it suprisingly expensive to copy around, return
by value and so on. Being pimpl'd it is also still lacking a move
constructor, like most of such types in Qt.

Remove a bit of the surprise factor and make it implictly shared. In
practice this means making it eagerly parse host addresses from strings.

Since it was entirely implemented out of line, replacing it with a
implictly shared implementation is binary compatible.

[ChangeLog][QtNetwork][QHostAddress] QHostAddress is now implicitly
shared.

Change-Id: Ia7ff94efcb74e7321b7607cd690c5c162f685605
Reviewed-by: Richard J. Moore <rich@kde.org>
2017-01-19 14:09:47 +00:00
Maurice Kalinowski
d3eec16862 Remove support for WinRT 8.1 and Windows Phone 8.1
[ChangeLog][QtBase][General] Removed support for WinRT/Windows Phone 8.1.

Task-number: QTBUG-57288
Change-Id: Ifd6d6780cbbdb710d99556ba3d2fb2e514d4f789
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-01-18 12:38:56 +00:00
Jake Petroules
ae072cd9c4 Polish up the QOperatingSystemVersion API and documentation
operator== and operator!= have been disabled, as they are likely to be
misused and are not particularly useful in practice. The same goes for
the QVersionNumber conversion convenience functions.

The constructor normalizes version component values so that invalid
versions like [5, -1, 3] cannot be constructed and made to wreak havoc
on assumed logic.

Change-Id: Iabb6876bd5dc11522032837f78cf825b921a49b2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-18 05:15:01 +00:00
Jake Petroules
7634225ad2 Fix whitespace, formatting, and line length in QOperatingSystemVersion
Change-Id: Ie26571a8098e8215a6bc1e0e363763e5fc546bcd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-17 01:40:54 +00:00
Tasuku Suzuki
ca7f67e82b Fix build without feature.animation
Change-Id: Ia1b9ae3a35cbc73d0bbf27db234d0cd120d0b601
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-16 14:12:50 +00:00
Liang Qi
7600cb6901 Merge "Merge remote-tracking branch 'origin/5.8.0' into 5.8" into refs/staging/5.8 2017-01-15 16:48:35 +00:00
Kavindra Palaraja
dbb4504f12 Add Q_CC_CLANG to the documentation page
Task-number: QTBUG-42247
Change-Id: I3f707df4d25cac12fabac863b4f6bb50bfac5e26
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-01-15 11:33:20 +00:00
Marc Mutz
0deca277d2 QtCore: fix GCC 7 warnings
GCC 7 warns about implicit fall-throughs now.

Fix by adding Q_FALLTHROUGH.

Change-Id: I482ab4c6adc469b11e1fd163516ff486b3b55ef7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-15 08:09:24 +00:00
Liang Qi
00935bf8c2 Merge remote-tracking branch 'origin/5.8.0' into 5.8
Conflicts:
	src/gui/painting/qcoregraphics.mm

Change-Id: I4d49535cd75f2cdf0151c1dbff312cce5e159760
2017-01-14 22:02:55 +01:00
Thiago Macieira
5a1b4832a2 Adapt to the C++ SIC introduced by P0021: noexcept overloading
C++17 adopts P0021R1[1], which makes noexcept be part of the function
pointer's type and thus be overloadable. It contains some provisions for
allowing a noexcept function pointer to cast implicitly to a non-
noexcept function pointer, but that fails in the presence of templates
and additional overloads that could match the type in question.

Fortunately, the paper proposed a test macro, so we can change our
sources now and be compatible with both C++14 and C++17 rules.

This first failed with Clang 4.0 trunk. This source incompatibility is
not our fault, it's the language's doing.

[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html

Task-number: QTBUG-58054
Change-Id: I2bc52f3c7a574209b213fffd14988cf0b875be63
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-14 03:24:30 +00:00
Paul Olav Tvete
635d0ae007 Fix typo in QT_REQUIRE_CONFIG error message
Change-Id: Iecfd398935f9c10aa456bd3452d34b31bc7eb4c9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-01-13 08:25:50 +00:00
Kimmo Ollila
01cade5050 Fix build for INTEGRITY
Change-Id: I2c41295688e962eb263f2180bebfd1dd37613804
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-01-13 07:52:16 +00:00
Jake Petroules
2f08a1d614 qglobal.cpp/QSysInfo::macVersion(): Silence deprecation warning
clang/g++ still warn when encountering the implementation of a
deprecated function.

Follows up 21a247adb4

Change-Id: I6ab1695acb520ef7ce7cb1896545d02607c3ce29
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-01-13 01:53:48 +00:00
Giuseppe D'Angelo
6255cb893d Remove qtypetraits.h's contents altogether
So that QFlags can use an (un)signed int matching the
underlying type as identified by the compiler and not by us.

Requires fixing a few warnings about sign conversion due to
QFlags misusages in qtbase that were either plain wrong, or
were relying on the enum being backed by an (un)signed int
when it wasn't.

Keep qtypetraits.h in the source tree in order to prevent
source breaks if some downstream #includes it (note however
that it did not contain any public API).

Change-Id: Ib3a92b98db7031e793a088fb2a3b306eff4d7a3c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-12 22:16:06 +00:00
Alexander Volkov
dcec1420ea Use QString::asprintf(), QStringBuilder, and the multi-arg overload of QString::arg()
... instead of sequential .arg(const QString &) callings.
It saves memory allocations and prevents unexpected results
if replacing strings contain place markers.
Found with clazy's qstring-arg check.

Change-Id: I3912275a6e11c6fb7559ff5623f2e8cde9b7f07a
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-12 17:54:28 +00:00
Edward Welbourne
8f469e4a19 Remove two unused static methods of QDateTimePrivate
... along with the two matching unused methods of QDateTime's test.

Change-Id: Id11a4b1b0132587f0df451d49c0043e9425d87ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-12 16:42:21 +00:00
Giuseppe D'Angelo
d9cb064425 Doc: fix the datatype returned by Qt::TextAlignmentRole
It's supposed to be a full alignment (like Top | Right), not
just one flag.

Change-Id: I656adda83742d7e4f31955322e937e979b32747c
Reviewed-by: David Faure <david.faure@kdab.com>
2017-01-12 16:14:40 +00:00
Jake Petroules
2b928ef6f9 Provide sensible defaults for QCoreApplication::applicationVersion
[ChangeLog][QtCore] QCoreApplication::applicationVersion now defaults to
an appropriate platform-specific value. On Windows, it defaults to the
PRODUCTVERSION parameter of the VERSIONINFO resource for classic desktop
apps, and the version attribute of the application package manifest for
Univeral Windows Platform apps. On Apple Platforms (macOS, iOS, tvOS,
watchOS), it defaults to the CFBundleVersion property of the information
property list (Info.plist) file. On Android, it defaults to the
android:versionName attribute of the AndroidManifest.xml manifest
element. On other platforms, the default remains an empty string.

Task-number: QTBUG-57715
Change-Id: I26f83dd00737e06f4321cf962aa5fab8398104ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-12 02:13:21 +00:00
Edward Welbourne
4b4bd6ab98 Simplify fileTimeToQDateTime() by having it return a UTC time
This avoids so many complications.  The prior code, using
SystemTimeToTzSpecificLocalTime(), lead to unhelpful results when the
QDateTime() implementation used MS-POSIX's defective mktime().
Although SystemTimeToTzSpecificLocalTime() is actually more correct,
we were getting inconsistent results by mixing the two: and
eliminating the use of mktime() turns out to be decidedly tricky.  So,
to avoid inconsistency, stick with a UTC time (which is what FILETIME
is defined as).  Change QFileInfo's methods to explicitly convert
.toLocalTime() where appropriate and document that these methods do
indeed return local time (as we conjecture has been taken for granted
by callers).

Also added a regression test for the reported case of this going
wrong.  A time-stamp from before Russia's (permanent, not DST) change
of TZ could end up inconsistently handled between file-system
meta-data and raw date-time APIs, due to cross-talk between different
MS-Win time APIs.

[ChangeLog][QtCore][QFileInfo] Made sure that all file lifecycle times
are in local time. This was probably true before, but is now explicit.

Task-number: QTBUG-48306
Change-Id: Ic0b99d25c4168f623d31967bc60665c0c4f38a14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-11 11:53:27 +00:00
Jason Erb
ae42bf0f9b Fixed Chinese language selection on iOS
For language "Traditional Chinese" on iOS with region "US",
the logic was formerly to attempt a match on country/language/script (fail),
followed by country/language (which would result in script defaulting to
"Simplified"). Now, the logic is to try language/script first if script is
specified. Failing that, language/country will be attempted.

Task-number: QTBUG-39639
Change-Id: I75a774b1e66686e95167ff221458a97a7ea2660d
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jason Erb <jason.erb@sparist.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 17:35:35 +00:00
Rafael Roquetto
858c1afb7a QNX: Fix comments on qcompilerdetection.h
Change-Id: I75495b4ba3d8742419f824aa0e0b52694dbd42ed
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 17:33:57 +00:00
Ulf Hermann
eaa0063b70 Fix compilation with QT_NO_SHAREDMEMORY
If we use QLatin1String we should include qstring.h.

Change-Id: Iebd761b98e515e9cd9cd34b96a0f8a602d00f086
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 16:35:06 +00:00
Kimmo Ollila
03a59d1bb8 Add support for building for INTEGRITY using GHS toolchain
Initial support for INTEGRITY to build QtBase

Change-Id: I18f36b4dea9107f01e1c281e4b62880590c777a1
Reviewed-by: Tuukka Turunen <tuukka.turunen@theqtcompany.com>
Reviewed-by: Nikola Velinov <nvelinov@ghs.com>
Reviewed-by: Risto Avila <risto.avila@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-10 10:06:23 +00:00
Giuseppe D'Angelo
a35a01aaa2 QForeachContainer: make it a move-only type
Honor the rule of five. Copy assignment was already disabled.
Disable also copy construction, but re-enable the move special
member functions.

This requires making the container non-const; to avoid detaches
and keep compatibility with containers that only have begin/end
(but not cbegin/cend), use qAsConst. This requires moving qAsConst
definition a bit up in the file.

Change-Id: I19cd74437cf69baceada9483920a21e96d7b1727
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 08:29:19 +00:00
Kavindra Palaraja
41d1785e13 Clarify that QString::toDouble does not have a fallback
QString::toDouble always uses the 'C' locale.

Task-number: QTBUG-44045
Change-Id: Ifb0c2f11c83c209907dd35bb39d1450022c8e85c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 06:38:03 +00:00
James McDonnell
b0a9b9ab87 Adjust QNX choices
Don't use Dinkum choices when the C++ library is libC++ (QNX 7.0).

Change-Id: I18c3f716ccfb0c02dbfdc01eac4b707d3ae9aab6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 01:42:53 +00:00
Jake Petroules
6b7e633248 Remove compatibility code paths for macOS < 10.10 and iOS < 8.0
Change-Id: I11bec0efc2b4d86adf64a58990260fee70f050ac
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-01-09 10:11:48 +00:00
Elvis Angelaccio
3f455a4b53 Introduce QDir::isEmpty()
A directory is empty when it doesn't contain files or folders.
We can exploit QDirIterator::hasNext() to check whether this is the
case. This is efficient since it doesn't list the whole folder (in the
non-empty case).

Test cases are added for both the empty and non-empty cases.

Change-Id: I0f7e26782c0f97f9c16f928dab6cae37927875d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-08 16:11:34 +00:00
Kavindra Palaraja
389165dd25 Clarify StripTrailingSlash behavior
StripTrailingSlash removes trailing slashes from the path, but not the
entire URL.

Task-number: QTBUG-47607
Change-Id: Id62b971e563e290b7ca000576bcc328616a3f1a2
Reviewed-by: David Faure <david.faure@kdab.com>
2017-01-08 16:02:44 +00:00
Martin Smith
9605f4f47b doc: clangqdoc documents the threads case
qmutex.h is updated to let clangqdoc document the threads case,
because the no-threads case is not interesting, and clang can
handle everything declared in qmutex.h. This change required
that a few minor qdoc errors be corrected in qmutex.cpp as well.

Change-Id: Icb4122f2179d6aad39dc68376498364820143297
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-01-06 20:18:19 +00:00
Oswald Buddenhagen
52d64fca66 revert to building qmake with qconfig.cpp
turns out that just appending builtin-qt.conf isn't a good idea:
executable-editing tools (objcopy, prelink, etc.) will happily drop the
"attachment".

a safe method would be adding a proper section to the executable, but
there doesn't appear to be an objcopy equivalent in msvc, and using
entirely different methods of embedding the file with different
toolchains seems like a rather bad idea.

so instead go back to the old method of building qmake with a generated
qconfig.cpp. of course, as said file is now created by qmake itself, we
have to compile qlibraryinfo.cpp a second time, and link a second qmake
executable.

Task-number: QTBUG-57803
Change-Id: I9e232693550aa870cec154e49cc06add13017cc2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-06 20:09:08 +00:00
Martin Smith
45ff1cf60a doc: Fix all remaining "Cannot tie" errors in QtBase
Most of these involved moving or removing extraneous
aide-memoir comments left by programmers between qdoc
comments and their functions. There were also some
cases where Q_CLANG_QDOC had to be tested to make
something visible to clangqdoc. And there were a few
functions that should not have been documented at all.

Change-Id: I3bf7c397a9e5ddbffc40cc1fee7f19cad71a1ae7
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-01-06 07:04:12 +00:00
Ulf Hermann
2ed9a52ebf Fix compilation without sharedmemory
We have to enable qt_safe_ftok with either sharedmemory or
systemsemaphore. In order to make the resulting QT_CONFIG work with the
bootstrap library we switch the features off for bootstrapping. Some
tests and examples have to be excluded when sharedmemory is not
available.

Change-Id: I3fc3926d160202b378be2293fba40201a4bf50c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-05 08:38:33 +00:00
Ulf Hermann
9ba39c4b05 Remove pointless QT_NO_THREAD ifdefs from qpropertyanimation.cpp
Change-Id: I7b7e80abbddf4d43c6135775136d993196d708b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-04 17:39:55 +00:00
Ulf Hermann
99245e9576 Avoid zero-as-nullpointer warnings in QThread
Change-Id: I3fd557a54d63c2dcabe58fab65326538896d02a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-01-04 16:17:44 +00:00
Martin Smith
dd58804cfe doc: clangqdoc doesn't need Q_GADGET
This update undefines Q_GADGET when clangqdoc is running.
With Q_GADGET defined, clangqdoc expects documentation for
QtGadgetHelper in each class where Q_GADGET is used.

Note that the documentation for the Q_GADGET macro is still
generated.

Change-Id: I3e6e6644c2c537c00c44ae77664892e125046daa
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-01-04 12:58:37 +00:00
Simon Hausmann
47c4d1378c Restore configure command line compatibility for PCRE support
Commit 9ca635482d renamed the configure
feature from pcre to pcre2, which unfortunately means that people would
have to change their build scripts to pass -qt-pcre2 instead of
-qt-pcre. As the configure check already verifies the correct PCRE
version for use (when using the system library), it seems more
convenient for our users to retain compatibility and call the configure
feature "pcre" again.

Change-Id: If26e7888814d8204d43baf7298d9916a4f856a48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-01-04 12:02:31 +00:00
Aleksey Lysenko
1b82a9aea5 Doc: add note about unsupported platforms for QProcess
Task-number: QTBUG-57840
Change-Id: I46a26a9c4c6ad0aa6994945091a2904c3b51080f
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-01-04 07:20:06 +00:00
Ulf Hermann
c96a4058f1 Avoid compile warnings in qabstractanimation.cpp
Change-Id: I57f90fc335b50231fb2093f096ad38168d476145
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-01-03 16:29:07 +00:00
Jędrzej Nowacki
5d4089299a Reduce size of QPpsObject by one pointer
Change-Id: Ibb1bef375e7d23b45595ca759646883820643f02
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-01-03 15:27:01 +00:00
Frederik Schwarzer
1c3c2486c6 Fix broken link in documentation
Task-number: QTBUG-57530
Change-Id: Iecb1a26f6b8a7e8a506d768668cde1c277d15dde
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-01-03 15:08:20 +00:00
Thiago Macieira
39e80062d0 Work around MSVC ABI stupidity in exporting inline members of base class
In this case, the issue was ICC, when compiling QtQml:

qv4sequenceobject.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QList<class QItemSelectionRange>::replace(int,class QItemSelectionRange const &)" (__imp_?replace@?$QList@VQItemSelectionRange@@@@QEAAXHAEBVQItemSelectionRange@@@Z)
  referenced in function "public: static bool __cdecl QV4::QQmlSequence<class QItemSelection>::deleteIndexedProperty(struct QV4::Managed *,unsigned int)" (?deleteIndexedProperty@?$QQmlSequence@VQItemSelection@@@QV4@@SA_NPEAUManaged@2@I@Z)

This applies the same fix as qvector.h has had for ages due to QPolygon.

Change-Id: I15b62e0f9cec482fbb40fffd1490d791db5056bc
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-03 15:01:32 +00:00
David Faure
a8ae8e3130 QDateTime::fromString(): improve performance by 33%
getMaximum() and getMinimum(), called during parsing, create new
QDateTime instances, which on Linux end up calling mktime().
Making these static (for the common case of LocalTime spec)
improves performance dramatically, when parsing several date/times.

tests/benchmarks/corelib/tools/qdatetime/ (after fixing it to
actually parse a valid date/time) says:
 RESULT : tst_QDateTime::fromString():
-     36,742,060 instruction reads per iteration (total: 36,742,060, iterations: 1)
+     24,230,060 instruction reads per iteration (total: 24,230,060, iterations: 1)

Change-Id: I0c3931285475bf19a5be8cba1486ed07cbf5e134
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-03 13:37:49 +00:00
Simon Hausmann
79bf4e8f1c Added QSaveFile to the bootstrap library
It's quite a simple addition and required for the ahead of time compilation
tool for qtdeclarative.

Change-Id: Iba85ae5182919cdb5ab15a0b643e57c103eae632
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-02 12:51:37 +00:00
Daniel Vrátil
c7f0e3ebc2 Use qGetPtrHelper in Q_DECLARE_PRIVATE_D macro
This allows the Dptr parameter of the Q_DECLARE_PRIVATE_D macro to be
a smart pointer, not just a raw pointer.

Change-Id: Iaf27352e327e9aedea149461d47f2f11460a42dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-30 11:07:15 +00:00
Thiago Macieira
69ce68cb89 Doc: add a quick note about unfixed Windows encoding bug
Task-number: QTBUG-49640
Change-Id: Icb0289e3118a41dd9438fffd1492925b03de62d6
Reviewed-by: David Faure <david.faure@kdab.com>
2016-12-28 14:56:01 +00:00
Kavindra Palaraja
a89c392097 Link QVariant class documentation to the Creating Custom Qt Types article
The article does answer the questions asked in the bug.

Task-number: QTBUG-56629
Change-Id: Ib8bac0acf45bc10598fc47feb6dd73005b5ad040
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-28 13:31:45 +00:00
Thiago Macieira
d908ba2765 Remove HarryF's "compiler error feature" that isn't used anymore
The "qYouForgotTheQ_OBJECT_Macro" function hasn't been used in
qobject_cast since commit 7d7e8ae3fa (Qt
5.2), when Olivier made the error use Q_STATIC_ASSERT instead.

Change-Id: I15b62e0f9cec482fbb40fffd1490d7c050084369
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-12-28 12:43:53 +00:00
Thiago Macieira
dc6b73390b Revert "QUrl::resolved: keep treating file:name.txt as relative for now"
This reverts commit 91a2c8630b. We
promised in the Qt 5.6.2 changelog to do it in Qt 5.8. It was a
temporary compatibility hack.

[ChangeLog][QtCore][QUrl] The temporary compatibility in
QUrl::resolved() that treated the base URL as relative if its scheme
matched the current URL's scheme has been removed.

Change-Id: I3e4e5051937c40319d6efffd1490eb9a5a948481
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-12-28 12:43:50 +00:00
Kavindra Palaraja
2be9880ebb Removed random notes in the documentation that should not be there
Two sentences that read like author notes likely added by accident.

Task-number: QTBUG-56630
Change-Id: I7a0b114e128f95e54e9e8f26b43493f67747d650
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-12-28 12:00:44 +00:00
David Faure
6722147696 QMimeDatabase: fix handling of conflicting globs
This code always intended to follow the recommended checking order from
the spec, which says "if multiple globs match, use file contents".
But if the globs had different weights, it would discard globs with
lower weights, and then wrongly conclude, if there is only one glob
left, that there was no ambiguity.

The correct way is rather: remember that multiple globs matched,
do determination from contents, and if that didn't work, *then* use
(one of) the highest-weight glob(s).

This fixes PGP-encrypted *.asc files being detected as text/plain rather
than application/pgp-encrypted.
(https://bugs.kde.org/show_bug.cgi?id=346754)

Change-Id: I734459daf9f502baa95ebb89432819964e0ce304
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-27 11:33:03 +00:00