diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-03-14 13:51:27 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-03-17 08:35:44 +0000 |
commit | 720dab7ad0f77b739a12f0e3e7e7178ea16c2e64 (patch) | |
tree | dd508b1ec0b453e948da33e760d73560ae6a9e06 /src/qml/jsruntime/qv4lookup_p.h | |
parent | 25e40b18d5348064e1b31d491a22c50a2ffb89c3 (diff) |
Protect Lookup usage against cross-compilation word size differences
The offsets we're taking from Lookup in the code generator are always
zero, but with static assertions we can ensure that they stay that way.
Task-number: QTBUG-58666
Change-Id: I91e047d2101ba33e36aaada4a5adc75e20fea7d8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4lookup_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4lookup_p.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4lookup_p.h b/src/qml/jsruntime/qv4lookup_p.h index c5ee92fedd..2ffb43cce9 100644 --- a/src/qml/jsruntime/qv4lookup_p.h +++ b/src/qml/jsruntime/qv4lookup_p.h @@ -141,6 +141,13 @@ struct Lookup { }; +Q_STATIC_ASSERT(std::is_standard_layout<Lookup>::value); +// Ensure that these offsets are always at this point to keep generated code compatible +// across 32-bit and 64-bit (matters when cross-compiling). +Q_STATIC_ASSERT(offsetof(Lookup, indexedGetter) == 0); +Q_STATIC_ASSERT(offsetof(Lookup, getter) == 0); +Q_STATIC_ASSERT(offsetof(Lookup, engine) == offsetof(Lookup, getter) + QT_POINTER_SIZE); + } QT_END_NAMESPACE |