Commit Graph

51243 Commits

Author SHA1 Message Date
Giuseppe D'Angelo
5656a60dd0 QList::(const_)iterator: protect element_type on GCC < 11
GCC 10 in C++20 mode will still try to use
std::indirectly_readable_traits on QList iterators, and since it
does not have the fixes for LWG 3346 / 3541, it will fail to build:

    /usr/include/c++/10/bits/iterator_concepts.h: In substitution of ‘template<class _Tp> using __iter_value_t = typename std::__detail::__iter_traits_impl<_Tp, std::indirectly_readable_traits<_Iter> >::type::value_type [with _Tp = QList<std::pair<int, int> >::const_iterator]’:
    /usr/include/c++/10/bits/iterator_concepts.h:248:11:   required by substitution of ‘template<class _Tp> using iter_value_t = std::__detail::__iter_value_t<typename std::remove_cv<typename std::remove_reference<_Tp>::type>::type> [with _Tp = QList<std::pair<int, int> >::const_iterator]’
    /usr/include/c++/10/bits/iterator_concepts.h:468:11:   required from ‘class std::reverse_iterator<QList<std::pair<int, int> >::const_iterator>’
    ../src/corelib/itemmodels/qsortfilterproxymodel.cpp:669:43:   required from here
    /usr/include/c++/10/bits/iterator_concepts.h:243:13: error: ambiguous template instantiation for ‘struct std::indirectly_readable_traits<QList<std::pair<int, int> >::const_iterator>’
      243 |       using __iter_value_t = typename
          |             ^~~~~~~~~~~~~~
    /usr/include/c++/10/bits/iterator_concepts.h:231:12: note: candidates are: ‘template<class _Tp>  requires requires{typename _Tp::value_type;} struct std::indirectly_readable_traits<_Iter> [with _Tp = QList<std::pair<int, int> >::const_iterator]’
      231 |     struct indirectly_readable_traits<_Tp>
          |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/c++/10/bits/iterator_concepts.h:236:12: note:                 ‘template<class _Tp>  requires requires{typename _Tp::element_type;} struct std::indirectly_readable_traits<_Iter> [with _Tp = QList<std::pair<int, int> >::const_iterator]’
      236 |     struct indirectly_readable_traits<_Tp>
          |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So hide element_type as well.

The CI didn't catch this because the CI doesn't build in C++20 mode.

Amends 595b4e1a9b.

Change-Id: I5c8e47d693ca584571cd89f856d08ba249dd05ab
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-16 16:49:28 +02:00
Giuseppe D'Angelo
b322bfcc14 QString: add missing char8_t* constructor / fromUtf8 overloads
Currently we support:

  QString s = QString::fromUtf(u8"foo", 3);

But we don't support

  QString s = QString::fromUtf8(u8"foo");
  QString s(u8"foo");

There's no reason not to have these two functions. Guess what,
we've actually got code _in Qt_ that tries to build a QString out of
a char8_t; that code stops compiling under C++20 (which is supported,
but not CI-tested at the moment, it seems).

Re-add the missing constructor and fromUtf8 overloads.

[ChangeLog][QtCore][QString] Added a constructor and a fromUtf8()
overload taking a `const char8_t *` argument.

Task-number: QTQAINFRA-4117
Task-number: QTQAINFRA-4242
Change-Id: I1f0ae658b3490b9e092941cabcc7fb8fc4c51aa3
Pick-to: 6.1.0 6.1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-04-16 16:49:28 +02:00
Giuseppe D'Angelo
8546e017c0 util/unicode: enable asserts unconditionally
If one "accidentally" uses a release build of the unicode tool,
the asserts within it won't fire. Enable them in all cases.

Change-Id: I9d63641dc6d6d2e5805b61b36f8c28e624b25e12
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-04-16 16:49:28 +02:00
Edward Welbourne
aeeaab1a5a Fix handling of surrogates in QBidiAlgorithm
Prior code was naively assuming the character after a high surrogate
would necessarily be a low surrogate, which is buggy.
Fixes oss-fuzz issue 29718.

