Merge remote-tracking branch 'origin/5.11' into dev

Change-Id: I35a6555e3885e489f88aa9b4b0142e1017f7a959
bb10
Qt Forward Merge Bot 2018-03-21 08:59:26 +01:00
commit cc920b4cdd
63 changed files with 722 additions and 1020 deletions

View File

@ -95,6 +95,8 @@ Build options:
-optimized-tools ..... Build optimized host tools even in debug build [no]
-force-debug-info .... Create symbol files for release builds [no]
-separate-debug-info . Split off debug information to separate files [no]
-gdb-index ........... Index the debug info to speed up GDB
[no; auto if -developer-build with debug info]
-strip ............... Strip release binaries of unneeded symbols [yes]
-force-asserts ....... Enable Q_ASSERT even in release builds [no]
-developer-build ..... Compile and link Qt for developing Qt itself

View File

@ -79,6 +79,7 @@
"force-debug-info": { "type": "boolean", "name": "force_debug_info" },
"force-pkg-config": { "type": "void", "name": "pkg-config" },
"framework": "boolean",
"gdb-index": { "type": "boolean", "name": "gdb_index" },
"gcc-sysroot": "boolean",
"gcov": "boolean",
"gnumake": { "type": "boolean", "name": "GNUmake" },

View File

@ -33,7 +33,7 @@ for(resource, RESOURCES) {
next()
}
resource_file = $$RCC_DIR/qmake_$${resource}.qrc
resource_file = $$absolute_path($$RCC_DIR/qmake_$${resource}.qrc, $$OUT_PWD)
isEmpty(BUILDS)|build_pass {
# Collection of files, generate qrc file
@ -64,7 +64,7 @@ for(resource, RESOURCES) {
"</qresource>" \
"</RCC>"
!write_file($$absolute_path($$resource_file, $$OUT_PWD), resource_file_content): \
!write_file($$resource_file, resource_file_content): \
error()
}

View File

@ -779,8 +779,9 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
mkt << "\\\n\t";
++added;
const QString file_name = fileFixify(fn, FileFixifyFromOutdir);
const QString tmpOut = fileFixify(tmp_out.first().toQString(), FileFixifyFromOutdir);
mkt << ' ' << escapeDependencyPath(Option::fixPathToTargetOS(
replaceExtraCompilerVariables(tmp_out.first().toQString(), file_name, QString(), NoShell)));
replaceExtraCompilerVariables(tmpOut, file_name, QString(), NoShell)));
}
}
}

View File

@ -1,7 +0,0 @@
win32:HEADERS += arch/qatomic_msvc.h
HEADERS += \
arch/qatomic_bootstrap.h \
arch/qatomic_cxx11.h
qtConfig(std-atomic64): QMAKE_USE += libatomic

View File

