From 02b3d43fd4661271e6e8dc8940d84cb2ba352fe0 Mon Sep 17 00:00:00 2001 From: Luca Beldi Date: Wed, 22 Aug 2018 08:21:01 +0100 Subject: [PATCH 01/18] _q_interpolate is unsafe with unsigned template arguments _q_interpolate subtracts 2 arguments of type T, for unsigned types this can cause wrapping around Task-number: QTBUG-57925 Change-Id: Iffa59f413579a3d5de8cb728fe71443d8e8a04aa Reviewed-by: Giuseppe D'Angelo --- src/corelib/animation/qvariantanimation_p.h | 14 ++++++++++- .../tst_qvariantanimation.cpp | 25 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h index 37318a5339..9f0f2e3030 100644 --- a/src/corelib/animation/qvariantanimation_p.h +++ b/src/corelib/animation/qvariantanimation_p.h @@ -58,6 +58,8 @@ #include "private/qabstractanimation_p.h" +#include + #ifndef QT_NO_ANIMATION QT_BEGIN_NAMESPACE @@ -104,7 +106,17 @@ public: }; //this should make the interpolation faster -template inline T _q_interpolate(const T &f, const T &t, qreal progress) +template +typename std::enable_if::value, T>::type +_q_interpolate(const T &f, const T &t, qreal progress) +{ + return T(f + t * progress - f * progress); +} + +// the below will apply also to all non-arithmetic types +template +typename std::enable_if::value, T>::type +_q_interpolate(const T &f, const T &t, qreal progress) { return T(f + (t - f) * progress); } diff --git a/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp b/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp index 00962afa72..ac20fb35ec 100644 --- a/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp +++ b/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp @@ -43,6 +43,7 @@ private slots: void keyValueAt(); void keyValues(); void duration(); + void interpolation(); }; class TestableQVariantAnimation : public QVariantAnimation @@ -129,6 +130,30 @@ void tst_QVariantAnimation::duration() QCOMPARE(anim.duration(), 500); } +void tst_QVariantAnimation::interpolation() +{ + QVariantAnimation unsignedAnim; + unsignedAnim.setStartValue(100u); + unsignedAnim.setEndValue(0u); + unsignedAnim.setDuration(100); + unsignedAnim.setCurrentTime(50); + QCOMPARE(unsignedAnim.currentValue().toUInt(), 50u); + + QVariantAnimation signedAnim; + signedAnim.setStartValue(100); + signedAnim.setEndValue(0); + signedAnim.setDuration(100); + signedAnim.setCurrentTime(50); + QCOMPARE(signedAnim.currentValue().toInt(), 50); + + QVariantAnimation pointAnim; + pointAnim.setStartValue(QPoint(100, 100)); + pointAnim.setEndValue(QPoint(0, 0)); + pointAnim.setDuration(100); + pointAnim.setCurrentTime(50); + QCOMPARE(pointAnim.currentValue().toPoint(), QPoint(50, 50)); +} + QTEST_MAIN(tst_QVariantAnimation) #include "tst_qvariantanimation.moc" From 972dd1c54484179ef0213598e85da981a7d7601f Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 21 Aug 2018 14:52:24 +0200 Subject: [PATCH 02/18] Doc: fix typo in QNativeGestureEvent docs Change-Id: I83ac3463752488d7dbb758ea767ba186ddd3fa2a Reviewed-by: Friedemann Kleint --- src/gui/kernel/qevent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index adc83302cf..4207697c01 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2750,7 +2750,7 @@ Qt::MouseButtons QTabletEvent::buttons() const \header \li Event Type \li Description - \li Touch equence + \li Touch sequence \row \li Qt::ZoomNativeGesture \li Magnification delta in percent. From dc7e775c9c6ecc66f76af8139b8dfc3ee101c7ff Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 22 Aug 2018 20:30:57 +0200 Subject: [PATCH 03/18] Test for fractional part of Costa Rican currency CLDR up to somewhere between v29 (used by 5.9) and v31.0.1 (used by 5.10 and later) claimed Costa Ricans don't include fractions in their currency; now it claims they expec two digits. Apparently one of them does expect those digits, so this is the regression test I'll be cherry-picking back to LTS, to accompany the CLDR updates they need. Task-number: QTBUG-70093 Change-Id: I138772cc6013fa74de4f7c54b836cac83421eab2 Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 4131c44c84..b7cb8a1bdc 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -2385,6 +2385,10 @@ void tst_QLocale::currency() QCOMPARE(de_DE.toCurrencyString(double(-1234.56)), QString::fromUtf8("-1.234,56\xc2\xa0\xe2\x82\xac")); QCOMPARE(de_DE.toCurrencyString(double(-1234.56), QLatin1String("BAZ")), QString::fromUtf8("-1.234,56\xc2\xa0" "BAZ")); + const QLocale es_CR(QLocale::Spanish, QLocale::CostaRica); + QCOMPARE(es_CR.toCurrencyString(double(1565.25)), + QString::fromUtf8("\xE2\x82\xA1" "1\xC2\xA0" "565,25")); + const QLocale system = QLocale::system(); QVERIFY(system.toCurrencyString(1, QLatin1String("FOO")).contains(QLatin1String("FOO"))); } From 8a270dee2b8c06e734247b18533564b997923c06 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 24 Aug 2018 11:46:20 +0200 Subject: [PATCH 04/18] Revert "Fix time-zone tests on macOS >= 10.13, which now knows what CET is" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit fd38c97a6c5b7bfab39b5f814d68a02e4d197e70. Apparently our actual VMs for 10.13 don't get this right, although the ones used in testing did (prompting the fix this reverts). We probably have mis-configured VMs, but this is the quick-fix to get development moving again. Task-number: QTBUG-70149 Change-Id: Ib96755d8e21d9b226e22fc985f13f34fa04117b1 Reviewed-by: Mårten Nordheim --- .../corelib/tools/qdatetime/tst_qdatetime.cpp | 16 ++++++++-------- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index c0b7674f22..d460beafde 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -2726,15 +2726,15 @@ void tst_QDateTime::timeZoneAbbreviation() qDebug("(Skipped some CET-only tests)"); } - QString cet(QStringLiteral("CET")), cest(QStringLiteral("CEST")); #ifdef Q_OS_ANDROID // Only reports (general) zones as offsets (QTBUG-68837) - cet = QStringLiteral("GMT+01:00"); - cest = QStringLiteral("GMT+02:00"); -#elif defined Q_OS_DARWIN // Lacked real names until 10.13, High Sierra - if (QOperatingSystemVersion::current() < QOperatingSystemVersion::MacOSHighSierra) { - cet = QStringLiteral("GMT+1"); - cest = QStringLiteral("GMT+2"); - } + const QString cet(QStringLiteral("GMT+01:00")); + const QString cest(QStringLiteral("GMT+02:00")); +#elif defined Q_OS_DARWIN + const QString cet(QStringLiteral("GMT+1")); + const QString cest(QStringLiteral("GMT+2")); +#else + const QString cet(QStringLiteral("CET")); + const QString cest(QStringLiteral("CEST")); #endif QDateTime dt5(QDate(2013, 1, 1), QTime(0, 0, 0), QTimeZone("Europe/Berlin")); diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 9e9ba03a60..130ac4ce59 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -1623,15 +1623,15 @@ void tst_QLocale::formatTimeZone() qDebug("(Skipped some CET-only tests)"); } - QString cet(QStringLiteral("CET")), cest(QStringLiteral("CEST")); #ifdef Q_OS_ANDROID // Only reports (general) zones as offsets (QTBUG-68837) - cet = QStringLiteral("GMT+01:00"); - cest = QStringLiteral("GMT+02:00"); -#elif defined Q_OS_DARWIN // Lacked real names until 10.13, High Sierra - if (QOperatingSystemVersion::current() < QOperatingSystemVersion::MacOSHighSierra) { - cet = QStringLiteral("GMT+1"); - cest = QStringLiteral("GMT+2"); - } + const QString cet(QStringLiteral("GMT+01:00")); + const QString cest(QStringLiteral("GMT+02:00")); +#elif defined Q_OS_DARWIN + const QString cet(QStringLiteral("GMT+1")); + const QString cest(QStringLiteral("GMT+2")); +#else + const QString cet(QStringLiteral("CET")); + const QString cest(QStringLiteral("CEST")); #endif QDateTime dt6(QDate(2013, 1, 1), QTime(0, 0, 0), QTimeZone("Europe/Berlin")); From 10e468b32aab9d221aadc819a3241db43608b5a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 23 Aug 2018 14:03:22 +0200 Subject: [PATCH 05/18] macOS: Bump deployment target (minimum supported version) to 10.12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As discussed earlier, we don't want to keep backwards compatibility for more than two versions in addition to the current macOS version. Change-Id: I24df6fb4a08e14a9f842d209b8e0a6079c533b65 Reviewed-by: Oswald Buddenhagen Reviewed-by: Morten Johan Sørvig --- mkspecs/common/macx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/common/macx.conf b/mkspecs/common/macx.conf index 810b94fc9e..8122a54d9d 100644 --- a/mkspecs/common/macx.conf +++ b/mkspecs/common/macx.conf @@ -5,7 +5,7 @@ QMAKE_PLATFORM += macos osx macx QMAKE_MAC_SDK = macosx -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11 +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.12 QMAKE_APPLE_DEVICE_ARCHS = x86_64 device.sdk = macosx From 286c2a0e09480219dd799614c421d420b7b75727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 23 Aug 2018 14:08:12 +0200 Subject: [PATCH 06/18] iOS/tvOS/watchOS: Bump deployment targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As planned, we only support the latest and previous release for these platforms, and by the time 5.12 is out these platforms will all have had new releases, so we should bump the deployment target now. Change-Id: Ibbb7d07bb5d9a1007ab37b88d75781be2c1f7075 Reviewed-by: Oswald Buddenhagen Reviewed-by: Morten Johan Sørvig --- mkspecs/macx-ios-clang/qmake.conf | 2 +- mkspecs/macx-tvos-clang/qmake.conf | 2 +- mkspecs/macx-watchos-clang/qmake.conf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mkspecs/macx-ios-clang/qmake.conf b/mkspecs/macx-ios-clang/qmake.conf index d58b9fcbe1..88e96ef32e 100644 --- a/mkspecs/macx-ios-clang/qmake.conf +++ b/mkspecs/macx-ios-clang/qmake.conf @@ -2,7 +2,7 @@ # qmake configuration for macx-ios-clang # -QMAKE_IOS_DEPLOYMENT_TARGET = 10.0 +QMAKE_IOS_DEPLOYMENT_TARGET = 11.0 # Universal target (iPhone and iPad) QMAKE_APPLE_TARGETED_DEVICE_FAMILY = 1,2 diff --git a/mkspecs/macx-tvos-clang/qmake.conf b/mkspecs/macx-tvos-clang/qmake.conf index ab1a95fe88..77f6a02f7b 100644 --- a/mkspecs/macx-tvos-clang/qmake.conf +++ b/mkspecs/macx-tvos-clang/qmake.conf @@ -2,7 +2,7 @@ # qmake configuration for macx-tvos-clang # -QMAKE_TVOS_DEPLOYMENT_TARGET = 10.0 +QMAKE_TVOS_DEPLOYMENT_TARGET = 11.0 QMAKE_APPLE_TARGETED_DEVICE_FAMILY = 3 diff --git a/mkspecs/macx-watchos-clang/qmake.conf b/mkspecs/macx-watchos-clang/qmake.conf index bd28722d44..8194261275 100644 --- a/mkspecs/macx-watchos-clang/qmake.conf +++ b/mkspecs/macx-watchos-clang/qmake.conf @@ -2,7 +2,7 @@ # qmake configuration for macx-watchos-clang # -QMAKE_WATCHOS_DEPLOYMENT_TARGET = 3.0 +QMAKE_WATCHOS_DEPLOYMENT_TARGET = 4.0 QMAKE_APPLE_TARGETED_DEVICE_FAMILY = 4 From 9dd9c6cae4b37d3bd14127f60d20e08a2f6b2808 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 24 Aug 2018 10:20:40 +0200 Subject: [PATCH 07/18] qthreadstorage.h: Fix syncqt warning about include path for qscopedpointer.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add QtCore, fixing: qthreadstorage.h includes qscopedpointer.h when it should include QtCore/qscopedpointer.h Amends 815153d4a453855bb528f0fa9cb7e5a77d589a11. Change-Id: I8424bc4d0b0d666dbd04d63530af4fbd27987628 Reviewed-by: Morten Johan Sørvig --- src/corelib/thread/qthreadstorage.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/thread/qthreadstorage.h b/src/corelib/thread/qthreadstorage.h index d556e33c57..55fc482da3 100644 --- a/src/corelib/thread/qthreadstorage.h +++ b/src/corelib/thread/qthreadstorage.h @@ -154,7 +154,7 @@ QT_END_NAMESPACE #else // !QT_CONFIG(thread) -#include +#include #include From 96c202e981346b9159fe9652676753d14a9dfaf4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 22 Aug 2018 14:29:56 +0200 Subject: [PATCH 08/18] Refactor tst_QFiledialog::clearLineEdit() The test had some shortcomings: - Flakyness due to not waiting for the file dialog list to be populated. - It assumed that the hardcoded directory name ____aaaa... always would show first in the list. This may not be true on Windows, where names like .designer show above. - On failure, the test directory would leak. This manifested in failures like: FAIL! : tst_QFiledialog::clearLineEdit() '(fd.directory().absolutePath() != QDir::home().absolutePath())' returned FALSE. () To fix this, use QTemporaryDir and introduce predicates that can be used to check whether the dialog has been populated and the right file/directory is selected by pressing cursor down. Use the temporary directory as not to pollute the home directory. Change-Id: Ic504b91325993dcd6099c99e125e7ed8ff1d7672 Reviewed-by: Qt CI Bot Reviewed-by: David Faure --- .../dialogs/qfiledialog/tst_qfiledialog.cpp | 92 +++++++++++++++---- 1 file changed, 76 insertions(+), 16 deletions(-) diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index eee649847f..ae8e4f7e04 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include #if defined QT_BUILD_INTERNAL #include @@ -1310,57 +1311,116 @@ void tst_QFiledialog::saveButtonText() QCOMPARE(button->text(), caption); } +// Predicate for use with QTRY_VERIFY() that checks whether the file dialog list +// has been populated (contains an entry). +class DirPopulatedPredicate +{ +public: + explicit DirPopulatedPredicate(QListView *list, const QString &needle) : + m_list(list), m_needle(needle) {} + + operator bool() const + { + const auto model = m_list->model(); + const auto root = m_list->rootIndex(); + for (int r = 0, count = model->rowCount(root); r < count; ++r) { + if (m_needle == model->index(r, 0, root).data(Qt::DisplayRole).toString()) + return true; + } + return false; + } + +private: + QListView *m_list; + QString m_needle; +}; + +// A predicate for use with QTRY_VERIFY() that ensures an entry of the file dialog +// list is selected by pressing cursor down. +class SelectDirTestPredicate +{ +public: + explicit SelectDirTestPredicate(QListView *list, const QString &needle) : + m_list(list), m_needle(needle) {} + + operator bool() const + { + if (m_needle == m_list->currentIndex().data(Qt::DisplayRole).toString()) + return true; + QCoreApplication::processEvents(); + QTest::keyClick(m_list, Qt::Key_Down); + return false; + } + +private: + QListView *m_list; + QString m_needle; +}; + void tst_QFiledialog::clearLineEdit() { - QFileDialog fd(0, "caption", "foo"); + // Play it really safe by creating a directory which should show first in + // a temporary dir + QTemporaryDir workDir(QDir::tempPath() + QLatin1String("/tst_qfd_clearXXXXXX")); + QVERIFY2(workDir.isValid(), qPrintable(workDir.errorString())); + const QString workDirPath = workDir.path(); + const QString dirName = QLatin1String("aaaaa"); + QVERIFY(QDir(workDirPath).mkdir(dirName)); + + QFileDialog fd(nullptr, + QLatin1String(QTest::currentTestFunction()) + QLatin1String(" AnyFile"), + "foo"); fd.setViewMode(QFileDialog::List); fd.setFileMode(QFileDialog::AnyFile); fd.show(); - //play it really safe by creating a directory - QDir::home().mkdir("_____aaaaaaaaaaaaaaaaaaaaaa"); - QLineEdit *lineEdit = fd.findChild("fileNameEdit"); QVERIFY(lineEdit); QCOMPARE(lineEdit->text(), QLatin1String("foo")); - fd.setDirectory(QDir::home()); QListView* list = fd.findChild("listView"); QVERIFY(list); - // saving a file the text shouldn't be cleared - fd.setDirectory(QDir::home()); + // When in AnyFile mode, lineEdit's text shouldn't be cleared when entering + // a directory by activating one in the list + fd.setDirectory(workDirPath); + DirPopulatedPredicate dirPopulated(list, dirName); + QTRY_VERIFY(dirPopulated); #ifdef QT_KEYPAD_NAVIGATION list->setEditFocus(true); #endif - QTest::keyClick(list, Qt::Key_Down); + + SelectDirTestPredicate selectTestDir(list, dirName); + QTRY_VERIFY(selectTestDir); + #ifndef Q_OS_MAC QTest::keyClick(list, Qt::Key_Return); #else QTest::keyClick(list, Qt::Key_O, Qt::ControlModifier); #endif - QTRY_VERIFY(fd.directory().absolutePath() != QDir::home().absolutePath()); + QTRY_VERIFY(fd.directory().absolutePath() != workDirPath); QVERIFY(!lineEdit->text().isEmpty()); - // selecting a dir the text should be cleared so one can just hit ok + // When in Directory mode, lineEdit's text should be cleared when entering + // a directory by activating one in the list so one can just hit ok // and it selects that directory fd.setFileMode(QFileDialog::Directory); - fd.setDirectory(QDir::home()); + fd.setWindowTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1String(" Directory")); + fd.setDirectory(workDirPath); + QTRY_VERIFY(dirPopulated); + + QTRY_VERIFY(selectTestDir); - QTest::keyClick(list, Qt::Key_Down); #ifndef Q_OS_MAC QTest::keyClick(list, Qt::Key_Return); #else QTest::keyClick(list, Qt::Key_O, Qt::ControlModifier); #endif - QTRY_VERIFY(fd.directory().absolutePath() != QDir::home().absolutePath()); + QTRY_VERIFY(fd.directory().absolutePath() != workDirPath); QVERIFY(lineEdit->text().isEmpty()); - - //remove the dir - QDir::home().rmdir("_____aaaaaaaaaaaaaaaaaaaaaa"); } void tst_QFiledialog::enableChooseButton() From 39cb9ac873cc9b6f829238142c1efa11f6a51fda Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 23 Aug 2018 13:16:15 +0200 Subject: [PATCH 09/18] Fix qtbase build for clang-cl with MSVC 2017 15.8 Move the definition of _ENABLE_EXTENDED_ALIGNED_STORAGE to msvc-desktop.conf so that it becomes effective for all compilers using MSVC (icc, clang-cl). Task-number: QTBUG-50804 Change-Id: I5ff612cc0f5a712b855925f9bcf645e578e80504 Reviewed-by: Thiago Macieira --- mkspecs/common/msvc-desktop.conf | 4 +++- mkspecs/common/msvc-version.conf | 6 ------ mkspecs/win32-icc/qmake.conf | 1 - 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/mkspecs/common/msvc-desktop.conf b/mkspecs/common/msvc-desktop.conf index b7d2eecc82..a4fadeb029 100644 --- a/mkspecs/common/msvc-desktop.conf +++ b/mkspecs/common/msvc-desktop.conf @@ -16,7 +16,9 @@ MAKEFILE_GENERATOR = MSVC.NET QMAKE_PLATFORM = win32 QMAKE_COMPILER = msvc CONFIG += flat debug_and_release debug_and_release_target precompile_header autogen_precompile_source embed_manifest_dll embed_manifest_exe -DEFINES += UNICODE _UNICODE WIN32 +# MSVC 2017 15.8+ fixed std::aligned_storage but compilation fails without +# _ENABLE_EXTENDED_ALIGNED_STORAGE flag since the fix breaks binary compatibility. +DEFINES += UNICODE _UNICODE WIN32 _ENABLE_EXTENDED_ALIGNED_STORAGE QMAKE_COMPILER_DEFINES += _WIN32 contains(QMAKE_TARGET.arch, x86_64) { DEFINES += WIN64 diff --git a/mkspecs/common/msvc-version.conf b/mkspecs/common/msvc-version.conf index 5805383a04..3fb55c9d81 100644 --- a/mkspecs/common/msvc-version.conf +++ b/mkspecs/common/msvc-version.conf @@ -110,12 +110,6 @@ greaterThan(QMAKE_MSC_VER, 1909) { QMAKE_CXXFLAGS_CXX14 = -std:c++14 QMAKE_CXXFLAGS_CXX1Z = -std:c++17 } - - # MSVC 2017 15.8+ fixed std::aligned_storage but compilation fails without - # this flag since the fix breaks binary compatibility. - greaterThan(QMAKE_MSC_VER, 1914) { - DEFINES += _ENABLE_EXTENDED_ALIGNED_STORAGE - } } greaterThan(QMAKE_MSC_VER, 1910) { diff --git a/mkspecs/win32-icc/qmake.conf b/mkspecs/win32-icc/qmake.conf index 2447c712b1..3cb0d58824 100644 --- a/mkspecs/win32-icc/qmake.conf +++ b/mkspecs/win32-icc/qmake.conf @@ -12,7 +12,6 @@ include(../common/msvc-desktop.conf) # modifications to msvc-desktop.conf QMAKE_COMPILER += intel_icl -DEFINES += _ENABLE_EXTENDED_ALIGNED_STORAGE QMAKE_CFLAGS_OPTIMIZE_FULL = -O3 From f12fd482f50fde77f11d3c45309d538c02b9d334 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 24 May 2018 20:50:32 +0200 Subject: [PATCH 10/18] qmake: fix file id mapping lifetime management turns out that flushing the ids together with the ProFile cache was an abysmal idea, as the latter expires after a few seconds after loading the project, while references to the ProFiles (and thus the underlying file ids) are kept for as long as the project stays loaded. the early flush would cause re-use of the file ids, which would wreak all kinds of havoc when re-loading projects. but just ref-counting the vfs class is insufficient as well, as then the ProFile cache (which expires after a timeout) could outlive all VFS instances and thus refer to ids which were discarded and later re-used. so we ref-count, and additionally let the cache instance hold a reference to the vfs class. this is sync-up with qt creator; no actual effect on qmake itself. amends 190aa94be. Change-Id: Idd4478ffc1c2405b3b83df32fba45b1f687f6a18 Reviewed-by: Robert Loehning Reviewed-by: Orgad Shaneh Reviewed-by: Eike Ziller Reviewed-by: Tobias Hunger (cherry picked from qtcreator/d03fb350672d311dccc06f0bcb4da744a3c99745) (cherry picked from qtcreator/1ddfb443b686ef04cc0e28363308ce70d01f0d73) Reviewed-by: Oswald Buddenhagen --- qmake/library/qmakeparser.cpp | 6 ++++++ qmake/library/qmakeparser.h | 2 +- qmake/library/qmakevfs.cpp | 37 +++++++++++++++++++++++++---------- qmake/library/qmakevfs.h | 6 +++++- 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp index 131ec6db6a..4c8360b459 100644 --- a/qmake/library/qmakeparser.cpp +++ b/qmake/library/qmakeparser.cpp @@ -45,11 +45,17 @@ QT_BEGIN_NAMESPACE // /////////////////////////////////////////////////////////////////////// +ProFileCache::ProFileCache() +{ + QMakeVfs::ref(); +} + ProFileCache::~ProFileCache() { for (const Entry &ent : qAsConst(parsed_files)) if (ent.pro) ent.pro->deref(); + QMakeVfs::deref(); } void ProFileCache::discardFile(const QString &fileName, QMakeVfs *vfs) diff --git a/qmake/library/qmakeparser.h b/qmake/library/qmakeparser.h index e9529f8bf6..7b96d4e88f 100644 --- a/qmake/library/qmakeparser.h +++ b/qmake/library/qmakeparser.h @@ -201,7 +201,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QMakeParser::ParseFlags) class QMAKE_EXPORT ProFileCache { public: - ProFileCache() {} + ProFileCache(); ~ProFileCache(); void discardFile(int id); diff --git a/qmake/library/qmakevfs.cpp b/qmake/library/qmakevfs.cpp index 2239a2beec..3a54ef4023 100644 --- a/qmake/library/qmakevfs.cpp +++ b/qmake/library/qmakevfs.cpp @@ -52,11 +52,38 @@ QMakeVfs::QMakeVfs() #ifndef QT_NO_TEXTCODEC m_textCodec = 0; #endif + ref(); +} + +QMakeVfs::~QMakeVfs() +{ + deref(); +} + +void QMakeVfs::ref() +{ +#ifdef PROEVALUATOR_THREAD_SAFE + QMutexLocker locker(&s_mutex); +#endif + ++s_refCount; +} + +void QMakeVfs::deref() +{ +#ifdef PROEVALUATOR_THREAD_SAFE + QMutexLocker locker(&s_mutex); +#endif + if (!--s_refCount) { + s_fileIdCounter = 0; + s_fileIdMap.clear(); + s_idFileMap.clear(); + } } #ifdef PROPARSER_THREAD_SAFE QMutex QMakeVfs::s_mutex; #endif +int QMakeVfs::s_refCount; QAtomicInt QMakeVfs::s_fileIdCounter; QHash QMakeVfs::s_fileIdMap; QHash QMakeVfs::s_idFileMap; @@ -114,16 +141,6 @@ QString QMakeVfs::fileNameForId(int id) return s_idFileMap.value(id); } -void QMakeVfs::clearIds() -{ -#ifdef PROEVALUATOR_THREAD_SAFE - QMutexLocker locker(&s_mutex); -#endif - s_fileIdCounter = 0; - s_fileIdMap.clear(); - s_idFileMap.clear(); -} - bool QMakeVfs::writeFile(int id, QIODevice::OpenMode mode, VfsFlags flags, const QString &contents, QString *errStr) { diff --git a/qmake/library/qmakevfs.h b/qmake/library/qmakevfs.h index 1217225471..68c21a3d37 100644 --- a/qmake/library/qmakevfs.h +++ b/qmake/library/qmakevfs.h @@ -76,10 +76,13 @@ public: Q_DECLARE_FLAGS(VfsFlags, VfsFlag) QMakeVfs(); + ~QMakeVfs(); + + static void ref(); + static void deref(); int idForFileName(const QString &fn, VfsFlags flags); QString fileNameForId(int id); - static void clearIds(); bool writeFile(int id, QIODevice::OpenMode mode, VfsFlags flags, const QString &contents, QString *errStr); ReadResult readFile(int id, QString *contents, QString *errStr); bool exists(const QString &fn, QMakeVfs::VfsFlags flags); @@ -97,6 +100,7 @@ private: #ifdef PROEVALUATOR_THREAD_SAFE static QMutex s_mutex; #endif + static int s_refCount; static QAtomicInt s_fileIdCounter; // Qt Creator's ProFile cache is a singleton to maximize its cross-project // effectiveness (shared prf files from QtVersions). From 48f0996449fbc302c7557832425b17e123be37c1 Mon Sep 17 00:00:00 2001 From: Mikhail Svetkin Date: Thu, 23 Aug 2018 16:35:13 +0200 Subject: [PATCH 11/18] macOS: minor refactoring QSendSuperHelper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace local implementation of index_sequence with QtPrivate::IndexesList Change-Id: I193b9183ec6832294687e979576a2e3ec56d550b Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoahelpers.h | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h index 4df212bc7a..953bf331bb 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.h +++ b/src/plugins/platforms/cocoa/qcocoahelpers.h @@ -295,26 +295,17 @@ public: } private: - template - struct index {}; - - template - struct gen_seq : gen_seq {}; - - template - struct gen_seq<0, Ts...> : index {}; - template using if_requires_stret = typename std::enable_if::value == V, ReturnType>::type; - template - if_requires_stret msgSendSuper(std::tuple& args, index) + template + if_requires_stret msgSendSuper(std::tuple& args, QtPrivate::IndexesList) { return qt_msgSendSuper(m_receiver, m_selector, std::get(args)...); } - template - if_requires_stret msgSendSuper(std::tuple& args, index) + template + if_requires_stret msgSendSuper(std::tuple& args, QtPrivate::IndexesList) { return qt_msgSendSuper_stret(m_receiver, m_selector, std::get(args)...); } @@ -322,7 +313,7 @@ private: template ReturnType msgSendSuper(std::tuple& args) { - return msgSendSuper(args, gen_seq{}); + return msgSendSuper(args, QtPrivate::makeIndexSequence{}); } id m_receiver; From 0de4b76b9c76ddc4d7ee9790b70f39b7ee577ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 21 Aug 2018 15:22:01 +0200 Subject: [PATCH 12/18] macOS: Take application appearance into account when drawing glyphs macOS 10.14 uses a new font smoothing algorithm that takes the fill color into account. This means our default approach of drawing white on black to produce the alpha map will result in non-native looking text when then drawn as black on white during the final blit. As a workaround we use the application's current appearance to decide whether to draw with white or black fill, and then invert the glyph image in the latter case, producing an alpha map. This covers the most common use-cases, but longer term we should propagate the fill color all the way from the paint engine, and include it in the key for the glyph cache. At the moment we do not react to changes in the application appearance, as that seems to be buggy in general in Qt (palette/style, e.g.), and those bugs need to be weeded before we can react to the theme change with confidence. Task-number: QTBUG-68824 Change-Id: Ibbfd49fcf3a091e454009c08159f46b3499e2bd0 Reviewed-by: Simon Hausmann --- src/corelib/kernel/qcore_mac_objc.mm | 19 ++++++++-- src/corelib/kernel/qcore_mac_p.h | 3 +- .../fontdatabases/mac/qfontengine_coretext.mm | 35 +++++++++++++++++-- 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm index 0d7bfad943..2e303607df 100644 --- a/src/corelib/kernel/qcore_mac_objc.mm +++ b/src/corelib/kernel/qcore_mac_objc.mm @@ -40,8 +40,13 @@ #include -#ifdef Q_OS_OSX -#include +#ifdef Q_OS_MACOS +# include +# if !QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14) +@interface NSApplication (MojaveForwardDeclarations) +@property (strong) NSAppearance *effectiveAppearance NS_AVAILABLE_MAC(10_14); +@end +# endif #endif #if defined(QT_PLATFORM_UIKIT) @@ -166,6 +171,16 @@ QDebug operator<<(QDebug debug, const QMacAutoReleasePool *pool) } #endif // !QT_NO_DEBUG_STREAM +#ifdef Q_OS_MACOS +bool qt_mac_applicationIsInDarkMode() +{ + if (__builtin_available(macOS 10.14, *)) + return [NSApp.effectiveAppearance.name hasSuffix:@"DarkAqua"]; + else + return false; +} +#endif + bool qt_apple_isApplicationExtension() { static bool isExtension = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSExtension"]; diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index a0802969dd..bf540c2e35 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -180,9 +180,10 @@ private: QString string; }; -#ifdef Q_OS_OSX +#ifdef Q_OS_MACOS Q_CORE_EXPORT QChar qt_mac_qtKey2CocoaKey(Qt::Key key); Q_CORE_EXPORT Qt::Key qt_mac_cocoaKey2QtKey(QChar keyCode); +Q_CORE_EXPORT bool qt_mac_applicationIsInDarkMode(); #endif #ifndef QT_NO_DEBUG_STREAM diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 98b753eff9..6543759a3d 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -42,6 +42,7 @@ #include #include #include +#include #include @@ -652,17 +653,36 @@ bool QCoreTextFontEngine::expectsGammaCorrectedBlending() const QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition, bool aa, const QTransform &matrix) { - glyph_metrics_t br = alphaMapBoundingBox(glyph, subPixelPosition, matrix, glyphFormat); bool isColorGlyph = glyphFormat == QFontEngine::Format_ARGB; QImage::Format imageFormat = isColorGlyph ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; QImage im(br.width.ceil().toInt(), br.height.ceil().toInt(), imageFormat); - im.fill(0); - if (!im.width() || !im.height()) return im; +#if defined(Q_OS_MACOS) + CGColorRef glyphColor = CGColorGetConstantColor(kCGColorWhite); + if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave) { + // macOS 10.14 uses a new font smoothing algorithm that takes the fill color into + // account. This means our default approach of drawing white on black to produce + // the alpha map will result in non-native looking text when then drawn as black + // on white during the final blit. As a workaround we use the application's current + // appearance to decide whether to draw with white or black fill, and then invert + // the glyph image in the latter case, producing an alpha map. This covers the + // most common use-cases, but longer term we should propagate the fill color all + // the way from the paint engine, and include it in the key for the glyph cache. + if (!qt_mac_applicationIsInDarkMode()) + glyphColor = CGColorGetConstantColor(kCGColorBlack); + } + const bool blackOnWhiteGlyphs = !isColorGlyph + && CGColorEqualToColor(glyphColor, CGColorGetConstantColor(kCGColorBlack)); + if (blackOnWhiteGlyphs) + im.fill(Qt::white); + else +#endif + im.fill(0); // Faster than Qt::black + CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); uint cgflags = isColorGlyph ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst; #ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version @@ -696,7 +716,11 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition if (!isColorGlyph) { CGContextSetTextMatrix(ctx, cgMatrix); +#if defined(Q_OS_MACOS) + CGContextSetFillColorWithColor(ctx, glyphColor); +#else CGContextSetRGBFillColor(ctx, 1, 1, 1, 1); +#endif CGContextSetTextDrawingMode(ctx, kCGTextFill); CGContextSetTextPosition(ctx, pos_x, pos_y); @@ -721,6 +745,11 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition CGContextRelease(ctx); CGColorSpaceRelease(colorspace); +#if defined(Q_OS_MACOS) + if (blackOnWhiteGlyphs) + im.invertPixels(); +#endif + return im; } From 7af0ea5b0f883415927727c8ed10bb6256d1f12d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 24 Aug 2018 17:02:57 +0200 Subject: [PATCH 13/18] Disable warnings about deprecated QRegularExpression::PatternOptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We still want to have these in the debug output for completeness, so disable the warning instead of removing the lines. Change-Id: I4291adddff486e4ea963be36ac0ebda089a66045 Reviewed-by: Simon Hausmann Reviewed-by: Tor Arne Vestbø --- src/corelib/tools/qregularexpression.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index 6f0e572f41..1026d4ab28 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -2742,10 +2742,13 @@ QDebug operator<<(QDebug debug, QRegularExpression::PatternOptions patternOption flags.append("DontCaptureOption|"); if (patternOptions & QRegularExpression::UseUnicodePropertiesOption) flags.append("UseUnicodePropertiesOption|"); +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED if (patternOptions & QRegularExpression::OptimizeOnFirstUsageOption) flags.append("OptimizeOnFirstUsageOption|"); if (patternOptions & QRegularExpression::DontAutomaticallyOptimizeOption) flags.append("DontAutomaticallyOptimizeOption|"); +QT_WARNING_POP flags.chop(1); } From bd42e2f0cebb2fe8de77a054e9d30aa803749a61 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 24 Aug 2018 17:03:03 +0200 Subject: [PATCH 14/18] Blacklist two tests on macOS that a planned CI change shall break MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have #if-ery on Q_OS_DARWIN controlling an expectation of gettign "GMT+1" and "GMT+2" instead of "CET" and "CEST" in two tests; this turns out to not be a deficiency of macOS so much as of how we configure Coin's VMs. While we fix that, we need to ignore failures in these tests, so that we can pull the #if-ery out and clear the blacklist once the VMs are set up properly. Task-number: QTBUG-70149 Change-Id: If3577200cf980b3329161ab3eea7bd2e9d0124e0 Reviewed-by: Tony Sarajärvi --- tests/auto/corelib/tools/qdatetime/BLACKLIST | 2 ++ tests/auto/corelib/tools/qlocale/BLACKLIST | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 tests/auto/corelib/tools/qdatetime/BLACKLIST create mode 100644 tests/auto/corelib/tools/qlocale/BLACKLIST diff --git a/tests/auto/corelib/tools/qdatetime/BLACKLIST b/tests/auto/corelib/tools/qdatetime/BLACKLIST new file mode 100644 index 0000000000..3a42ee066b --- /dev/null +++ b/tests/auto/corelib/tools/qdatetime/BLACKLIST @@ -0,0 +1,2 @@ +[timeZoneAbbreviation] +osx diff --git a/tests/auto/corelib/tools/qlocale/BLACKLIST b/tests/auto/corelib/tools/qlocale/BLACKLIST new file mode 100644 index 0000000000..3eac7c10ed --- /dev/null +++ b/tests/auto/corelib/tools/qlocale/BLACKLIST @@ -0,0 +1,2 @@ +[formatTimeZone] +osx From 4d38f225220bef8e66948afdcc10701d7fc65e81 Mon Sep 17 00:00:00 2001 From: Joni Jantti Date: Fri, 24 Aug 2018 09:45:49 +0300 Subject: [PATCH 15/18] Blacklist tst_Gestures::autoCancelGestures2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This autotest fails on the Ubuntu 18.04 platform. Task-number: QTBUG-70153 Change-Id: I2a2b0075a046664cdf5733d8629f634b4e33dc6f Reviewed-by: Tony Sarajärvi --- tests/auto/other/gestures/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/other/gestures/BLACKLIST b/tests/auto/other/gestures/BLACKLIST index 0cb80fc42f..7f36054c6e 100644 --- a/tests/auto/other/gestures/BLACKLIST +++ b/tests/auto/other/gestures/BLACKLIST @@ -12,3 +12,5 @@ ubuntu-18.04 ubuntu-18.04 [explicitGraphicsObjectTarget] ubuntu-18.04 +[autoCancelGestures2] +ubuntu-18.04 From 42588a84878c4d58ba5bf46636e31ba99a11227a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 23 Aug 2018 18:57:59 +0200 Subject: [PATCH 16/18] Improve detection and handling of unsupported Apple platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The application name wasn't always printed, so we try try a few more possibilities before falling back to the process name. We also run the check as early as possible, instead of relying on a QCoreApplication. We do not have to provide a dialog to the user, as macOS will do this for us if the application is launched from Finder. Change-Id: Ifbec86946d60294806364e08964852fd4b74ff56 Reviewed-by: Simon Hausmann Reviewed-by: Tor Arne Vestbø --- src/corelib/kernel/qcore_mac_objc.mm | 23 +++++++++++++++-------- src/corelib/kernel/qcore_mac_p.h | 1 - src/corelib/kernel/qcoreapplication.cpp | 3 --- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm index 2e303607df..4ca9c2e996 100644 --- a/src/corelib/kernel/qcore_mac_objc.mm +++ b/src/corelib/kernel/qcore_mac_objc.mm @@ -448,16 +448,23 @@ void qt_apple_check_os_version() version / 10000, version / 100 % 100, version % 100}; const NSOperatingSystemVersion current = NSProcessInfo.processInfo.operatingSystemVersion; if (![NSProcessInfo.processInfo isOperatingSystemAtLeastVersion:required]) { - fprintf(stderr, "You can't use this version of %s with this version of %s. " - "You have %s %ld.%ld.%ld. Qt requires %s %ld.%ld.%ld or later.\n", - (reinterpret_cast( - NSBundle.mainBundle.infoDictionary[@"CFBundleName"]).UTF8String), - os, - os, long(current.majorVersion), long(current.minorVersion), long(current.patchVersion), - os, long(required.majorVersion), long(required.minorVersion), long(required.patchVersion)); - abort(); + NSDictionary *plist = NSBundle.mainBundle.infoDictionary; + NSString *applicationName = plist[@"CFBundleDisplayName"]; + if (!applicationName) + applicationName = plist[@"CFBundleName"]; + if (!applicationName) + applicationName = NSProcessInfo.processInfo.processName; + + fprintf(stderr, "Sorry, \"%s\" can not be run on this version of %s. " + "Qt requires %s %ld.%ld.%ld or later, you have %s %ld.%ld.%ld.\n", + applicationName.UTF8String, os, + os, long(required.majorVersion), long(required.minorVersion), long(required.patchVersion), + os, long(current.majorVersion), long(current.minorVersion), long(current.patchVersion)); + + exit(1); } } +Q_CONSTRUCTOR_FUNCTION(qt_apple_check_os_version); // ------------------------------------------------------------------------- diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index bf540c2e35..19dddbc2ae 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -190,7 +190,6 @@ Q_CORE_EXPORT bool qt_mac_applicationIsInDarkMode(); QDebug operator<<(QDebug debug, const QMacAutoReleasePool *pool); #endif -Q_CORE_EXPORT void qt_apple_check_os_version(); Q_CORE_EXPORT bool qt_apple_isApplicationExtension(); #if defined(Q_OS_MACOS) && !defined(QT_BOOTSTRAPPED) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 04da52a960..0303916c11 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -456,9 +456,6 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint , q_ptr(0) #endif { -#if defined(Q_OS_DARWIN) - qt_apple_check_os_version(); -#endif app_compile_version = flags & 0xffffff; static const char *const empty = ""; if (argc == 0 || argv == 0) { From ce267bbe37beb94a6128469f6223be5f07168326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 24 Aug 2018 18:52:10 +0200 Subject: [PATCH 17/18] Weak-import global objects used for logging on Apple platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise the dynamic loader will complain about missing symbols when the binary is run on platforms below our supported deployment target: dyld: Symbol not found: __os_activity_current Referenced from: QtCore.framework/Versions/5/QtCore (which was built for Mac OS X 10.12) Expected in: /usr/lib/libSystem.B.dylib in /Users/torarne/build/qt/5.12/qtbase/lib/QtCore.framework/Versions/5/QtCore Trace/BPT trap: 5 We want this to trigger our own logic in qt_apple_check_os_version(), where we tell the user in more friendly terms what's going on. An alternative to the targeted weak imports would be do import the whole library as weak, using -weak-lSystem.B. This doesn't seem to cause any performance issues at startup, but since we only need the two global symbols we stick to the more targeted solution just to be on the safe side. Change-Id: I87c1f185f6dcf9df26c700d31bb5071ddf7685be Reviewed-by: Simon Hausmann Reviewed-by: Tor Arne Vestbø --- src/corelib/kernel/qcore_mac.cpp | 1 + src/corelib/kernel/qcore_mac_p.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/corelib/kernel/qcore_mac.cpp b/src/corelib/kernel/qcore_mac.cpp index 58380001a4..e78b2d1171 100644 --- a/src/corelib/kernel/qcore_mac.cpp +++ b/src/corelib/kernel/qcore_mac.cpp @@ -65,6 +65,7 @@ QCFString::operator CFStringRef() const #if defined(QT_USE_APPLE_UNIFIED_LOGGING) +QT_MAC_WEAK_IMPORT(_os_log_default); bool AppleUnifiedLogger::messageHandler(QtMsgType msgType, const QMessageLogContext &context, const QString &message, const QString &optionalSubsystem) { diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index 19dddbc2ae..8f2714aa12 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -108,6 +108,8 @@ #define QT_NAMESPACE_ALIAS_OBJC_CLASS(__KLASS__) #endif +#define QT_MAC_WEAK_IMPORT(symbol) extern "C" decltype(symbol) symbol __attribute__((weak_import)); + QT_BEGIN_NAMESPACE template class QAppleRefCounted @@ -326,6 +328,7 @@ private: #define QT_APPLE_LOG_ACTIVITY_WITH_PARENT2(description, parent) QT_APPLE_LOG_ACTIVITY_WITH_PARENT3(true, description, parent) #define QT_APPLE_LOG_ACTIVITY_WITH_PARENT(...) QT_OVERLOADED_MACRO(QT_APPLE_LOG_ACTIVITY_WITH_PARENT, __VA_ARGS__) +QT_MAC_WEAK_IMPORT(_os_activity_current); #define QT_APPLE_LOG_ACTIVITY2(condition, description) QT_APPLE_LOG_ACTIVITY_CREATE(condition, description, OS_ACTIVITY_CURRENT) #define QT_APPLE_LOG_ACTIVITY1(description) QT_APPLE_LOG_ACTIVITY2(true, description) #define QT_APPLE_LOG_ACTIVITY(...) QT_OVERLOADED_MACRO(QT_APPLE_LOG_ACTIVITY, __VA_ARGS__) From 5a707272a054e677a0577cf136a089891d981a29 Mon Sep 17 00:00:00 2001 From: Alessandro Ambrosano Date: Tue, 21 Aug 2018 15:12:35 +0200 Subject: [PATCH 18/18] Tracepoints: fix ETW generator for pointers Fixes compilation failure on Windows, due to TraceLoggingValue not correctly casting pointer arguments to a known type. Change-Id: I6027debe4ea3440588dd8677209d6d47048b6b0f Reviewed-by: Giuseppe D'Angelo --- src/tools/tracegen/etw.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tools/tracegen/etw.cpp b/src/tools/tracegen/etw.cpp index 07f2d114b6..8c065f93c9 100644 --- a/src/tools/tracegen/etw.cpp +++ b/src/tools/tracegen/etw.cpp @@ -75,6 +75,9 @@ static void writeEtwMacro(QTextStream &stream, const Tracepoint::Field &field) << "TraceLoggingValue(" << name << ".width(), \"width\"), " << "TraceLoggingValue(" << name << ".height(), \"height\")"; return; + case Tracepoint::Field::Pointer: + stream << "TraceLoggingPointer(" << name << ", \"" << name << "\")"; + return; default: break; }