diff options
Diffstat (limited to 'src/corelib/kernel/qmetatype.cpp')
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 7fadb66319..01e2542dfa 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -1081,25 +1081,16 @@ int QMetaType::registerNormalizedType(const NS(QByteArray) &normalizedTypeName, normalizedTypeName.constData(), idx, previousSize, size); } - // Do not compare types higher than 0x100: - // Ignore WasDeclaredAsMetaType inconsitency, to many users were hitting the problem - // Ignore IsGadget as it was added in Qt 5.5 - // Ignore all the future flags as well - if ((previousFlags ^ flags) & 0xff) { - const int maskForTypeInfo = NeedsConstruction | NeedsDestruction | MovableType; + // these flags cannot change in a binary compatible way: + const int binaryCompatibilityFlag = PointerToQObject | IsEnumeration | SharedPointerToQObject + | WeakPointerToQObject | TrackingPointerToQObject; + if ((previousFlags ^ flags) & binaryCompatibilityFlag) { + const char *msg = "QMetaType::registerType: Binary compatibility break. " "\nType flags for type '%s' [%i] don't match. Previously " - "registered TypeFlags(0x%x), now registering TypeFlags(0x%x). " - "This is an ODR break, which means that your application depends on a C++ undefined behavior." - "\nHint: %s"; - QT_PREPEND_NAMESPACE(QByteArray) hint; - if ((previousFlags & maskForTypeInfo) != (flags & maskForTypeInfo)) { - hint += "\nIt seems that the type was registered at least twice in a different translation units, " - "but Q_DECLARE_TYPEINFO is not visible from all the translations unit or different flags were used." - "Remember that Q_DECLARE_TYPEINFO should be declared before QMetaType registration, " - "preferably it should be placed just after the type declaration and before Q_DECLARE_METATYPE"; - } - qFatal(msg, normalizedTypeName.constData(), idx, previousFlags, int(flags), hint.constData()); + "registered TypeFlags(0x%x), now registering TypeFlags(0x%x). "; + + qFatal(msg, normalizedTypeName.constData(), idx, previousFlags, int(flags)); } return idx; @@ -1188,9 +1179,6 @@ bool QMetaType::isRegistered(int type) return ((type >= User) && (ct && ct->count() > type - User) && !ct->at(type - User).typeName.isEmpty()); } -/*! - \internal -*/ template <bool tryNormalizedType> static inline int qMetaTypeTypeImpl(const char *typeName, int length) { |