diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-07-20 12:02:39 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-07-30 19:46:56 +0000 |
commit | 190765c6accb58a6997636cb4fde64e9984ed070 (patch) | |
tree | 47540369a46bb445a2855d4fd4b845048ff00621 /src | |
parent | 7c1c016ced09c62ce0d857aef5ea734b7c35f394 (diff) |
Add missing sizeof assertions to compiled data structures
Since commit 4dbb3c7bc5829bcf699715157d3a82fb86f4ea5e we must ensure at
compile time that any host compiler we're using generates structures of
the same size as the differing target compiler.
Change-Id: I7b41f12d0db0eac78196c7c0db07ec8610ff2527
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/compiler/qv4compileddata_p.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h index a556ccb0c0..5103c6901e 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/compiler/qv4compileddata_p.h @@ -224,6 +224,7 @@ struct CodeOffsetToLine { quint32_le codeOffset; quint32_le line; }; +static_assert(sizeof(CodeOffsetToLine) == 8, "CodeOffsetToLine structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); struct Block { @@ -243,6 +244,7 @@ struct Block return (a + 7) & ~size_t(7); } }; +static_assert(sizeof(Block) == 8, "Block structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); // Function is aligned on an 8-byte boundary to make sure there are no bus errors or penalties // for unaligned access. The ordering of the fields is also from largest to smallest. @@ -331,6 +333,7 @@ struct Method { quint32_le type; quint32_le function; }; +static_assert(sizeof(Method) == 12, "Method structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); struct Class { @@ -354,7 +357,7 @@ struct Class return (a + 7) & ~size_t(7); } }; -static_assert(sizeof(Class) == 24, "Function structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); +static_assert(sizeof(Class) == 24, "Class 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 @@ -502,6 +505,7 @@ struct EnumValue qint32_le value; Location location; }; +static_assert(sizeof(EnumValue) == 12, "EnumValue structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); struct Enum { @@ -525,6 +529,7 @@ struct Enum int enumValueCount() const { return nEnumValues; } // --- }; +static_assert(sizeof(Enum) == 12, "Enum structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); struct Parameter { |