Pick-to: 6.0 6.1 5.15
Change-Id: I10f023c4b5024a0d76fea0a3672001063591ec6d
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-04-16 15:49:28 +01:00
Ulf Hermann
57850f9d6d Switch metatypes generation on by default for Qt modules
We need the metatypes for anything directly or indirectly exposed to
QML. Switching this on has no runtime overhead. For interface libraries
we cannot generate any metatypes, though.

Change-Id: I7b7f85bb4e16c28d00383c5c88b0f1c172c8d193
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-04-16 16:49:28 +02:00
Qt CI Bot
07d4a981a2 Merge integration refs/builds/qtci/dev/1618561273 2021-04-16 14:49:26 +00:00
Allan Sandfeld Jensen
38e111158a Don't parse XML symbols longer than 4096 characters
It is slow and will use too much memory.

Pick-to: 6.1 6.1.0 6.0 5.15
Fixes: QTBUG-91889
Change-Id: I45c5e6038357c87bbb85b1ace17ef39a2a814ea0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-16 10:08:32 +00:00
Ivan Solovev
930e59b798 QTest: add helper methods to test bindable properties
This patch adds helper methods to test bindable properties in the QTest
lib. These methods can be useful in many Qt modules, so we decided to
have them in qtbase.
For now they are in the private header, because we are not sure that
they can be useful for the end users.

Task-number: QTBUG-89874
Change-Id: I6738728df1bcd895758008ef2ade0d3693802c3e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-04-16 12:08:32 +02:00
Qt CI Bot
7e15d57eb4 Merge integration refs/builds/qtci/dev/1618515869 2021-04-16 10:08:31 +00:00
Mårten Nordheim
54730b31fa QNetworkDiskCache: Switch to unique_ptr in most cases
Because take() is deprecated, and these pointers are meant to leave the
scope in some branches.

Pick-to: 6.1
Change-Id: I5432d91a28f4c5c8c17fadf7ce3bcd41716e216a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-04-16 11:00:08 +02:00
Mårten Nordheim
c254d73be6 QNetworkDiskCache: Drop the file mmap-ing
Presumably the code at some point would do a
QByteArray::fromRawData-style thing. But now it doesn't do that so
the current code was a bit strange. It would map the content of the file
to memory only to then copy the content into a QByteArray. Then it
reparents the file to the QBuffer, keeping it alive even if its not
needed.

Fixes: QTBUG-92838
Pick-to: 6.1 6.0 5.15
Change-Id: I88f8cd1b64e0fd13d08b5cc4df44661e216da340
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-04-16 11:00:05 +02:00
Edward Welbourne
d4242b8af3 Revise deprecation of countriesForLanguage()
It was originally marked \obsolete without any comment on what was to
be used to replace it, or deprecation markings in the declaration, so
it got missed at 6.0. More recently it's been deprecated in favor of a
territory-based name; but actually it was obsoleted by (iterating the
territory() of each return from) matchingLocales() in Qt 4.8.

So back out of adding territoriesForLanguage to replace it and,
instead, mark it as deprecated in the declaration, in favor of
matchingLocales(). Also rewrite the implementation to be exactly that
replacement. Rewrote the one example using it.

Fixes: QTBUG-92484
Change-Id: Iedaf30378446dd9adac5128b7ee5fee48aab1636
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-16 10:23:23 +02:00
Edward Welbourne
530e0bd469 Use QTimeZone to determine offsets outside the system-function range
Follow up on some comments saying "TODO Use QTimeZone when available"
in converting times, outside the range supported by the system's
time_t functions, between local or zone time and UTC.  Since this
required two formerly static functions in qdatetime.cpp to access
QTimeZone's d-ptr, turn those into methods of QTZ's friend QDTPrivate.

