aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compileddata_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/compiler/qv4compileddata_p.h')
-rw-r--r--src/qml/compiler/qv4compileddata_p.h34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index 1fa13e7d37..8825ce7b98 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -112,10 +112,6 @@ struct TableIterator
bool operator!=(const TableIterator &rhs) const { return index != rhs.index; }
};
-#if defined(Q_CC_MSVC) || defined(Q_CC_GNU)
-#pragma pack(push, 1)
-#endif
-
struct Location
{
union {
@@ -131,6 +127,7 @@ struct Location
(line == other.line && column < other.column);
}
};
+static_assert(sizeof(Location) == 4, "Location structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
struct RegExp
{
@@ -147,6 +144,7 @@ struct RegExp
RegExp() : _dummy(0) { }
};
+static_assert(sizeof(RegExp) == 4, "RegExp structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
struct Lookup
{
@@ -164,6 +162,7 @@ struct Lookup
Lookup() : _dummy(0) { }
};
+static_assert(sizeof(Lookup) == 4, "Lookup structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
struct JSClassMember
{
@@ -175,6 +174,7 @@ struct JSClassMember
JSClassMember() : _dummy(0) { }
};
+static_assert(sizeof(JSClassMember) == 4, "JSClassMember structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
struct JSClass
{
@@ -183,6 +183,7 @@ struct JSClass
static int calculateSize(int nMembers) { return (sizeof(JSClass) + nMembers * sizeof(JSClassMember) + 7) & ~7; }
};
+static_assert(sizeof(JSClass) == 4, "JSClass structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
struct String
{
@@ -193,6 +194,7 @@ struct String
return (sizeof(String) + str.length() * sizeof(quint16) + 7) & ~0x7;
}
};
+static_assert(sizeof(String) == 4, "String structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
struct CodeOffsetToLine {
quint32_le codeOffset;
@@ -243,6 +245,8 @@ struct Function
// Keep all unaligned data at the end
quint8 flags;
+ quint8 padding1;
+ quint16_le padding2;
const quint32_le *formalsTable() const { return reinterpret_cast<const quint32_le *>(reinterpret_cast<const char *>(this) + formalsOffset); }
const quint32_le *localsTable() const { return reinterpret_cast<const quint32_le *>(reinterpret_cast<const char *>(this) + localsOffset); }
@@ -272,6 +276,7 @@ struct Function
return (a + 7) & ~size_t(7);
}
};
+static_assert(sizeof(Function) == 76, "Function structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
// Qml data structures
@@ -279,6 +284,7 @@ struct Q_QML_EXPORT TranslationData {
quint32_le commentIndex;
qint32_le number;
};
+static_assert(sizeof(TranslationData) == 8, "TranslationData structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
struct Q_QML_PRIVATE_EXPORT Binding
{
@@ -325,6 +331,8 @@ struct Q_QML_PRIVATE_EXPORT Binding
Location location;
Location valueLocation;
+ quint32_le padding;
+
bool isValueBinding() const
{
if (type == Type_AttachedProperty
@@ -404,6 +412,8 @@ struct Q_QML_PRIVATE_EXPORT Binding
};
+static_assert(sizeof(Binding) == 32, "Binding structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
+
struct EnumValue
{
quint32_le nameIndex;
@@ -441,6 +451,7 @@ struct Parameter
quint32_le customTypeNameIndex;
Location location;
};
+static_assert(sizeof(Parameter) == 16, "Parameter structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
struct Signal
{
@@ -465,6 +476,7 @@ struct Signal
int parameterCount() const { return nParameters; }
// ---
};
+static_assert(sizeof(Signal) == 12, "Signal structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
struct Property
{
@@ -485,6 +497,7 @@ struct Property
quint32_le customTypeNameIndex; // If type >= Custom
Location location;
};
+static_assert(sizeof(Property) == 16, "Property structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
struct Alias {
enum Flags : unsigned int {
@@ -514,6 +527,7 @@ struct Alias {
return encodedMetaPropertyIndex == -1;
}
};
+static_assert(sizeof(Alias) == 20, "Alias structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
struct Object
{
@@ -636,6 +650,7 @@ struct Object
int namedObjectsInComponentCount() const { return nNamedObjectsInComponent; }
// ---
};
+static_assert(sizeof(Object) == 80, "Object structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
struct Import
{
@@ -656,6 +671,7 @@ struct Import
Import() { type = 0; uriIndex = 0; qualifierIndex = 0; majorVersion = 0; minorVersion = 0; }
};
+static_assert(sizeof(Import) == 24, "Import structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
static const char magic_str[] = "qv4cdata";
@@ -706,7 +722,6 @@ struct Unit
quint32_le offsetToImports;
quint32_le nObjects;
quint32_le offsetToObjects;
- quint32_le indexOfRootObject;
const Import *importAt(int idx) const {
return reinterpret_cast<const Import*>((reinterpret_cast<const char *>(this)) + offsetToImports + idx * sizeof(Import));
@@ -772,9 +787,7 @@ struct Unit
}
};
-#if defined(Q_CC_MSVC) || defined(Q_CC_GNU)
-#pragma pack(pop)
-#endif
+static_assert(sizeof(Unit) == 144, "Unit structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target");
struct TypeReference
{
@@ -894,7 +907,7 @@ struct Q_QML_PRIVATE_EXPORT CompilationUnit : public CompilationUnitBase, public
// QML specific fields
QQmlPropertyCacheVector propertyCaches;
- QQmlPropertyCache *rootPropertyCache() const { return propertyCaches.at(data->indexOfRootObject); }
+ QQmlPropertyCache *rootPropertyCache() const { return propertyCaches.at(/*root object*/0); }
QQmlRefPointer<QQmlTypeNameCache> typeNameCache;
@@ -931,7 +944,6 @@ struct Q_QML_PRIVATE_EXPORT CompilationUnit : public CompilationUnitBase, public
// --- interface for QQmlPropertyCacheCreator
typedef Object CompiledObject;
int objectCount() const { return data->nObjects; }
- int rootObjectIndex() const { return data->indexOfRootObject; }
const Object *objectAt(int index) const { return data->objectAt(index); }
QString stringAt(int index) const { return data->stringAt(index); }
@@ -956,7 +968,7 @@ struct Q_QML_PRIVATE_EXPORT CompilationUnit : public CompilationUnitBase, public
void markObjects(MarkStack *markStack);
- void destroy() Q_DECL_OVERRIDE;
+ void destroy() override;
bool loadFromDisk(const QUrl &url, const QDateTime &sourceTimeStamp, QString *errorString);