Bootstrap: remove the ability to register custom QMetaTypes
Nothing was registering them, but moc does query types by name and that searched the always-empty custom type database. This commit simplifies the code a bit. Change-Id: I7aac990cf04c9c514441fffdbb9faca471c92ffe Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
74bdd85209
commit
c1026f2ff0
@ -80,11 +80,13 @@ struct QMetaTypeDeleter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#ifndef QT_BOOTSTRAPPED
|
||||||
|
namespace {
|
||||||
struct QMetaTypeCustomRegistry
|
struct QMetaTypeCustomRegistry
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED)
|
|
||||||
QMetaTypeCustomRegistry()
|
QMetaTypeCustomRegistry()
|
||||||
{
|
{
|
||||||
/* qfloat16 was neither a builtin, nor unconditionally registered
|
/* qfloat16 was neither a builtin, nor unconditionally registered
|
||||||
@ -165,7 +167,6 @@ struct QMetaTypeCustomRegistry
|
|||||||
};
|
};
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(QMetaTypeCustomRegistry, customTypeRegistry)
|
Q_GLOBAL_STATIC(QMetaTypeCustomRegistry, customTypeRegistry)
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// used by QVariant::save(): returns the name used in the Q_DECLARE_METATYPE
|
// used by QVariant::save(): returns the name used in the Q_DECLARE_METATYPE
|
||||||
@ -205,6 +206,7 @@ const char *QtMetaTypePrivate::typedefNameForType(const QtPrivate::QMetaTypeInte
|
|||||||
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
#endif // !QT_BOOTSTRAPPED
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\macro Q_DECLARE_OPAQUE_POINTER(PointerType)
|
\macro Q_DECLARE_OPAQUE_POINTER(PointerType)
|
||||||
@ -540,6 +542,7 @@ const char *QtMetaTypePrivate::typedefNameForType(const QtPrivate::QMetaTypeInte
|
|||||||
|
|
||||||
\sa qRegisterMetaType()
|
\sa qRegisterMetaType()
|
||||||
*/
|
*/
|
||||||
|
#ifndef QT_BOOTSTRAPPED
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
Out-of-line path for registerType() and slow path id().
|
Out-of-line path for registerType() and slow path id().
|
||||||
@ -553,6 +556,7 @@ int QMetaType::registerHelper(const QtPrivate::QMetaTypeInterface *iface)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn constexpr qsizetype QMetaType::sizeOf() const
|
\fn constexpr qsizetype QMetaType::sizeOf() const
|
||||||
@ -887,7 +891,7 @@ bool QMetaType::isOrdered() const
|
|||||||
return d_ptr && (d_ptr->flags & QMetaType::IsPointer || d_ptr->lessThan != nullptr);
|
return d_ptr && (d_ptr->flags & QMetaType::IsPointer || d_ptr->lessThan != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_BOOTSTRAPPED
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
@ -910,6 +914,7 @@ void QMetaType::unregisterMetaType(QMetaType type)
|
|||||||
|
|
||||||
const_cast<QtPrivate::QMetaTypeInterface *>(d_ptr)->typeId.storeRelease(0);
|
const_cast<QtPrivate::QMetaTypeInterface *>(d_ptr)->typeId.storeRelease(0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn template<typename T> QMetaType QMetaType::fromType()
|
\fn template<typename T> QMetaType QMetaType::fromType()
|
||||||
@ -2758,6 +2763,7 @@ static inline int qMetaTypeStaticType(const char *typeName, int length)
|
|||||||
return types[i].type;
|
return types[i].type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_BOOTSTRAPPED
|
||||||
/*
|
/*
|
||||||
Similar to QMetaType::type(), but only looks in the custom set of
|
Similar to QMetaType::type(), but only looks in the custom set of
|
||||||
types, and doesn't lock the mutex.
|
types, and doesn't lock the mutex.
|
||||||
@ -2797,14 +2803,16 @@ void QMetaType::registerNormalizedTypedef(const NS(QByteArray) & normalizedTypeN
|
|||||||
al = metaType.d_ptr;
|
al = metaType.d_ptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // !QT_BOOTSTRAPPED
|
||||||
|
|
||||||
static const QtPrivate::QMetaTypeInterface *interfaceForTypeNoWarning(int typeId)
|
static const QtPrivate::QMetaTypeInterface *interfaceForTypeNoWarning(int typeId)
|
||||||
{
|
{
|
||||||
const QtPrivate::QMetaTypeInterface *iface = nullptr;
|
const QtPrivate::QMetaTypeInterface *iface = nullptr;
|
||||||
if (typeId >= QMetaType::User) {
|
if (typeId >= QMetaType::User) {
|
||||||
|
#ifndef QT_BOOTSTRAPPED
|
||||||
if (customTypeRegistry.exists())
|
if (customTypeRegistry.exists())
|
||||||
iface = customTypeRegistry->getCustomType(typeId);
|
iface = customTypeRegistry->getCustomType(typeId);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (auto moduleHelper = qModuleHelperForType(typeId))
|
if (auto moduleHelper = qModuleHelperForType(typeId))
|
||||||
iface = moduleHelper->interfaceForType(typeId);
|
iface = moduleHelper->interfaceForType(typeId);
|
||||||
@ -2836,6 +2844,7 @@ static inline int qMetaTypeTypeImpl(const char *typeName, int length)
|
|||||||
return QMetaType::UnknownType;
|
return QMetaType::UnknownType;
|
||||||
int type = qMetaTypeStaticType(typeName, length);
|
int type = qMetaTypeStaticType(typeName, length);
|
||||||
if (type == QMetaType::UnknownType) {
|
if (type == QMetaType::UnknownType) {
|
||||||
|
#ifndef QT_BOOTSTRAPPED
|
||||||
QReadLocker locker(&customTypeRegistry()->lock);
|
QReadLocker locker(&customTypeRegistry()->lock);
|
||||||
type = qMetaTypeCustomType_unlocked(typeName, length);
|
type = qMetaTypeCustomType_unlocked(typeName, length);
|
||||||
#ifndef QT_NO_QOBJECT
|
#ifndef QT_NO_QOBJECT
|
||||||
@ -2848,6 +2857,7 @@ static inline int qMetaTypeTypeImpl(const char *typeName, int length)
|
|||||||
normalizedTypeName.size());
|
normalizedTypeName.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
|
@ -1351,6 +1351,10 @@ int qRegisterNormalizedMetaType(const QT_PREPEND_NAMESPACE(QByteArray) &normaliz
|
|||||||
return qRegisterNormalizedMetaTypeImplementation<T>(normalizedTypeName);
|
return qRegisterNormalizedMetaTypeImplementation<T>(normalizedTypeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(QT_BOOTSTRAPPED)
|
||||||
|
#define QT_DECL_METATYPE_EXTERN_TAGGED(TYPE, TAG, EXPORT)
|
||||||
|
#define QT_IMPL_METATYPE_EXTERN_TAGGED(TYPE, TAG)
|
||||||
|
#else
|
||||||
#define QT_DECL_METATYPE_EXTERN_TAGGED(TYPE, TAG, EXPORT) \
|
#define QT_DECL_METATYPE_EXTERN_TAGGED(TYPE, TAG, EXPORT) \
|
||||||
QT_BEGIN_NAMESPACE \
|
QT_BEGIN_NAMESPACE \
|
||||||
EXPORT int qRegisterNormalizedMetaType_ ## TAG (const QByteArray &); \
|
EXPORT int qRegisterNormalizedMetaType_ ## TAG (const QByteArray &); \
|
||||||
@ -1363,6 +1367,7 @@ int qRegisterNormalizedMetaType(const QT_PREPEND_NAMESPACE(QByteArray) &normaliz
|
|||||||
int qRegisterNormalizedMetaType_ ## TAG (const QByteArray &name) \
|
int qRegisterNormalizedMetaType_ ## TAG (const QByteArray &name) \
|
||||||
{ return qRegisterNormalizedMetaTypeImplementation< TYPE >(name); } \
|
{ return qRegisterNormalizedMetaTypeImplementation< TYPE >(name); } \
|
||||||
/* end */
|
/* end */
|
||||||
|
#endif
|
||||||
#define QT_DECL_METATYPE_EXTERN(TYPE, EXPORT) \
|
#define QT_DECL_METATYPE_EXTERN(TYPE, EXPORT) \
|
||||||
QT_DECL_METATYPE_EXTERN_TAGGED(TYPE, TYPE, EXPORT)
|
QT_DECL_METATYPE_EXTERN_TAGGED(TYPE, TYPE, EXPORT)
|
||||||
#define QT_IMPL_METATYPE_EXTERN(TYPE) \
|
#define QT_IMPL_METATYPE_EXTERN(TYPE) \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user