Change-Id: I27fe03d8eff9f4e98661263b1a1d4d830f4e7459
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-04-16 10:22:35 +02:00
Edward Welbourne
b4a875544b Extend time_t-based handling all the way to the end of time_t
At least some modern 64-bit systems have widened time_t to 64 bits
fixing the "Unix time" problem. (This is even the default on MS-Win,
although the system functions artificially limit the accepted range to
1970 through 3000.) Even the 32-bit range extends into January 2038
but the code was artificially cutting this off at the end of 2037.
This is a preparation for using the same also all the way back to the
start of time_t.

In the process, simplify and tidy up the logic of the existing code,
update the docs (this includes correcting some misinformation) and
revise some tests.

Fixes: QTBUG-73225
Change-Id: Ib8001b5a982386c747eda3dea2b5a26eedd499ad
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-16 10:22:27 +02:00
Edward Welbourne
c3aa4cf952 Catch invalid offset returns from QTimeZone backends
If the backends run into an error in computing the offset, they return
INT_MIN; but they are valled via the front-end, which returns zero
when the zone is invalid. So treat INT_MIN returns from the backend
the same as the case of being invalid.

Change-Id: Ic3c4dfe964dbfba4030c770213eca8a63e84736d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-16 10:20:11 +02:00
Qt CI Bot
455994c2ee Merge integration refs/builds/qtci/dev/1618512247 2021-04-16 07:57:01 +00:00
Qt CI Bot
8f6c93b645 Merge integration refs/builds/qtci/dev/1618489823 2021-04-15 21:27:52 +00:00
Alex Trotsenko
063cdb9870 QWindowsPipe{Reader|Writer}: restructure signals
For QProcess, there is no point in suppressing recursive
QWPR::readyRead() emission, as the former manages this logic itself. On
top of that, the non-recursive nature of QWPR::readyRead() indirectly
disallowed reading from the channels inside
QProcess::waitForReadyRead(), if that is called from a slot connected
to QProcess::readyRead().

QWPW had two signals, one allowing recursion and one not.

This commit allows recursion of QWPR::readyRead() and
QWPW::bytesWritten(), and moves recursion suppression to the higher-
level classes. This makes the code more uniform and efficient, at the
cost of a few duplicated lines.

Change-Id: Ib20017fff4d92403d0bf2335f1622de4aa1ddcef
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-04-15 19:00:42 +00:00
Joerg Bornemann
d437a0bfca Remove Qt dependency from some test helper executables
pro2cmake did not take into account the
   QT -= qt
bit of the .pro files.

Fixes: QTBUG-91676
Change-Id: If1373ee966312e4246490bd7389d75be9fa739cb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-15 20:38:44 +02:00
Qt CI Bot
92d351089b Merge integration refs/builds/qtci/dev/1618486203 2021-04-15 18:29:29 +00:00
Qt CI Bot
d52a57760f Merge integration refs/builds/qtci/dev/1618471711 2021-04-15 14:58:54 +00:00
Alexandru Croitor
6cefc83875 CMake: Don't consider /opt/homebrew as a system path for arm64 macOS
Homebrew introduced a new default prefix for Apple Silicon machines,
so that both arm64 and x86_64 packages can be co-installed on a single
system.
The intel packages are installed into /usr/local and the arm64
packages are installed into /opt/homebrew.

For Qt building purposes, we don't want to find packages in any of
homebrew's prefixes unless explicitly requested by the user

Currently our arm64 macOS CI config does pick up system libs under new
prefix.
Remove the new path from the system prefixes.

Amends f3c7d22dd0

Task-number: QTBUG-85447
Change-Id: I381d31c95bcdab26147a331444ba40c7af9d0a95
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-04-15 14:24:59 +02:00
Alexandru Croitor
9471febddf CMake: Use PROJECT_VERSION for generated QtModule.json files
So that the correct version is generated in top-level builds.

Change-Id: I360370815ce178564cc79157dc61d70adfd4f947
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-04-15 14:23:11 +02:00
Edward Welbourne
cbb4c59c38 Make QLocale documentation more honest
Documented the fall-back process by which QLocale selects an actual
locale based on what it is asked for. The prior documentation was
wrong.

In the process, removed some out-of-date claims about QString's
toInt() and toDouble() caring about the default locale; and caught a
few more cases (in \internal docs) of country -> territory.

