diff options
Diffstat (limited to 'src/corelib/global/qglobal.h')
-rw-r--r-- | src/corelib/global/qglobal.h | 73 |
1 files changed, 14 insertions, 59 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 7db7dba9b5..c1fcc12cfb 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -86,15 +86,9 @@ #define QT_CONFIG(feature) (1/QT_FEATURE_##feature == 1) #define QT_REQUIRE_CONFIG(feature) Q_STATIC_ASSERT_X(QT_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " not available.") -#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) -// ### Qt6: FIXME and get rid of unsharable containers -//# define QT_NO_UNSHARABLE_CONTAINERS -# define QT6_VIRTUAL virtual -# define QT6_NOT_VIRTUAL -#else -# define QT6_VIRTUAL -# define QT6_NOT_VIRTUAL virtual -#endif +// ### Clean those up, once all code is adjusted +#define QT6_VIRTUAL virtual +#define QT6_NOT_VIRTUAL /* These two macros makes it possible to turn the builtin line expander into a * string literal. */ @@ -499,53 +493,6 @@ Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion(void) Q_DECL_NOEXCEPT; # define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC) #endif -namespace QtPrivate { - template <class T> - struct AlignOfHelper - { - char c; - T type; - - AlignOfHelper(); - ~AlignOfHelper(); - }; - - template <class T> - struct AlignOf_Default - { - enum { Value = sizeof(AlignOfHelper<T>) - sizeof(T) }; - }; - - template <class T> struct AlignOf : AlignOf_Default<T> { }; - template <class T> struct AlignOf<T &> : AlignOf<T> {}; - template <class T> struct AlignOf<T &&> : AlignOf<T> {}; - template <size_t N, class T> struct AlignOf<T[N]> : AlignOf<T> {}; - -#if defined(Q_PROCESSOR_X86_32) && !defined(Q_OS_WIN) - template <class T> struct AlignOf_WorkaroundForI386Abi { enum { Value = sizeof(T) }; }; - - // x86 ABI weirdness - // Alignment of naked type is 8, but inside struct has alignment 4. - template <> struct AlignOf<double> : AlignOf_WorkaroundForI386Abi<double> {}; - template <> struct AlignOf<qint64> : AlignOf_WorkaroundForI386Abi<qint64> {}; - template <> struct AlignOf<quint64> : AlignOf_WorkaroundForI386Abi<quint64> {}; -#ifdef Q_CC_CLANG - // GCC and Clang seem to disagree wrt to alignment of arrays - template <size_t N> struct AlignOf<double[N]> : AlignOf_Default<double> {}; - template <size_t N> struct AlignOf<qint64[N]> : AlignOf_Default<qint64> {}; - template <size_t N> struct AlignOf<quint64[N]> : AlignOf_Default<quint64> {}; -#endif -#endif -} // namespace QtPrivate - -#define QT_EMULATED_ALIGNOF(T) \ - (size_t(QT_PREPEND_NAMESPACE(QtPrivate)::AlignOf<T>::Value)) - -#ifndef Q_ALIGNOF -#define Q_ALIGNOF(T) QT_EMULATED_ALIGNOF(T) -#endif - - /* quintptr and qptrdiff is guaranteed to be the same size as a pointer, i.e. @@ -770,7 +717,7 @@ inline void qt_noop(void) {} #if !defined(QT_NO_EXCEPTIONS) # if !defined(Q_MOC_RUN) -# if (defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !QT_HAS_FEATURE(cxx_exceptions)) || \ +# if (defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !__has_feature(cxx_exceptions)) || \ (defined(Q_CC_GNU) && !defined(__EXCEPTIONS)) # define QT_NO_EXCEPTIONS # endif @@ -945,6 +892,10 @@ QT_WARNING_POP # define Q_DUMMY_COMPARISON_OPERATOR(C) #endif +QT_WARNING_PUSH +// warning: noexcept-expression evaluates to 'false' because of a call to 'void swap(..., ...)' +QT_WARNING_DISABLE_GCC("-Wnoexcept") + namespace QtPrivate { namespace SwapExceptionTester { // insulate users from the "using std::swap" below @@ -964,6 +915,8 @@ inline void qSwap(T &value1, T &value2) swap(value1, value2); } +QT_WARNING_POP + #if QT_DEPRECATED_SINCE(5, 0) Q_CORE_EXPORT QT_DEPRECATED void *qMalloc(size_t size) Q_ALLOC_SIZE(1); Q_CORE_EXPORT QT_DEPRECATED void qFree(void *ptr); @@ -1267,8 +1220,10 @@ inline int qIntCast(float f) { return int(f); } /* Reentrant versions of basic rand() functions for random number generation */ -Q_CORE_EXPORT void qsrand(uint seed); -Q_CORE_EXPORT int qrand(); +#if QT_DEPRECATED_SINCE(5, 15) +Q_CORE_EXPORT QT_DEPRECATED_VERSION_X_5_15("use QRandomGenerator instead") void qsrand(uint seed); +Q_CORE_EXPORT QT_DEPRECATED_VERSION_X_5_15("use QRandomGenerator instead") int qrand(); +#endif #define QT_MODULE(x) |