@ -1,485 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QATOMIC_MSVC_H
#define QATOMIC_MSVC_H
#include <QtCore/qgenericatomic.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
// use compiler intrinsics for all atomic functions
# define QT_INTERLOCKED_PREFIX _
# define QT_INTERLOCKED_PROTOTYPE
# define QT_INTERLOCKED_DECLARE_PROTOTYPES
# define QT_INTERLOCKED_INTRINSIC
# define Q_ATOMIC_INT16_IS_SUPPORTED
# ifdef _WIN64
# define Q_ATOMIC_INT64_IS_SUPPORTED
# endif
////////////////////////////////////////////////////////////////////////////////////////////////////
// Prototype declaration
#define QT_INTERLOCKED_CONCAT_I(prefix, suffix) \
prefix ## suffix
#define QT_INTERLOCKED_CONCAT(prefix, suffix) \
QT_INTERLOCKED_CONCAT_I(prefix, suffix)
// MSVC intrinsics prefix function names with an underscore. Also, if platform
// SDK headers have been included, the Interlocked names may be defined as
// macros.
// To avoid double underscores, we paste the prefix with Interlocked first and
// then the remainder of the function name.
#define QT_INTERLOCKED_FUNCTION(name) \
QT_INTERLOCKED_CONCAT( \
QT_INTERLOCKED_CONCAT(QT_INTERLOCKED_PREFIX, Interlocked), name)
#ifndef QT_INTERLOCKED_VOLATILE
# define QT_INTERLOCKED_VOLATILE volatile
#endif
#ifndef QT_INTERLOCKED_PREFIX
#define QT_INTERLOCKED_PREFIX
#endif
#ifndef QT_INTERLOCKED_PROTOTYPE
#define QT_INTERLOCKED_PROTOTYPE
#endif
#ifdef QT_INTERLOCKED_DECLARE_PROTOTYPES
#undef QT_INTERLOCKED_DECLARE_PROTOTYPES
extern "C" {
long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Increment )(long QT_INTERLOCKED_VOLATILE *);
long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Decrement )(long QT_INTERLOCKED_VOLATILE *);
long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( CompareExchange )(long QT_INTERLOCKED_VOLATILE *, long, long);
long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Exchange )(long QT_INTERLOCKED_VOLATILE *, long);
long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( ExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long);
# if !defined(__i386__) && !defined(_M_IX86)
void * QT_INTERLOCKED_FUNCTION( CompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *);
void * QT_INTERLOCKED_FUNCTION( ExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *);
__int64 QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64);
# endif
# ifdef Q_ATOMIC_INT16_IS_SUPPORTED
short QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Increment16 )(short QT_INTERLOCKED_VOLATILE *);
short QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Decrement16 )(short QT_INTERLOCKED_VOLATILE *);
short QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( CompareExchange16 )(short QT_INTERLOCKED_VOLATILE *, short, short);
short QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Exchange16 )(short QT_INTERLOCKED_VOLATILE *, short);
short QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( ExchangeAdd16 )(short QT_INTERLOCKED_VOLATILE *, short);
# endif
# ifdef Q_ATOMIC_INT64_IS_SUPPORTED
__int64 QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Increment64 )(__int64 QT_INTERLOCKED_VOLATILE *);
__int64 QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Decrement64 )(__int64 QT_INTERLOCKED_VOLATILE *);
__int64 QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( CompareExchange64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64, __int64);
__int64 QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Exchange64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64);
//above already: qint64 QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )(qint64 QT_INTERLOCKED_VOLATILE *, qint64);
# endif
}
#endif // QT_INTERLOCKED_DECLARE_PROTOTYPES
#undef QT_INTERLOCKED_PROTOTYPE
////////////////////////////////////////////////////////////////////////////////////////////////////
#ifdef QT_INTERLOCKED_INTRINSIC
#undef QT_INTERLOCKED_INTRINSIC
# pragma intrinsic (_InterlockedIncrement)
# pragma intrinsic (_InterlockedDecrement)
# pragma intrinsic (_InterlockedExchange)
# pragma intrinsic (_InterlockedCompareExchange)
# pragma intrinsic (_InterlockedExchangeAdd)
# if !defined(_M_IX86)
# pragma intrinsic (_InterlockedCompareExchangePointer)
# pragma intrinsic (_InterlockedExchangePointer)
# pragma intrinsic (_InterlockedExchangeAdd64)
# endif
#endif // QT_INTERLOCKED_INTRINSIC
////////////////////////////////////////////////////////////////////////////////////////////////////
// Interlocked* replacement macros
#if defined(__i386__) || defined(_M_IX86)
# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
reinterpret_cast<void *>( \
QT_INTERLOCKED_FUNCTION(CompareExchange)( \
reinterpret_cast<long QT_INTERLOCKED_VOLATILE *>(value), \
long(newValue), \
long(expectedValue)))
# define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \
QT_INTERLOCKED_FUNCTION(Exchange)( \
reinterpret_cast<long QT_INTERLOCKED_VOLATILE *>(value), \
long(newValue))
# define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \
QT_INTERLOCKED_FUNCTION(ExchangeAdd)( \
reinterpret_cast<long QT_INTERLOCKED_VOLATILE *>(value), \
(valueToAdd))
#else // !defined(__i386__) && !defined(_M_IX86)
# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
QT_INTERLOCKED_FUNCTION(CompareExchangePointer)( \
(void * QT_INTERLOCKED_VOLATILE *)(value), \
(void *) (newValue), \
(void *) (expectedValue))
# define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \
QT_INTERLOCKED_FUNCTION(ExchangePointer)( \
(void * QT_INTERLOCKED_VOLATILE *)(value), \
(void *) (newValue))
# define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \
QT_INTERLOCKED_FUNCTION(ExchangeAdd64)( \
reinterpret_cast<qint64 QT_INTERLOCKED_VOLATILE *>(value), \
(valueToAdd))
#endif // !defined(__i386__) && !defined(_M_IX86)
////////////////////////////////////////////////////////////////////////////////////////////////////
QT_BEGIN_NAMESPACE
#if 0
// silence syncqt warnings
QT_END_NAMESPACE
#pragma qt_sync_skip_header_check
#pragma qt_sync_stop_processing
#endif
#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_WAIT_FREE
#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT_TEST_AND_SET_IS_WAIT_FREE
#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE
#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_WAIT_FREE
#define Q_ATOMIC_INT32_IS_SUPPORTED
#define Q_ATOMIC_INT32_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT32_REFERENCE_COUNTING_IS_WAIT_FREE
#define Q_ATOMIC_INT32_TEST_AND_SET_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT32_TEST_AND_SET_IS_WAIT_FREE
#define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT32_FETCH_AND_STORE_IS_WAIT_FREE
#define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT32_FETCH_AND_ADD_IS_WAIT_FREE
#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE
#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_WAIT_FREE
#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE
#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE
#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE
#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_WAIT_FREE
#ifdef Q_ATOMIC_INT16_IS_SUPPORTED
# define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
# define Q_ATOMIC_INT16_REFERENCE_COUNTING_IS_WAIT_FREE
# define Q_ATOMIC_INT16_TEST_AND_SET_IS_ALWAYS_NATIVE
# define Q_ATOMIC_INT16_TEST_AND_SET_IS_WAIT_FREE
# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_ALWAYS_NATIVE
# define Q_ATOMIC_INT16_FETCH_AND_STORE_IS_WAIT_FREE
# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_ALWAYS_NATIVE
# define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_WAIT_FREE
template<> struct QAtomicOpsSupport<2> { enum { IsSupported = 1 }; };
#endif
#ifdef Q_ATOMIC_INT64_IS_SUPPORTED
# define Q_ATOMIC_INT64_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
# define Q_ATOMIC_INT64_REFERENCE_COUNTING_IS_WAIT_FREE
# define Q_ATOMIC_INT64_TEST_AND_SET_IS_ALWAYS_NATIVE
# define Q_ATOMIC_INT64_TEST_AND_SET_IS_WAIT_FREE
# define Q_ATOMIC_INT64_FETCH_AND_STORE_IS_ALWAYS_NATIVE
# define Q_ATOMIC_INT64_FETCH_AND_STORE_IS_WAIT_FREE
# define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_ALWAYS_NATIVE
# define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_WAIT_FREE
template<> struct QAtomicOpsSupport<8> { enum { IsSupported = 1 }; };
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////
template <int N> struct QAtomicWindowsType { typedef typename QIntegerForSize<N>::Signed Type; };
template <> struct QAtomicWindowsType<4> { typedef long Type; };
template <int N> struct QAtomicOpsBySize : QGenericAtomicOps<QAtomicOpsBySize<N> >
{
static inline Q_DECL_CONSTEXPR bool isReferenceCountingNative() Q_DECL_NOTHROW { return true; }
static inline Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree() Q_DECL_NOTHROW { return true; }
template <typename T> static bool ref(T &_q_value) Q_DECL_NOTHROW;
template <typename T> static bool deref(T &_q_value) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW { return true; }
static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return true; }
template <typename T> static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW;
template <typename T>
static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return true; }
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return true; }
template <typename T> static T fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return true; }
static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return true; }
template <typename T> static T fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW;
private:
typedef typename QAtomicWindowsType<N>::Type Type;
template <typename T> static inline Type *atomic(T *t)
{ Q_STATIC_ASSERT(sizeof(T) == sizeof(Type)); return reinterpret_cast<Type *>(t); }
template <typename T> static inline Type value(T t)
{ Q_STATIC_ASSERT(sizeof(T) == sizeof(Type)); return Type(t); }
};
template <typename T>
struct QAtomicOps : QAtomicOpsBySize<sizeof(T)>
{
typedef T Type;
};
template<> template<typename T>
inline bool QAtomicOpsBySize<4>::ref(T &_q_value) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_FUNCTION(Increment)(atomic(&_q_value)) != 0;
}
template<> template<typename T>
inline bool QAtomicOpsBySize<4>::deref(T &_q_value) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_FUNCTION(Decrement)(atomic(&_q_value)) != 0;
}
template<> template<typename T>
inline bool QAtomicOpsBySize<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_FUNCTION(CompareExchange)(atomic(&_q_value), value(newValue), value(expectedValue)) == value(expectedValue);
}
template<> template <typename T>
inline bool QAtomicOpsBySize<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW
{
*currentValue = T(QT_INTERLOCKED_FUNCTION(CompareExchange)(atomic(&_q_value), newValue, expectedValue));
return *currentValue == expectedValue;
}
template<> template<typename T>
inline T QAtomicOpsBySize<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_FUNCTION(Exchange)(atomic(&_q_value), value(newValue));
}
template<> template<typename T>
inline T QAtomicOpsBySize<4>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_FUNCTION(ExchangeAdd)(atomic(&_q_value), value<T>(valueToAdd * QAtomicAdditiveType<T>::AddScale));
}
#ifdef Q_ATOMIC_INT16_IS_SUPPORTED
template<> template<typename T>
inline bool QAtomicOpsBySize<2>::ref(T &_q_value) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_FUNCTION(Increment16)(atomic(&_q_value)) != 0;
}
template<> template<typename T>
inline bool QAtomicOpsBySize<2>::deref(T &_q_value) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_FUNCTION(Decrement16)(atomic(&_q_value)) != 0;
}
template<> template<typename T>
inline bool QAtomicOpsBySize<2>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_FUNCTION(CompareExchange16)(atomic(&_q_value), value(newValue), value(expectedValue)) == value(expectedValue);
}
template<> template <typename T>
inline bool QAtomicOpsBySize<2>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW
{
*currentValue = T(QT_INTERLOCKED_FUNCTION(CompareExchange16)(atomic(&_q_value), newValue, expectedValue));
return *currentValue == expectedValue;
}
template<> template<typename T>
inline T QAtomicOpsBySize<2>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_FUNCTION(Exchange16)(atomic(&_q_value), value(newValue));
}
template<> template<typename T>
inline T QAtomicOpsBySize<2>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_FUNCTION(ExchangeAdd16)(atomic(&_q_value), value<T>(valueToAdd * QAtomicAdditiveType<T>::AddScale));
}
#endif
#ifdef Q_ATOMIC_INT64_IS_SUPPORTED
template<> template<typename T>
inline bool QAtomicOpsBySize<8>::ref(T &_q_value) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_FUNCTION(Increment64)(atomic(&_q_value)) != 0;
}
template<> template<typename T>
inline bool QAtomicOpsBySize<8>::deref(T &_q_value) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_FUNCTION(Decrement64)(atomic(&_q_value)) != 0;
}
template<> template<typename T>
inline bool QAtomicOpsBySize<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_FUNCTION(CompareExchange64)(atomic(&_q_value), value(newValue), value(expectedValue)) == value(expectedValue);
}
template<> template <typename T>
inline bool QAtomicOpsBySize<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue) Q_DECL_NOTHROW
{
*currentValue = T(QT_INTERLOCKED_FUNCTION(CompareExchange64)(atomic(&_q_value), newValue, expectedValue));
return *currentValue == expectedValue;
}
template<> template<typename T>
inline T QAtomicOpsBySize<8>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_FUNCTION(Exchange64)(atomic(&_q_value), value(newValue));
}
template<> template<typename T>
inline T QAtomicOpsBySize<8>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_FUNCTION(ExchangeAdd64)(atomic(&_q_value), value<T>(valueToAdd * QAtomicAdditiveType<T>::AddScale));
}
#endif
// Specialization for pointer types, since we have Interlocked*Pointer() variants in some configurations
template <typename T>
struct QAtomicOps<T *> : QGenericAtomicOps<QAtomicOps<T *> >
{
typedef T *Type;
static inline Q_DECL_CONSTEXPR bool isTestAndSetNative() Q_DECL_NOTHROW { return true; }
static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return true; }
static bool testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue) Q_DECL_NOTHROW;
static bool testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue, T **currentValue) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreNative() Q_DECL_NOTHROW { return true; }
static inline Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree() Q_DECL_NOTHROW { return true; }
static T *fetchAndStoreRelaxed(T *&_q_value, T *newValue) Q_DECL_NOTHROW;
static inline Q_DECL_CONSTEXPR bool isFetchAndAddNative() Q_DECL_NOTHROW { return true; }
static inline Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree() Q_DECL_NOTHROW { return true; }
static T *fetchAndAddRelaxed(T *&_q_value, qptrdiff valueToAdd) Q_DECL_NOTHROW;
};
template <typename T>
inline bool QAtomicOps<T *>::testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue) Q_DECL_NOTHROW
{
return QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&_q_value, newValue, expectedValue) == expectedValue;
}
template <typename T>
inline bool QAtomicOps<T *>::testAndSetRelaxed(T *&_q_value, T *expectedValue, T *newValue, T **currentValue) Q_DECL_NOTHROW
{
*currentValue = reinterpret_cast<T *>(QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(&_q_value, newValue, expectedValue));
return *currentValue == expectedValue;
}
template <typename T>
inline T *QAtomicOps<T *>::fetchAndStoreRelaxed(T *&_q_value, T *newValue) Q_DECL_NOTHROW
{
return reinterpret_cast<T *>(QT_INTERLOCKED_EXCHANGE_POINTER(&_q_value, newValue));
}
template <typename T>
inline T *QAtomicOps<T *>::fetchAndAddRelaxed(T *&_q_value, qptrdiff valueToAdd) Q_DECL_NOTHROW
{
return reinterpret_cast<T *>(QT_INTERLOCKED_EXCHANGE_ADD_POINTER(&_q_value, valueToAdd * sizeof(T)));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Cleanup
#undef QT_INTERLOCKED_CONCAT_I
#undef QT_INTERLOCKED_CONCAT
#undef QT_INTERLOCKED_FUNCTION
#undef QT_INTERLOCKED_PREFIX
#undef QT_INTERLOCKED_VOLATILE
#undef QT_INTERLOCKED_INCREMENT
#undef QT_INTERLOCKED_DECREMENT
#undef QT_INTERLOCKED_COMPARE_EXCHANGE
#undef QT_INTERLOCKED_EXCHANGE
#undef QT_INTERLOCKED_EXCHANGE_ADD
#undef QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER
#undef QT_INTERLOCKED_EXCHANGE_POINTER
#undef QT_INTERLOCKED_EXCHANGE_ADD_POINTER
QT_END_NAMESPACE
#endif // QATOMIC_MSVC_H

View File

@ -32,7 +32,6 @@ ANDROID_PERMISSIONS = \
freebsd|openbsd: QMAKE_LFLAGS_NOUNDEF =
include(animation/animation.pri)
include(arch/arch.pri)
include(global/global.pri)
include(thread/thread.pri)
include(tools/tools.pri)

View File

@ -747,12 +747,13 @@ Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() Q_DECL_NOTHROW;
# define QT_DEBUG
#endif
// QtPrivate::asString defined in qstring.h
#ifndef qPrintable
# define qPrintable(string) QString(string).toLocal8Bit().constData()
# define qPrintable(string) QtPrivate::asString(string).toLocal8Bit().constData()
#endif
#ifndef qUtf8Printable
# define qUtf8Printable(string) QString(string).toUtf8().constData()
# define qUtf8Printable(string) QtPrivate::asString(string).toUtf8().constData()
#endif
/*

View File

@ -91,8 +91,7 @@
# include "private/qcore_unix_p.h"
#endif
#ifndef QT_BOOTSTRAPPED
#if !defined QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
# ifdef __UCLIBC__
# if __UCLIBC_HAS_BACKTRACE__
# define QLOGGING_HAVE_BACKTRACE
@ -106,6 +105,7 @@
extern char *__progname;
#endif
#ifndef QT_BOOTSTRAPPED
#if defined(Q_OS_LINUX) && (defined(__GLIBC__) || QT_HAS_INCLUDE(<sys/syscall.h>))
# include <sys/syscall.h>

View File

@ -42,7 +42,9 @@
#include <qfile.h>
#include <qhash.h>
#include <qtextstream.h>
#if QT_CONFIG(regularexpression)
#include <qregularexpression.h>
#endif
#include <private/qfilesystemengine_p.h>
#include <errno.h>
#include <stdlib.h>

View File

@ -53,12 +53,15 @@
#include "qdatastream.h"
#include "qmetatypeswitcher_p.h"
#if QT_CONFIG(regularexpression)
# include "qregularexpression.h"
#endif
#ifndef QT_BOOTSTRAPPED
# include "qbitarray.h"
# include "qurl.h"
# include "qvariant.h"
# include "qabstractitemmodel.h"
# include "qregularexpression.h"
# include "qjsonvalue.h"
# include "qjsonobject.h"
# include "qjsonarray.h"
@ -1481,12 +1484,12 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data)
stream << *static_cast<const NS(QRegExp)*>(data);
break;
#endif
#ifndef QT_BOOTSTRAPPED
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
case QMetaType::QRegularExpression:
stream << *static_cast<const NS(QRegularExpression)*>(data);
break;
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
case QMetaType::QEasingCurve:
stream << *static_cast<const NS(QEasingCurve)*>(data);
break;
@ -1711,12 +1714,12 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
stream >> *static_cast< NS(QRegExp)*>(data);
break;
#endif
#ifndef QT_BOOTSTRAPPED
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
case QMetaType::QRegularExpression:
stream >> *static_cast< NS(QRegularExpression)*>(data);
break;
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
case QMetaType::QEasingCurve:
stream >> *static_cast< NS(QEasingCurve)*>(data);
break;

View File

@ -219,7 +219,7 @@ template<> struct TypeDefinition<QPointF> { static const bool IsAvailable = fals
#ifdef QT_NO_REGEXP
template<> struct TypeDefinition<QRegExp> { static const bool IsAvailable = false; };
#endif
#if defined(QT_BOOTSTRAPPED) || defined(QT_NO_REGULAREXPRESSION)
#if !QT_CONFIG(regularexpression)
template<> struct TypeDefinition<QRegularExpression> { static const bool IsAvailable = false; };
#endif
#ifdef QT_NO_SHORTCUT

View File

@ -50,7 +50,9 @@
#include "qvariant.h"
#include "qmetaobject.h"
#include <qregexp.h>
#include <qregularexpression.h>
#if QT_CONFIG(regularexpression)
# include <qregularexpression.h>
#endif
#include <qthread.h>
#include <private/qthread_p.h>
#include <qdebug.h>
@ -1921,7 +1923,7 @@ void qt_qFindChildren_helper(const QObject *parent, const QRegExp &re,
}
#endif // QT_NO_REGEXP
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
/*!
\internal
*/
@ -1943,7 +1945,7 @@ void qt_qFindChildren_helper(const QObject *parent, const QRegularExpression &re
qt_qFindChildren_helper(obj, re, mo, list, options);
}
}
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
/*!
\internal

View File

@ -74,7 +74,7 @@ class QWidget;
#ifndef QT_NO_REGEXP
class QRegExp;
#endif
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
class QRegularExpression;
#endif
#ifndef QT_NO_USERDATA
@ -187,7 +187,7 @@ public:
}
#endif
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
template<typename T>
inline QList<T> findChildren(const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const
{
@ -197,7 +197,7 @@ public:
reinterpret_cast<QList<void *> *>(&list), options);
return list;
}
#endif
#endif // QT_CONFIG(regularexpression)
inline const QObjectList &children() const { return d_ptr->children; }

View File

@ -48,7 +48,9 @@
#include "qdatetime.h"
#include "qeasingcurve.h"
#include "qlist.h"
#if QT_CONFIG(regularexpression)
#include "qregularexpression.h"
#endif
#include "qstring.h"
#include "qstringlist.h"
#include "qurl.h"
@ -1941,12 +1943,12 @@ QVariant::QVariant(const QRegExp &regExp)
: d(RegExp)
{ v_construct<QRegExp>(&d, regExp); }
#endif // QT_NO_REGEXP
#ifndef QT_BOOTSTRAPPED
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
QVariant::QVariant(const QRegularExpression &re)
: d(RegularExpression)
{ v_construct<QRegularExpression>(&d, re); }
#endif
#endif // QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
QVariant::QVariant(const QUuid &uuid)
: d(Uuid)
{ v_construct<QUuid>(&d, uuid); }
@ -2650,7 +2652,7 @@ QRegExp QVariant::toRegExp() const
}
#endif
#ifndef QT_BOOTSTRAPPED
#if QT_CONFIG(regularexpression)
/*!
\fn QRegularExpression QVariant::toRegularExpression() const
\since 5.0
@ -2660,13 +2662,13 @@ QRegExp QVariant::toRegExp() const
\sa canConvert(), convert()
*/
#ifndef QT_NO_REGULAREXPRESSION
QRegularExpression QVariant::toRegularExpression() const
{
return qVariantToHelper<QRegularExpression>(d, handlerManager);
}
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
/*!
\since 5.0
@ -2758,7 +2760,7 @@ QJsonDocument QVariant::toJsonDocument() const
{
return qVariantToHelper<QJsonDocument>(d, handlerManager);
}
#endif
#endif // QT_BOOTSTRAPPED
/*!
\fn QChar QVariant::toChar() const

View File

@ -81,9 +81,9 @@ class QRectF;
#ifndef QT_NO_REGEXP
class QRegExp;
#endif // QT_NO_REGEXP
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
class QRegularExpression;
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
class QTextFormat;
class QTextLength;
class QUrl;
@ -248,10 +248,10 @@ class Q_CORE_EXPORT QVariant
#ifndef QT_NO_REGEXP
QVariant(const QRegExp &regExp);
#endif // QT_NO_REGEXP
#ifndef QT_BOOTSTRAPPED
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
QVariant(const QRegularExpression &re);
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
QVariant(const QUrl &url);
QVariant(const QEasingCurve &easing);
QVariant(const QUuid &uuid);
@ -322,10 +322,10 @@ class Q_CORE_EXPORT QVariant
#ifndef QT_NO_REGEXP
QRegExp toRegExp() const;
#endif // QT_NO_REGEXP
#ifndef QT_BOOTSTRAPPED
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
QRegularExpression toRegularExpression() const;
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
QUrl toUrl() const;
QEasingCurve toEasingCurve() const;
QUuid toUuid() const;

View File

@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2011 Thiago Macieira <thiago@kde.org>
** Copyright (C) 2016 Intel Corporation.
** Copyright (C) 2018 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@ -45,20 +45,8 @@
#if defined(QT_BOOTSTRAPPED)
# include <QtCore/qatomic_bootstrap.h>
// If C++11 atomics are supported, use them!
// Note that constexpr support is sometimes disabled in QNX builds but its
// library has <atomic>.
#elif defined(Q_COMPILER_ATOMICS) && (defined(Q_COMPILER_CONSTEXPR) || defined(Q_OS_QNX))
# include <QtCore/qatomic_cxx11.h>
// We only support one fallback: MSVC, because even on version 2015, it lacks full constexpr support
#elif defined(Q_CC_MSVC)
# include <QtCore/qatomic_msvc.h>
// No fallback
#else
# error "Qt requires C++11 support"
# include <QtCore/qatomic_cxx11.h>
#endif
QT_WARNING_PUSH

View File

@ -253,12 +253,15 @@ template <typename BaseClass> struct QGenericAtomicOps
return BaseClass::fetchAndAddRelaxed(_q_value, valueToAdd);
}
QT_WARNING_PUSH
QT_WARNING_DISABLE_MSVC(4146) // unary minus operator applied to unsigned type, result still unsigned
template <typename T> static Q_ALWAYS_INLINE
T fetchAndSubRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) Q_DECL_NOTHROW
{
// implement fetchAndSub on top of fetchAndAdd
return fetchAndAddRelaxed(_q_value, -operand);
}
QT_WARNING_POP
template <typename T> static Q_ALWAYS_INLINE
T fetchAndSubAcquire(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT operand) Q_DECL_NOTHROW

View File

@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2017 Intel Corporation.
** Copyright (C) 2018 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@ -119,28 +119,44 @@ using namespace QtFutex;
acquire tokens. Which ones get woken up is unspecified.
If the system has the ability to wake up a precise number of threads, has
Linux's FUTEX_WAKE_OP functionality, and is 64-bit, we'll use the high word
as a copy of the low word, but the sign bit indicating the presence of a
thread waiting for multiple tokens. So when releasing n tokens on those
systems, we tell the kernel to wake up n single-token threads and all of
the multi-token ones, then clear that wait bit. Which threads get woken up
is unspecified, but it's likely single-token threads will get woken up
first.
Linux's FUTEX_WAKE_OP functionality, and is 64-bit, instead of using a
single bit indicating a contended semaphore, we'll store the total number
of waiters in the high word. Additionally, all multi-token waiters will be
waiting on that high word. So when releasing n tokens on those systems, we
tell the kernel to wake up n single-token threads and all of the
multi-token ones. Which threads get woken up is unspecified, but it's
likely single-token threads will get woken up first.
*/
static const quint32 futexContendedBit = 1U << 31;
#if defined(FUTEX_OP) && QT_POINTER_SIZE > 4
static Q_CONSTEXPR bool futexHasWaiterCount = true;
#else
static Q_CONSTEXPR bool futexHasWaiterCount = false;
#endif
static const quintptr futexNeedsWakeAllBit =
Q_UINT64_C(1) << (sizeof(quintptr) * CHAR_BIT - 1);
static int futexAvailCounter(quintptr v)
{
// the low 31 bits
return int(v & (futexContendedBit - 1));
if (futexHasWaiterCount) {
// the high bit of the low word isn't used
Q_ASSERT((v & 0x80000000U) == 0);
// so we can be a little faster
return int(unsigned(v));
}
return int(v & 0x7fffffffU);
}
static quintptr futexCounterParcel(int n)
static bool futexNeedsWake(quintptr v)
{
// replicate the 31 bits if we're on 64-bit
quint64 nn = quint32(n);
nn |= (nn << 32);
return quintptr(nn);
// If we're counting waiters, the number of waiters is stored in the low 31
// bits of the high word (that is, bits 32-62). If we're not, then we use
// bit 31 to indicate anyone is waiting. Either way, if any bit 31 or above
// is set, there are waiters.
return v >> 31;
}
static QBasicAtomicInteger<quint32> *futexLow32(QBasicAtomicInteger<quintptr> *ptr)
@ -152,9 +168,6 @@ static QBasicAtomicInteger<quint32> *futexLow32(QBasicAtomicInteger<quintptr> *p
return result;
}
#ifdef FUTEX_OP
// quintptr might be 32bit, in which case we want this to be 0, without implicitly casting.
static const quintptr futexMultiWaiterBit = static_cast<quintptr>(Q_UINT64_C(1) << 63);
static QBasicAtomicInteger<quint32> *futexHigh32(QBasicAtomicInteger<quintptr> *ptr)
{
auto result = reinterpret_cast<QBasicAtomicInteger<quint32> *>(ptr);
@ -163,18 +176,21 @@ static QBasicAtomicInteger<quint32> *futexHigh32(QBasicAtomicInteger<quintptr> *
#endif
return result;
}
#endif
template <bool IsTimed> bool futexSemaphoreTryAcquire(QBasicAtomicInteger<quintptr> &u, int n, int timeout)
template <bool IsTimed> bool
futexSemaphoreTryAcquire_loop(QBasicAtomicInteger<quintptr> &u, quintptr curValue, quintptr nn, int timeout)
{
QDeadlineTimer timer(IsTimed ? QDeadlineTimer(timeout) : QDeadlineTimer());
quintptr curValue = u.loadAcquire();
qint64 remainingTime = timeout * Q_INT64_C(1000) * 1000;
int n = int(unsigned(nn));
// we're called after one testAndSet, so start by waiting first
goto start_wait;
forever {
int available = futexAvailCounter(curValue);
if (available >= n) {
if (futexAvailCounter(curValue) >= n) {
// try to acquire
quintptr newValue = curValue - futexCounterParcel(n);
quintptr newValue = curValue - nn;
if (u.testAndSetOrdered(curValue, newValue, curValue))
return true; // succeeded!
continue;
@ -184,19 +200,18 @@ template <bool IsTimed> bool futexSemaphoreTryAcquire(QBasicAtomicInteger<quintp
if (remainingTime == 0)
return false;
// set the contended and multi-wait bits
quintptr bitsToSet = futexContendedBit;
// indicate we're waiting
start_wait:
auto ptr = futexLow32(&u);
#ifdef FUTEX_OP
if (n > 1 && sizeof(curValue) >= sizeof(int)) {
bitsToSet |= futexMultiWaiterBit;
ptr = futexHigh32(&u);
if (n > 1 || !futexHasWaiterCount) {
u.fetchAndOrRelaxed(futexNeedsWakeAllBit);
curValue |= futexNeedsWakeAllBit;
if (n > 1 && futexHasWaiterCount) {
ptr = futexHigh32(&u);
//curValue >>= 32; // but this is UB in 32-bit, so roundabout:
curValue = quint64(curValue) >> 32;
}
}
#endif
// the value is the same for either branch
u.fetchAndOrRelaxed(bitsToSet);
curValue |= bitsToSet;
if (IsTimed && remainingTime > 0) {
bool timedout = !futexWait(*ptr, curValue, remainingTime);
@ -212,6 +227,47 @@ template <bool IsTimed> bool futexSemaphoreTryAcquire(QBasicAtomicInteger<quintp
}
}
template <bool IsTimed> bool futexSemaphoreTryAcquire(QBasicAtomicInteger<quintptr> &u, int n, int timeout)
{
// Try to acquire without waiting (we still loop because the testAndSet
// call can fail).
quintptr curValue = u.loadAcquire();
while (futexAvailCounter(curValue) >= n) {
// try to acquire
quintptr newValue = curValue - n;
if (u.testAndSetOrdered(curValue, newValue, curValue))
return true; // succeeded!
}
if (timeout == 0)
return false;
// we need to wait
quintptr valueToSubtract = unsigned(n);
quintptr oneWaiter = quintptr(Q_UINT64_C(1) << 32); // zero on 32-bit
if (futexHasWaiterCount) {
// increase the waiter count
u.fetchAndAddRelaxed(oneWaiter);
// We don't use the fetched value from above so futexWait() fails if
// it changed after the testAndSetOrdered above.
curValue += oneWaiter;
// Also adjust valueToSubtract to subtract oneWaiter when we succeed in
// acquiring.
valueToSubtract += oneWaiter;
}
if (futexSemaphoreTryAcquire_loop<IsTimed>(u, curValue, valueToSubtract, timeout))
return true;
if (futexHasWaiterCount) {
// decrement the number of threads waiting
Q_ASSERT(futexHigh32(&u)->load() & 0x7fffffffU);
u.fetchAndSubRelaxed(oneWaiter);
}
return false;
}
class QSemaphorePrivate {
public:
inline QSemaphorePrivate(int n) : avail(n) { }
@ -289,10 +345,10 @@ void QSemaphore::release(int n)
Q_ASSERT_X(n >= 0, "QSemaphore::release", "parameter 'n' must be non-negative");
if (futexAvailable()) {
quintptr prevValue = u.fetchAndAddRelease(futexCounterParcel(n));
if (prevValue & futexContendedBit) {
quintptr prevValue = u.fetchAndAddRelease(n);
if (futexNeedsWake(prevValue)) {
#ifdef FUTEX_OP
if (sizeof(u) == sizeof(int)) {
if (!futexHasWaiterCount) {
/*
On 32-bit systems, all waiters are waiting on the same address,
so we'll wake them all and ask the kernel to clear the high bit.
@ -317,9 +373,6 @@ void QSemaphore::release(int n)
the kernel to wake up n single-token waiters and all multi-token
waiters (if any), then clear the multi-token wait bit.
That means we must clear the contention bit ourselves. See
below for handling the race.
atomic {
int oldval = *upper;
*upper = oldval & ~(1 << 31);
@ -332,7 +385,6 @@ void QSemaphore::release(int n)
quint32 oparg = 31;
quint32 cmp = FUTEX_OP_CMP_LT;
quint32 cmparg = 0;
futexLow32(&u)->fetchAndAndRelease(futexContendedBit - 1);
futexWakeOp(*futexLow32(&u), n, INT_MAX, *futexHigh32(&u), FUTEX_OP(op, oparg, cmp, cmparg));
}
#else
@ -343,7 +395,7 @@ void QSemaphore::release(int n)
// its acquisition anyway, so it has to wait;
// 2) it did not see the new counter value, in which case its
// futexWait will fail.
u.fetchAndAndRelease(futexContendedBit - 1);
u.fetchAndAndRelease(futexNeedsWakeAllBit - 1);
futexWakeAll(u);
#endif
}

View File

@ -10,6 +10,8 @@ HEADERS += thread/qmutex.h \
thread/qthreadstorage.h \
thread/qwaitcondition.h \
thread/qatomic.h \
thread/qatomic_bootstrap.h \
thread/qatomic_cxx11.h \
thread/qbasicatomic.h \
thread/qgenericatomic.h
@ -67,3 +69,5 @@ win32 {
thread/qthread_unix.cpp \
thread/qwaitcondition_unix.cpp
}
qtConfig(std-atomic64): QMAKE_USE += libatomic

View File

@ -41,8 +41,6 @@
#include "qregularexpression.h"
#ifndef QT_NO_REGULAREXPRESSION
#include <QtCore/qcoreapplication.h>
#include <QtCore/qhashfunctions.h>
#include <QtCore/qreadwritelock.h>
@ -2912,5 +2910,3 @@ static const char *pcreCompileErrorCodes[] =
#endif // #if 0
QT_END_NAMESPACE
#endif // QT_NO_REGULAREXPRESSION

View File

@ -43,13 +43,13 @@
#include <QtCore/qglobal.h>
#ifndef QT_NO_REGULAREXPRESSION
#include <QtCore/qstring.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qshareddata.h>
#include <QtCore/qvariant.h>
QT_REQUIRE_CONFIG(regularexpression);
QT_BEGIN_NAMESPACE
class QStringView;
@ -277,6 +277,4 @@ Q_DECLARE_SHARED(QRegularExpressionMatchIterator)
QT_END_NAMESPACE
#endif // QT_NO_REGULAREXPRESSION
#endif // QREGULAREXPRESSION_H

View File

@ -115,7 +115,11 @@ public:
#ifdef Q_COMPILER_RVALUE_REFS
QSharedDataPointer(QSharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = nullptr; }
inline QSharedDataPointer<T> &operator=(QSharedDataPointer<T> &&other) Q_DECL_NOTHROW
{ qSwap(d, other.d); return *this; }
{
QSharedDataPointer moved(std::move(other));
swap(moved);
return *this;
}
#endif
inline bool operator!() const { return !d; }
@ -216,7 +220,11 @@ public:
#ifdef Q_COMPILER_RVALUE_REFS
inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = nullptr; }
inline QExplicitlySharedDataPointer<T> &operator=(QExplicitlySharedDataPointer<T> &&other) Q_DECL_NOTHROW
{ qSwap(d, other.d); return *this; }
{
QExplicitlySharedDataPointer moved(std::move(other));
swap(moved);
return *this;
}
#endif
inline bool operator!() const { return !d; }

View File

@ -40,7 +40,9 @@
#include "qstringlist.h"
#include "qregexp.h"
#if QT_CONFIG(regularexpression)
#include "qregularexpression.h"
#endif
#include "qunicodetables_p.h"
#ifndef QT_NO_TEXTCODEC
#include <qtextcodec.h>
@ -3695,7 +3697,7 @@ int QString::lastIndexOf(const QStringRef &str, int from, Qt::CaseSensitivity cs
}
#if !(defined(QT_NO_REGEXP) && defined(QT_NO_REGULAREXPRESSION))
#if !(defined(QT_NO_REGEXP) && !QT_CONFIG(regularexpression))
struct QStringCapture
{
int pos;
@ -3862,8 +3864,7 @@ QString& QString::replace(const QRegExp &rx, const QString &after)
}
#endif
#ifndef QT_NO_REGULAREXPRESSION
#ifndef QT_BOOTSTRAPPED
#if QT_CONFIG(regularexpression)
/*!
\overload replace()
\since 5.0
@ -3991,8 +3992,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after)
return *this;
}
#endif // QT_BOOTSTRAPPED
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
/*!
Returns the number of (potentially overlapping) occurrences of
@ -4207,8 +4207,7 @@ int QString::count(const QRegExp& rx) const
}
#endif // QT_NO_REGEXP
#ifndef QT_NO_REGULAREXPRESSION
#ifndef QT_BOOTSTRAPPED
#if QT_CONFIG(regularexpression)
/*!
\overload indexOf()
\since 5.0
@ -4386,8 +4385,7 @@ int QString::count(const QRegularExpression &re) const
}
return count;
}
#endif // QT_BOOTSTRAPPED
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
/*! \fn int QString::count() const
@ -4509,7 +4507,7 @@ QString QString::section(const QString &sep, int start, int end, SectionFlags fl
return ret;
}
#if !(defined(QT_NO_REGEXP) && defined(QT_NO_REGULAREXPRESSION))
#if !(defined(QT_NO_REGEXP) && !QT_CONFIG(regularexpression))
class qt_section_chunk {
public:
qt_section_chunk() {}
@ -4619,8 +4617,7 @@ QString QString::section(const QRegExp &reg, int start, int end, SectionFlags fl
}
#endif
#ifndef QT_NO_REGULAREXPRESSION
#ifndef QT_BOOTSTRAPPED
#if QT_CONFIG(regularexpression)
/*!
\overload section()
\since 5.0
@ -4664,8 +4661,7 @@ QString QString::section(const QRegularExpression &re, int start, int end, Secti
return extractSections(sections, start, end, flags);
}
#endif // QT_BOOTSTRAPPED
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
/*!
Returns a substring that contains the \a n leftmost characters
@ -7630,8 +7626,7 @@ QVector<QStringRef> QString::splitRef(const QRegExp &rx, SplitBehavior behavior)
}
#endif
#ifndef QT_NO_REGULAREXPRESSION
#ifndef QT_BOOTSTRAPPED
#if QT_CONFIG(regularexpression)
namespace {
template<class ResultList, typename MidMethod>
static ResultList splitString(const QString &source, MidMethod mid, const QRegularExpression &re,
@ -7711,8 +7706,7 @@ QVector<QStringRef> QString::splitRef(const QRegularExpression &re, SplitBehavio
{
return splitString<QVector<QStringRef> >(*this, &QString::midRef, re, behavior);
}
#endif // QT_BOOTSTRAPPED
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
/*!
\enum QString::NormalizationForm

View File

@ -353,7 +353,7 @@ public:
inline bool contains(QRegExp &rx) const { return indexOf(rx) != -1; }
#endif
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
int indexOf(const QRegularExpression &re, int from = 0) const;
int indexOf(const QRegularExpression &re, int from, QRegularExpressionMatch *rmatch) const; // ### Qt 6: merge overloads
int lastIndexOf(const QRegularExpression &re, int from = -1) const;
@ -377,7 +377,7 @@ public:
#ifndef QT_NO_REGEXP
QString section(const QRegExp &reg, int start, int end = -1, SectionFlags flags = SectionDefault) const;
#endif
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
QString section(const QRegularExpression &re, int start, int end = -1, SectionFlags flags = SectionDefault) const;
#endif
Q_REQUIRED_RESULT QString left(int n) const;
@ -505,7 +505,7 @@ public:
inline QString &remove(const QRegExp &rx)
{ return replace(rx, QString()); }
#endif
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
QString &replace(const QRegularExpression &re, const QString &after);
inline QString &remove(const QRegularExpression &re)
{ return replace(re, QString()); }
@ -525,7 +525,7 @@ public:
Q_REQUIRED_RESULT QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const;
Q_REQUIRED_RESULT QVector<QStringRef> splitRef(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const;
#endif
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
Q_REQUIRED_RESULT QStringList split(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const;
Q_REQUIRED_RESULT QVector<QStringRef> splitRef(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const;
#endif
@ -1860,6 +1860,12 @@ QT_DEPRECATED inline QString escape(const QString &plain) {
#endif
}
namespace QtPrivate {
// used by qPrintable() and qUtf8Printable() macros
inline const QString &asString(const QString &s) { return s; }
inline QString &&asString(QString &&s) { return std::move(s); }
}
QT_END_NAMESPACE
#if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER)

View File

@ -39,7 +39,9 @@
#include <qstringlist.h>
#include <qset.h>
#include <qregularexpression.h>
#if QT_CONFIG(regularexpression)
# include <qregularexpression.h>
#endif
#include <algorithm>
@ -361,8 +363,7 @@ QStringList QtPrivate::QStringList_filter(const QStringList *that, const QRegExp
}
#endif
#ifndef QT_BOOTSTRAPPED
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
/*!
\fn QStringList QStringList::filter(const QRegularExpression &re) const
\overload
@ -380,8 +381,7 @@ QStringList QtPrivate::QStringList_filter(const QStringList *that, const QRegula
}
return res;
}
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_BOOTSTRAPPED
#endif // QT_CONFIG(regularexpression)
/*!
\fn QStringList &QStringList::replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs)
@ -436,8 +436,7 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegExp &r
}
#endif
#ifndef QT_BOOTSTRAPPED
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
/*!
\fn QStringList &QStringList::replaceInStrings(const QRegularExpression &re, const QString &after)
\overload
@ -466,8 +465,7 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegularEx
for (int i = 0; i < that->size(); ++i)
(*that)[i].replace(re, after);
}
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_BOOTSTRAPPED
#endif // QT_CONFIG(regularexpression)
static int accumulatedSize(const QStringList &list, int seplen)
{
@ -674,8 +672,7 @@ int QtPrivate::QStringList_lastIndexOf(const QStringList *that, QRegExp &rx, int
}
#endif
#ifndef QT_BOOTSTRAPPED
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
/*!
\fn int QStringList::indexOf(const QRegularExpression &re, int from) const
\overload
@ -732,8 +729,7 @@ int QtPrivate::QStringList_lastIndexOf(const QStringList *that, const QRegularEx
}
return -1;
}
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_BOOTSTRAPPED
#endif // QT_CONFIG(regularexpression)
/*!
\fn int QStringList::removeDuplicates()

View File

@ -84,12 +84,10 @@ public:
inline QStringList &replaceInStrings(const QRegExp &rx, const QString &after);
#endif
#ifndef QT_BOOTSTRAPPED
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
inline QStringList filter(const QRegularExpression &re) const;
inline QStringList &replaceInStrings(const QRegularExpression &re, const QString &after);
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_BOOTSTRAPPED
#endif // QT_CONFIG(regularexpression)
#ifndef Q_QDOC
private:
@ -138,12 +136,10 @@ public:
inline int lastIndexOf(QRegExp &rx, int from = -1) const;
#endif
#ifndef QT_BOOTSTRAPPED
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
inline int indexOf(const QRegularExpression &re, int from = 0) const;
inline int lastIndexOf(const QRegularExpression &re, int from = -1) const;
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_BOOTSTRAPPED
#endif // QT_CONFIG(regularexpression)
using QList<QString>::indexOf;
using QList<QString>::lastIndexOf;
@ -179,14 +175,12 @@ namespace QtPrivate {
int Q_CORE_EXPORT QStringList_lastIndexOf(const QStringList *that, QRegExp &rx, int from);
#endif
#ifndef QT_BOOTSTRAPPED
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, const QRegularExpression &rx, const QString &after);
QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, const QRegularExpression &re);
int Q_CORE_EXPORT QStringList_indexOf(const QStringList *that, const QRegularExpression &re, int from);
int Q_CORE_EXPORT QStringList_lastIndexOf(const QStringList *that, const QRegularExpression &re, int from);
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_BOOTSTRAPPED
#endif // QT_CONFIG(regularexpression)
}
inline void QListSpecialMethods<QString>::sort(Qt::CaseSensitivity cs)
@ -275,8 +269,7 @@ inline int QStringList::lastIndexOf(QRegExp &rx, int from) const
}
#endif
#ifndef QT_BOOTSTRAPPED
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
inline QStringList &QListSpecialMethods<QString>::replaceInStrings(const QRegularExpression &rx, const QString &after)
{
QtPrivate::QStringList_replaceInStrings(self(), rx, after);
@ -297,8 +290,7 @@ inline int QStringList::lastIndexOf(const QRegularExpression &rx, int from) cons
{
return QtPrivate::QStringList_lastIndexOf(this, rx, from);
}
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_BOOTSTRAPPED
#endif // QT_CONFIG(regularexpression)
#endif // Q_QDOC
QT_END_NAMESPACE

View File

@ -172,6 +172,31 @@ inline int qt_depthForFormat(QImage::Format format)
#pragma optimize("", on)
#endif
inline QImage::Format qt_opaqueVersion(QImage::Format format)
{
switch (format) {
case QImage::Format_ARGB8565_Premultiplied:
return QImage::Format_RGB16;
case QImage::Format_ARGB8555_Premultiplied:
return QImage::Format_RGB555;
case QImage::Format_ARGB6666_Premultiplied:
return QImage::Format_RGB666;
case QImage::Format_ARGB4444_Premultiplied:
return QImage::Format_RGB444;
case QImage::Format_RGBA8888:
case QImage::Format_RGBA8888_Premultiplied:
return QImage::Format_RGBX8888;
case QImage::Format_A2BGR30_Premultiplied:
return QImage::Format_BGR30;
case QImage::Format_A2RGB30_Premultiplied:
return QImage::Format_RGB30;
case QImage::Format_ARGB32_Premultiplied:
case QImage::Format_ARGB32:
default:
return QImage::Format_RGB32;
}
}
inline QImage::Format qt_alphaVersion(QImage::Format format)
{
switch (format) {
@ -201,6 +226,11 @@ inline QImage::Format qt_maybeAlphaVersionWithSameDepth(QImage::Format format)
return qt_depthForFormat(format) == qt_depthForFormat(toFormat) ? toFormat : format;
}
inline QImage::Format qt_opaqueVersionForPainting(QImage::Format format)
{
return qt_opaqueVersion(format);
}
inline QImage::Format qt_alphaVersionForPainting(QImage::Format format)
{
QImage::Format toFormat = qt_alphaVersion(format);

View File

@ -89,7 +89,7 @@ QRasterPlatformPixmap::~QRasterPlatformPixmap()
{
}
QImage::Format QRasterPlatformPixmap::systemOpaqueFormat()
QImage::Format QRasterPlatformPixmap::systemNativeFormat()
{
if (!QGuiApplication::primaryScreen())
return QImage::Format_RGB32;
@ -107,7 +107,7 @@ void QRasterPlatformPixmap::resize(int width, int height)
if (pixelType() == BitmapType)
format = QImage::Format_MonoLSB;
else
format = systemOpaqueFormat();
format = systemNativeFormat();
image = QImage(width, height, format);
w = width;
@ -314,8 +314,9 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage sourceImage, Qt::ImageCo
? QImage::Format_ARGB32_Premultiplied
: QImage::Format_RGB32;
} else {
QImage::Format opaqueFormat = systemOpaqueFormat();
QImage::Format alphaFormat = qt_alphaVersionForPainting(opaqueFormat);
QImage::Format nativeFormat = systemNativeFormat();
QImage::Format opaqueFormat = qt_opaqueVersionForPainting(nativeFormat);
QImage::Format alphaFormat = qt_alphaVersionForPainting(nativeFormat);
if (!sourceImage.hasAlphaChannel()) {
format = opaqueFormat;

View File

@ -88,7 +88,7 @@ protected:
void createPixmapForImage(QImage sourceImage, Qt::ImageConversionFlags flags);
void setImage(const QImage &image);
QImage image;
static QImage::Format systemOpaqueFormat();
static QImage::Format systemNativeFormat();
private:
friend class QPixmap;

View File

@ -1,3 +1,5 @@
!qtConfig(standarditemmodel): return()
HEADERS += \
itemmodels/qstandarditemmodel.h \
itemmodels/qstandarditemmodel_p.h \

View File

@ -39,8 +39,6 @@
#include "qstandarditemmodel.h"
#ifndef QT_NO_STANDARDITEMMODEL
#include <QtCore/qdatetime.h>
#include <QtCore/qlist.h>
#include <QtCore/qmap.h>
@ -3259,5 +3257,3 @@ bool QStandardItemModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
QT_END_NAMESPACE
#include "moc_qstandarditemmodel.cpp"
#endif // QT_NO_STANDARDITEMMODEL

View File

@ -49,11 +49,10 @@
#include <QtCore/qdatastream.h>
#endif
QT_REQUIRE_CONFIG(standarditemmodel);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_STANDARDITEMMODEL
template <class T> class QList;
class QStandardItemModel;
@ -454,8 +453,6 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QStandardItem &item);
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &out, const QStandardItem &item);
#endif
#endif // QT_NO_STANDARDITEMMODEL
QT_END_NAMESPACE
#endif //QSTANDARDITEMMODEL_H

View File

@ -54,8 +54,6 @@
#include <QtGui/private/qtguiglobal_p.h>
#include "private/qabstractitemmodel_p.h"
#ifndef QT_NO_STANDARDITEMMODEL
#include <QtCore/qlist.h>
#include <QtCore/qpair.h>
#include <QtCore/qstack.h>
@ -63,6 +61,8 @@
#include <QtCore/qvector.h>
#include <QtCore/qdebug.h>
QT_REQUIRE_CONFIG(standarditemmodel);
QT_BEGIN_NAMESPACE
class QStandardItemData
@ -224,6 +224,4 @@ public:
QT_END_NAMESPACE
#endif // QT_NO_STANDARDITEMMODEL
#endif // QSTANDARDITEMMODEL_P_H

View File

@ -46,7 +46,6 @@
#include <QtCore/qfile.h>
#include <QtCore/qvarlengtharray.h>
#include <QtCore/qvector.h>
#include <QtCore/qregularexpression.h>
#include <QtCore/qloggingcategory.h>
#include <QtCore/qcryptographichash.h>
#include <QtCore/qcoreapplication.h>

View File

@ -123,7 +123,6 @@ class QPageLayoutPrivate : public QSharedData
{
public:
QPageLayoutPrivate();
QPageLayoutPrivate(const QPageSize &pageSize, QPageLayout::Orientation orientation,
const QMarginsF &margins, QPageLayout::Unit units,
const QMarginsF &minMargins);
@ -166,12 +165,6 @@ private:
QMarginsF m_maxMargins;
};
QPageLayoutPrivate::QPageLayoutPrivate()
: m_orientation(QPageLayout::Landscape),
m_mode(QPageLayout::StandardMode)
{
}
QPageLayoutPrivate::QPageLayoutPrivate(const QPageSize &pageSize, QPageLayout::Orientation orientation,
const QMarginsF &margins, QPageLayout::Unit units,
const QMarginsF &minMargins)
@ -356,7 +349,7 @@ QRectF QPageLayoutPrivate::paintRect() const
*/
QPageLayout::QPageLayout()
: d(new QPageLayoutPrivate())
: QPageLayout(QPageSize(), QPageLayout::Landscape, QMarginsF())
{
}

View File

@ -47,7 +47,9 @@
#include "qtextlist.h"
#include <qdebug.h>
#include <qregexp.h>
#if QT_CONFIG(regularexpression)
#include <qregularexpression.h>
#endif
#include <qvarlengtharray.h>
#include <qtextcodec.h>
#include <qthread.h>
@ -1488,7 +1490,7 @@ QTextCursor QTextDocument::find(const QRegExp &expr, const QTextCursor &cursor,
}
#endif // QT_REGEXP
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
static bool findInBlock(const QTextBlock &block, const QRegularExpression &expression, int offset,
QTextDocument::FindFlags options, QTextCursor *cursor)
{
@ -1613,7 +1615,7 @@ QTextCursor QTextDocument::find(const QRegularExpression &expr, const QTextCurso
}
return find(expr, pos, options);
}
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
/*!
\fn QTextObject *QTextDocument::createObject(const QTextFormat &format)

View File

@ -175,7 +175,7 @@ public:
QTextCursor find(const QRegExp &expr, const QTextCursor &cursor, FindFlags options = FindFlags()) const;
#endif
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
QTextCursor find(const QRegularExpression &expr, int from = 0, FindFlags options = FindFlags()) const;
QTextCursor find(const QRegularExpression &expr, const QTextCursor &cursor, FindFlags options = FindFlags()) const;
#endif

View File

@ -916,7 +916,7 @@ void QRegExpValidator::setRegExp(const QRegExp& rx)
#endif
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
/*!
\class QRegularExpressionValidator
@ -1067,7 +1067,7 @@ void QRegularExpressionValidatorPrivate::setRegularExpression(const QRegularExpr
}
}
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
QT_END_NAMESPACE

View File

@ -45,7 +45,9 @@
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
#include <QtCore/qregexp.h>
#include <QtCore/qregularexpression.h>
#if QT_CONFIG(regularexpression)
# include <QtCore/qregularexpression.h>
#endif
#include <QtCore/qlocale.h>
QT_BEGIN_NAMESPACE
@ -194,7 +196,7 @@ private:
#endif // QT_NO_REGEXP
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
class QRegularExpressionValidatorPrivate;
@ -223,7 +225,7 @@ private:
Q_DECLARE_PRIVATE(QRegularExpressionValidator)
};
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
#endif // QT_NO_VALIDATOR

View File

@ -2090,10 +2090,7 @@ QImage QFontEngineFT::alphaMapForGlyph(glyph_t g, QFixed subPixelPosition, const
if (!cacheEnabled && glyph != &emptyGlyph)
delete glyph;
if (!img.isNull())
return img;
return QFontEngine::alphaMapForGlyph(g, subPixelPosition, t);
return img;
}
QImage QFontEngineFT::alphaRGBMapForGlyph(glyph_t g, QFixed subPixelPosition, const QTransform &t)

View File

@ -119,7 +119,7 @@ static FontKeys &fontKeys()
QSettings::NativeFormat);
const QStringList allKeys = fontRegistry.allKeys();
const QString trueType = QStringLiteral("(TrueType)");
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
const QRegularExpression sizeListMatch(QStringLiteral("\\s(\\d+,)+\\d+"));
#else
const QRegExp sizeListMatch(QLatin1String("\\s(\\d+,)+\\d+"));

View File

@ -647,7 +647,7 @@ QString QIBusPlatformInputContextPrivate::getSocketPath()
if (pos2 > 0)
displayNumber = display.mid(pos, pos2 - pos);
else
displayNumber = display.right(pos);
displayNumber = display.mid(pos);
if (debug)
qDebug() << "host=" << host << "displayNumber" << displayNumber;

View File

@ -140,7 +140,7 @@ QByteArray QEglFSDeviceIntegration::fbDeviceName() const
int QEglFSDeviceIntegration::framebufferIndex() const
{
int fbIndex = 0;
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
QRegularExpression fbIndexRx(QLatin1String("fb(\\d+)"));
QRegularExpressionMatch match = fbIndexRx.match(QString::fromLocal8Bit(fbDeviceName()));
if (match.hasMatch())

View File

@ -1083,7 +1083,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::LeaveEvent:
{
QWindow *window = platformWindow->window();
while (window->flags() & Qt::WindowTransparentForInput)
while (window && (window->flags() & Qt::WindowTransparentForInput))
window = window->parent();
if (!window)
return false;

View File

@ -396,9 +396,6 @@ Qt::ScreenOrientation QWindowsScreen::orientationPreference()
*/
QPlatformScreen::SubpixelAntialiasingType QWindowsScreen::subpixelAntialiasingTypeHint() const
{
#if !defined(FT_LCD_FILTER_H) || !defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING)
return QPlatformScreen::Subpixel_None;
#else
QPlatformScreen::SubpixelAntialiasingType type = QPlatformScreen::subpixelAntialiasingTypeHint();
if (type == QPlatformScreen::Subpixel_None) {
QSettings settings(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Avalon.Graphics\\DISPLAY1"), QSettings::NativeFormat);
@ -419,7 +416,6 @@ QPlatformScreen::SubpixelAntialiasingType QWindowsScreen::subpixelAntialiasingTy
}
}
return type;
#endif
}
/*!

View File

@ -1,6 +1,6 @@
TEMPLATE = subdirs
QT_FOR_CONFIG += widgets-private
qtConfig(dbus): SUBDIRS += flatpak
qtConfig(dbus):qtConfig(regularexpression): SUBDIRS += flatpak
qtHaveModule(widgets):qtConfig(gtk3): SUBDIRS += gtk3

View File

@ -51,7 +51,7 @@
#include <qstringlist.h>
#include <qvector.h>
#include <qdebug.h>
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
#include <qcache.h>
#include <qregularexpression.h>
#endif
@ -467,7 +467,10 @@ bool QSQLiteResult::exec()
#if (SQLITE_VERSION_NUMBER >= 3003011)
// In the case of the reuse of a named placeholder
if (paramCount < values.count()) {
// We need to check explicitly that paramCount is greater than 1, as sqlite
// can end up in a case where for virtual tables it returns 0 even though it
// has parameters
if (paramCount > 1 && paramCount < values.count()) {
const auto countIndexes = [](int counter, const QList<int>& indexList) {
return counter + indexList.length();
};
@ -622,7 +625,7 @@ QVariant QSQLiteResult::handle() const
/////////////////////////////////////////////////////////
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
static void _q_regexp(sqlite3_context* context, int argc, sqlite3_value** argv)
{
if (Q_UNLIKELY(argc != 2)) {
@ -721,7 +724,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
bool sharedCache = false;
bool openReadOnlyOption = false;
bool openUriOption = false;
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
static const QLatin1String regexpConnectOption = QLatin1String("QSQLITE_ENABLE_REGEXP");
bool defineRegexp = false;
int regexpCacheSize = 25;
@ -745,7 +748,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
} else if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE")) {
sharedCache = true;
}
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
else if (option.startsWith(regexpConnectOption)) {
option = option.mid(regexpConnectOption.size()).trimmed();
if (option.isEmpty()) {
@ -774,7 +777,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
sqlite3_busy_timeout(d->access, timeOut);
setOpen(true);
setOpenError(false);
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
if (defineRegexp) {
auto cache = new QCache<QString, QRegularExpression>(regexpCacheSize);
sqlite3_create_function_v2(d->access, "regexp", 2, SQLITE_UTF8, cache, &_q_regexp, NULL,

View File

@ -1977,7 +1977,7 @@ void QTest::ignoreMessage(QtMsgType type, const char *message)
QTestLog::ignoreMessage(type, message);
}
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
/*!
\overload
@ -1997,7 +1997,7 @@ void QTest::ignoreMessage(QtMsgType type, const QRegularExpression &messagePatte
{
QTestLog::ignoreMessage(type, messagePattern);
}
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
/*! \internal
*/

View File

@ -306,7 +306,7 @@ namespace QTest
const char *file, int line);
Q_TESTLIB_EXPORT void qWarn(const char *message, const char *file = nullptr, int line = 0);
Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const char *message);
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern);
#endif

View File

@ -60,7 +60,9 @@
#include <QtCore/qbytearray.h>
#include <QtCore/QElapsedTimer>
#include <QtCore/QVariant>
#if QT_CONFIG(regularexpression)
#include <QtCore/QRegularExpression>
#endif
#include <stdlib.h>
#include <string.h>
@ -144,7 +146,7 @@ namespace QTest {
return tp == type
&& (pattern.type() == QVariant::String ?
stringsMatch(pattern.toString(), message) :
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
pattern.toRegularExpression().match(message).hasMatch());
#else
false);
@ -380,7 +382,7 @@ void QTestLog::printUnhandledIgnoreMessages()
if (list->pattern.type() == QVariant::String) {
message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"');
} else {
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
message = QStringLiteral("Did not receive any message matching: \"") + list->pattern.toRegularExpression().pattern() + QLatin1Char('"');
#endif
}
@ -576,14 +578,14 @@ void QTestLog::ignoreMessage(QtMsgType type, const char *msg)
QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QString::fromLocal8Bit(msg));
}
#ifndef QT_NO_REGULAREXPRESSION
#if QT_CONFIG(regularexpression)
void QTestLog::ignoreMessage(QtMsgType type, const QRegularExpression &expression)
{
QTEST_ASSERT(expression.isValid());
QTest::IgnoreResultList::append(QTest::ignoreResultList, type, QVariant(expression));
}
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_CONFIG(regularexpression)
void QTestLog::setMaxWarnings(int m)
{

View File

@ -1299,7 +1299,7 @@ QColorShower::QColorShower(QColorDialog *parent)
lblHtml->setBuddy(htEd);
#endif
#if !defined(QT_NO_REGULAREXPRESSION)
#if QT_CONFIG(regularexpression)
QRegularExpression regExp(QStringLiteral("#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})"));
QRegularExpressionValidator *validator = new QRegularExpressionValidator(regExp, this);
htEd->setValidator(validator);

View File

@ -160,9 +160,13 @@ bool QDockWidgetTitleButton::event(QEvent *event)
static inline bool isWindowsStyle(const QStyle *style)
{
// Note: QStyleSheetStyle inherits QWindowsStyle
const QStyle *effectiveStyle = style->inherits("QStyleSheetStyle")
? static_cast<const QStyleSheetStyle *>(style)->baseStyle()
: style;
const QStyle *effectiveStyle = style;
#if QT_CONFIG(style_stylesheet)
if (style->inherits("QStyleSheetStyle"))
effectiveStyle = static_cast<const QStyleSheetStyle *>(style)->baseStyle();
#endif
return effectiveStyle->inherits("QWindowsStyle");
}

View File

@ -37,6 +37,8 @@ class tst_QSemaphore : public QObject
Q_OBJECT
private slots:
void acquire();
void multiRelease();
void multiAcquireRelease();
void tryAcquire();
void tryAcquireWithTimeout_data();
void tryAcquireWithTimeout();
@ -149,6 +151,73 @@ void tst_QSemaphore::acquire()
QCOMPARE(semaphore.available(), 0);
}
void tst_QSemaphore::multiRelease()
{
class Thread : public QThread
{
public:
QSemaphore &sem;
Thread(QSemaphore &sem) : sem(sem) {}
void run() override
{
sem.acquire();
}
};
QSemaphore sem;
QVector<Thread *> threads;
threads.resize(4);
for (Thread *&t : threads)
t = new Thread(sem);
for (Thread *&t : threads)
t->start();
// wait for all threads to reach the sem.acquire() and then
// release them all
QTest::qSleep(1);
sem.release(threads.size());
for (Thread *&t : threads)
t->wait();
qDeleteAll(threads);
}
void tst_QSemaphore::multiAcquireRelease()
{
class Thread : public QThread
{
public:
QSemaphore &sem;
Thread(QSemaphore &sem) : sem(sem) {}
void run() override
{
sem.acquire();
sem.release();
}
};
QSemaphore sem;
QVector<Thread *> threads;
threads.resize(4);
for (Thread *&t : threads)
t = new Thread(sem);
for (Thread *&t : threads)
t->start();
// wait for all threads to reach the sem.acquire() and then
// release them all
QTest::qSleep(1);
sem.release();
for (Thread *&t : threads)
t->wait();
qDeleteAll(threads);
}
void tst_QSemaphore::tryAcquire()
{
QSemaphore semaphore;

View File

@ -528,16 +528,8 @@ void tst_QPixmap::fill_transparent()
QVERIFY(pixmap.hasAlphaChannel());
}
static bool isPlatformWayland()
{
return QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive);
}
void tst_QPixmap::mask()
{
if (isPlatformWayland())
QSKIP("Wayland: This fails. See QTBUG-66983.");
QPixmap pm(100, 100);
QBitmap bm(100, 100);
@ -800,9 +792,6 @@ void tst_QPixmap::convertFromImageNoDetach()
void tst_QPixmap::convertFromImageNoDetach2()
{
if (isPlatformWayland())
QSKIP("Wayland: This fails. See QTBUG-66984.");
QPixmap randomPixmap(10, 10);
if (randomPixmap.handle()->classId() != QPlatformPixmap::RasterClass)
QSKIP("Test only valid for raster pixmaps");
@ -1477,9 +1466,6 @@ void tst_QPixmap::fromImageReaderAnimatedGif()
void tst_QPixmap::task_246446()
{
if (isPlatformWayland())
QSKIP("Wayland: This fails. See QTBUG-66985.");
// This crashed without the bugfix in 246446
QPixmap pm(10, 10);
pm.fill(Qt::transparent); // force 32-bit depth

View File

@ -42,6 +42,7 @@ private slots:
void initTestCase();
void create();
void basic();
void resize();
void painter();
void partial_data();
void partial();
@ -115,8 +116,7 @@ void tst_QOpenGLWindow::basic()
// Check that the virtuals are invoked.
QCOMPARE(w.initCount, 1);
int resCount = w.resizeCount;
QVERIFY(resCount >= 1);
QVERIFY(w.resizeCount >= 1);
QVERIFY(w.paintCount >= 1);
// Check that something has been drawn;
@ -132,6 +132,27 @@ void tst_QOpenGLWindow::basic()
QCOMPARE(v[2], GLint(w.width() * w.devicePixelRatio()));
QCOMPARE(v[3], GLint(w.height() * w.devicePixelRatio()));
w.doneCurrent();
}
static bool isPlatformWayland()
{
return QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive);
}
void tst_QOpenGLWindow::resize()
{
if (isPlatformWayland())
QSKIP("Wayland: Crashes on Intel Mesa due to a driver bug (QTBUG-66848).");
Window w;
w.reset();
w.resize(640, 480);
w.show();
QVERIFY(QTest::qWaitForWindowExposed(&w));
// Check that the virtuals are invoked.
int resCount = w.resizeCount;
QVERIFY(resCount >= 1);
// Check that a future resize triggers resizeGL.
w.resize(800, 600);

File diff suppressed because it is too large Load Diff

View File

@ -32,13 +32,13 @@
#include <qmap.h>
#include <qpainterpath.h>
#include <qregion.h>
#include <qregularexpression.h>
#include <qstringlist.h>
#include <qpixmap.h>
#include <qbrush.h>
#include <qhash.h>
QT_FORWARD_DECLARE_CLASS(QPainter)
QT_FORWARD_DECLARE_CLASS(QRegExp)
#ifndef QT_NO_OPENGL
QT_FORWARD_DECLARE_CLASS(QOpenGLFramebufferObject)
QT_FORWARD_DECLARE_CLASS(QOpenGLPaintDevice)
@ -128,121 +128,121 @@ private:
QColor convertToColor(const QString &str);
// commands: comments
void command_comment(QRegExp re);
void command_comment(QRegularExpressionMatch re);
// commands: importer
void command_import(QRegExp re);
void command_import(QRegularExpressionMatch re);
// commands: blocks
void command_begin_block(QRegExp re);
void command_end_block(QRegExp re);
void command_repeat_block(QRegExp re);
void command_begin_block(QRegularExpressionMatch re);
void command_end_block(QRegularExpressionMatch re);
void command_repeat_block(QRegularExpressionMatch re);
// commands: misc
void command_textlayout_draw(QRegExp re);
void command_abort(QRegExp re);
void command_textlayout_draw(QRegularExpressionMatch re);
void command_abort(QRegularExpressionMatch re);
// commands: noops
void command_noop(QRegExp re);
void command_noop(QRegularExpressionMatch re);
// commands: setters
void command_setBgMode(QRegExp re);
void command_setBackground(QRegExp re);
void command_setOpacity(QRegExp re);
void command_path_setFillRule(QRegExp re);
void command_setBrush(QRegExp re);
void command_setBrushOrigin(QRegExp re);
void command_brushTranslate(QRegExp re);
void command_brushRotate(QRegExp re);
void command_brushScale(QRegExp re);
void command_brushShear(QRegExp re);
void command_setClipPath(QRegExp re);
void command_setClipRect(QRegExp re);
void command_setClipRectangle(QRegExp re);
void command_setClipRegion(QRegExp re);
void command_setClipping(QRegExp re);
void command_setCompositionMode(QRegExp re);
void command_setFont(QRegExp re);
void command_setPen(QRegExp re);
void command_setPen2(QRegExp re);
void command_pen_setDashOffset(QRegExp re);
void command_pen_setDashPattern(QRegExp re);
void command_pen_setCosmetic(QRegExp re);
void command_setRenderHint(QRegExp re);
void command_clearRenderHint(QRegExp re);
void command_gradient_appendStop(QRegExp re);
void command_gradient_clearStops(QRegExp re);
void command_gradient_setConical(QRegExp re);
void command_gradient_setLinear(QRegExp re);
void command_gradient_setRadial(QRegExp re);
void command_gradient_setRadialExtended(QRegExp re);
void command_gradient_setLinearPen(QRegExp re);
void command_gradient_setSpread(QRegExp re);
void command_gradient_setCoordinateMode(QRegExp re);
void command_setBgMode(QRegularExpressionMatch re);
void command_setBackground(QRegularExpressionMatch re);
void command_setOpacity(QRegularExpressionMatch re);
void command_path_setFillRule(QRegularExpressionMatch re);
void command_setBrush(QRegularExpressionMatch re);
void command_setBrushOrigin(QRegularExpressionMatch re);
void command_brushTranslate(QRegularExpressionMatch re);
void command_brushRotate(QRegularExpressionMatch re);
void command_brushScale(QRegularExpressionMatch re);
void command_brushShear(QRegularExpressionMatch re);
void command_setClipPath(QRegularExpressionMatch re);
void command_setClipRect(QRegularExpressionMatch re);
void command_setClipRectangle(QRegularExpressionMatch re);
void command_setClipRegion(QRegularExpressionMatch re);
void command_setClipping(QRegularExpressionMatch re);
void command_setCompositionMode(QRegularExpressionMatch re);
void command_setFont(QRegularExpressionMatch re);
void command_setPen(QRegularExpressionMatch re);
void command_setPen2(QRegularExpressionMatch re);
void command_pen_setDashOffset(QRegularExpressionMatch re);
void command_pen_setDashPattern(QRegularExpressionMatch re);
void command_pen_setCosmetic(QRegularExpressionMatch re);
void command_setRenderHint(QRegularExpressionMatch re);
void command_clearRenderHint(QRegularExpressionMatch re);
void command_gradient_appendStop(QRegularExpressionMatch re);
void command_gradient_clearStops(QRegularExpressionMatch re);
void command_gradient_setConical(QRegularExpressionMatch re);
void command_gradient_setLinear(QRegularExpressionMatch re);
void command_gradient_setRadial(QRegularExpressionMatch re);
void command_gradient_setRadialExtended(QRegularExpressionMatch re);
void command_gradient_setLinearPen(QRegularExpressionMatch re);
void command_gradient_setSpread(QRegularExpressionMatch re);
void command_gradient_setCoordinateMode(QRegularExpressionMatch re);
// commands: drawing ops
void command_drawArc(QRegExp re);
void command_drawChord(QRegExp re);
void command_drawConvexPolygon(QRegExp re);
void command_drawEllipse(QRegExp re);
void command_drawImage(QRegExp re);
void command_drawLine(QRegExp re);
void command_drawPath(QRegExp re);
void command_drawPie(QRegExp re);
void command_drawPixmap(QRegExp re);
void command_drawPoint(QRegExp re);
void command_drawPolygon(QRegExp re);
void command_drawPolyline(QRegExp re);
void command_drawRect(QRegExp re);
void command_drawRoundedRect(QRegExp re);
void command_drawRoundRect(QRegExp re);
void command_drawText(QRegExp re);
void command_drawStaticText(QRegExp re);
void command_drawTiledPixmap(QRegExp re);
void command_path_addEllipse(QRegExp re);
void command_path_addPolygon(QRegExp re);
void command_path_addRect(QRegExp re);
void command_path_addText(QRegExp re);
void command_path_arcTo(QRegExp re);
void command_path_closeSubpath(QRegExp re);
void command_path_createOutline(QRegExp re);
void command_path_cubicTo(QRegExp re);
void command_path_debugPrint(QRegExp re);
void command_path_lineTo(QRegExp re);
void command_path_moveTo(QRegExp re);
void command_region_addEllipse(QRegExp re);
void command_region_addRect(QRegExp re);
void command_drawArc(QRegularExpressionMatch re);
void command_drawChord(QRegularExpressionMatch re);
void command_drawConvexPolygon(QRegularExpressionMatch re);
void command_drawEllipse(QRegularExpressionMatch re);
void command_drawImage(QRegularExpressionMatch re);
void command_drawLine(QRegularExpressionMatch re);
void command_drawPath(QRegularExpressionMatch re);
void command_drawPie(QRegularExpressionMatch re);
void command_drawPixmap(QRegularExpressionMatch re);
void command_drawPoint(QRegularExpressionMatch re);
void command_drawPolygon(QRegularExpressionMatch re);
void command_drawPolyline(QRegularExpressionMatch re);
void command_drawRect(QRegularExpressionMatch re);
void command_drawRoundedRect(QRegularExpressionMatch re);
void command_drawRoundRect(QRegularExpressionMatch re);
void command_drawText(QRegularExpressionMatch re);
void command_drawStaticText(QRegularExpressionMatch re);
void command_drawTiledPixmap(QRegularExpressionMatch re);
void command_path_addEllipse(QRegularExpressionMatch re);
void command_path_addPolygon(QRegularExpressionMatch re);
void command_path_addRect(QRegularExpressionMatch re);
void command_path_addText(QRegularExpressionMatch re);
void command_path_arcTo(QRegularExpressionMatch re);
void command_path_closeSubpath(QRegularExpressionMatch re);
void command_path_createOutline(QRegularExpressionMatch re);
void command_path_cubicTo(QRegularExpressionMatch re);
void command_path_debugPrint(QRegularExpressionMatch re);
void command_path_lineTo(QRegularExpressionMatch re);
void command_path_moveTo(QRegularExpressionMatch re);
void command_region_addEllipse(QRegularExpressionMatch re);
void command_region_addRect(QRegularExpressionMatch re);
// getters
void command_region_getClipRegion(QRegExp re);
void command_path_getClipPath(QRegExp re);
void command_region_getClipRegion(QRegularExpressionMatch re);
void command_path_getClipPath(QRegularExpressionMatch re);
// commands: surface begin/end
void command_surface_begin(QRegExp re);
void command_surface_end(QRegExp re);
void command_surface_begin(QRegularExpressionMatch re);
void command_surface_end(QRegularExpressionMatch re);
// commands: save/restore painter state
void command_restore(QRegExp re);
void command_save(QRegExp re);
void command_restore(QRegularExpressionMatch re);
void command_save(QRegularExpressionMatch re);
// commands: pixmap/image
void command_pixmap_load(QRegExp re);
void command_pixmap_setMask(QRegExp re);
void command_bitmap_load(QRegExp re);
void command_image_convertToFormat(QRegExp re);
void command_image_load(QRegExp re);
void command_image_setColor(QRegExp re);
void command_image_setColorCount(QRegExp re);
void command_pixmap_load(QRegularExpressionMatch re);
void command_pixmap_setMask(QRegularExpressionMatch re);
void command_bitmap_load(QRegularExpressionMatch re);
void command_image_convertToFormat(QRegularExpressionMatch re);
void command_image_load(QRegularExpressionMatch re);
void command_image_setColor(QRegularExpressionMatch re);
void command_image_setColorCount(QRegularExpressionMatch re);
// commands: transformation
void command_resetMatrix(QRegExp re);
void command_translate(QRegExp re);
void command_rotate(QRegExp re);
void command_rotate_x(QRegExp re);
void command_rotate_y(QRegExp re);
void command_scale(QRegExp re);
void command_mapQuadToQuad(QRegExp re);
void command_setMatrix(QRegExp re);
void command_resetMatrix(QRegularExpressionMatch re);
void command_translate(QRegularExpressionMatch re);
void command_rotate(QRegularExpressionMatch re);
void command_rotate_x(QRegularExpressionMatch re);
void command_rotate_y(QRegularExpressionMatch re);
void command_scale(QRegularExpressionMatch re);
void command_mapQuadToQuad(QRegularExpressionMatch re);
void command_setMatrix(QRegularExpressionMatch re);
// attributes
QPainter *m_painter;
@ -302,7 +302,7 @@ private:
public:
struct PaintCommandInfos
{
PaintCommandInfos(QString id, void (PaintCommands::*p)(QRegExp), QRegExp r, QString sy, QString sa)
PaintCommandInfos(QString id, void (PaintCommands::*p)(QRegularExpressionMatch), QRegularExpression r, QString sy, QString sa)
: identifier(id)
, regExp(r)
, syntax(sy)
@ -313,10 +313,10 @@ public:
: identifier(title), paintMethod(0) {}
bool isSectionHeader() const { return paintMethod == 0; }
QString identifier;
QRegExp regExp;
QRegularExpression regExp;
QString syntax;
QString sample;
void (PaintCommands::*paintMethod)(QRegExp);
void (PaintCommands::*paintMethod)(QRegularExpressionMatch);
};
static PaintCommandInfos *findCommandById(const QString &identifier) {

View File

@ -890,10 +890,10 @@ void tst_QSqlDatabase::recordMySQL()
static QDateTime dt(QDate::currentDate(), QTime(1, 2, 3, 0));
static const FieldDef fieldDefs[] = {
FieldDef("tinyint", QVariant::Int, 127),
FieldDef("tinyint unsigned", QVariant::UInt, 255),
FieldDef("smallint", QVariant::Int, 32767),
FieldDef("smallint unsigned", QVariant::UInt, 65535),
FieldDef("tinyint", static_cast<QVariant::Type>(QMetaType::Char), 127),
FieldDef("tinyint unsigned", static_cast<QVariant::Type>(QMetaType::UChar), 255),
FieldDef("smallint", static_cast<QVariant::Type>(QMetaType::Short), 32767),
FieldDef("smallint unsigned", static_cast<QVariant::Type>(QMetaType::UShort), 65535),
FieldDef("mediumint", QVariant::Int, 8388607),
FieldDef("mediumint unsigned", QVariant::UInt, 16777215),
FieldDef("integer", QVariant::Int, 2147483647),

View File

@ -176,6 +176,8 @@ private slots:
void emptyTableNavigate();
void timeStampParsing_data() { generic_data(); }
void timeStampParsing();
void sqliteVirtualTable_data() { generic_data("QSQLITE"); }
void sqliteVirtualTable();
#ifdef NOT_READY_YET
void task_229811();
@ -3033,11 +3035,7 @@ void tst_QSqlQuery::nextResult()
QCOMPARE( q.record().field( 0 ).type(), QVariant::String );
QCOMPARE( q.record().field( 1 ).name().toUpper(), QString( "NUM" ) );
if (dbType == QSqlDriver::MySqlServer)
QCOMPARE( q.record().field( 1 ).type(), QVariant::String );
else
QCOMPARE( q.record().field( 1 ).type(), QVariant::Double );
QCOMPARE(q.record().field(1).type(), QVariant::Double);
QVERIFY( q.next() ); // Move to first row of the second result set
@ -3287,6 +3285,10 @@ void tst_QSqlQuery::timeStampParsing()
QVERIFY_SQL(q, exec(QStringLiteral("CREATE TABLE ") + tableName + QStringLiteral("("
"id serial NOT NULL, "
"datefield timestamp, primary key(id));")));
} else if (dbType == QSqlDriver::MySqlServer) {
QVERIFY_SQL(q, exec(QStringLiteral("CREATE TABLE ") + tableName + QStringLiteral("("
"id integer NOT NULL AUTO_INCREMENT,"
"datefield timestamp, primary key(id));")));
} else {
QVERIFY_SQL(q, exec(QStringLiteral("CREATE TABLE ") + tableName + QStringLiteral("("
"\"id\" integer NOT NULL PRIMARY KEY AUTOINCREMENT,"
@ -4623,5 +4625,44 @@ void tst_QSqlQuery::dateTime()
}
}
void tst_QSqlQuery::sqliteVirtualTable()
{
// Virtual tables can behave differently when it comes to prepared
// queries, so we need to check these explicitly
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
const auto tableName = qTableName("sqliteVirtual", __FILE__, db);
QSqlQuery qry(db);
QVERIFY_SQL(qry, exec("create virtual table " + tableName + " using fts3(id, name)"));
// Delibrately malform the query to try and provoke a potential crash situation
QVERIFY_SQL(qry, prepare("select * from " + tableName + " where name match '?'"));
qry.addBindValue("Andy");
QVERIFY(!qry.exec());
QVERIFY_SQL(qry, prepare("insert into " + tableName + "(id, name) VALUES (?, ?)"));
qry.addBindValue(1);
qry.addBindValue("Andy");
QVERIFY_SQL(qry, exec());
QVERIFY_SQL(qry, exec("select * from " + tableName));
QVERIFY(qry.next());
QCOMPARE(qry.value(0).toInt(), 1);
QCOMPARE(qry.value(1).toString(), "Andy");
QVERIFY_SQL(qry, prepare("insert into " + tableName + "(id, name) values (:id, :name)"));
qry.bindValue(":id", 2);
qry.bindValue(":name", "Peter");
QVERIFY_SQL(qry, exec());
QVERIFY_SQL(qry, prepare("select * from " + tableName + " where name match ?"));
qry.addBindValue("Peter");
QVERIFY_SQL(qry, exec());
QVERIFY(qry.next());
QCOMPARE(qry.value(0).toInt(), 2);
QCOMPARE(qry.value(1).toString(), "Peter");
}
QTEST_MAIN( tst_QSqlQuery )
#include "tst_qsqlquery.moc"

View File

@ -32,7 +32,7 @@
#if defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM)
#define SHOULD_CHECK_ARM_ON_X86
#if QT_CONFIG(process) && !defined(QT_NO_REGULAREXPRESSION)
#if QT_CONFIG(process) && QT_CONFIG(regularexpression)
#include <QProcess>
#include <QRegularExpression>
#endif
@ -88,7 +88,7 @@ static bool isX86SpecificFileAvailable()
*/
static bool isReportedArchitectureX86(void)
{
#if QT_CONFIG(process) && !defined(QT_NO_REGULAREXPRESSION)
#if QT_CONFIG(process) && QT_CONFIG(regularexpression)
QProcess unamer;
QString machineString;