Fixes: QTBUG-90962
Change-Id: I5e7cfa66443c9335a71fb2048c3f2ebf7af64573
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-15 14:18:01 +02:00
Edward Welbourne
fad730b164 Make script and territory optional in QLocale constructors
Previously the (language, territory) constructor had optional
territory; however, the (language, script, territory) one required all
three. Making the latter's script and territory optional, while
requiring the former to pass territory, makes it possible to construct
with (language), with (language, territory), with (language, script)
or with (language, script, territory), without (overt) use of AnyScrit
or AnyTerritory.

Change-Id: Iaf6e46c473042d886eee7068515f9e41a704c2e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-15 14:17:56 +02:00
JiDe Zhang
50a7eb8cf7 Add the "Territory" enumerated type for QLocale
The use of "Country" is misleading as some entries in the enumeration
are not countries (eg, HongKong), for all that most are. The Unicode
Consortium's Common Locale Data Repository (CLDR, from which QLocale's
data is taken) calls these territories, so introduce territory-based
names and prepare to deprecate the country-based ones in due course.

[ChangeLog][QtCore][QLocale] QLocale now has Territory as an alias for
its Country enumeration, and associated territory-based names to match
its country-named methods, to better match the usage in relevant
standards. The country-based names shall in due course be deprecated
in favor of the territory-based names.

Fixes: QTBUG-91686
Change-Id: Ia1ae1ad7323867016186fb775c9600cd5113aa42
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-15 20:17:49 +08:00
Tasuku Suzuki
7c8d45cb26 Fix build without features.settings
Change-Id: Id13980fd5124afe1ee2d378590eb7a4e11b7a4fb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-04-15 20:42:50 +09:00
Alexandru Croitor
cf27a23937 CMake: pro2cmake: Use latest project version for qml import version
Use PROJECT_VERSION instead of CMAKE_PROJECT_VERSION when setting the
version of a qml module, which extracts the version of the latest
project() call rather than the top-level one.

Using CMAKE_PROJECT_VERSION caused issues in top-level builds where
the qtdeclarative version is 6.2, but the top-level project version is
still 6.1 and hasn't been updated to 6.2, causing qml module import
errors.

This was probably an oversight during initial implementation of qml
support in pro2cmake.
So projects that define qml modules should be adapted accordingly.

Amends cce8ada814
Amends 28fff4a551

Pick-to: 6.1 6.0
Task-number: QTBUG-92861
Change-Id: I494784694e997501a5bc4fd0c0eac458ddc248aa
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-04-15 13:27:23 +02:00
Qt CI Bot
e7bdf7273c Merge integration refs/builds/qtci/dev/1618460978 2021-04-15 08:38:34 +00:00
Alexey Edelev
9cd7d83069 Check if all required Qt targets are declared when finalizing the module
CMake makes possible to specify a target in the target_link_library
call even if the target is not declared yet. This adds flexibility to
the target declaration arrangement. For the Qt modules we have to
restrict freedom, because of the .prl files generating. If the Qt
module depends on another Qt module, the dependecy must be declared
before the module finalizing step, otherwise this will cause invalid
records in the module .prl file.

TODO: The dependency order issue could be solved by using conditional
genex's when generating step1 .prl file. But we ask developers to
depend on Qt module targets that have been defined before their usage.

Fixes: QTBUG-89467
Change-Id: I12ce1000048fd4a2f3334f17720c8df1c680ca20
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-15 09:27:23 +02:00
Qt CI Bot
33e098704e Merge integration refs/builds/qtci/dev/1618451439 2021-04-15 04:58:02 +00:00
Qt CI Bot
cb3db09617 Merge integration refs/builds/qtci/dev/1618447824 2021-04-15 04:30:18 +00:00
Tasuku Suzuki
35886002d8 Fix build without features.textedit
Change-Id: I3702137451bd5022c454645b1198d63843778214
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-04-15 13:28:19 +09:00
Qt CI Bot
3556b2f753 Merge integration refs/builds/qtci/dev/1618441870 2021-04-15 03:12:49 +00:00
Zhang Hao
78c4d0c48f Add new enum value VisualTabCharacter into QChar
With this enumeration value, users can get the width of
the current font TAB character more conveniently

