From 5c3b16706ff30c38258df0e98e071bf8ae6a1460 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 8 Aug 2016 09:05:53 +0200 Subject: Remove compiler-specific implementations of Q_IS_ENUM Since the macro is now just a wrapper for std::is_enum, its use is also deprecated. [ChangeLog][QtCore][Global] Q_IS_ENUM is deprecated. Use std::is_enum<>::value instead. Change-Id: I09b9f4559c02c81f338cace927873318f2acafde Reviewed-by: Thiago Macieira --- src/corelib/global/qisenum.h | 17 ++--------------- src/corelib/global/qtypeinfo.h | 6 ++---- src/corelib/kernel/qmetatype.h | 3 +-- src/corelib/kernel/qvariant_p.h | 2 +- 4 files changed, 6 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qisenum.h b/src/corelib/global/qisenum.h index 185db5e45f..8f784ef6e3 100644 --- a/src/corelib/global/qisenum.h +++ b/src/corelib/global/qisenum.h @@ -42,21 +42,8 @@ #ifndef QISENUM_H #define QISENUM_H -#ifndef Q_IS_ENUM -# if defined(Q_CC_GNU) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) -# define Q_IS_ENUM(x) __is_enum(x) -# elif defined(Q_CC_MSVC) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >=140050215) -# define Q_IS_ENUM(x) __is_enum(x) -# elif defined(Q_CC_CLANG) -# if __has_extension(is_enum) -# define Q_IS_ENUM(x) __is_enum(x) -# endif -# endif -#endif - -#ifndef Q_IS_ENUM -# define Q_IS_ENUM(x) std::is_enum::value -#endif +// Use of Q_IS_ENUM is deprecated since 5.8 +#define Q_IS_ENUM(x) std::is_enum::value // shut up syncqt QT_BEGIN_NAMESPACE diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index cdc85ab1d0..8aa5cb4fb4 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -38,13 +38,11 @@ ** ****************************************************************************/ -#include +#include #ifndef QTYPEINFO_H #define QTYPEINFO_H -#include - QT_BEGIN_NAMESPACE /* @@ -64,7 +62,7 @@ public: isIntegral = std::is_integral::value, isComplex = true, isStatic = true, - isRelocatable = Q_IS_ENUM(T), + isRelocatable = std::is_enum::value, isLarge = (sizeof(T)>sizeof(void*)), isDummy = false, //### Qt6: remove sizeOf = sizeof(T) diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 29e60b0eb5..e64812b3ae 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -45,7 +45,6 @@ #include #include #include -#include #ifndef QT_NO_QOBJECT #include #endif @@ -1635,7 +1634,7 @@ namespace QtPrivate { | (IsSharedPointerToTypeDerivedFromQObject::Value ? QMetaType::SharedPointerToQObject : 0) | (IsWeakPointerToTypeDerivedFromQObject::Value ? QMetaType::WeakPointerToQObject : 0) | (IsTrackingPointerToTypeDerivedFromQObject::Value ? QMetaType::TrackingPointerToQObject : 0) - | (Q_IS_ENUM(T) ? QMetaType::IsEnumeration : 0) + | (std::is_enum::value ? QMetaType::IsEnumeration : 0) | (IsGadgetHelper::Value ? QMetaType::IsGadget : 0) }; }; diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h index ec87e20656..bf88def438 100644 --- a/src/corelib/kernel/qvariant_p.h +++ b/src/corelib/kernel/qvariant_p.h @@ -65,7 +65,7 @@ template struct QVariantIntegrator { static const bool CanUseInternalSpace = sizeof(T) <= sizeof(QVariant::Private::Data) - && ((QTypeInfoQuery::isRelocatable) || Q_IS_ENUM(T)); + && ((QTypeInfoQuery::isRelocatable) || std::is_enum::value); typedef std::integral_constant CanUseInternalSpace_t; }; Q_STATIC_ASSERT(QVariantIntegrator::CanUseInternalSpace); -- cgit v1.2.3