diff options
Diffstat (limited to 'src/corelib/global/qglobal.h')
-rw-r--r-- | src/corelib/global/qglobal.h | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 501c542157..450c1e586a 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -378,11 +378,19 @@ typedef double qreal; # define QT_DEPRECATED_VERSION_5_15 #endif +#if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(6, 0, 0) +# define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_6_0 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_6_0(text) +# define QT_DEPRECATED_VERSION_6_0 +#endif + #define QT_DEPRECATED_VERSION_X_5(minor, text) QT_DEPRECATED_VERSION_X_5_##minor(text) -#define QT_DEPRECATED_VERSION_X(major, minor, text) QT_DEPRECATED_VERSION_X_##major(minor, text) +#define QT_DEPRECATED_VERSION_X(major, minor, text) QT_DEPRECATED_VERSION_X_##major##_##minor(text) #define QT_DEPRECATED_VERSION_5(minor) QT_DEPRECATED_VERSION_5_##minor -#define QT_DEPRECATED_VERSION(major, minor) QT_DEPRECATED_VERSION_##major(minor) +#define QT_DEPRECATED_VERSION(major, minor) QT_DEPRECATED_VERSION_##major##_##minor #ifdef __cplusplus // A tag to help mark stuff deprecated (cf. QStringViewLiteral) @@ -632,7 +640,7 @@ using qsizetype = QIntegerForSizeof<std::size_t>::Signed; //defines the type for the WNDPROC on windows //the alignment needs to be forced for sse2 to not crash with mingw #if defined(Q_OS_WIN) -# if defined(Q_CC_MINGW) && !defined(Q_OS_WIN64) +# if defined(Q_CC_MINGW) && defined(Q_PROCESSOR_X86_32) # define QT_ENSURE_STACK_ALIGNED_FOR_SSE __attribute__ ((force_align_arg_pointer)) # else # define QT_ENSURE_STACK_ALIGNED_FOR_SSE @@ -1094,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 @@ -1111,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(;;) @@ -1180,19 +1194,6 @@ Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1); #endif // QT_NO_TRANSLATION -/* - When RTTI is not available, define this macro to force any uses of - dynamic_cast to cause a compile failure. -*/ - -#if defined(QT_NO_DYNAMIC_CAST) && !defined(dynamic_cast) -# define dynamic_cast QT_PREPEND_NAMESPACE(qt_dynamic_cast_check) - - template<typename T, typename X> - T qt_dynamic_cast_check(X, T* = 0) - { return T::dynamic_cast_will_always_fail_because_rtti_is_disabled; } -#endif - #ifdef Q_QDOC |