In addition, added some documentation about where
users may use this enumeration.

Fixes: QTBUG-92205
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Change-Id: I9794b7553e9299e351f9182de02866d07a1393fc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-04-15 01:43:46 +00:00
Tasuku Suzuki
d3638e18d3 Fix build without features.thread
Change-Id: I233808be77dbf1930ebf65b6f23298414eab1da7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-04-15 09:48:59 +09:00
Giuseppe D'Angelo
86ad338aa4 Q{*String,ByteArray}View::length(): use qsizetype, not int
Looks like these ones have been forgotten in the Qt 5 -> 6 upgrade
to qsizetype. Change them to return qsizetype as well,
and fix the docs. Being entirely inline, non-exported classes, we
should be able to get away with it without affecting binary
compatibility. Moreover, there's no reason for keeping them
deprecated.

Requires some minor adjustments, just like the ones done for
size()'s changes.

[ChangeLog][QtCore][QStringView] The length() function
now returns `qsizetype`, not `int`, for consistency with the
other string and container classes in Qt. Following this
change, it has been un-deprecated.

[ChangeLog][QtCore][QAnyStringView] The length() function
now returns `qsizetype`, not `int`, for consistency with the
other string and container classes in Qt. Following this
change, it has been un-deprecated.

[ChangeLog][QtCore][QUtf8StringView] The length() function
now returns `qsizetype`, not `int`, for consistency with the
other string and container classes in Qt. Following this
change, it has been un-deprecated.

[ChangeLog][QtCore][QByteArrayView] The length() function
now returns `qsizetype`, not `int`, for consistency with the
other string and container classes in Qt. Following this
change, it has been un-deprecated.

Fixes: QTBUG-92496
Change-Id: Ie0f4939d1083884e95d4725f891b6c6764532cb8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-04-15 01:09:44 +02:00
Alexandru Croitor
ed5543475e CMake: Fix hardcoded iOS SDK when finding OpenGLES
The find script checked for UIKIT which is set during a Qt build
in QtPlaformSupport.cmake but is not set when building a user project.
This casused the find script to skip the iOS specific code that
passed the -framework OpenGLES linker flag.

This broke SDK switching in Xcode.

Check the IOS variable instead which is set by CMake for all projects
that pass -DCMAKE_SYSTEM_NAME=iOS.

Pick-to: 6.1
Change-Id: I9bd088f317917544ccfeff61fc4ff90f18f0f3d8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-04-15 00:07:51 +02:00
Qt CI Bot
1d59fe368a Merge integration refs/builds/qtci/dev/1618405176 2021-04-14 16:39:38 +00:00
Qt CI Bot
5341569b41 Merge integration refs/builds/qtci/dev/1618401544 2021-04-14 15:08:32 +00:00
Qt CI Bot
fb0fcd7fe3 Merge integration refs/builds/qtci/dev/1618397939 2021-04-14 14:29:23 +00:00
Qt CI Bot
3766cd6ff5 Merge integration refs/builds/qtci/dev/1618392398 2021-04-14 13:33:24 +00:00
Volker Hilsheimer
1d3fe418e2 Replace deprecated APIs in metatype/variant benchmarks
Fix compiler warnings.

Change-Id: Id09b414f530a0d35c1a79e32112ff59185be2bc3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-14 14:38:42 +02:00
Assam Boudjelthia
1359238572 Replace conversion operator by operator* in QJniEnvironment
Since conversion operators do implicit conversion that might bring
some potential issues while using the API, let's stick to having
an operator* instead.

Pick-to: 6.1 6.1.0
Change-Id: Ie7ad5537958944b8d1c11d69fbd30284b4b0344d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-04-14 12:38:20 +00:00
Allan Sandfeld Jensen
004189b2d8 Fix partial pixel coverage calculation
We want right - left, but the numbers we have are (1 - left) and right,
so we need right - (1 - left) = right + left - 1.

