From 7bf4f81de81b6e800509867d5acad545c566dbac Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 17 Sep 2019 19:53:55 +0200 Subject: Add qfloat16::copySign() since we can't overload std::copysign() Change-Id: Idfaf841b3eb3538f076ae4f0de2d7d029e1588fe Reviewed-by: Thiago Macieira --- src/corelib/global/qfloat16.cpp | 8 ++++++++ src/corelib/global/qfloat16.h | 3 +++ 2 files changed, 11 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp index 6c21b7de5a..97709d7685 100644 --- a/src/corelib/global/qfloat16.cpp +++ b/src/corelib/global/qfloat16.cpp @@ -145,6 +145,14 @@ QT_BEGIN_NAMESPACE \sa qIsFinite() */ +/*! + \since 5.15 + \fn qfloat16::copySign(qfloat16 sign) const noexcept + + Returns a qfloat16 with the sign of \a sign but the rest of its value taken + from this qfloat16. Serves as qfloat16's equivalent of std::copysign(). +*/ + /*! \internal \since 5.14 diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h index 9a4f1800a4..c50fa36402 100644 --- a/src/corelib/global/qfloat16.h +++ b/src/corelib/global/qfloat16.h @@ -84,6 +84,9 @@ public: bool isNaN() const noexcept { return ((b16 >> 8) & 0x7e) == 0x7e; } bool isFinite() const noexcept { return ((b16 >> 8) & 0x7c) != 0x7c; } Q_CORE_EXPORT int fpClassify() const noexcept; + // Can't specialize std::copysign() for qfloat16 + qfloat16 copySign(qfloat16 sign) const noexcept + { return qfloat16(Wrap((sign.b16 & 0x8000) | (b16 & 0x7fff))); } // Support for std::numeric_limits static constexpr qfloat16 _limit_epsilon() noexcept { return qfloat16(Wrap(0x1400)); } static constexpr qfloat16 _limit_min() noexcept { return qfloat16(Wrap(0x400)); } -- cgit v1.2.3 From 3c7df4a0ff91a833cf77e38ab8ccd65e289242e9 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 17 Sep 2019 19:55:44 +0200 Subject: Add support for a signaling NaN in qfloat16 There was a comment saying what value does the job, so might as well put it to work. Change-Id: I47f1a8ce7ce889580f71aa784ccbcc227ebe0b23 Reviewed-by: Thiago Macieira --- src/corelib/global/qfloat16.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h index c50fa36402..154b200475 100644 --- a/src/corelib/global/qfloat16.h +++ b/src/corelib/global/qfloat16.h @@ -95,7 +95,9 @@ public: static constexpr qfloat16 _limit_lowest() noexcept { return qfloat16(Wrap(0xfbff)); } static constexpr qfloat16 _limit_infinity() noexcept { return qfloat16(Wrap(0x7c00)); } static constexpr qfloat16 _limit_quiet_NaN() noexcept { return qfloat16(Wrap(0x7e00)); } - // Signalling NaN is 0x7f00 +#if QT_CONFIG(signaling_nan) + static constexpr qfloat16 _limit_signaling_NaN() noexcept { return qfloat16(Wrap(0x7f00)); } +#endif inline constexpr bool isNormal() const noexcept { return (b16 & 0x7fff) == 0 || ((b16 & 0x7c00) && (b16 & 0x7c00) != 0x7c00); } private: @@ -330,6 +332,12 @@ public: { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_infinity(); } static constexpr QT_PREPEND_NAMESPACE(qfloat16) quiet_NaN() { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_quiet_NaN(); } +#if QT_CONFIG(signaling_nan) + static constexpr QT_PREPEND_NAMESPACE(qfloat16) signaling_NaN() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_signaling_NaN(); } +#else + static constexpr bool has_signaling_NaN = false; +#endif }; template<> class numeric_limits -- cgit v1.2.3 From 737fd5550bbbc727af18cc2ce43a71753ab95b95 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 2 Oct 2019 21:16:49 -0700 Subject: Change the QtCore library output to show the plugin path It's a lot more useful than the include dir. It actually helps debug problems. Change-Id: I1496b069cc534f1a838dfffd15ca07fe8ad1c8c6 Reviewed-by: Edward Welbourne Reviewed-by: Allan Sandfeld Jensen --- src/corelib/global/qlibraryinfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 8bcf67e73d..276741c9fb 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -887,10 +887,10 @@ void qt_core_boilerplate() "\n" "Installation prefix: %s\n" "Library path: %s\n" - "Include path: %s\n", + "Plugin path: %s\n", qt_configure_prefix_path_str + 12, qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::LibrariesPath - 1], - qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::HeadersPath - 1]); + qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::PluginsPath - 1]); QT_PREPEND_NAMESPACE(qDumpCPUFeatures)(); -- cgit v1.2.3 From af2daafde72db02454d24b7d691aa6861525ab99 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 18 Nov 2019 17:01:26 +0100 Subject: Deprecate constructing QFlags from a pointer This was used to support QFlags f = 0 initialization, but with 0 used as a pointer literal now considered bad form, it had been changed many places to QFlags f = nullptr, which is meaningless and confusing. Change-Id: I4bc592151c255dc5cab1a232615caecc520f02e8 Reviewed-by: Thiago Macieira --- src/corelib/global/qflags.h | 7 ++++++- src/corelib/global/qglobal.cpp | 12 +++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index bd3c219968..4f46de5eaa 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -93,8 +93,10 @@ class QFlags "long long will overflow."); Q_STATIC_ASSERT_X((std::is_enum::value), "QFlags is only usable on enumeration types."); +#if QT_DEPRECATED_SINCE(5,15) struct Private; typedef int (Private::*Zero); +#endif template friend QDataStream &operator>>(QDataStream &, QFlags &); template friend QDataStream &operator<<(QDataStream &, QFlags); public: @@ -115,8 +117,11 @@ public: Q_DECL_CONSTEXPR inline QFlags(const QFlags &other); Q_DECL_CONSTEXPR inline QFlags &operator=(const QFlags &other); #endif + Q_DECL_CONSTEXPR inline QFlags() noexcept : i(0) {} Q_DECL_CONSTEXPR inline QFlags(Enum flags) noexcept : i(Int(flags)) {} - Q_DECL_CONSTEXPR inline QFlags(Zero = nullptr) noexcept : i(0) {} +#if QT_DEPRECATED_SINCE(5,15) + QT_DEPRECATED_X("Use default constructor instead") Q_DECL_CONSTEXPR inline QFlags(Zero) noexcept : i(0) {} +#endif Q_DECL_CONSTEXPR inline QFlags(QFlag flag) noexcept : i(flag) {} Q_DECL_CONSTEXPR inline QFlags(std::initializer_list flags) noexcept diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 4ab5bd2edb..d95cc786ab 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -250,7 +250,7 @@ Q_STATIC_ASSERT((std::is_same::value)); Qt::Alignment type is simply a typedef for QFlags. QLabel::setAlignment() takes a Qt::Alignment parameter, which means that any combination of - Qt::AlignmentFlag values, or 0, is legal: + Qt::AlignmentFlag values, or \c{{ }}, is legal: \snippet code/src_corelib_global_qglobal.cpp 0 @@ -317,11 +317,21 @@ Q_STATIC_ASSERT((std::is_same::value)); Constructs a QFlags object storing the \a flags. */ +/*! + \fn template QFlags::QFlags() + \since 5.15 + + Constructs a QFlags object with no flags set. +*/ + /*! \fn template QFlags::QFlags(Zero) + \deprecated Constructs a QFlags object with no flags set. The parameter must be a literal 0 value. + + Deprecated, use default constructor instead. */ /*! -- cgit v1.2.3 From a131d6100ca13b00721ea30e6ef0d5225002867e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 22 Nov 2019 09:24:55 +0100 Subject: Fix prefix determination for windeployqt'ed applications Qt5Core.dll of windeployqt'ed applications is right next to the executable, and the prefix is considered the directory where the application is located. QLibraryInfo of a relocatable Qt5Core.dll would return a wrong prefix (by default /..), because it determines the prefix with QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH (by default ".."). We now detect whether the executable was windeployqt'ed by checking whether Qt5Core.dll is next to the executable. However, we must not do that for applications in QT_HOST_BINS, because they are not windeployqt'ed and must still use the standard prefix. We detect this case by checking whether for Qt5Core.dll exists a corresponding Qt5Core.lib in the libdir below the detected prefix. Fixes: QTBUG-79318 Change-Id: I1c9b971b282c6b9b19a93f1819ba8aee74be5be4 Reviewed-by: Friedemann Kleint --- src/corelib/global/qlibraryinfo.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 276741c9fb..8c3ed184ae 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -562,9 +562,31 @@ static QString getRelocatablePrefix() HMODULE hModule = getWindowsModuleHandle(); const int kBufferSize = 4096; wchar_t buffer[kBufferSize]; - const int pathSize = GetModuleFileName(hModule, buffer, kBufferSize); - if (pathSize > 0) - prefixPath = prefixFromQtCoreLibraryHelper(QString::fromWCharArray(buffer, pathSize)); + DWORD pathSize = GetModuleFileName(hModule, buffer, kBufferSize); + const QString qtCoreFilePath = QString::fromWCharArray(buffer, int(pathSize)); + const QString qtCoreDirPath = QFileInfo(qtCoreFilePath).absolutePath(); + pathSize = GetModuleFileName(NULL, buffer, kBufferSize); + const QString exeDirPath = QFileInfo(QString::fromWCharArray(buffer, int(pathSize))).absolutePath(); + if (QFileInfo(exeDirPath) == QFileInfo(qtCoreDirPath)) { + // QtCore DLL is next to the executable. This is either a windeployqt'ed executable or an + // executable within the QT_HOST_BIN directory. We're detecting the latter case by checking + // whether there's an import library corresponding to our QtCore DLL in PREFIX/lib. + const QString libdir = QString::fromLatin1( + qt_configure_strs + qt_configure_str_offsets[QLibraryInfo::LibrariesPath - 1]); + const QLatin1Char slash('/'); + const QString qtCoreImpLibPath + = qtCoreDirPath + + slash + QLatin1String(QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH) + + slash + libdir + + slash + QFileInfo(qtCoreFilePath).completeBaseName() + QLatin1String(".lib"); + if (!QFileInfo::exists(qtCoreImpLibPath)) { + // We did not find a corresponding import library and conclude that this is a + // windeployqt'ed executable. + return exeDirPath; + } + } + if (!qtCoreFilePath.isEmpty()) + prefixPath = prefixFromQtCoreLibraryHelper(qtCoreFilePath); #else #error "The chosen platform / config does not support querying for a dynamic prefix." #endif -- cgit v1.2.3 From 2260d680c935eae0e989beb2040a01040f66a5fa Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 24 Nov 2019 20:57:19 +0100 Subject: Deprecate qMove(), Q_DECL_OVERRIDE and Q_DECL_FINAL This function and the two macros are natively supported by all compilers needed since Qt 5.7 as explained in 4c704fad089ddd92e9d274faa5a840dd96349ca1 Change-Id: Iac01d2481ef4a6ee333e3ee5f09082a9fba725e8 Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index d95cc786ab..f46313d9d5 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -4810,9 +4810,11 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) /*! \macro qMove(x) \relates + \obsolete - It expands to "std::move" if your compiler supports that C++11 function, or to nothing - otherwise. + Use \c std::move instead. + + It expands to "std::move". qMove takes an rvalue reference to its parameter \a x, and converts it to an xvalue. */ @@ -4913,6 +4915,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) /*! \macro Q_DECL_OVERRIDE \since 5.0 + \obsolete \relates This macro can be used to declare an overriding virtual @@ -4920,8 +4923,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) an error if the overriding virtual function does not in fact override anything. - It expands to "override" if your compiler supports that C++11 - contextual keyword, or to nothing otherwise. + It expands to "override". The macro goes at the end of the function, usually after the \c{const}, if any: @@ -4933,6 +4935,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) /*! \macro Q_DECL_FINAL \since 5.0 + \obsolete \relates This macro can be used to declare an overriding virtual or a class @@ -4940,10 +4943,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) no longer override this virtual function, or inherit from this class, respectively. - It expands to "final" if your compiler supports that C++11 - contextual keyword, or something non-standard if your compiler - supports something close enough to the C++11 semantics, or to - nothing otherwise. + It expands to "final". The macro goes at the end of the function, usually after the \c{const}, if any: -- cgit v1.2.3 From 6566157df3c5a1352231be87c7b7d2705a46efe3 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 13 Nov 2019 18:42:00 +0100 Subject: Make Qt::RFC2822Date's doc match up with its implementation The qdatetime implementation's rfcDateImpl() uses regexes which did not match its comments; nor did either the regexes or the comments match what was documented. A review of relevant RFCs suggests we should revise this in future, probably at Qt 6. The documentation also only addressed the formats recognized when parsing a date-time, without indicating how they are serialised or how dates and times are handled separately. Added a note to the tests for the read-only formats, to remind the reader that the RFCs merely recommend recognising these - be permissive in what you expect and strict in what you deliver. Change-Id: I0f0bec752e7a50bde98cceceb7e0d11be15c6a6f Reviewed-by: Thiago Macieira --- src/corelib/global/qnamespace.qdoc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index cce88782e9..bebe67be3f 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -724,9 +724,17 @@ \value LocalDate \e{This enum value is deprecated.} Use Qt::SystemLocaleShortDate instead (or Qt::SystemLocaleLongDate if you want long dates). - \value RFC2822Date \l{RFC 2822}, \l{RFC 850} and \l{RFC 1036} format: either - \c{[ddd,] dd MMM yyyy hh:mm[:ss] +/-TZ} or \c{ddd MMM dd yyyy hh:mm[:ss] +/-TZ} - for combined dates and times. + \value RFC2822Date \l{RFC 2822}, \l{RFC 850} and \l{RFC 1036} format: + either \c{[ddd,] dd MMM yyyy [hh:mm[:ss]][ ±tzoff]} + or \c{ddd MMM dd[ hh:mm:ss] yyyy[ ±tzoff]} are recognized for combined dates + and times, where \c{tzoff} is a timezone offset in \c{hhmm} format. For + dates and times separately, the same formats are matched and the unwanted + parts are ignored. In particular, note that a time is not recognized without + an accompanying date. When converting dates to string form, + format \c{dd MMM yyyy} is used, for times the format is \c{hh:mm:ss}. For + combined date and time, these are combined + as \c{dd MMM yyyy hh:mm:ss ±tzoff} (omitting the optional leading day of the + week from the first format recognized). \note For \c ISODate formats, each \c Y, \c M and \c D represents a single digit of the year, month and day used to specify the date. Each \c H, \c M and \c S -- cgit v1.2.3 From c33916a279ef5908e1ebd44644c873933f6a7c77 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 28 Nov 2019 13:38:28 +0100 Subject: Fix prefix determination for windeployqt'ed MinGW applications We hard-coded the assumption the import lib naming scheme is always basename + ".lib" which is wrong for MinGW. This amends commit a131d610. Fixes: QTBUG-80366 Change-Id: Ibefb8a54483cc62743b8783530644b03e720262c Reviewed-by: Ulf Hermann --- src/corelib/global/qlibraryinfo.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 8c3ed184ae..f0f77fe68e 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -574,11 +574,19 @@ static QString getRelocatablePrefix() const QString libdir = QString::fromLatin1( qt_configure_strs + qt_configure_str_offsets[QLibraryInfo::LibrariesPath - 1]); const QLatin1Char slash('/'); - const QString qtCoreImpLibPath - = qtCoreDirPath +#if defined(Q_CC_MINGW) + const QString implibPrefix = QStringLiteral("lib"); + const QString implibSuffix = QStringLiteral(".a"); +#else + const QString implibPrefix; + const QString implibSuffix = QStringLiteral(".lib"); +#endif + const QString qtCoreImpLibFileName = implibPrefix + + QFileInfo(qtCoreFilePath).completeBaseName() + implibSuffix; + const QString qtCoreImpLibPath = qtCoreDirPath + slash + QLatin1String(QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH) + slash + libdir - + slash + QFileInfo(qtCoreFilePath).completeBaseName() + QLatin1String(".lib"); + + slash + qtCoreImpLibFileName; if (!QFileInfo::exists(qtCoreImpLibPath)) { // We did not find a corresponding import library and conclude that this is a // windeployqt'ed executable. -- cgit v1.2.3 From 9fd217e7467fa5f82340c30b1b6bb28557057919 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 27 Nov 2019 12:46:28 +0100 Subject: Silence intel compiler warning about float comparison Add the equivalent intel warning macro in public header where there was already the macro for -Wfloat-equal Change-Id: I8f20400f0b95c8f3857fa7a0a33464c8c34d5c0e Reviewed-by: Thiago Macieira --- src/corelib/global/qfloat16.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h index 9a4f1800a4..02fd2f03cc 100644 --- a/src/corelib/global/qfloat16.h +++ b/src/corelib/global/qfloat16.h @@ -239,6 +239,7 @@ QF16_MAKE_ARITH_OP_INT(/) QT_WARNING_PUSH QT_WARNING_DISABLE_CLANG("-Wfloat-equal") QT_WARNING_DISABLE_GCC("-Wfloat-equal") +QT_WARNING_DISABLE_INTEL(1572) inline bool operator>(qfloat16 a, qfloat16 b) noexcept { return static_cast(a) > static_cast(b); } inline bool operator<(qfloat16 a, qfloat16 b) noexcept { return static_cast(a) < static_cast(b); } -- cgit v1.2.3 From 4e9e9c2c17afa472fb8ae04fc36d9605863f8b83 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 27 Sep 2019 09:18:46 +0200 Subject: INTEGRITY: remove constexpr support It doesn't seem to be working correctly with array of literal types, blocking the patch refactoring the webgradient support: 10171: "painting/webgradients.cpp", line 79: error #28: expression must have a constant value Change-Id: I9ddd768d24ef79dd7a69e23c91988d891e41d4b9 Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index e47f284a42..aab5625d00 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -365,7 +365,6 @@ # define Q_COMPILER_ATTRIBUTES # define Q_COMPILER_AUTO_FUNCTION # define Q_COMPILER_CLASS_ENUM -# define Q_COMPILER_CONSTEXPR # define Q_COMPILER_DECLTYPE # define Q_COMPILER_DEFAULT_MEMBERS # define Q_COMPILER_DELETE_MEMBERS -- cgit v1.2.3 From ece0c0a5e7e0b18beb58ccd868bde54c7be64f78 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 22 Nov 2019 14:46:58 +0100 Subject: Tidy nullptr usage Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/corelib/global/qlibraryinfo.cpp | 12 ++++++------ src/corelib/global/qlogging.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 1ebffd9f49..ecd26233cd 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -124,12 +124,12 @@ public: QLibrarySettings *ls = qt_library_settings(); if (ls) { #ifndef QT_BUILD_QMAKE - if (ls->reloadOnQAppAvailable && QCoreApplication::instance() != 0) + if (ls->reloadOnQAppAvailable && QCoreApplication::instance() != nullptr) ls->load(); #endif return ls->settings.data(); } else { - return 0; + return nullptr; } } }; @@ -146,7 +146,7 @@ void QLibrarySettings::load() // If we get any settings here, those won't change when the application shows up. settings.reset(QLibraryInfoPrivate::findConfiguration()); #ifndef QT_BUILD_QMAKE - reloadOnQAppAvailable = (settings.data() == 0 && QCoreApplication::instance() == 0); + reloadOnQAppAvailable = (settings.data() == nullptr && QCoreApplication::instance() == nullptr); bool haveDevicePaths; bool haveEffectivePaths; bool havePaths; @@ -169,7 +169,7 @@ void QLibrarySettings::load() || children.contains(QLatin1String("Paths")); #ifndef QT_BUILD_QMAKE if (!havePaths) - settings.reset(0); + settings.reset(nullptr); #else } else { haveDevicePaths = false; @@ -212,7 +212,7 @@ QSettings *QLibraryInfoPrivate::findConfiguration() return new QSettings(qtconfig, QSettings::IniFormat); } #endif - return 0; //no luck + return nullptr; //no luck } #endif // settings @@ -750,7 +750,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) // will binary-patch the Qt installation paths -- in such scenarios, Qt // will be built with a dummy path, thus the compile-time result of // strlen is meaningless. - const char * volatile path = 0; + const char * volatile path = nullptr; if (loc == PrefixPath) { path = getPrefix( #ifdef QT_BUILD_QMAKE diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 17f2246082..c9209bd8e3 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1315,7 +1315,7 @@ static QStringList backtraceFramesForLogMessage(int frameCount) if (function.startsWith(QLatin1String("_Z"))) { QScopedPointer demangled( - abi::__cxa_demangle(function.toUtf8(), 0, 0, 0)); + abi::__cxa_demangle(function.toUtf8(), nullptr, nullptr, nullptr)); if (demangled) function = QString::fromUtf8(qCleanupFuncinfo(demangled.data())); } -- cgit v1.2.3 From cedf0207d1ebd931fe155ca04abbf3cb0702854a Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 4 Dec 2019 19:36:33 +0100 Subject: Use Q_NAMESPACE for the Qt namespace, and remove the old moc hack to support it Since I can't #include qobjectdefs from qnamespace because of circular dependency, move the Qt macro in the qtmetamacros.h header. Deprecate QObject::staticQtMetaObject since now one can just use Qt::staticMetaObject Change-Id: I11982aa17c2afa2067486b113f8052672f3695eb Reviewed-by: Volker Hilsheimer --- src/corelib/global/qnamespace.h | 200 ++++++++++++++++++---------------------- 1 file changed, 88 insertions(+), 112 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 047ed8e7b3..6ae04f0c7b 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -41,6 +41,7 @@ #define QNAMESPACE_H #include +#include #if defined(__OBJC__) && !defined(__cplusplus) # warning "File built in Objective-C mode (.m), but using Qt requires Objective-C++ (.mm)" @@ -48,29 +49,10 @@ QT_BEGIN_NAMESPACE -#if !defined(Q_QDOC) && !defined(Q_MOC_RUN) struct QMetaObject; -const QMetaObject *qt_getQtMetaObject() noexcept; // defined in qobject.h (which can't be included here) -#define QT_Q_ENUM(ENUM) \ - inline const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return qt_getQtMetaObject(); } \ - inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) noexcept { return #ENUM; } -#define QT_Q_FLAG(ENUM) QT_Q_ENUM(ENUM) -#else -#define QT_Q_ENUM Q_ENUM -#define QT_Q_FLAG Q_FLAG -#endif - -#ifndef Q_MOC_RUN -namespace -#else -class Q_CORE_EXPORT -#endif -Qt { -#if defined(Q_MOC_RUN) - Q_OBJECT -public: -#endif +namespace Qt { + Q_NAMESPACE_EXPORT(Q_CORE_EXPORT) enum GlobalColor { color0, @@ -1767,102 +1749,96 @@ public: }; #ifndef Q_QDOC - // NOTE: Generally, do not add QT_Q_ENUM if a corresponding Q_Q_FLAG exists. - QT_Q_ENUM(ScrollBarPolicy) - QT_Q_ENUM(FocusPolicy) - QT_Q_ENUM(ContextMenuPolicy) - QT_Q_ENUM(ArrowType) - QT_Q_ENUM(ToolButtonStyle) - QT_Q_ENUM(PenStyle) - QT_Q_ENUM(PenCapStyle) - QT_Q_ENUM(PenJoinStyle) - QT_Q_ENUM(BrushStyle) - QT_Q_ENUM(FillRule) - QT_Q_ENUM(MaskMode) - QT_Q_ENUM(BGMode) - QT_Q_ENUM(ClipOperation) - QT_Q_ENUM(SizeMode) - QT_Q_ENUM(Axis) - QT_Q_ENUM(Corner) - QT_Q_ENUM(Edge) - QT_Q_ENUM(LayoutDirection) - QT_Q_ENUM(SizeHint) - QT_Q_ENUM(Orientation) - QT_Q_ENUM(DropAction) - QT_Q_FLAG(Alignment) - QT_Q_ENUM(TextFlag) - QT_Q_FLAG(Orientations) - QT_Q_FLAG(SplitBehavior) - QT_Q_FLAG(DropActions) - QT_Q_FLAG(Edges) - QT_Q_FLAG(DockWidgetAreas) - QT_Q_FLAG(ToolBarAreas) - QT_Q_ENUM(DockWidgetArea) - QT_Q_ENUM(ToolBarArea) - QT_Q_ENUM(TextFormat) - QT_Q_ENUM(TextElideMode) - QT_Q_ENUM(DateFormat) - QT_Q_ENUM(TimeSpec) - QT_Q_ENUM(DayOfWeek) - QT_Q_ENUM(CursorShape) - QT_Q_ENUM(GlobalColor) - QT_Q_ENUM(AspectRatioMode) - QT_Q_ENUM(TransformationMode) - QT_Q_FLAG(ImageConversionFlags) - QT_Q_ENUM(Key) - QT_Q_ENUM(ShortcutContext) - QT_Q_ENUM(TextInteractionFlag) - QT_Q_FLAG(TextInteractionFlags) - QT_Q_ENUM(ItemSelectionMode) - QT_Q_ENUM(ItemSelectionOperation) - QT_Q_FLAG(ItemFlags) - QT_Q_ENUM(CheckState) - QT_Q_ENUM(ItemDataRole) - QT_Q_ENUM(SortOrder) - QT_Q_ENUM(CaseSensitivity) - QT_Q_FLAG(MatchFlags) - QT_Q_FLAG(KeyboardModifiers) - QT_Q_FLAG(MouseButtons) - QT_Q_ENUM(WindowType) - QT_Q_ENUM(WindowState) - QT_Q_ENUM(WindowModality) - QT_Q_ENUM(WidgetAttribute) - QT_Q_ENUM(ApplicationAttribute) - QT_Q_FLAG(WindowFlags) - QT_Q_FLAG(WindowStates) - QT_Q_ENUM(FocusReason) - QT_Q_ENUM(InputMethodHint) - QT_Q_ENUM(InputMethodQuery) - QT_Q_FLAG(InputMethodHints) - QT_Q_ENUM(EnterKeyType) - QT_Q_FLAG(InputMethodQueries) - QT_Q_FLAG(TouchPointStates) - QT_Q_ENUM(ScreenOrientation) - QT_Q_FLAG(ScreenOrientations) - QT_Q_ENUM(ConnectionType) - QT_Q_ENUM(ApplicationState) + // NOTE: Generally, do not add Q_ENUM_NS if a corresponding Q_FLAG_NS exists. + Q_ENUM_NS(ScrollBarPolicy) + Q_ENUM_NS(FocusPolicy) + Q_ENUM_NS(ContextMenuPolicy) + Q_ENUM_NS(ArrowType) + Q_ENUM_NS(ToolButtonStyle) + Q_ENUM_NS(PenStyle) + Q_ENUM_NS(PenCapStyle) + Q_ENUM_NS(PenJoinStyle) + Q_ENUM_NS(BrushStyle) + Q_ENUM_NS(FillRule) + Q_ENUM_NS(MaskMode) + Q_ENUM_NS(BGMode) + Q_ENUM_NS(ClipOperation) + Q_ENUM_NS(SizeMode) + Q_ENUM_NS(Axis) + Q_ENUM_NS(Corner) + Q_ENUM_NS(Edge) + Q_ENUM_NS(LayoutDirection) + Q_ENUM_NS(SizeHint) + Q_ENUM_NS(Orientation) + Q_ENUM_NS(DropAction) + Q_FLAG_NS(Alignment) + Q_ENUM_NS(TextFlag) + Q_FLAG_NS(Orientations) + Q_FLAG_NS(SplitBehavior) + Q_FLAG_NS(DropActions) + Q_FLAG_NS(Edges) + Q_FLAG_NS(DockWidgetAreas) + Q_FLAG_NS(ToolBarAreas) + Q_ENUM_NS(DockWidgetArea) + Q_ENUM_NS(ToolBarArea) + Q_ENUM_NS(TextFormat) + Q_ENUM_NS(TextElideMode) + Q_ENUM_NS(DateFormat) + Q_ENUM_NS(TimeSpec) + Q_ENUM_NS(DayOfWeek) + Q_ENUM_NS(CursorShape) + Q_ENUM_NS(GlobalColor) + Q_ENUM_NS(AspectRatioMode) + Q_ENUM_NS(TransformationMode) + Q_FLAG_NS(ImageConversionFlags) + Q_ENUM_NS(Key) + Q_ENUM_NS(ShortcutContext) + Q_ENUM_NS(TextInteractionFlag) + Q_FLAG_NS(TextInteractionFlags) + Q_ENUM_NS(ItemSelectionMode) + Q_ENUM_NS(ItemSelectionOperation) + Q_FLAG_NS(ItemFlags) + Q_ENUM_NS(CheckState) + Q_ENUM_NS(ItemDataRole) + Q_ENUM_NS(SortOrder) + Q_ENUM_NS(CaseSensitivity) + Q_FLAG_NS(MatchFlags) + Q_FLAG_NS(KeyboardModifiers) + Q_FLAG_NS(MouseButtons) + Q_ENUM_NS(WindowType) + Q_ENUM_NS(WindowState) + Q_ENUM_NS(WindowModality) + Q_ENUM_NS(WidgetAttribute) + Q_ENUM_NS(ApplicationAttribute) + Q_FLAG_NS(WindowFlags) + Q_FLAG_NS(WindowStates) + Q_ENUM_NS(FocusReason) + Q_ENUM_NS(InputMethodHint) + Q_ENUM_NS(InputMethodQuery) + Q_FLAG_NS(InputMethodHints) + Q_ENUM_NS(EnterKeyType) + Q_FLAG_NS(InputMethodQueries) + Q_FLAG_NS(TouchPointStates) + Q_ENUM_NS(ScreenOrientation) + Q_FLAG_NS(ScreenOrientations) + Q_ENUM_NS(ConnectionType) + Q_ENUM_NS(ApplicationState) #ifndef QT_NO_GESTURES - QT_Q_ENUM(GestureState) - QT_Q_ENUM(GestureType) - QT_Q_ENUM(NativeGestureType) + Q_ENUM_NS(GestureState) + Q_ENUM_NS(GestureType) + Q_ENUM_NS(NativeGestureType) #endif - QT_Q_ENUM(CursorMoveStyle) - QT_Q_ENUM(TimerType) - QT_Q_ENUM(ScrollPhase) - QT_Q_ENUM(MouseEventSource) - QT_Q_FLAG(MouseEventFlag) - QT_Q_ENUM(ChecksumType) - QT_Q_ENUM(HighDpiScaleFactorRoundingPolicy) - QT_Q_ENUM(TabFocusBehavior) + Q_ENUM_NS(CursorMoveStyle) + Q_ENUM_NS(TimerType) + Q_ENUM_NS(ScrollPhase) + Q_ENUM_NS(MouseEventSource) + Q_FLAG_NS(MouseEventFlag) + Q_ENUM_NS(ChecksumType) + Q_ENUM_NS(HighDpiScaleFactorRoundingPolicy) + Q_ENUM_NS(TabFocusBehavior) #endif // Q_DOC } -#ifdef Q_MOC_RUN - ; -#endif - -#undef QT_Q_ENUM -#undef QT_Q_FLAG typedef bool (*qInternalCallback)(void **); -- cgit v1.2.3 From b42a2b3c3338a320a438bc081cb885fd4547f01f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 13 Jun 2012 18:22:27 +0200 Subject: Inline the size and begin pointer in QVector Add QGenericArray to simplify operations. This class can be shared by other tool classes. If there is nothing else to share it, we can move the code onto qvector.h. The one candidate is QList. All tests pass and valgrind is good. Change-Id: Ieaa80709caf5f50520aa97312ab726396f5475eb Reviewed-by: Simon Hausmann --- src/corelib/global/qt_pch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qt_pch.h b/src/corelib/global/qt_pch.h index 0dfd6c745f..1663d9392f 100644 --- a/src/corelib/global/qt_pch.h +++ b/src/corelib/global/qt_pch.h @@ -67,7 +67,7 @@ #include #include #include -#include /* All moc genereated code has this include */ +//#include /* All moc genereated code has this include */ #include #include #include -- cgit v1.2.3 From 00fbc087dd54b31e97b1557766b037b00120c43f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 25 Jun 2012 17:41:51 +0200 Subject: Inline the size and data pointers in QByteArray Change-Id: I82feeb2c9bd2900f421fc0c8d78698b1e83db043 Reviewed-by: Simon Hausmann --- src/corelib/global/qt_pch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qt_pch.h b/src/corelib/global/qt_pch.h index 1663d9392f..0dfd6c745f 100644 --- a/src/corelib/global/qt_pch.h +++ b/src/corelib/global/qt_pch.h @@ -67,7 +67,7 @@ #include #include #include -//#include /* All moc genereated code has this include */ +#include /* All moc genereated code has this include */ #include #include #include -- cgit v1.2.3 From c3bd5ffdc8a3b459f18ba6e35fca93e29f3b0ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sun, 8 Dec 2019 23:47:10 +0100 Subject: Don't wrap feature detection macros with QT_HAS_FOO() variants Using wrappers for these macros is problematic when for example passing the -frewrite-includes flag to preprocess sources before shipping off to distcc or Icecream. It will also start producing warnings when compilers implement http://eel.is/c++draft/cpp.cond#7.sentence-2. See for example https://reviews.llvm.org/D49091 Both https://clang.llvm.org/docs/LanguageExtensions.html and the SD-6 document at https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations recommend defining '__has_foo(x) 0' as a fallback for compilers without the macros, so that's what we go for. Change-Id: I0298cd3b4a6ff6618821e34642a5ddd6728be767 Reviewed-by: Alex Richardson Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 77 +++++++++++++++---------------- src/corelib/global/qconfig-bootstrapped.h | 4 +- src/corelib/global/qendian.h | 4 +- src/corelib/global/qglobal.cpp | 4 +- src/corelib/global/qglobal.h | 2 +- src/corelib/global/qglobal_p.h | 4 +- src/corelib/global/qlogging.cpp | 8 ++-- src/corelib/global/qnumeric_p.h | 2 +- 8 files changed, 51 insertions(+), 54 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index e47f284a42..60dc7ce688 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -505,6 +505,39 @@ # error "Qt has not been tested with this compiler - see http://www.qt-project.org/" #endif +/* + * SG10's SD-6 feature detection and some useful extensions from Clang and GCC + * https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations + * http://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros + * Not using wrapper macros, per http://eel.is/c++draft/cpp.cond#7.sentence-2 + */ +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif +#ifndef __has_feature +# define __has_feature(x) 0 +#endif +#ifndef __has_attribute +# define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute +# define __has_cpp_attribute(x) 0 +#endif +#ifndef __has_include +# define __has_include(x) 0 +#endif +#ifndef __has_include_next +# define __has_include_next(x) 0 +#endif + +// Kept around until all submodules have transitioned +#define QT_HAS_BUILTIN(x) __has_builtin(x) +#define QT_HAS_FEATURE(x) __has_feature(x) +#define QT_HAS_ATTRIBUTE(x) __has_attribute(x) +#define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) +#define QT_HAS_INCLUDE(x) __has_include(x) +#define QT_HAS_INCLUDE_NEXT(x) __has_include_next(x) + /* * C++11 support * @@ -1031,37 +1064,6 @@ # endif #endif -/* - * SG10's SD-6 feature detection and some useful extensions from Clang and GCC - * https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations - * http://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros - */ -#ifdef __has_builtin -# define QT_HAS_BUILTIN(x) __has_builtin(x) -#else -# define QT_HAS_BUILTIN(x) 0 -#endif -#ifdef __has_attribute -# define QT_HAS_ATTRIBUTE(x) __has_attribute(x) -#else -# define QT_HAS_ATTRIBUTE(x) 0 -#endif -#ifdef __has_cpp_attribute -# define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) -#else -# define QT_HAS_CPP_ATTRIBUTE(x) 0 -#endif -#ifdef __has_include -# define QT_HAS_INCLUDE(x) __has_include(x) -#else -# define QT_HAS_INCLUDE(x) 0 -#endif -#ifdef __has_include_next -# define QT_HAS_INCLUDE_NEXT(x) __has_include_next(x) -#else -# define QT_HAS_INCLUDE_NEXT(x) 0 -#endif - /* * C++11 keywords and expressions */ @@ -1138,7 +1140,7 @@ # define Q_DECL_ALIGN(n) alignas(n) #endif -#if QT_HAS_CPP_ATTRIBUTE(nodiscard) && !defined(Q_CC_CLANG) // P0188R1 +#if __has_cpp_attribute(nodiscard) && !defined(Q_CC_CLANG) // P0188R1 // Can't use [[nodiscard]] with Clang, see https://bugs.llvm.org/show_bug.cgi?id=33518 # undef Q_REQUIRED_RESULT # define Q_REQUIRED_RESULT [[nodiscard]] @@ -1240,11 +1242,6 @@ #ifndef QT_MAKE_CHECKED_ARRAY_ITERATOR # define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) (x) #endif -#ifdef __has_feature -# define QT_HAS_FEATURE(x) __has_feature(x) -#else -# define QT_HAS_FEATURE(x) 0 -#endif /* * Warning/diagnostic handling @@ -1335,11 +1332,11 @@ } while (false) #if defined(__cplusplus) -#if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough) +#if __has_cpp_attribute(clang::fallthrough) # define Q_FALLTHROUGH() [[clang::fallthrough]] -#elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough) +#elif __has_cpp_attribute(gnu::fallthrough) # define Q_FALLTHROUGH() [[gnu::fallthrough]] -#elif QT_HAS_CPP_ATTRIBUTE(fallthrough) +#elif __has_cpp_attribute(fallthrough) # define Q_FALLTHROUGH() [[fallthrough]] #endif #endif diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index e6ad80525a..c6f071bc3f 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -75,13 +75,13 @@ # define QT_FEATURE_alloca_malloc_h -1 #endif #define QT_CRYPTOGRAPHICHASH_ONLY_SHA1 -#define QT_FEATURE_cxx11_random (QT_HAS_INCLUDE() ? 1 : -1) +#define QT_FEATURE_cxx11_random (__has_include() ? 1 : -1) #define QT_NO_DATASTREAM #define QT_FEATURE_datestring 1 #define QT_FEATURE_datetimeparser -1 #define QT_FEATURE_easingcurve -1 #define QT_FEATURE_etw -1 -#define QT_FEATURE_getauxval (QT_HAS_INCLUDE() ? 1 : -1) +#define QT_FEATURE_getauxval (__has_include() ? 1 : -1) #define QT_FEATURE_getentropy -1 #define QT_NO_GEOM_VARIANT #define QT_FEATURE_hijricalendar -1 diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 5cd9d3160b..257efbbdbe 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -66,7 +66,7 @@ template Q_ALWAYS_INLINE void qToUnaligned(const T src, void *dest) // Using sizeof(T) inside memcpy function produces internal compiler error with // MSVC2008/ARM in tst_endian -> use extra indirection to resolve size of T. const size_t size = sizeof(T); -#if QT_HAS_BUILTIN(__builtin_memcpy) +#if __has_builtin(__builtin_memcpy) __builtin_memcpy #else memcpy @@ -78,7 +78,7 @@ template Q_ALWAYS_INLINE T qFromUnaligned(const void *src) { T dest; const size_t size = sizeof(T); -#if QT_HAS_BUILTIN(__builtin_memcpy) +#if __has_builtin(__builtin_memcpy) __builtin_memcpy #else memcpy diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 4ab5bd2edb..b662233d4e 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -92,7 +92,7 @@ # include #endif -#if defined(Q_OS_DARWIN) && QT_HAS_INCLUDE() +#if defined(Q_OS_DARWIN) && __has_include() # include # include #endif @@ -3041,7 +3041,7 @@ enum { */ QByteArray QSysInfo::machineUniqueId() { -#if defined(Q_OS_DARWIN) && QT_HAS_INCLUDE() +#if defined(Q_OS_DARWIN) && __has_include() char uuid[UuidStringLen + 1]; io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 1e26e9453a..e335916eac 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -769,7 +769,7 @@ inline void qt_noop(void) {} #if !defined(QT_NO_EXCEPTIONS) # if !defined(Q_MOC_RUN) -# if (defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !QT_HAS_FEATURE(cxx_exceptions)) || \ +# if (defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !__has_feature(cxx_exceptions)) || \ (defined(Q_CC_GNU) && !defined(__EXCEPTIONS)) # define QT_NO_EXCEPTIONS # endif diff --git a/src/corelib/global/qglobal_p.h b/src/corelib/global/qglobal_p.h index 58bc8b7bf3..5ab84fa8be 100644 --- a/src/corelib/global/qglobal_p.h +++ b/src/corelib/global/qglobal_p.h @@ -74,7 +74,7 @@ Q_CORE_EXPORT time_t qMkTime(struct tm *when); QT_END_NAMESPACE -#if !QT_HAS_BUILTIN(__builtin_available) +#if !__has_builtin(__builtin_available) #include #include #include @@ -142,7 +142,7 @@ QT_END_NAMESPACE QT_BUILTIN_AVAILABLE1, \ QT_BUILTIN_AVAILABLE0, ) #define __builtin_available(...) QT_BUILTIN_AVAILABLE_CHOOSER(__VA_ARGS__)(__VA_ARGS__) -#endif // !QT_HAS_BUILTIN(__builtin_available) +#endif // !__has_builtin(__builtin_available) #endif // defined(__cplusplus) #endif // QGLOBAL_P_H diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 17f2246082..5a7f8242de 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -70,7 +70,7 @@ #if QT_CONFIG(slog2) #include #endif -#if QT_HAS_INCLUDE() +#if __has_include() #include #endif @@ -106,7 +106,7 @@ # if __UCLIBC_HAS_BACKTRACE__ # define QLOGGING_HAVE_BACKTRACE # endif -# elif (defined(__GLIBC__) && defined(__GLIBCXX__)) || (QT_HAS_INCLUDE() && QT_HAS_INCLUDE()) +# elif (defined(__GLIBC__) && defined(__GLIBCXX__)) || (__has_include() && __has_include()) # define QLOGGING_HAVE_BACKTRACE # endif #endif @@ -116,7 +116,7 @@ extern char *__progname; #endif #ifndef QT_BOOTSTRAPPED -#if defined(Q_OS_LINUX) && (defined(__GLIBC__) || QT_HAS_INCLUDE()) +#if defined(Q_OS_LINUX) && (defined(__GLIBC__) || __has_include()) # include # if defined(Q_OS_ANDROID) && !defined(SYS_gettid) @@ -1276,7 +1276,7 @@ void QMessagePattern::setPattern(const QString &pattern) #if defined(QLOGGING_HAVE_BACKTRACE) && !defined(QT_BOOTSTRAPPED) // make sure the function has "Message" in the name so the function is removed -#if ((defined(Q_CC_GNU) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) || QT_HAS_ATTRIBUTE(optimize)) \ +#if ((defined(Q_CC_GNU) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) || __has_attribute(optimize)) \ && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG) // force skipping the frame pointer, to save the backtrace() function some work __attribute__((optimize("omit-frame-pointer"))) diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 86e7997680..fdfcbda6ca 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -249,7 +249,7 @@ QT_WARNING_POP // size_t. Implementations for 8- and 16-bit types will work but may not be as // efficient. Implementations for 64-bit may be missing on 32-bit platforms. -#if (defined(Q_CC_GNU) && (Q_CC_GNU >= 500) || (defined(Q_CC_INTEL) && !defined(Q_OS_WIN))) || QT_HAS_BUILTIN(__builtin_add_overflow) +#if (defined(Q_CC_GNU) && (Q_CC_GNU >= 500) || (defined(Q_CC_INTEL) && !defined(Q_OS_WIN))) || __has_builtin(__builtin_add_overflow) // GCC 5, ICC 18, and Clang 3.8 have builtins to detect overflows template inline -- cgit v1.2.3 From b3c0e9afa0041d4d45e47880732deda1dd1013b9 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 9 Dec 2019 23:51:46 +0100 Subject: Deprecate qrand/qsrand They have been marked as deprecated in the documentation for a while Change-Id: Ia2b0b6dbd4c525e3e9c4bc835eee2c9da5a938cb Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index e335916eac..861f087c60 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1266,8 +1266,10 @@ inline int qIntCast(float f) { return int(f); } /* Reentrant versions of basic rand() functions for random number generation */ -Q_CORE_EXPORT void qsrand(uint seed); -Q_CORE_EXPORT int qrand(); +#if QT_DEPRECATED_SINCE(5, 15) +Q_CORE_EXPORT QT_DEPRECATED_VERSION_X_5_15("use QRandomGenerator instead") void qsrand(uint seed); +Q_CORE_EXPORT QT_DEPRECATED_VERSION_X_5_15("use QRandomGenerator instead") int qrand(); +#endif #define QT_MODULE(x) -- cgit v1.2.3 From 5a660353edde7b9f382ee41ecf278fc4537f38fa Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 13 Nov 2019 10:20:09 +0100 Subject: Doc: Fix qdoc compilation errors qtbase Task-number: QTBUG-79824 Change-Id: I6557de598de1931fc30556951d35783d02b83abe Reviewed-by: Paul Wicking --- src/corelib/global/qendian.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qendian.cpp b/src/corelib/global/qendian.cpp index 7fd6e13d3b..98dc6a9a4b 100644 --- a/src/corelib/global/qendian.cpp +++ b/src/corelib/global/qendian.cpp @@ -137,7 +137,7 @@ QT_BEGIN_NAMESPACE \sa qToLittleEndian() */ /*! - \fn template T qFromLittleEndian(const void *src) + \fn template inline T qFromLittleEndian(const void *src) \since 4.3 \relates @@ -159,7 +159,7 @@ QT_BEGIN_NAMESPACE \sa qToLittleEndian() */ /*! - \fn template T qFromLittleEndian(T src) + \fn template inline T qFromLittleEndian(T src) \since 4.3 \relates \overload @@ -171,7 +171,7 @@ QT_BEGIN_NAMESPACE unmodified. */ /*! - \fn template T qFromLittleEndian(const void *src, qsizetype count, void *dest) + \fn template inline T qFromLittleEndian(const void *src, qsizetype count, void *dest) \since 5.12 \relates -- cgit v1.2.3 From c496fee2a5b65fd1b0672923293db058486e350e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 11 Oct 2019 14:10:39 -0700 Subject: qSwap: suppress pedantic warning about noexcept being false This warning is not in -Wall or -Wextra, but it happens in a single place, so we can reasonably suppress it. Fixes: QTBUG-79138 Change-Id: Ib5d667bf77a740c28d2efffd15ccb3f62cf8f431 Reviewed-by: Edward Welbourne Reviewed-by: Allan Sandfeld Jensen --- src/corelib/global/qglobal.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index e335916eac..e636a7cf8f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -944,6 +944,10 @@ QT_WARNING_POP # define Q_DUMMY_COMPARISON_OPERATOR(C) #endif +QT_WARNING_PUSH +// warning: noexcept-expression evaluates to ‘false’ because of a call to ‘void swap(..., ...)' +QT_WARNING_DISABLE_GCC("-Wnoexcept") + namespace QtPrivate { namespace SwapExceptionTester { // insulate users from the "using std::swap" below @@ -963,6 +967,8 @@ inline void qSwap(T &value1, T &value2) swap(value1, value2); } +QT_WARNING_POP + #if QT_DEPRECATED_SINCE(5, 0) Q_CORE_EXPORT QT_DEPRECATED void *qMalloc(size_t size) Q_ALLOC_SIZE(1); Q_CORE_EXPORT QT_DEPRECATED void qFree(void *ptr); -- cgit v1.2.3 From 23d23125068f98f4e6bb1ed3bc9899cefd8cbbf4 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 29 Oct 2019 13:50:22 +0100 Subject: Split cborstream feature in two Reading of Cbor streams is substantially more complicated than writing as it requires float16 support. When writing Cbor, we can just choose to always write 32bit floats, even if we could compress the numbers into 16 bits. We need Cbor writing in the bootstrap library, but we cannot easily add float16 support. Furthermore, Cbor reading is required for plugin support, but not Cbor writing. It might make sense for some users to build a custom Qt with Cbor writing disabled. Therefore, provide two features, cborstreamreader and cborstreamwriter, split up the code in cborstream.{h|cpp} into several files, and enable Cbor writing in the bootstrap library. Change-Id: I15450afb0e328a84a22ebca9379cffc4f900a75a Reviewed-by: Thiago Macieira --- src/corelib/global/qconfig-bootstrapped.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index b62c1a4d35..b3daf43c04 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -75,7 +75,8 @@ # define QT_FEATURE_alloca_malloc_h -1 #endif #define QT_FEATURE_binaryjson -1 -#define QT_FEATURE_cborstream -1 +#define QT_FEATURE_cborstreamreader -1 +#define QT_FEATURE_cborstreamwriter 1 #define QT_CRYPTOGRAPHICHASH_ONLY_SHA1 #define QT_FEATURE_cxx11_random (__has_include() ? 1 : -1) #define QT_NO_DATASTREAM -- cgit v1.2.3 From bda2169d965a40b3229421154979526448a1f745 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 25 Nov 2019 20:31:38 +0100 Subject: Doc: remove documented macros which were removed in Qt5 Remove documentation about QMIN, QMAX and QABS - they were removed during Qt4 -> 5 porting. Change-Id: I24e12e4f2bba635ff412e73dd1d0134bbab5247a Reviewed-by: Paul Wicking --- src/corelib/global/qglobal.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index b662233d4e..c145c46f78 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -4134,36 +4134,6 @@ bool qunsetenv(const char *varName) directive. */ -/*! - \macro QABS(n) - \relates - \obsolete - - Use qAbs(\a n) instead. - - \sa QMIN(), QMAX() -*/ - -/*! - \macro QMIN(x, y) - \relates - \obsolete - - Use qMin(\a x, \a y) instead. - - \sa QMAX(), QABS() -*/ - -/*! - \macro QMAX(x, y) - \relates - \obsolete - - Use qMax(\a x, \a y) instead. - - \sa QMIN(), QABS() -*/ - /*! \macro const char *qPrintable(const QString &str) \relates -- cgit v1.2.3 From 18f22fea7c89da59b040da6361026593c8557a74 Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Wed, 13 Nov 2019 16:39:52 +0100 Subject: Windows QPA: Allow the native Windows virtual keyboard to be disabled This change provides a way to disable the automatic showing of the native Windows on-screen virtual keyboard when a text editing widget is selected on a system without a physical keyboard, by enabling the new AA_MSWindowsDisableVirtualKeyboard application attribute, allowing applications to use a custom virtual keyboard implementation. Fixes: QTBUG-76088 Change-Id: Id76f9673a2e4081e5325662f3e3b4b102d133b9a Reviewed-by: Friedemann Kleint Reviewed-by: Oliver Wolff --- src/corelib/global/qnamespace.h | 1 + src/corelib/global/qnamespace.qdoc | 6 ++++++ 2 files changed, 7 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 047ed8e7b3..5b63daec69 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -523,6 +523,7 @@ public: AA_DontUseNativeMenuBar = 6, AA_MacDontSwapCtrlAndMeta = 7, AA_Use96Dpi = 8, + AA_MSWindowsDisableVirtualKeyboard = 9, #if QT_DEPRECATED_SINCE(5, 14) AA_X11InitThreads Q_DECL_ENUMERATOR_DEPRECATED = 10, #endif diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index ef5f345e9c..6149281904 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -293,6 +293,12 @@ This attribute must be set before QGuiApplication is constructed. This value was added in 5.13 + \value AA_MSWindowsDisableVirtualKeyboard When this attribute is set, + Windows' native on-screen virtual keyboard will not be shown + automatically when a text input widget gains focus on a system + without a physical keyboard. + This value was added in 5.15 + The following values are deprecated or obsolete: \value AA_ImmediateWidgetCreation This attribute is no longer fully -- cgit v1.2.3 From caa82e1fc24907af0a81e31cf9b77ae8e82e44cc Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Wed, 18 Dec 2019 15:27:06 +0100 Subject: Doc: Add since version for QCursor::swap and QOperatingSystemVersion::currentType. Fixes: QTBUG-80854 Fixes: QTBUG-80891 Change-Id: Ia256fa0d3ad4665f44b933f5a4a8d4ee87e9fc13 Reviewed-by: Timur Pocheptsov Reviewed-by: Leena Miettinen --- src/corelib/global/qoperatingsystemversion.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp index 33793ca168..261f5c8795 100644 --- a/src/corelib/global/qoperatingsystemversion.cpp +++ b/src/corelib/global/qoperatingsystemversion.cpp @@ -299,6 +299,8 @@ int QOperatingSystemVersion::compare(const QOperatingSystemVersion &v1, Returns the current OS type without constructing a QOperatingSystemVersion instance. + \since 5.10 + \sa current() */ -- cgit v1.2.3 From 512b87bc28fc70058e240cf720fdfc9c9da98afb Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 18 Dec 2019 09:32:31 +0100 Subject: Don't have a "see also qrand" from qrand I guess what we wanted there was qsrand Change-Id: I8e18e76ae65abf9de231d51faa61cc9142ea2b98 Reviewed-by: Thiago Macieira --- src/corelib/global/qrandom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index 3cbd40b772..10672c1f92 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -1295,7 +1295,7 @@ void qsrand(uint seed) \note This function is deprecated. In new applications, use QRandomGenerator instead. - \sa qrand(), QRandomGenerator + \sa qsrand(), QRandomGenerator */ int qrand() { -- cgit v1.2.3 From c24404dbda48bd4f9d6ceb4777fced7b164345fd Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 19 Dec 2019 10:10:43 +0100 Subject: Unbreak developer build with clang-cl Move the macro definitions for Q_DECL_UNUSED_MEMBER along with a definition for Q_DECL_UNUSED from the scope excluding icc and cl into a separate one for plain clang and cl since the attributes work with clang-cl as well. Remove the check introduced in 9782938045c33b37fe0bbb6cdf00e406cd3d837e since it is assumed that all clang versions have the attribute now. Fixes: include\QtCore/../../src/corelib/io/qloggingcategory.h(87,32): error: private field 'd' is not used [-Werror,-Wunused-private-field] Q_DECL_UNUSED_MEMBER void *d; // reserved for future use ^ include\QtCore/../../src/corelib/io/qloggingcategory.h(108,31): error: private field 'placeholder' is not used [-Werror,-Wunused-private-field] Q_DECL_UNUSED_MEMBER bool placeholder[4]; // reserved for future use Task-number: QTBUG-63512 Change-Id: I651771b085408443bb02e96698a980170fcaeb6d Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 60dc7ce688..0091cfcb60 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -828,13 +828,14 @@ # endif # endif -# if defined(__has_warning) -# if __has_warning("-Wunused-private-field") -# define Q_DECL_UNUSED_MEMBER Q_DECL_UNUSED -# endif -# endif +#endif // Q_CC_CLANG && !Q_CC_INTEL && !Q_CC_MSVC -#endif // Q_CC_CLANG +#if defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) +# ifndef Q_DECL_UNUSED +# define Q_DECL_UNUSED __attribute__((__unused__)) +# endif +# define Q_DECL_UNUSED_MEMBER Q_DECL_UNUSED +#endif #if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG) # define Q_COMPILER_RESTRICTED_VLA -- cgit v1.2.3 From a6f56251ca6090cb0ba4c4989d7ccc638b1dbe2b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 2 Jan 2020 12:24:15 +0100 Subject: Fix some qdoc warnings src/corelib/tools/qhash.cpp:2596: (qdoc) warning: clang found diagnostics parsing \fn template template QMultiHash::QMultiHash(InputIterator begin, InputIterator end) error: 'QMultiHash' is not a class, namespace, or enumeration src/corelib/kernel/qobject.cpp:4593: (qdoc) warning: Undocumented parameter 'EXPORT_MACRO' in QObject::Q_NAMESPACE_EXPORT src/corelib/global/qfloat16.cpp:129: (qdoc) warning: Cannot tie this documentation to anything src/corelib/text/qlocale.qdoc:1204: (qdoc) warning: Overrides a previous doc src/corelib/text/qlocale.qdoc:1187: (qdoc) warning: (The previous doc is here) src/network/kernel/qhostinfo.cpp:597: (qdoc) warning: clang found diagnostics parsing \fn QHostInfo(QHostInfo &&other) src/printsupport/dialogs/qabstractprintdialog.cpp:346: (qdoc) warning: clang found diagnostics parsing \fn int QAbstractPrintDialog::exec(): error: out-of-line definition of 'exec' does not match any declaration in 'QAbstractPrintDialog' src/testlib/qsignalspy.qdoc:101: (qdoc) warning: clang found diagnostics parsing \fn QSignalSpy(const QObject *obj, const QMetaMethod &signal): error: expected unqualified-id src/testlib/doc/src/qttest-best-practices.qdoc:28: (qdoc) warning: Can't link to 'Q_VERIFY2()' src/widgets/kernel/qactiongroup.cpp:291: (qdoc) warning: Undocumented parameter 'b' in QActionGroup::setExclusive() src/widgets/kernel/qactiongroup.cpp:305: (qdoc) warning: Undocumented return value (hint: use 'return' or 'returns' in the text src/widgets/kernel/qshortcut.cpp:542: (qdoc) warning: No such parameter 'context' in QShortcut::QShortcut() src/widgets/widgets/qdatetimeedit.cpp:632: (qdoc) warning: No such parameter 'minimumTime' in QDateTimeEdit::setTimeRange() src/widgets/widgets/qdatetimeedit.cpp:632: (qdoc) warning: No such parameter 'maximumTime' in QDateTimeEdit::setTimeRange() src/widgets/widgets/qdatetimeedit.cpp:632: (qdoc) warning: No such parameter 'less' in QDateTimeEdit::setTimeRange() Change-Id: I9799b5135e84c4d811674b2d114ef27315bc12df Reviewed-by: Paul Wicking --- src/corelib/global/qfloat16.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp index 6c21b7de5a..c868e879b7 100644 --- a/src/corelib/global/qfloat16.cpp +++ b/src/corelib/global/qfloat16.cpp @@ -109,7 +109,7 @@ QT_BEGIN_NAMESPACE /*! \internal \since 5.14 - bool qfloat16::isInf() const noexcept + \fn bool qfloat16::isInf() const noexcept Tests whether this \c qfloat16 value is an infinity. @@ -119,7 +119,7 @@ QT_BEGIN_NAMESPACE /*! \internal \since 5.14 - bool qfloat16::isNaN() const noexcept + \fn bool qfloat16::isNaN() const noexcept Tests whether this \c qfloat16 value is "not a number". @@ -128,7 +128,7 @@ QT_BEGIN_NAMESPACE /*! \since 5.14 - bool qfloat16::isNormal() const noexcept + \fn bool qfloat16::isNormal() const noexcept Tests whether this \c qfloat16 value is finite and in normal form. @@ -138,7 +138,7 @@ QT_BEGIN_NAMESPACE /*! \internal \since 5.14 - bool qfloat16::isFinite() const noexcept + \fn bool qfloat16::isFinite() const noexcept Tests whether this \c qfloat16 value is finite. -- cgit v1.2.3 From c61cedcc5475a77fb94ed12788f61039835f8079 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 3 Jan 2020 23:06:45 +0100 Subject: GCC: revoke constexpr before 5.0 It's causing build failures on GCC 4.9 due to our code hitting https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57694 (at least since de82d239f814cf2a717bea0defeee3732384e271). Task-number: QTBUG-80997 Change-Id: I80a9d1fcbf26d8c0bf514ddc7bdb86eb7173360f Reviewed-by: Ville Voutilainen --- src/corelib/global/qcompilerdetection.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 0091cfcb60..1ea4e7d287 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -883,7 +883,6 @@ # define Q_COMPILER_DEFAULT_MEMBERS # define Q_COMPILER_DELETE_MEMBERS /* C++11 features supported in GCC 4.6: */ -# define Q_COMPILER_CONSTEXPR # define Q_COMPILER_NULLPTR # define Q_COMPILER_UNRESTRICTED_UNIONS # define Q_COMPILER_RANGE_FOR @@ -914,7 +913,11 @@ # define Q_COMPILER_REF_QUALIFIERS # endif # endif - /* C++11 features are complete as of GCC 4.8.1 */ +# if Q_CC_GNU >= 500 + /* GCC 4.6 introduces constexpr, but it's bugged (at least) in the whole + * 4.x series, see e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57694 */ +# define Q_COMPILER_CONSTEXPR +# endif # endif # if __cplusplus > 201103L # if Q_CC_GNU >= 409 -- cgit v1.2.3 From a16c37b78fff5c4b24328d52bf9b2c7f57db0d12 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 11 Jan 2020 12:36:01 +0100 Subject: Enforce that char16_t / char32_t are 16/32 bits The standard makes them as big as int_least16_t / 32_t, i.e. big enough to hold UTF-16 / UTF-32 code units. We're relying on them to be *exactly* 16/32 bit instead. Drive by: move the check that a char is 8 bits before saying that some other type is not its expected sizeof() * 8. Change-Id: Idbf3d33331667d417702d9dde221905bcfc4d021 Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 20046e3fcf..da69628d2b 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -139,10 +139,12 @@ Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n); // in. The idea here is to error or warn if otherwise implicit Qt // assumptions are not fulfilled on new hardware or compilers // (if this list becomes too long, consider factoring into a separate file) -Q_STATIC_ASSERT_X(sizeof(int) == 4, "Qt assumes that int is 32 bits"); Q_STATIC_ASSERT_X(UCHAR_MAX == 255, "Qt assumes that char is 8 bits"); +Q_STATIC_ASSERT_X(sizeof(int) == 4, "Qt assumes that int is 32 bits"); Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined incorrectly"); Q_STATIC_ASSERT_X(sizeof(float) == 4, "Qt assumes that float is 32 bits"); +Q_STATIC_ASSERT_X(sizeof(char16_t) == 2, "Qt assumes that char16_t is 16 bits"); +Q_STATIC_ASSERT_X(sizeof(char32_t) == 4, "Qt assumes that char32_t is 32 bits"); // While we'd like to check for __STDC_IEC_559__, as per ISO/IEC 9899:2011 // Annex F (C11, normative for C++11), there are a few corner cases regarding -- cgit v1.2.3 From f936ca4f86e359cb919be9d21ad239618a878559 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 12 Jan 2020 11:32:06 -0800 Subject: qglobal.h: remove non-ASCII quotes from comment Because MSVC warns. Added by me on commit. c496fee2a5b65fd1b0672923293db058486e350e Fixes: QTBUG-81310 Change-Id: I596aec77785a4e4e84d5fffd15e93a8e367e035e Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Edward Welbourne --- src/corelib/global/qglobal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index e636a7cf8f..fe8e8e8bc8 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -945,7 +945,7 @@ QT_WARNING_POP #endif QT_WARNING_PUSH -// warning: noexcept-expression evaluates to ‘false’ because of a call to ‘void swap(..., ...)' +// warning: noexcept-expression evaluates to 'false' because of a call to 'void swap(..., ...)' QT_WARNING_DISABLE_GCC("-Wnoexcept") namespace QtPrivate -- cgit v1.2.3 From 04f6073da2eb9af1d0728aa688c906b682a44801 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 9 Jan 2020 10:35:12 +0100 Subject: ICC compile-fix for __builtin_add_overflow()'s parameter type Based on Glen Johnson's patch, but rearranged to avoid repetition. Fixes: QTBUG-81248 Change-Id: I9c23ab233ebd5514bc05fd155999597ada7295ef Reviewed-by: Thiago Macieira --- src/corelib/global/qnumeric_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index fdfcbda6ca..7418579fe0 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -249,7 +249,8 @@ QT_WARNING_POP // size_t. Implementations for 8- and 16-bit types will work but may not be as // efficient. Implementations for 64-bit may be missing on 32-bit platforms. -#if (defined(Q_CC_GNU) && (Q_CC_GNU >= 500) || (defined(Q_CC_INTEL) && !defined(Q_OS_WIN))) || __has_builtin(__builtin_add_overflow) +#if ((defined(Q_CC_INTEL) ? (Q_CC_INTEL >= 1800 && !defined(Q_OS_WIN)) : defined(Q_CC_GNU)) \ + && Q_CC_GNU >= 500) || __has_builtin(__builtin_add_overflow) // GCC 5, ICC 18, and Clang 3.8 have builtins to detect overflows template inline -- cgit v1.2.3 From 28f95d4688c28f8c06aa103012c6a00e197db12c Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 15 Jan 2020 14:38:14 +0100 Subject: Doc: Fix qdoc compilation errors qtbase Task-number: QTBUG-79824 Change-Id: I5a39525e3e735415ba96e2d585c5de754deb15de Reviewed-by: Venugopal Shivashankar --- src/corelib/global/qendian.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qendian.cpp b/src/corelib/global/qendian.cpp index 98dc6a9a4b..eb08b2f848 100644 --- a/src/corelib/global/qendian.cpp +++ b/src/corelib/global/qendian.cpp @@ -192,7 +192,6 @@ QT_BEGIN_NAMESPACE an in-place swap (if necessary). If they are not the same, the memory regions must not overlap. - \sa qFromLittleEndian() \sa qToBigEndian() \sa qToLittleEndian() */ -- cgit v1.2.3