diff options
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 33 | ||||
-rw-r--r-- | src/corelib/global/qendian.h | 8 | ||||
-rw-r--r-- | src/corelib/global/qendian_p.h | 193 | ||||
-rw-r--r-- | src/corelib/global/qflags.h | 27 | ||||
-rw-r--r-- | src/corelib/global/qfloat16_f16c.c | 11 | ||||
-rw-r--r-- | src/corelib/global/qglobal.cpp | 32 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 24 | ||||
-rw-r--r-- | src/corelib/global/qglobalstatic.h | 4 | ||||
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 4 | ||||
-rw-r--r-- | src/corelib/global/qlogging.cpp | 6 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.h | 7 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 25 | ||||
-rw-r--r-- | src/corelib/global/qrandom.cpp | 3 |
13 files changed, 335 insertions, 42 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index ebffe74188..64c96023b0 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Copyright (C) 2016 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** @@ -48,6 +48,7 @@ /* The compiler, must be one of: (Q_CC_x) + COVERITY - Coverity cov-scan SYM - Digital Mars C/C++ (used to be Symantec C++) MSVC - Microsoft Visual C/C++, Intel C++ for Windows BOR - Borland/Turbo C++ @@ -74,6 +75,10 @@ Should be sorted most to least authoritative. */ +#if defined(__COVERITY__) +# define Q_CC_COVERITY +#endif + /* Symantec C++ is now Digital Mars */ #if defined(__DMC__) || defined(__SC__) # define Q_CC_SYM @@ -83,11 +88,14 @@ # endif #elif defined(_MSC_VER) +# define Q_CC_MSVC (_MSC_VER) +# define Q_CC_MSVC_NET +# define Q_CC_MSVC_ONLY Q_CC_MSVC # ifdef __clang__ +# undef Q_CC_MSVC_ONLY # define Q_CC_CLANG ((__clang_major__ * 100) + __clang_minor__) +# define Q_CC_CLANG_ONLY Q_CC_CLANG # endif -# define Q_CC_MSVC (_MSC_VER) -# define Q_CC_MSVC_NET # define Q_OUTOFLINE_TEMPLATE inline # define Q_COMPILER_MANGLES_RETURN_TYPE # define Q_FUNC_INFO __FUNCSIG__ @@ -106,6 +114,10 @@ # define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) stdext::make_checked_array_iterator(x, size_t(N)) // Since _MSC_VER >= 1500 /* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */ # if defined(__INTEL_COMPILER) +# undef Q_CC_MSVC_ONLY +# ifdef Q_CC_CLANG_ONLY +# undef Q_CC_CLANG_ONLY +# endif # define Q_DECL_VARIABLE_DEPRECATED # define Q_CC_INTEL __INTEL_COMPILER # endif @@ -183,6 +195,7 @@ # else # define Q_CC_CLANG ((__clang_major__ * 100) + __clang_minor__) # endif +# define Q_CC_CLANG_ONLY Q_CC_CLANG # if __has_builtin(__builtin_assume) # define Q_ASSUME_IMPL(expr) __builtin_assume(expr) # else @@ -205,6 +218,7 @@ # endif # else /* Plain GCC */ +# define Q_CC_GNU_ONLY Q_CC_GNU # if Q_CC_GNU >= 405 # define Q_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable() # define Q_UNREACHABLE_IMPL() __builtin_unreachable() @@ -836,7 +850,7 @@ # define Q_DECL_UNUSED_MEMBER Q_DECL_UNUSED #endif -#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG) +#if defined(Q_CC_GNU_ONLY) # define Q_COMPILER_RESTRICTED_VLA # define Q_COMPILER_THREADSAFE_STATICS # if Q_CC_GNU >= 403 @@ -1247,6 +1261,16 @@ #endif /* + * "Weak overloads" - makes an otherwise confliciting overload weaker + * (by making it a template) + */ +#ifndef Q_CLANG_QDOC +# define Q_WEAK_OVERLOAD template <typename = void> +#else +# define Q_WEAK_OVERLOAD +#endif + +/* * Warning/diagnostic handling */ @@ -1371,6 +1395,7 @@ # undef QT_COMPILER_SUPPORTS_SSE4_2 # undef QT_COMPILER_SUPPORTS_AVX # undef QT_COMPILER_SUPPORTS_AVX2 +# undef QT_COMPILER_SUPPORTS_F16C #endif #if !defined(Q_PROCESSOR_ARM) # undef QT_COMPILER_SUPPORTS_NEON diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index a97776c761..e9e51c4b93 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -372,8 +372,8 @@ public: QLEInteger &operator ^=(T i); QLEInteger &operator ++(); QLEInteger &operator --(); - QLEInteger &operator ++(int); - QLEInteger &operator --(int); + QLEInteger operator ++(int); + QLEInteger operator --(int); static Q_DECL_CONSTEXPR QLEInteger max(); static Q_DECL_CONSTEXPR QLEInteger min(); @@ -399,8 +399,8 @@ public: QBEInteger &operator ^=(T i); QBEInteger &operator ++(); QBEInteger &operator --(); - QBEInteger &operator ++(int); - QBEInteger &operator --(int); + QBEInteger operator ++(int); + QBEInteger operator --(int); static Q_DECL_CONSTEXPR QBEInteger max(); static Q_DECL_CONSTEXPR QBEInteger min(); diff --git a/src/corelib/global/qendian_p.h b/src/corelib/global/qendian_p.h index c830e65b54..5421a452d9 100644 --- a/src/corelib/global/qendian_p.h +++ b/src/corelib/global/qendian_p.h @@ -52,6 +52,7 @@ // #include <QtCore/qendian.h> +#include <type_traits> QT_BEGIN_NAMESPACE @@ -136,6 +137,198 @@ using qint32_be_bitfield = QBEIntegerBitfield<int, pos, width>; template<int pos, int width> using quint32_be_bitfield = QBEIntegerBitfield<uint, pos, width>; +enum class QSpecialIntegerBitfieldInitializer {}; +constexpr QSpecialIntegerBitfieldInitializer QSpecialIntegerBitfieldZero{}; + +template<class S> +class QSpecialIntegerStorage +{ +public: + using UnsignedStorageType = typename std::make_unsigned<typename S::StorageType>::type; + + constexpr QSpecialIntegerStorage() = default; + constexpr QSpecialIntegerStorage(QSpecialIntegerBitfieldInitializer) : val(0) {} + constexpr QSpecialIntegerStorage(UnsignedStorageType initial) : val(initial) {} + + UnsignedStorageType val; +}; + +template<class S, int pos, int width, class T = typename S::StorageType> +class QSpecialIntegerAccessor; + +template<class S, int pos, int width, class T = typename S::StorageType> +class QSpecialIntegerConstAccessor +{ + Q_DISABLE_COPY(QSpecialIntegerConstAccessor) +public: + using Storage = const QSpecialIntegerStorage<S>; + using Type = T; + using UnsignedType = typename std::make_unsigned<T>::type; + + QSpecialIntegerConstAccessor(QSpecialIntegerConstAccessor &&) noexcept = default; + QSpecialIntegerConstAccessor &operator=(QSpecialIntegerConstAccessor &&) noexcept = default; + + operator Type() const noexcept + { + if (std::is_signed<Type>::value) { + UnsignedType i = S::fromSpecial(storage->val); + i <<= (sizeof(Type) * 8) - width - pos; + Type t = Type(i); + t >>= (sizeof(Type) * 8) - width; + return t; + } + return (S::fromSpecial(storage->val) & mask()) >> pos; + } + + bool operator!() const noexcept { return !(storage->val & S::toSpecial(mask())); } + + static constexpr UnsignedType mask() noexcept + { + return ((UnsignedType(1) << width) - 1) << pos; + } + +private: + template<class Storage, typename... Accessors> + friend class QSpecialIntegerBitfieldUnion; + friend class QSpecialIntegerAccessor<S, pos, width, T>; + + explicit QSpecialIntegerConstAccessor(Storage *storage) : storage(storage) {} + + friend bool operator==(const QSpecialIntegerConstAccessor<S, pos, width, T> &i, + const QSpecialIntegerConstAccessor<S, pos, width, T> &j) noexcept + { + return ((i.storage->val ^ j.storage->val) & S::toSpecial(mask())) == 0; + } + + friend bool operator!=(const QSpecialIntegerConstAccessor<S, pos, width, T> &i, + const QSpecialIntegerConstAccessor<S, pos, width, T> &j) noexcept + { + return ((i.storage->val ^ j.storage->val) & S::toSpecial(mask())) != 0; + } + + Storage *storage; +}; + +template<class S, int pos, int width, class T> +class QSpecialIntegerAccessor +{ + Q_DISABLE_COPY(QSpecialIntegerAccessor) +public: + using Const = QSpecialIntegerConstAccessor<S, pos, width, T>; + using Storage = QSpecialIntegerStorage<S>; + using Type = T; + using UnsignedType = typename std::make_unsigned<T>::type; + + QSpecialIntegerAccessor(QSpecialIntegerAccessor &&) noexcept = default; + QSpecialIntegerAccessor &operator=(QSpecialIntegerAccessor &&) noexcept = default; + + QSpecialIntegerAccessor &operator=(Type t) + { + UnsignedType i = S::fromSpecial(storage->val); + i &= ~Const::mask(); + i |= (UnsignedType(t) << pos) & Const::mask(); + storage->val = S::toSpecial(i); + return *this; + } + + operator Const() { return Const(storage); } + +private: + template<class Storage, typename... Accessors> + friend class QSpecialIntegerBitfieldUnion; + + explicit QSpecialIntegerAccessor(Storage *storage) : storage(storage) {} + + Storage *storage; +}; + +template<class S, typename... Accessors> +class QSpecialIntegerBitfieldUnion +{ +public: + constexpr QSpecialIntegerBitfieldUnion() = default; + constexpr QSpecialIntegerBitfieldUnion(QSpecialIntegerBitfieldInitializer initial) + : storage(initial) + {} + + constexpr QSpecialIntegerBitfieldUnion( + typename QSpecialIntegerStorage<S>::UnsignedStorageType initial) + : storage(initial) + {} + + template<typename A> + void set(typename A::Type value) + { + member<A>() = value; + } + + template<typename A> + typename A::Type get() const + { + return member<A>(); + } + + typename QSpecialIntegerStorage<S>::UnsignedStorageType data() const + { + return storage.val; + } + +private: + template<class A, class...> struct Contains : std::false_type { }; + template<class A, class B> struct Contains<A, B> : std::is_same<A, B> { }; + template<class A, class B1, class... Bn> + struct Contains<A, B1, Bn...> + : std::conditional<Contains<A, B1>::value, std::true_type, Contains<A, Bn...>>::type {}; + + template<typename A> + using IsAccessor = Contains<A, Accessors...>; + + template<typename A> + A member() + { + Q_STATIC_ASSERT(IsAccessor<A>::value); + return A(&storage); + } + + template<typename A> + typename A::Const member() const + { + Q_STATIC_ASSERT(IsAccessor<A>::value); + return typename A::Const(&storage); + } + + QSpecialIntegerStorage<S> storage; +}; + +template<typename T, typename... Accessors> +using QLEIntegerBitfieldUnion + = QSpecialIntegerBitfieldUnion<QLittleEndianStorageType<T>, Accessors...>; + +template<typename T, typename... Accessors> +using QBEIntegerBitfieldUnion + = QSpecialIntegerBitfieldUnion<QBigEndianStorageType<T>, Accessors...>; + +template<typename... Accessors> +using qint32_le_bitfield_union = QLEIntegerBitfieldUnion<int, Accessors...>; +template<typename... Accessors> +using quint32_le_bitfield_union = QLEIntegerBitfieldUnion<uint, Accessors...>; +template<typename... Accessors> +using qint32_be_bitfield_union = QBEIntegerBitfieldUnion<int, Accessors...>; +template<typename... Accessors> +using quint32_be_bitfield_union = QBEIntegerBitfieldUnion<uint, Accessors...>; + +template<int pos, int width, typename T = int> +using qint32_le_bitfield_member + = QSpecialIntegerAccessor<QLittleEndianStorageType<int>, pos, width, T>; +template<int pos, int width, typename T = uint> +using quint32_le_bitfield_member + = QSpecialIntegerAccessor<QLittleEndianStorageType<uint>, pos, width, T>; +template<int pos, int width, typename T = int> +using qint32_be_bitfield_member + = QSpecialIntegerAccessor<QBigEndianStorageType<int>, pos, width, T>; +template<int pos, int width, typename T = uint> +using quint32_be_bitfield_member + = QSpecialIntegerAccessor<QBigEndianStorageType<uint>, pos, width, T>; QT_END_NAMESPACE diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index 4f46de5eaa..0fb0f8c6ae 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -192,6 +192,33 @@ typedef uint Flags; #endif /* Q_NO_TYPESAFE_FLAGS */ +// restore bit-wise enum-enum operators deprecated in C++20, +// but used in a few places in the API +#if __cplusplus > 201702L // assume compilers don't warn if in C++17 mode + // in C++20 mode, provide user-defined operators to override the deprecated operations: +# define Q_DECLARE_MIXED_ENUM_OPERATOR(op, Ret, LHS, RHS) \ + constexpr inline Ret operator op (LHS lhs, RHS rhs) noexcept \ + { return static_cast<Ret>(std::underlying_type_t<LHS>(lhs) op std::underlying_type_t<RHS>(rhs)); } \ + /* end */ +#else + // in C++11-17 mode, statically-assert that this compiler's result of the + // operation is the same that the C++20 version would produce: +# define Q_DECLARE_MIXED_ENUM_OPERATOR(op, Ret, LHS, RHS) \ + Q_STATIC_ASSERT((std::is_same<decltype(std::declval<LHS>() op std::declval<RHS>()), Ret>::value)); +#endif + +#define Q_DECLARE_MIXED_ENUM_OPERATORS(Ret, Flags, Enum) \ + Q_DECLARE_MIXED_ENUM_OPERATOR(|, Ret, Flags, Enum) \ + Q_DECLARE_MIXED_ENUM_OPERATOR(&, Ret, Flags, Enum) \ + Q_DECLARE_MIXED_ENUM_OPERATOR(^, Ret, Flags, Enum) \ + /* end */ + +#define Q_DECLARE_MIXED_ENUM_OPERATORS_SYMMETRIC(Ret, Flags, Enum) \ + Q_DECLARE_MIXED_ENUM_OPERATORS(Ret, Flags, Enum) \ + Q_DECLARE_MIXED_ENUM_OPERATORS(Ret, Enum, Flags) \ + /* end */ + + QT_END_NAMESPACE #endif // QFLAGS_H diff --git a/src/corelib/global/qfloat16_f16c.c b/src/corelib/global/qfloat16_f16c.c index ba1e16f481..d60a021bdb 100644 --- a/src/corelib/global/qfloat16_f16c.c +++ b/src/corelib/global/qfloat16_f16c.c @@ -40,13 +40,8 @@ #include "private/qsimd_p.h" // The x86 F16C instructions operate on AVX registers, so AVX support is -// required. We don't need to check for __F16C__ because we this file wouldn't -// have been compiled if the support was missing in the first place, and not -// all compilers define it. Technically, we didn't need to check for __AVX__ -// either. -#if !QT_COMPILER_SUPPORTS_HERE(AVX) -# error "AVX support required" -#endif +// required. +#if QT_COMPILER_SUPPORTS_HERE(AVX) #ifdef __cplusplus QT_BEGIN_NAMESPACE @@ -89,3 +84,5 @@ void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL } // extern "C" QT_END_NAMESPACE #endif + +#endif // QT_COMPILER_SUPPORTS_HERE(AVX) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 0efcf6ba53..5ad82c259d 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -499,6 +499,14 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value)); \since 4.2 Returns \c true if the flag \a flag is set, otherwise \c false. + + \note if \a flag contains multiple bits set to 1 (for instance, if + it's an enumerator equal to the bitwise-OR of other enumerators) + then this function will return \c true if and only if all the bits + are set in this flags object. On the other hand, if \a flag contains + no bits set to 1 (that is, its value as a integer is 0), then this + function will return \c true if and only if this flags object also + has no bits set to 1. */ /*! @@ -2256,7 +2264,17 @@ static const char *osVer_helper(QOperatingSystemVersion version = QOperatingSyst case Q_WINVER(6, 3): return workstation ? "8.1" : "Server 2012 R2"; case Q_WINVER(10, 0): - return workstation ? "10" : "Server 2016"; + if (workstation) { + if (osver.dwBuildNumber >= 22000) + return "11"; + return "10"; + } + // else: Server + if (osver.dwBuildNumber >= 20348) + return "Server 2022"; + if (osver.dwBuildNumber >= 17763) + return "Server 2019"; + return "Server 2016"; } #undef Q_WINVER // unknown, future version @@ -3059,7 +3077,8 @@ QByteArray QSysInfo::machineUniqueId() { #if defined(Q_OS_DARWIN) && __has_include(<IOKit/IOKitLib.h>) char uuid[UuidStringLen + 1]; - io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); + static const mach_port_t defaultPort = 0; // Effectively kIOMasterPortDefault/kIOMainPortDefault + io_service_t service = IOServiceGetMatchingService(defaultPort, IOServiceMatching("IOPlatformExpertDevice")); QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman); return QByteArray(uuid); @@ -3704,6 +3723,15 @@ bool qEnvironmentVariableIsSet(const char *varName) noexcept */ bool qputenv(const char *varName, const QByteArray& value) { + // protect against non-NUL-terminated QByteArrays: + #define IS_RAW_DATA(d) ((d)->offset != sizeof(QByteArrayData)) // copied from qbytearray.cpp + if (IS_RAW_DATA(const_cast<QByteArray&>(value).data_ptr())) { + QByteArray copy(value); + copy.detach(); // ensures NUL termination + return qputenv(varName, copy); + } + #undef IS_RAW_DATA + const auto locker = qt_scoped_lock(environmentMutex); #if defined(Q_CC_MSVC) return _putenv_s(varName, value.constData()) == 0; diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 12ac48f3cb..450c1e586a 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1102,13 +1102,16 @@ QForeachContainer<typename std::decay<T>::type> qMakeForeachContainer(T &&t) } +#define Q_FOREACH_JOIN(A, B) Q_FOREACH_JOIN_IMPL(A, B) +#define Q_FOREACH_JOIN_IMPL(A, B) A ## B + #if __cplusplus >= 201703L // Use C++17 if statement with initializer. User's code ends up in a else so // scoping of different ifs is not broken -#define Q_FOREACH(variable, container) \ -for (auto _container_ = QtPrivate::qMakeForeachContainer(container); \ - _container_.i != _container_.e; ++_container_.i) \ - if (variable = *_container_.i; false) {} else +#define Q_FOREACH_IMPL(variable, name, container) \ + for (auto name = QtPrivate::qMakeForeachContainer(container); \ + name.i != name.e; ++name.i) \ + if (variable = *name.i; false) {} else #else // Explanation of the control word: // - it's initialized to 1 @@ -1119,12 +1122,15 @@ for (auto _container_ = QtPrivate::qMakeForeachContainer(container); \ // the outer loop to continue executing // - if there was a break inside the inner loop, it will exit with control still // set to 1; in that case, the outer loop will invert it to 0 and will exit too -#define Q_FOREACH(variable, container) \ -for (auto _container_ = QtPrivate::qMakeForeachContainer(container); \ - _container_.control && _container_.i != _container_.e; \ - ++_container_.i, _container_.control ^= 1) \ - for (variable = *_container_.i; _container_.control; _container_.control = 0) +#define Q_FOREACH_IMPL(variable, name, container) \ +for (auto name = QtPrivate::qMakeForeachContainer(container); \ + name.control && name.i != name.e; \ + ++name.i, name.control ^= 1) \ + for (variable = *name.i; name.control; name.control = 0) #endif + +#define Q_FOREACH(variable, container) \ + Q_FOREACH_IMPL(variable, Q_FOREACH_JOIN(_container_, __LINE__), container) #endif // QT_NO_FOREACH #define Q_FOREVER for(;;) diff --git a/src/corelib/global/qglobalstatic.h b/src/corelib/global/qglobalstatic.h index e56fe1dbcb..d1e1107f95 100644 --- a/src/corelib/global/qglobalstatic.h +++ b/src/corelib/global/qglobalstatic.h @@ -44,6 +44,8 @@ #include <QtCore/qatomic.h> +#include <type_traits> + QT_BEGIN_NAMESPACE namespace QtGlobalStatic { @@ -86,7 +88,7 @@ enum GuardValues { static struct Holder : public HolderBase { \ Type value; \ Holder() \ - noexcept(noexcept(Type ARGS)) \ + noexcept(noexcept(typename std::remove_cv<Type>::type ARGS)) \ : value ARGS \ { guard.storeRelaxed(QtGlobalStatic::Initialized); } \ } holder; \ diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 8ceb763491..a1558a6abe 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -333,8 +333,10 @@ QLibraryInfo::buildDate() # define COMPILER_STRING "MSVC 2015" # elif _MSC_VER < 1917 # define COMPILER_STRING "MSVC 2017" -# elif _MSC_VER < 2000 +# elif _MSC_VER < 1930 # define COMPILER_STRING "MSVC 2019" +# elif _MSC_VER < 2000 +# define COMPILER_STRING "MSVC 2022" # else # define COMPILER_STRING "MSVC _MSC_VER " QT_STRINGIFY(_MSC_VER) # endif diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 89f49324c0..292116cc47 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1543,7 +1543,7 @@ static bool slog2_default_handler(QtMsgType type, const QMessageLogContext &cont // Set as the default buffer slog2_set_default_buffer(buffer_handle); } - int severity; + int severity = SLOG2_INFO; //Determines the severity level switch (type) { case QtDebugMsg: @@ -1669,7 +1669,7 @@ static bool android_default_message_handler(QtMsgType type, #endif //Q_OS_ANDROID #ifdef Q_OS_WIN -static void win_outputDebugString_helper(QStringView message) +static void win_outputDebugString_helper(const QString &message) { const int maxOutputStringLength = 32766; static QBasicMutex m; @@ -1681,7 +1681,7 @@ static void win_outputDebugString_helper(QStringView message) wchar_t *messagePart = new wchar_t[maxOutputStringLength + 1]; for (int i = 0; i < message.length(); i += maxOutputStringLength ) { const int length = std::min(message.length() - i, maxOutputStringLength ); - const int len = message.mid(i, length).toWCharArray(messagePart); + const int len = QStringView{message}.mid(i, length).toWCharArray(messagePart); Q_ASSERT(len == length); messagePart[len] = 0; OutputDebugString(messagePart); diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index ad4150b317..deab11f729 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -235,9 +235,7 @@ public: AlignCenter = AlignVCenter | AlignHCenter }; - Q_DECLARE_FLAGS(Alignment, AlignmentFlag) - Q_DECLARE_OPERATORS_FOR_FLAGS(Alignment) enum TextFlag { TextSingleLine = 0x0100, @@ -260,6 +258,10 @@ public: , TextBypassShaping = 0x100000 #endif }; + Q_DECLARE_MIXED_ENUM_OPERATORS_SYMMETRIC(int, AlignmentFlag, TextFlag) + // *After* we've defined the mixed operators (or verified their sanity), + // otherwise the operators defined here mess with the mixed ones: + Q_DECLARE_OPERATORS_FOR_FLAGS(Alignment) enum TextElideMode { ElideLeft, @@ -267,6 +269,7 @@ public: ElideMiddle, ElideNone }; + Q_DECLARE_MIXED_ENUM_OPERATORS_SYMMETRIC(int, TextElideMode, TextFlag) enum WhiteSpaceMode { WhiteSpaceNormal, diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index f95e2621e9..dbb9469bba 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -117,7 +117,9 @@ \value AA_DontShowShortcutsInContextMenus Actions with the Shortcut property won't be shown in any shortcut menus unless specifically set by the QAction::shortcutVisibleInContextMenu property. This value was added - in Qt 5.10. + in Qt 5.10, and defaults to the preference reported by the implementation + of QPlatformIntegration::styleHint. To override the platform integration, + set this attribute after QCoreApplication has been instantiated. \value AA_NativeWindows Ensures that widgets have native windows. @@ -825,14 +827,18 @@ /*! \enum Qt::DockWidgetArea - \value LeftDockWidgetArea - \value RightDockWidgetArea - \value TopDockWidgetArea - \value BottomDockWidgetArea - \value AllDockWidgetAreas - \value NoDockWidgetArea + Represents the areas a QDockWidget can be plugged to. + \note A floating dock widget with tabs can be docked anywhere. + + \value LeftDockWidgetArea The left dock area of a QMainWindow. + \value RightDockWidgetArea The right dock area of a QMainWindow. + \value TopDockWidgetArea The top dock area of a QMainWindow. + \value BottomDockWidgetArea The bottom dock area of a QMainWindow. + \value AllDockWidgetAreas All dock widget areas (default). + \value NoDockWidgetArea No dock widget areas. \omitvalue DockWidgetArea_Mask + \sa QDockWidget::setAllowedAreas, QDockWidget::isAreaAllowed */ /*! @@ -2913,6 +2919,11 @@ the first item and continues until all items have been examined. \value MatchRecursive Searches the entire hierarchy. + \note Qt::MatchExactly, Qt::MatchContains, Qt::MatchStartsWith, + Qt::MatchEndsWith, Qt::MatchRegularExpression, Qt::MatchWildcard, and + Qt::MatchFixedString are mutually exclusive. The behavior achieved by + setting several of them in a Qt::MatchFlags argument is undefined. + \sa QString::compare(), QRegExp, QRegularExpression */ diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index 10672c1f92..0f0409976d 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -383,7 +383,6 @@ struct QRandomGenerator::SystemAndGlobalGenerators constexpr SystemAndGlobalGenerators g = {}; Q_UNUSED(g); - Q_STATIC_ASSERT(std::is_literal_type<SystemAndGlobalGenerators>::value); #endif } @@ -681,7 +680,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel position in the deterministic sequence as the \a other object was. Both objects will generate the same sequence from this point on. - For that reason, it is not adviseable to create a copy of + For that reason, it is not advisable to create a copy of QRandomGenerator::global(). If one needs an exclusive deterministic generator, consider instead using securelySeeded() to obtain a new object that shares no relationship with the QRandomGenerator::global(). |