Pick-to: 6.1 6.0
Fixes: QTBUG-91957
Fixes: QTBUG-92485
Change-Id: I238cbbe1eebddff1ce56da38127899cdbd21db0e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-04-14 14:28:54 +02:00
Eirik Aavitsland
f4d791b330 Avoid processing-intensive painting of high number of tiny dashes
When stroking a dashed path, an unnecessary amount of processing would
be spent if there is a huge number of dashes visible, e.g. because of
scaling. Since the dashes are too small to be indivdually visible
anyway, just replace with a semi-transparent solid line for such
cases.

Pick-to: 6.1 6.0 5.15
Change-Id: I9e9f7861257ad5bce46a0cf113d1a9d7824911e6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-04-14 13:52:37 +02:00
Mårten Nordheim
a7dac8e35b QNetworkCookie: Rename sameSite to sameSitePolicy
As suggested in the API review.
Amends 37bd7b5733

Pick-to: 6.1 6.1.0
Change-Id: Ic3e8567f349568dc3b4dbf79be27c304b39480cf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-04-14 13:44:26 +02:00
Alexandru Croitor
e379147f95 CMake: Fix default architecture selection for macOS and iOS
Before this change, we created a CMake toolchain file for iOS and
macOS universal which propagated the initially configured
CMAKE_OSX_ARCHITECTURES values to user projects.

So if Qt was configured with 2 arches, configuring a CMake user
project using the generated toolchain file would also build the
user project targeting those 2 arches.

The reason for this that the same toolchain file is used for
configuring both Qt and users projects and we needed to ensure that
other Qt repos are built with the same set of arches. That
unfortunately led the multiple arches to carry over into user
projects.
This is different from qmake behavior which configured user projects
with 1 arch only.

Instead of the toolchain file explicitly setting
CMAKE_OSX_ARCHITECTURES for all projects, save the initial list of
arches into QT_OSX_ARCHITECTURES.
Then if the toolchain file detects that we're building a Qt repo (by
checking for the presence of QT_REPO_MODULE_VERSION) set
CMAKE_OSX_ARCHITECTURES to QT_OSX_ARCHITECTURES to propagate the
initial list of arches.

For user projects we want to have some sensible defaults.
For macOS projects, leave the decision of the architecture to build
to CMake.
For iOS Xcode projects, leave the decision to Xcode.
For iOS Ninja projects, set the architecture to the first value of the
architectures used when configuring Qt.

As a side note this fixes an issue in our CI where we configured macOS
Qt with 2 architectures and then tried to run CMake build tests for
both architectures on a machine that doesn't have the universal SDK.
This led to build failures.
Because the CMake build tests act as regular user projects, now they
are configured with a single architecture that is automtically
detected by CMake.

Pick-to: 6.1
Task-number: QTBUG-85447
Change-Id: Id1b7e78d7e67c1796efed10751416e5f857c16d2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-04-14 13:38:31 +02:00
Edward Welbourne
964f91fd25 Make POSIX transition rule parser more robust
The POSIX rule parser used by QTzTimeZonePrivate recklessly assumed
that, if splitting the rule on a dot produced more than one part, it
necessarily produced at least three. That's true for well-formed POSIX
rules, but we should catch the case of malformed rules.

Likewise, when calculating the dates of transitions, splitting the
date rule on dots might produce too few fragments; and the fragments
might not parse as valid numbers, or might be out of range for their
respective fields in a date. Check all these cases, too.

Added a test that crashed previously. Changed
QTimeZone::offsetFromUtc() so that its "return zero on invalid"
applies also to the case where the backend returns invalid, in
support of this.

Fixes: QTBUG-92808
Pick-to: 6.1 6.1.0 6.0 5.15
Change-Id: Ica383a7a987465483341bdef8dcfd42edb6b43d6
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
2021-04-14 12:57:30 +02:00
Qt CI Bot
b7a3aa39e7 Merge integration refs/builds/qtci/dev/1618388786 2021-04-14 10:52:21 +00:00