From ec1548ae122af2febfc61c0242025ee52c8cbc30 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 31 Oct 2018 13:49:14 +0100 Subject: Doc: Fix various documentation warnings These include typos, marking functions as \internal, documenting trivial things, and fixing the function signatures passed to the \fn command. Task-number: QTBUG-71502 Change-Id: I24a9e1f7e1cdb39e5c31b99202bdd593c6b789ff Reviewed-by: Martin Smith Reviewed-by: Paul Wicking Reviewed-by: Edward Welbourne --- src/corelib/global/qglobal.cpp | 2 +- src/corelib/global/qglobalstatic.qdoc | 10 ++++++---- src/corelib/io/qdir.cpp | 11 ++++++----- src/corelib/io/qprocess.cpp | 8 ++++---- src/corelib/kernel/qdeadlinetimer.cpp | 5 +++++ src/corelib/kernel/qeventdispatcher_cf.mm | 2 +- src/corelib/kernel/qtimer.cpp | 18 +++++++++--------- src/corelib/tools/qbytearray.cpp | 4 ++-- src/corelib/tools/qmap.cpp | 2 +- src/corelib/tools/qregularexpression.cpp | 4 ++-- src/corelib/tools/qshareddata.cpp | 7 +++++++ src/corelib/tools/qstring.cpp | 2 +- src/corelib/tools/qtimezone.cpp | 2 +- 13 files changed, 46 insertions(+), 31 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 5c1665fa00..88d4877be5 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -3796,7 +3796,7 @@ bool qunsetenv(const char *varName) dependent delayed translation in the given \a context with the given \a comment. The \a context is typically a class and also needs to be specified - as a string literal. The string literal \a disambiguation should be + as a string literal. The string literal \a comment should be a short semantic tag to tell apart otherwise identical strings. The macro tells lupdate to collect the string, and expands to an diff --git a/src/corelib/global/qglobalstatic.qdoc b/src/corelib/global/qglobalstatic.qdoc index dbea04ecab..e7935d5a9b 100644 --- a/src/corelib/global/qglobalstatic.qdoc +++ b/src/corelib/global/qglobalstatic.qdoc @@ -435,6 +435,7 @@ */ /*! + \keyword qglobalstatic-operator-type-ptr \fn template QGlobalStatic::operator Type*() This function returns the address of the contents of this global static. If @@ -476,10 +477,11 @@ by this function. If the contents have already been destroyed, this function will return a null pointer. - This function is equivalent to \l {operator Type *()}. It is provided for - compatibility with the private Q_GLOBAL_STATIC implementation that existed - in Qt 4.x and 5.0. New code should avoid using it and should instead treat - the object as a smart pointer. + This function is equivalent to \l {qglobalstatic-operator-type-ptr} + {operator Type *()}. It is provided for compatibility with the private + Q_GLOBAL_STATIC implementation that existed in Qt 4.x and 5.0. New code + should avoid using it and should instead treat the object as a smart + pointer. */ /*! diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 75fd0f8e0a..7df461ddce 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1040,7 +1040,8 @@ QStringList QDir::nameFilters() const list of filters specified by \a nameFilters. Each name filter is a wildcard (globbing) filter that understands - \c{*} and \c{?} wildcards. (See \l{QRegularExpression wildcard matching}.) + \c{*} and \c{?} wildcards. See \l{QRegularExpression#Wildcard matching} + {QRegularExpression Wildcard Matching}. For example, the following code sets three name filters on a QDir to ensure that only files with extensions typically used for C++ @@ -2120,8 +2121,8 @@ QString QDir::rootPath() patterns in the list of \a filters; otherwise returns \c false. The matching is case insensitive. - \sa {QRegularExpression Wildcard matching}, QRegularExpression::wildcardToRegularExpression(), - entryList(), entryInfoList() + \sa {QRegularExpression#Wildcard matching}{QRegularExpression Wildcard Matching}, + entryList(), entryInfoList() */ bool QDir::match(const QStringList &filters, const QString &fileName) { @@ -2143,8 +2144,8 @@ bool QDir::match(const QStringList &filters, const QString &fileName) contain multiple patterns separated by spaces or semicolons. The matching is case insensitive. - \sa {QRegularExpression wildcard matching}, QRegularExpression::wildcardToRegularExpression, - entryList(), entryInfoList() + \sa {QRegularExpression#Wildcard matching}{QRegularExpression Wildcard Matching}, + entryList(), entryInfoList() */ bool QDir::match(const QString &filter, const QString &fileName) { diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 890867cd51..e1f4a3a311 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -112,12 +112,12 @@ QT_BEGIN_NAMESPACE \relates QProcess Disables the - \l {QProcess::start(const QString &, OpenMode)}{QProcess::start()} - overload taking a single string. + \l {QProcess::start(const QString &, QIODevice::OpenMode)} + {QProcess::start}() overload taking a single string. In most cases where it is used, the user intends for the first argument to be treated atomically as per the other overload. - \sa QProcess::start(const QString &command, OpenMode mode) + \sa QProcess::start(const QString &command, QIODevice::OpenMode mode) */ /*! @@ -2557,7 +2557,7 @@ bool QProcess::startDetached(const QString &program, After the \a command string has been split and unquoted, this function behaves like the overload which takes the arguments as a string list. - \sa start(const QString &command, OpenMode mode) + \sa start(const QString &command, QIODevice::OpenMode mode) */ bool QProcess::startDetached(const QString &command) { diff --git a/src/corelib/kernel/qdeadlinetimer.cpp b/src/corelib/kernel/qdeadlinetimer.cpp index 466056d513..6aa886cfe1 100644 --- a/src/corelib/kernel/qdeadlinetimer.cpp +++ b/src/corelib/kernel/qdeadlinetimer.cpp @@ -720,6 +720,11 @@ QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_ Returns the time remaining before the deadline. */ +/*! + \fn QPair QDeadlineTimer::_q_data() const + \internal +*/ + // the rest of the functions are in qelapsedtimer_xxx.cpp QT_END_NAMESPACE diff --git a/src/corelib/kernel/qeventdispatcher_cf.mm b/src/corelib/kernel/qeventdispatcher_cf.mm index 8881305b18..b7b379e2c1 100644 --- a/src/corelib/kernel/qeventdispatcher_cf.mm +++ b/src/corelib/kernel/qeventdispatcher_cf.mm @@ -58,7 +58,7 @@ QT_USE_NAMESPACE -/*! +/* During scroll view panning, and possibly other gestures, UIKit will request a switch to UITrackingRunLoopMode via GSEventPushRunLoopMode, which records the new runloop mode and stops the current runloop. diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 90f29aa630..13f027074a 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -571,43 +571,43 @@ void QTimer::singleShot(int msec, Qt::TimerType timerType, const QObject *receiv */ /*! - \fn template QMetaObject::Connection callOnTimeout(Functor functor, Qt::ConnectionType connectionType = Qt::AutoConnection) + \fn template QMetaObject::Connection QTimer::callOnTimeout(Functor slot, Qt::ConnectionType connectionType = Qt::AutoConnection) \since 5.12 \overload - Creates a connection from the timeout() signal to \a functor, and returns a + Creates a connection from the timeout() signal to \a slot, and returns a handle to the connection. This method is provided for convenience. - It's equivalent to calling \c {QObject::connect(timer, &QTimer::timeout, timer, functor, connectionType)}. + It's equivalent to calling \c {QObject::connect(timer, &QTimer::timeout, timer, slot, connectionType)}. \sa QObject::connect(), timeout() */ /*! - \fn template QMetaObject::Connection callOnTimeout(QObject *context, Functor functor, Qt::ConnectionType connectionType = Qt::AutoConnection) + \fn template QMetaObject::Connection QTimer::callOnTimeout(const QObject *context, Functor slot, Qt::ConnectionType connectionType = Qt::AutoConnection) \since 5.12 \overload callOnTimeout() - Creates a connection from the timeout() signal to \a functor to be placed in a specific + Creates a connection from the timeout() signal to \a slot to be placed in a specific event loop of \a context, and returns a handle to the connection. This method is provided for convenience. It's equivalent to calling - \c {QObject::connect(timer, &QTimer::timeout, context, functor, connectionType)}. + \c {QObject::connect(timer, &QTimer::timeout, context, slot, connectionType)}. \sa QObject::connect(), timeout() */ /*! - \fn template QMetaObject::Connection callOnTimeout(QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType connectionType = Qt::AutoConnection) + \fn template QMetaObject::Connection QTimer::callOnTimeout(const QObject *receiver, PointerToMemberFunction slot, Qt::ConnectionType connectionType = Qt::AutoConnection) \since 5.12 \overload callOnTimeout() - Creates a connection from the timeout() signal to the \a method in the \a receiver object. Returns + Creates a connection from the timeout() signal to the \a slot in the \a receiver object. Returns a handle to the connection. This method is provided for convenience. It's equivalent to calling - \c {QObject::connect(timer, &QTimer::timeout, receiver, method, connectionType)}. + \c {QObject::connect(timer, &QTimer::timeout, receiver, slot, connectionType)}. \sa QObject::connect(), timeout() */ diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 8f2ad8c012..53ae7b9452 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -3076,7 +3076,7 @@ bool QByteArray::endsWith(const char *str) const return qstrncmp(d->data() + d->size - len, str, len) == 0; } -/*! +/* Returns true if \a c is an uppercase Latin1 letter. \note The multiplication sign 0xD7 and the sz ligature 0xDF are not treated as uppercase Latin1. @@ -3112,7 +3112,7 @@ bool QByteArray::isUpper() const return true; } -/*! +/* Returns true if \a c is an lowercase Latin1 letter. \note The division sign 0xF7 is not treated as lowercase Latin1, but the small y dieresis 0xFF is. diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index d7844f3128..5f7275c5f8 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -537,7 +537,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator=() */ -/*! \fn template QMap::QMap(const std::map & other) +/*! \fn template QMap::QMap(const typename std::map & other) Constructs a copy of \a other. diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index fec5f620fc..908e7ff0d6 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -2000,8 +2000,8 @@ QString QRegularExpression::wildcardToRegularExpression(const QString &pattern) \since 5.12 - Returns the expression wrapped between the \c{\A} and \c{\z} anchors to be - used for exact matching. + Returns the \a expression wrapped between the \c{\A} and \c{\z} anchors to + be used for exact matching. \sa {Porting from QRegExp's Exact Matching} */ diff --git a/src/corelib/tools/qshareddata.cpp b/src/corelib/tools/qshareddata.cpp index bc4291e20f..c334f71fa0 100644 --- a/src/corelib/tools/qshareddata.cpp +++ b/src/corelib/tools/qshareddata.cpp @@ -579,6 +579,13 @@ QT_BEGIN_NAMESPACE the shared data object if the reference count became 0. */ +/*! \fn template T *QExplicitlySharedDataPointer::take() + \since 5.12 + + Returns a pointer to the shared object, and resets \e this to be null. + That is, this function sets the \e{d pointer} of \e this to \c nullptr. + */ + /*! \fn template QExplicitlySharedDataPointer::operator bool () const Returns \c true if the \e{d pointer} of \e this is \e not null. */ diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index c89635cfdb..fb7fb64223 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -254,7 +254,7 @@ inline RetType UnrollTailLoop<0>::exec(Number, RetType returnIfExited, Functor1, /*! * \internal * - * Searches for character \a \c in the string \a str and returns a pointer to + * Searches for character \a c in the string \a str and returns a pointer to * it. Unlike strchr() and wcschr() (but like glibc's strchrnul()), if the * character is not found, this function returns a pointer to the end of the * string -- that is, \c{str.end()}. diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index db6be581ec..cbc6b50c98 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -217,7 +217,7 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz); This class includes data obtained from the CLDR data files under the terms of the Unicode Data Files and Software License. See - \l{Unicode CLDR (Unicode Common Locale Data Repository)} for the details. + \l{Unicode Common Locale Data Repository (CLDR)} for details. \sa QDateTime */ -- cgit v1.2.3 From a92735ec007b7cafacb70029ce10f039ace66515 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 30 Oct 2018 14:40:54 +0100 Subject: Doc: Document Qt::ScrollMomentum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And fix a typo in Qt::ScrollEnd. Task-number: QTBUG-71502 Change-Id: I3efdbd12415814e066edd1b2f102a792812d36d5 Reviewed-by: Tor Arne Vestbø --- src/corelib/global/qnamespace.qdoc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 42009e0b5e..652efb10bf 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -3187,8 +3187,12 @@ \value ScrollUpdate The scrolling distance has changed (default). - \value ScrollEnd Scrolling has ended, but the scrolling distance + \value ScrollEnd Scrolling has ended, and the scrolling distance did not change anymore. + + \value ScrollMomentum The user no longer touches the input device, + but scrolling continues due to scroll momentum. + This value was introduced in Qt 5.12. */ /*! -- cgit v1.2.3 From 46a595b047a928b1a5d527065c6814ef05e3a97b Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 30 Oct 2018 14:13:31 +0100 Subject: Doc: QCbor classes: Fix \variable commands \variable must not include the variable type, QDoc will resolve that. This commit resolves four documentation warnings. Task-number: QTBUG-71502 Change-Id: I5e88cf66d3c3bb8f18495d5477e1271ac2cd9e74 Reviewed-by: Martin Smith --- src/corelib/serialization/qcborstream.cpp | 6 ++++-- src/corelib/serialization/qcborvalue.cpp | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/serialization/qcborstream.cpp b/src/corelib/serialization/qcborstream.cpp index 22286188b8..7628019943 100644 --- a/src/corelib/serialization/qcborstream.cpp +++ b/src/corelib/serialization/qcborstream.cpp @@ -1422,12 +1422,14 @@ bool QCborStreamWriter::endMap() */ /*! - \variable Container QCborStreamReader::StringResult::data + \variable QCborStreamReader::StringResult::data + Contains the actual data from the string if \l status is \c Ok. */ /*! - \variable QCborStreamReader::StringResultCode QCborStreamReader::StringResult::status + \variable QCborStreamReader::StringResult::status + Contains the status of the attempt of reading the string from the stream. */ diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp index 5d97a6a06a..e53b6a0326 100644 --- a/src/corelib/serialization/qcborvalue.cpp +++ b/src/corelib/serialization/qcborvalue.cpp @@ -221,7 +221,7 @@ QT_BEGIN_NAMESPACE */ /*! - \variable qint64 QCborParserError::offset + \variable QCborParserError::offset This field contains the offset from the beginning of the data where the error was detected. The offset should point to the beginning of the item @@ -232,7 +232,7 @@ QT_BEGIN_NAMESPACE */ /*! - \variable QCborError QCborParserError::error + \variable QCborParserError::error This field contains the error code that indicates what decoding problem was found. -- cgit v1.2.3 From 4615415500bfa816b6010cfd47162899dd72c682 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 30 Oct 2018 14:01:00 +0100 Subject: Doc: Tie the QScopeGuard documentation to a class Previously no documentation was generated for the global qScopeGuard() function. Create a class documentation page and add the the function as a related non-member using \relates. Task-number: QTBUG-71502 Change-Id: Ida5d7044f4de962360dfee9321feb49005d4b299 Reviewed-by: Martin Smith --- src/corelib/tools/qscopeguard.qdoc | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qscopeguard.qdoc b/src/corelib/tools/qscopeguard.qdoc index 7cbc3e9c7b..70e13ab2fd 100644 --- a/src/corelib/tools/qscopeguard.qdoc +++ b/src/corelib/tools/qscopeguard.qdoc @@ -30,24 +30,36 @@ QT_BEGIN_NAMESPACE /*! - \fn const QScopeGuard qScopeGuard(F f) - \inmodule QtCore - \brief The qScopeGuard function can be used to call a function at the end of the scope. + \class QScopeGuard \since 5.12 + \inmodule QtCore + \brief Provides a scope guard for calling a function at the of + a scope. +*/ + +/*! + \fn template const QScopeGuard qScopeGuard(F f) + \inmodule QtCore + \relates QScopeGuard + \brief The qScopeGuard function can be used to call a function at the end + of the scope. \ingroup misc - QScopeGuard is a class which sole purpose is to run a function F in its destructor. - This is useful for guaranteeing your cleanup code is executed whether the function is exited normally, - exited early by a return statement, or exited by an exception. + QScopeGuard is a class which sole purpose is to run a function \e F in + its destructor. This is useful for guaranteeing your cleanup code is + executed, whether the function is exited normally, exited early by a return + statement, or exited by an exception. - If F is a lambda then you cannot instantiate the template directly, therefore the qScopeGuard() helper - is provided and QScopeGuard is made a private implementation detail. + If \e F is a lambda then you cannot instantiate the template directly, + therefore the qScopeGuard() helper is provided and QScopeGuard is made a + private implementation detail. Example usage is as follows: \snippet code/src_corelib_tools_qscopeguard.cpp 0 - \note Exceptions are not supported. The callable shouldn't throw when executed, copied or moved. + \note Exceptions are not supported. The callable shouldn't throw when + executed, copied or moved. \sa QScopedValueRollback */ -- cgit v1.2.3 From 3f61873f497286af1bce97883f30bf9a520e6a75 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 26 Oct 2018 15:32:50 +0000 Subject: Correctly document value of QThread::currentThreadId on Windows The implementation calls GetCurrentThreadId, not GetCurrentThread, so the return value is not the pseudo-handle. Task-number: QTBUG-67686 Change-Id: Ifde0cf603dcea01bc1c454a8bebe1e5c0f22617f Reviewed-by: Paul Wicking Reviewed-by: Thiago Macieira --- src/corelib/thread/qthread.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index d2d6435004..d3f60eea4f 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -298,12 +298,9 @@ QThreadPrivate::~QThreadPrivate() \warning The handle returned by this function is used for internal purposes and should not be used in any application code. - \warning On Windows, the returned value is a pseudo-handle for the - current thread. It can't be used for numerical comparison. i.e., - this function returns the DWORD (Windows-Thread ID) returned by - the Win32 function getCurrentThreadId(), not the HANDLE - (Windows-Thread HANDLE) returned by the Win32 function - getCurrentThread(). + \note On Windows, this function returns the DWORD (Windows-Thread + ID) returned by the Win32 function GetCurrentThreadId(), not the pseudo-HANDLE + (Windows-Thread HANDLE) returned by the Win32 function GetCurrentThread(). */ /*! -- cgit v1.2.3 From efc7e02911f2244c693fe8336f7b4b1c0ea3bc09 Mon Sep 17 00:00:00 2001 From: Janne Koskinen Date: Wed, 24 Oct 2018 14:57:44 +0200 Subject: INTEGRITY: Fix missing uint/int 128 support for 64-bit ARM Add 64bit specializations for mul_overflow. Change-Id: I8bba69233dd71b94346983a100cf4d69bfc686f7 Reviewed-by: Thiago Macieira --- src/corelib/global/qnumeric_p.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 9c8514f5a3..e318c3759b 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -64,6 +64,10 @@ #include #endif +# if defined(Q_OS_INTEGRITY) && defined(Q_PROCESSOR_ARM_64) +#include +#endif + #if !defined(Q_CC_MSVC) && (defined(Q_OS_QNX) || defined(Q_CC_INTEL)) # include # ifdef isnan @@ -323,6 +327,38 @@ mul_overflow(T v1, T v2, T *r) return lr > std::numeric_limits::max() || lr < std::numeric_limits::min(); } +# if defined(Q_OS_INTEGRITY) && defined(Q_PROCESSOR_ARM_64) +template <> inline bool mul_overflow(quint64 v1, quint64 v2, quint64 *r) +{ + *r = v1 * v2; + return __MULUH64(v1, v2); +} +template <> inline bool mul_overflow(qint64 v1, qint64 v2, qint64 *r) +{ + qint64 high = __MULSH64(v1, v2); + if (high == 0) { + *r = v1 * v2; + return *r < 0; + } + if (high == -1) { + *r = v1 * v2; + return *r >= 0; + } + return true; +} + +template <> inline bool mul_overflow(uint64_t v1, uint64_t v2, uint64_t *r) +{ + return mul_overflow(v1,v2,reinterpret_cast(r)); +} + +template <> inline bool mul_overflow(int64_t v1, int64_t v2, int64_t *r) +{ + return mul_overflow(v1,v2,reinterpret_cast(r)); +} + +#endif + # if defined(Q_CC_MSVC) && defined(Q_PROCESSOR_X86) // We can use intrinsics for the unsigned operations with MSVC template <> inline bool add_overflow(unsigned v1, unsigned v2, unsigned *r) -- cgit v1.2.3 From a52d7861edfb5956de38ba80015c4dd0b596259b Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 13 Nov 2018 16:00:23 +0100 Subject: Fix compile issue with gcc 9 It appears messenne_twisters in the latest libstdc++ has one more requirement before it is willing to construct with our SystemGenerator struct as an sseq provider. Change-Id: If38151d1fa6f40a80274acc26d9ed6b4ac6049fe Reviewed-by: Giuseppe D'Angelo Reviewed-by: Thiago Macieira --- src/corelib/global/qrandom.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib') diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index 23e5e499b2..03534cf453 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -218,6 +218,7 @@ struct QRandomGenerator::SystemGenerator #endif // Q_OS_WINRT static SystemGenerator &self(); + typedef quint32 result_type; void generate(quint32 *begin, quint32 *end) Q_DECL_NOEXCEPT_EXPR(FillBufferNoexcept); // For std::mersenne_twister_engine implementations that use something -- cgit v1.2.3 From 527406cbd99f44470ef87468b73c18df949e8ac7 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 12 Nov 2018 09:40:47 +0100 Subject: Modernize the "settings" feature Change-Id: I9b8a61ecb1413b513ae5c9e77d3ee1b3e8b6562c Reviewed-by: Edward Welbourne Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qconfig-bootstrapped.h | 2 ++ src/corelib/global/qlibraryinfo.cpp | 14 ++++++++------ src/corelib/io/io.pri | 26 ++++++++++++++++++-------- src/corelib/io/qsettings.cpp | 4 ---- src/corelib/io/qsettings.h | 7 +------ src/corelib/io/qsettings_mac.cpp | 2 -- src/corelib/io/qsettings_win.cpp | 3 --- src/corelib/io/qsettings_winrt.cpp | 3 --- src/corelib/kernel/qcoreapplication_p.h | 2 ++ 9 files changed, 31 insertions(+), 32 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index 229b4d17a1..f62137fe66 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -126,11 +126,13 @@ #define QT_FEATURE_commandlineparser -1 #define QT_NO_COMPRESS #define QT_JSON_READONLY +#define QT_FEATURE_settings 1 #define QT_NO_STANDARDPATHS #define QT_FEATURE_textcodec -1 #else #define QT_FEATURE_codecs -1 #define QT_FEATURE_commandlineparser 1 +#define QT_FEATURE_settings -1 #define QT_FEATURE_textcodec 1 #endif diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index e727f00c8e..4119012d85 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -41,7 +41,9 @@ #include "qdir.h" #include "qstringlist.h" #include "qfile.h" +#if QT_CONFIG(settings) #include "qsettings.h" +#endif #include "qlibraryinfo.h" #include "qscopedpointer.h" @@ -67,7 +69,7 @@ QT_BEGIN_NAMESPACE extern void qDumpCPUFeatures(); // in qsimd.cpp -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) struct QLibrarySettings { @@ -204,7 +206,7 @@ QSettings *QLibraryInfoPrivate::findConfiguration() return 0; //no luck } -#endif // QT_NO_SETTINGS +#endif // settings /*! \class QLibraryInfo @@ -464,7 +466,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) #endif // QT_BUILD_QMAKE, started inside location ! QString ret; bool fromConf = false; -#ifndef QT_NO_SETTINGS +#if QT_CONFIG(settings) #ifdef QT_BUILD_QMAKE // Logic for choosing the right data source: if EffectivePaths are requested // and qt.conf with that section is present, use it, otherwise fall back to @@ -547,7 +549,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) ret = QDir::fromNativeSeparators(ret); } } -#endif // QT_NO_SETTINGS +#endif // settings #ifndef QT_BUILD_QMAKE_BOOTSTRAP if (!fromConf) { @@ -646,7 +648,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) QStringList QLibraryInfo::platformPluginArguments(const QString &platformName) { -#if !defined(QT_BUILD_QMAKE) && !defined(QT_NO_SETTINGS) +#if !defined(QT_BUILD_QMAKE) && QT_CONFIG(settings) QScopedPointer settings(QLibraryInfoPrivate::findConfiguration()); if (!settings.isNull()) { const QString key = QLatin1String(platformsSection) @@ -657,7 +659,7 @@ QStringList QLibraryInfo::platformPluginArguments(const QString &platformName) } #else Q_UNUSED(platformName); -#endif // !QT_BUILD_QMAKE && !QT_NO_SETTINGS +#endif // !QT_BUILD_QMAKE && settings return QStringList(); } diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index c6a5407e51..086d642c26 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -34,8 +34,6 @@ HEADERS += \ io/qurlquery.h \ io/qurltlds_p.h \ io/qtldurl_p.h \ - io/qsettings.h \ - io/qsettings_p.h \ io/qfsfileengine_p.h \ io/qfsfileengine_iterator_p.h \ io/qfilesystementry_p.h \ @@ -73,7 +71,6 @@ SOURCES += \ io/qurlidna.cpp \ io/qurlquery.cpp \ io/qurlrecode.cpp \ - io/qsettings.cpp \ io/qfsfileengine.cpp \ io/qfsfileengine_iterator.cpp \ io/qfilesystementry.cpp \ @@ -121,6 +118,24 @@ qtConfig(processenvironment) { SOURCES += io/qprocess_unix.cpp } +qtConfig(settings) { + SOURCES += \ + io/qsettings.cpp + HEADERS += \ + io/qsettings.h \ + io/qsettings_p.h + + win32 { + !winrt { + SOURCES += io/qsettings_win.cpp + } else { + SOURCES += io/qsettings_winrt.cpp + } + } else: darwin:!nacl { + SOURCES += io/qsettings_mac.cpp + } +} + win32 { SOURCES += io/qfsfileengine_win.cpp SOURCES += io/qlockfile_win.cpp @@ -136,7 +151,6 @@ win32 { io/qwindowspipewriter_p.h SOURCES += \ - io/qsettings_win.cpp \ io/qstandardpaths_win.cpp \ io/qstorageinfo_win.cpp \ io/qwindowspipereader.cpp \ @@ -146,7 +160,6 @@ win32 { } else { SOURCES += \ io/qstandardpaths_winrt.cpp \ - io/qsettings_winrt.cpp \ io/qstorageinfo_stub.cpp } } else:unix { @@ -162,9 +175,6 @@ win32 { ../3rdparty/forkfd/forkfd.h INCLUDEPATH += ../3rdparty/forkfd } - !nacl:mac: { - SOURCES += io/qsettings_mac.cpp - } mac { SOURCES += io/qstorageinfo_mac.cpp qtConfig(processenvironment): \ diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 580fe6caf3..68e77c4167 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -41,8 +41,6 @@ #include "qplatformdefs.h" #include "qsettings.h" -#ifndef QT_NO_SETTINGS - #include "qsettings_p.h" #include "qcache.h" #include "qfile.h" @@ -3573,5 +3571,3 @@ QT_END_NAMESPACE #ifndef QT_BOOTSTRAPPED #include "moc_qsettings.cpp" #endif - -#endif // QT_NO_SETTINGS diff --git a/src/corelib/io/qsettings.h b/src/corelib/io/qsettings.h index ccfec787a6..7a9eebe11b 100644 --- a/src/corelib/io/qsettings.h +++ b/src/corelib/io/qsettings.h @@ -45,10 +45,7 @@ #include #include -QT_BEGIN_NAMESPACE -QT_END_NAMESPACE - -#ifndef QT_NO_SETTINGS +QT_REQUIRE_CONFIG(settings); #include @@ -208,6 +205,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_SETTINGS - #endif // QSETTINGS_H diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp index aa14d8435a..9a1b578f7e 100644 --- a/src/corelib/io/qsettings_mac.cpp +++ b/src/corelib/io/qsettings_mac.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "qsettings.h" -#ifndef QT_NO_SETTINGS #include "qsettings_p.h" #include "qdatetime.h" @@ -664,4 +663,3 @@ bool QConfFileSettingsPrivate::writePlistFile(QIODevice &file, const ParsedSetti } QT_END_NAMESPACE -#endif //QT_NO_SETTINGS diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index edcae16776..bbaf45a95b 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -39,8 +39,6 @@ #include "qsettings.h" -#ifndef QT_NO_SETTINGS - #include "qsettings_p.h" #include "qvector.h" #include "qmap.h" @@ -859,4 +857,3 @@ QSettingsPrivate *QSettingsPrivate::create(const QString &fileName, QSettings::F } QT_END_NAMESPACE -#endif // QT_NO_SETTINGS diff --git a/src/corelib/io/qsettings_winrt.cpp b/src/corelib/io/qsettings_winrt.cpp index 209b56d920..c54e5861f0 100644 --- a/src/corelib/io/qsettings_winrt.cpp +++ b/src/corelib/io/qsettings_winrt.cpp @@ -39,8 +39,6 @@ #include "qsettings.h" -#ifndef QT_NO_SETTINGS - #include "qsettings_p.h" #include "qvector.h" #include "qmap.h" @@ -690,4 +688,3 @@ QSettingsPrivate *QSettingsPrivate::create(const QString &fileName, QSettings::F } QT_END_NAMESPACE -#endif // QT_NO_SETTINGS diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index cd995c17f1..b3479414ab 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -53,7 +53,9 @@ #include "QtCore/qcoreapplication.h" #include "QtCore/qtranslator.h" +#if QT_CONFIG(settings) #include "QtCore/qsettings.h" +#endif #ifndef QT_NO_QOBJECT #include "private/qobject_p.h" #endif -- cgit v1.2.3 From 6a792d6f0b5a15ce09b7883bbbb06b2724596e40 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Nov 2018 13:54:26 -0700 Subject: QResourceFileEngine: fix map() for compressed files We were returning a pointer to the compressed data and comparing to the compressed data size. Change-Id: I343f2beed55440a7ac0bfffd1563232d557c9427 Reviewed-by: Oswald Buddenhagen Reviewed-by: hjk --- src/corelib/io/qresource.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index b85bca8590..8c1bfc8c48 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -1503,14 +1503,25 @@ uchar *QResourceFileEnginePrivate::map(qint64 offset, qint64 size, QFile::Memory { Q_Q(QResourceFileEngine); Q_UNUSED(flags); + + qint64 max = resource.size(); + if (resource.isCompressed()) { + uncompress(); + max = uncompressed.size(); + } + qint64 end; if (offset < 0 || size <= 0 || !resource.isValid() || - add_overflow(offset, size, &end) || end > resource.size()) { + add_overflow(offset, size, &end) || end > max) { q->setError(QFile::UnspecifiedError, QString()); return 0; } - uchar *address = const_cast(resource.data()); - return (address + offset); + + const uchar *address = resource.data(); + if (resource.isCompressed()) + address = reinterpret_cast(uncompressed.constData()); + + return const_cast(address) + offset; } bool QResourceFileEnginePrivate::unmap(uchar *ptr) -- cgit v1.2.3 From 6b088b7a1da37511a8abb1503e4f2f95632dbdac Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 1 Nov 2018 16:35:29 -0700 Subject: QResourceFileEngine: fix use of mapped files after close() QFile::map() is documented to continue working after the QFile is closed, so this should work for the resource file engine too. Change-Id: I343f2beed55440a7ac0bfffd1563243a3966441f Reviewed-by: Oswald Buddenhagen Reviewed-by: Lars Knoll --- src/corelib/io/qresource.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 8c1bfc8c48..564a3e5f51 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -1288,7 +1288,6 @@ bool QResourceFileEngine::close() { Q_D(QResourceFileEngine); d->offset = 0; - d->uncompressed.clear(); return true; } -- cgit v1.2.3 From ca3ac2e1c7548f2e66561fb0afe93494416ebf9c Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 27 Oct 2018 21:41:16 +0200 Subject: Documentation: update Q_DISABLE_COPY documentation Q_DISABLE_COPY annotates the functions as deleted but this was not mentioned in the documentation. As a drive-by adjust some indentations. Change-Id: I808fe3f1ce9f949d2ba41436661569ab0f2a9f73 Reviewed-by: Sze Howe Koh Reviewed-by: Paul Wicking --- .../doc/snippets/code/src_corelib_global_qglobal.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp index c73e782b76..7fdff974c1 100644 --- a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp @@ -595,8 +595,7 @@ namespace QT_NAMESPACE { //! [43] class MyClass : public QObject { - - private: +private: Q_DISABLE_COPY(MyClass) }; @@ -605,22 +604,21 @@ class MyClass : public QObject //! [44] class MyClass : public QObject { - - private: - MyClass(const MyClass &); - MyClass &operator=(const MyClass &); +private: + MyClass(const MyClass &) = delete; + MyClass &operator=(const MyClass &) = delete; }; //! [44] //! [45] - QWidget w = QWidget(); +QWidget w = QWidget(); //! [45] //! [46] - // Instead of comparing with 0.0 - qFuzzyCompare(0.0,1.0e-200); // This will return false - // Compare adding 1 to both values will fix the problem - qFuzzyCompare(1 + 0.0, 1 + 1.0e-200); // This will return true +// Instead of comparing with 0.0 +qFuzzyCompare(0.0, 1.0e-200); // This will return false +// Compare adding 1 to both values will fix the problem +qFuzzyCompare(1 + 0.0, 1 + 1.0e-200); // This will return true //! [46] //! [47] -- cgit v1.2.3 From 574bf5d9aaea3319e6761b9782ab7ae99991771d Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 20 Nov 2018 09:47:23 +0100 Subject: Correct QT_FEATURE_settings in qconfig-bootstrapped.h This amends 4d180586cddbd71a67c83246db3bec1caa595e05. Change-Id: Ia008e618f726f113f84cf4caa8d5f30442dbbb64 Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qconfig-bootstrapped.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index f86cbaf74d..dfcc3c9c7f 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -104,7 +104,6 @@ #else # define QT_FEATURE_renameat2 -1 #endif -#define QT_FEATURE_settings -1 #define QT_FEATURE_sharedmemory -1 #define QT_FEATURE_slog2 -1 #ifdef __GLIBC_PREREQ -- cgit v1.2.3 From 2842088cb7c2b29bab6453298fff7b1aa5b488d5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 9 Nov 2018 13:05:04 -0800 Subject: Unbreak the build with ICC on Windows qlogging.obj : error LNK2019: unresolved external symbol __fastfail referenced in function "void __cdecl qt_message_fatal(enum QtMsgType,class QMessageLogContext const &,class QString const &)" (?qt_message_fatal@@YAXW4QtMsgType@@AEBVQMessageLogContext@@AEBVQString@@@Z) Fixes: QTBUG-71868 Change-Id: I42a48bd64ccc41aebf84fffd156590a93fe9da53 Reviewed-by: Lars Knoll --- src/corelib/global/qlogging.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 396aee8696..168934c202 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1885,7 +1885,7 @@ static void qt_message_fatal(QtMsgType, const QMessageLogContext &context, const // [support.start.term]). So we bypass std::abort() and directly // terminate the application. -# ifdef Q_CC_MSVC +# if defined(Q_CC_MSVC) && !defined(Q_CC_INTEL) if (IsProcessorFeaturePresent(PF_FASTFAIL_AVAILABLE)) __fastfail(FAST_FAIL_FATAL_APP_EXIT); # else -- cgit v1.2.3