QMetaType: remove compatibility code for MSVC 2013
We use the constexpr code for MSVC 2015. Change-Id: I91f63171877743978cb3fffd153ad52a3ee293d0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
36818779b9
commit
f05d1b0856
@ -835,7 +835,6 @@ void QMetaType::registerStreamOperators(int idx, SaveOperator saveOp,
|
|||||||
}
|
}
|
||||||
#endif // QT_NO_DATASTREAM
|
#endif // QT_NO_DATASTREAM
|
||||||
|
|
||||||
#if defined(Q_COMPILER_CONSTEXPR) || (defined(Q_CC_MSVC) && Q_CC_MSVC >= 1900)
|
|
||||||
// We don't officially support constexpr in MSVC 2015, but the limited support it
|
// We don't officially support constexpr in MSVC 2015, but the limited support it
|
||||||
// has is enough for the code below.
|
// has is enough for the code below.
|
||||||
|
|
||||||
@ -914,7 +913,6 @@ constexpr MetaTypeOffsets<QtPrivate::Indexes<QMetaType::HighestInternalId + 1>::
|
|||||||
#undef STRINGIFY_TYPE_NAME
|
#undef STRINGIFY_TYPE_NAME
|
||||||
#undef CALCULATE_TYPE_LEN
|
#undef CALCULATE_TYPE_LEN
|
||||||
#undef MAP_TYPE_ID_TO_IDX
|
#undef MAP_TYPE_ID_TO_IDX
|
||||||
#endif
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the type name associated with the given \a typeId, or a null
|
Returns the type name associated with the given \a typeId, or a null
|
||||||
@ -926,20 +924,8 @@ constexpr MetaTypeOffsets<QtPrivate::Indexes<QMetaType::HighestInternalId + 1>::
|
|||||||
const char *QMetaType::typeName(int typeId)
|
const char *QMetaType::typeName(int typeId)
|
||||||
{
|
{
|
||||||
const uint type = typeId;
|
const uint type = typeId;
|
||||||
#define QT_METATYPE_TYPEID_TYPENAME_CONVERTER(MetaTypeName, TypeId, RealName) \
|
|
||||||
case QMetaType::MetaTypeName: return #RealName; break;
|
|
||||||
|
|
||||||
if (Q_LIKELY(type <= QMetaType::HighestInternalId)) {
|
if (Q_LIKELY(type <= QMetaType::HighestInternalId)) {
|
||||||
#if defined(Q_COMPILER_CONSTEXPR) || (defined(Q_CC_MSVC) && Q_CC_MSVC >= 1900)
|
|
||||||
return metaTypeNames[typeId];
|
return metaTypeNames[typeId];
|
||||||
#else
|
|
||||||
switch (QMetaType::Type(type)) {
|
|
||||||
QT_FOR_EACH_STATIC_TYPE(QT_METATYPE_TYPEID_TYPENAME_CONVERTER)
|
|
||||||
case QMetaType::UnknownType:
|
|
||||||
case QMetaType::User:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} else if (Q_UNLIKELY(type < QMetaType::User)) {
|
} else if (Q_UNLIKELY(type < QMetaType::User)) {
|
||||||
return nullptr; // It can happen when someone cast int to QVariant::Type, we should not crash...
|
return nullptr; // It can happen when someone cast int to QVariant::Type, we should not crash...
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user