Remove the Q_NO_DATA_RELOCATION hack
This hack was there because symbian used to have a problem with relocations in the data section, between libraries. Hence, this was needed so the metaobject could have a pointer to the base metaobject, despite being in another library. Anyway, I was told that symbian was fixed eventually. but the hack had to stay there because of compatibility. But now that we don't even support symbian, we can get rid of this hack totally. Change-Id: I7249971ece35d952efa92bf8b04bf3aa3667624c Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>bb10
parent
0528d9dca7
commit
56b2a229a3
|
|
@ -657,26 +657,17 @@ static const QMetaObject *QMetaObject_findMetaObject(const QMetaObject *self, co
|
|||
if (strcmp(self->d.stringdata, name) == 0)
|
||||
return self;
|
||||
if (self->d.extradata) {
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
const QMetaObjectAccessor *e;
|
||||
Q_ASSERT(priv(self->d.data)->revision >= 2);
|
||||
#else
|
||||
const QMetaObject **e;
|
||||
if (priv(self->d.data)->revision < 2) {
|
||||
e = (const QMetaObject**)(self->d.extradata);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
const QMetaObjectExtraData *extra = (const QMetaObjectExtraData*)(self->d.extradata);
|
||||
e = extra->objects;
|
||||
}
|
||||
if (e) {
|
||||
while (*e) {
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
if (const QMetaObject *m =QMetaObject_findMetaObject(&((*e)()), name))
|
||||
#else
|
||||
if (const QMetaObject *m =QMetaObject_findMetaObject((*e), name))
|
||||
#endif
|
||||
return m;
|
||||
++e;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,11 +265,7 @@ public:
|
|||
QList<QByteArray> classInfoNames;
|
||||
QList<QByteArray> classInfoValues;
|
||||
QList<QMetaEnumBuilderPrivate> enumerators;
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
QList<QMetaObjectAccessor> relatedMetaObjects;
|
||||
#else
|
||||
QList<const QMetaObject *> relatedMetaObjects;
|
||||
#endif
|
||||
int flags;
|
||||
};
|
||||
|
||||
|
|
@ -695,11 +691,7 @@ int QMetaObjectBuilder::addClassInfo(const QByteArray& name, const QByteArray& v
|
|||
\sa relatedMetaObjectCount(), relatedMetaObject()
|
||||
\sa removeRelatedMetaObject()
|
||||
*/
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
int QMetaObjectBuilder::addRelatedMetaObject(const QMetaObjectAccessor &meta)
|
||||
#else
|
||||
int QMetaObjectBuilder::addRelatedMetaObject(const QMetaObject *meta)
|
||||
#endif
|
||||
{
|
||||
Q_ASSERT(meta);
|
||||
int index = d->relatedMetaObjects.size();
|
||||
|
|
@ -772,14 +764,10 @@ void QMetaObjectBuilder::addMetaObject
|
|||
}
|
||||
|
||||
if ((members & RelatedMetaObjects) != 0) {
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
const QMetaObjectAccessor *objects = 0;
|
||||
#else
|
||||
const QMetaObject **objects;
|
||||
if (priv(prototype->d.data)->revision < 2) {
|
||||
objects = (const QMetaObject **)(prototype->d.extradata);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
const QMetaObjectExtraData *extra = (const QMetaObjectExtraData *)(prototype->d.extradata);
|
||||
if (extra)
|
||||
|
|
@ -871,11 +859,7 @@ QMetaEnumBuilder QMetaObjectBuilder::enumerator(int index) const
|
|||
const QMetaObject *QMetaObjectBuilder::relatedMetaObject(int index) const
|
||||
{
|
||||
if (index >= 0 && index < d->relatedMetaObjects.size())
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
return &((*(d->relatedMetaObjects[index]))());
|
||||
#else
|
||||
return d->relatedMetaObjects[index];
|
||||
#endif
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1414,13 +1398,8 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
|
|||
reinterpret_cast<QMetaObjectExtraData *>(buf + size);
|
||||
size += sizeof(QMetaObjectExtraData);
|
||||
ALIGN(size, QMetaObject *);
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
QMetaObjectAccessor *objects =
|
||||
reinterpret_cast<QMetaObjectAccessor *>(buf + size);
|
||||
#else
|
||||
const QMetaObject **objects =
|
||||
reinterpret_cast<const QMetaObject **>(buf + size);
|
||||
#endif
|
||||
if (buf) {
|
||||
if (d->relatedMetaObjects.size() > 0) {
|
||||
extra->objects = objects;
|
||||
|
|
@ -1619,14 +1598,10 @@ void QMetaObjectBuilder::serialize(QDataStream& stream) const
|
|||
}
|
||||
|
||||
// Write the related meta objects.
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
//### What do we do here?
|
||||
#else
|
||||
for (index = 0; index < d->relatedMetaObjects.size(); ++index) {
|
||||
const QMetaObject *meta = d->relatedMetaObjects[index];
|
||||
stream << QByteArray(meta->className());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Add an extra empty QByteArray for additional data in future versions.
|
||||
// This should help maintain backwards compatibility, allowing older
|
||||
|
|
@ -1799,9 +1774,6 @@ void QMetaObjectBuilder::deserialize
|
|||
}
|
||||
|
||||
// Read the related meta objects.
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
//### What do we do here
|
||||
#else
|
||||
for (index = 0; index < relatedMetaObjectCount; ++index) {
|
||||
if (stream.status() != QDataStream::Ok)
|
||||
return;
|
||||
|
|
@ -1813,7 +1785,6 @@ void QMetaObjectBuilder::deserialize
|
|||
}
|
||||
addRelatedMetaObject(cl);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Read the extra data block, which is reserved for future use.
|
||||
stream >> name;
|
||||
|
|
|
|||
|
|
@ -136,11 +136,7 @@ public:
|
|||
|
||||
int addClassInfo(const QByteArray& name, const QByteArray& value);
|
||||
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
int addRelatedMetaObject(const QMetaObjectAccessor &meta);
|
||||
#else
|
||||
int addRelatedMetaObject(const QMetaObject *meta);
|
||||
#endif
|
||||
|
||||
void addMetaObject(const QMetaObject *prototype, QMetaObjectBuilder::AddMembers members = AllMembers);
|
||||
|
||||
|
|
|
|||
|
|
@ -136,18 +136,11 @@ template <typename T1, typename T2>
|
|||
inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {}
|
||||
#endif // QT_NO_QOBJECT_CHECK
|
||||
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
#define Q_OBJECT_GETSTATICMETAOBJECT static const QMetaObject &getStaticMetaObject();
|
||||
#else
|
||||
#define Q_OBJECT_GETSTATICMETAOBJECT
|
||||
#endif
|
||||
|
||||
/* tmake ignore Q_OBJECT */
|
||||
#define Q_OBJECT \
|
||||
public: \
|
||||
Q_OBJECT_CHECK \
|
||||
static const QMetaObject staticMetaObject; \
|
||||
Q_OBJECT_GETSTATICMETAOBJECT \
|
||||
virtual const QMetaObject *metaObject() const; \
|
||||
virtual void *qt_metacast(const char *); \
|
||||
QT_TR_FUNCTIONS \
|
||||
|
|
@ -162,8 +155,8 @@ private: \
|
|||
#define Q_GADGET \
|
||||
public: \
|
||||
static const QMetaObject staticMetaObject; \
|
||||
Q_OBJECT_GETSTATICMETAOBJECT \
|
||||
private:
|
||||
|
||||
#else // Q_MOC_RUN
|
||||
#define slots slots
|
||||
#define signals signals
|
||||
|
|
@ -469,11 +462,7 @@ typedef const QMetaObject& (*QMetaObjectAccessor)();
|
|||
|
||||
struct QMetaObjectExtraData
|
||||
{
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
const QMetaObjectAccessor *objects;
|
||||
#else
|
||||
const QMetaObject **objects;
|
||||
#endif
|
||||
|
||||
typedef void (*StaticMetacallFunction)(QObject *, QMetaObject::Call, int, void **); //from revision 6
|
||||
//typedef int (*StaticMetaCall)(QMetaObject::Call, int, void **); //used from revison 2 until revison 5
|
||||
|
|
|
|||
|
|
@ -329,17 +329,10 @@ void Generator::generateCode()
|
|||
}
|
||||
|
||||
if (!extraList.isEmpty()) {
|
||||
fprintf(out, "#ifdef Q_NO_DATA_RELOCATION\n");
|
||||
fprintf(out, "static const QMetaObjectAccessor qt_meta_extradata_%s[] = {\n ", qualifiedClassNameIdentifier.constData());
|
||||
for (int i = 0; i < extraList.count(); ++i) {
|
||||
fprintf(out, " %s::getStaticMetaObject,\n", extraList.at(i).constData());
|
||||
}
|
||||
fprintf(out, "#else\n");
|
||||
fprintf(out, "static const QMetaObject *qt_meta_extradata_%s[] = {\n ", qualifiedClassNameIdentifier.constData());
|
||||
for (int i = 0; i < extraList.count(); ++i) {
|
||||
fprintf(out, " &%s::staticMetaObject,\n", extraList.at(i).constData());
|
||||
}
|
||||
fprintf(out, "#endif //Q_NO_DATA_RELOCATION\n");
|
||||
fprintf(out, " 0\n};\n\n");
|
||||
}
|
||||
|
||||
|
|
@ -384,12 +377,6 @@ void Generator::generateCode()
|
|||
if(isQt)
|
||||
return;
|
||||
|
||||
//
|
||||
// Generate static meta object accessor (needed for symbian, because DLLs do not support data imports.
|
||||
//
|
||||
fprintf(out, "\n#ifdef Q_NO_DATA_RELOCATION\n");
|
||||
fprintf(out, "const QMetaObject &%s::getStaticMetaObject() { return staticMetaObject; }\n", cdef->qualified.constData());
|
||||
fprintf(out, "#endif //Q_NO_DATA_RELOCATION\n");
|
||||
|
||||
if (!cdef->hasQObject)
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue