diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-09-12 13:51:02 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-09-13 12:19:53 +0000 |
commit | 2bf1f4af53bd43ff91b33b3b847bf5ea502d4911 (patch) | |
tree | c034723070107063d99521a5b121dea728dcf17e | |
parent | 126d9d7cc35d1cca525091a49412ee6683310128 (diff) | |
download | qtdeclarative-2bf1f4af53bd43ff91b33b3b847bf5ea502d4911.tar.gz |
Fix building for QNX with buggy GCC
The complaint from GCC was that a static array InstrInfo::argumentCount)
cannot be in a union.
Change-Id: Ibd8dad478dc95853004fb2a871d5883d4dc73dcc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r-- | src/qml/compiler/qv4bytecodegenerator.cpp | 4 | ||||
-rw-r--r-- | src/qml/compiler/qv4instr_moth.cpp | 6 | ||||
-rw-r--r-- | src/qml/compiler/qv4instr_moth_p.h | 8 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/qml/compiler/qv4bytecodegenerator.cpp b/src/qml/compiler/qv4bytecodegenerator.cpp index dfdb71b253..78f9639ddd 100644 --- a/src/qml/compiler/qv4bytecodegenerator.cpp +++ b/src/qml/compiler/qv4bytecodegenerator.cpp @@ -75,7 +75,7 @@ void BytecodeGenerator::packInstruction(I &i) if (type >= MOTH_NUM_INSTRUCTIONS()) type -= MOTH_NUM_INSTRUCTIONS(); int instructionsAsInts[sizeof(Instr)/sizeof(int)]; - int nMembers = Moth::Instr::argumentCount[static_cast<int>(i.type)]; + int nMembers = Moth::InstrInfo::argumentCount[static_cast<int>(i.type)]; memcpy(instructionsAsInts, i.packed + 1, nMembers*sizeof(int)); enum { Normal, @@ -182,7 +182,7 @@ void BytecodeGenerator::finalize(Compiler::Context *context) int BytecodeGenerator::addInstructionHelper(Instr::Type type, const Instr &i, int offsetOfOffset) { int pos = instructions.size(); - int s = Moth::Instr::argumentCount[static_cast<int>(type)]*sizeof(int); + int s = Moth::InstrInfo::argumentCount[static_cast<int>(type)]*sizeof(int); if (offsetOfOffset != -1) offsetOfOffset += 1; I instr{type, static_cast<short>(s + 1), 0, currentLine, offsetOfOffset, -1, "\0\0" }; diff --git a/src/qml/compiler/qv4instr_moth.cpp b/src/qml/compiler/qv4instr_moth.cpp index 20917a5ee3..1cc8abcd24 100644 --- a/src/qml/compiler/qv4instr_moth.cpp +++ b/src/qml/compiler/qv4instr_moth.cpp @@ -43,9 +43,9 @@ using namespace QV4; using namespace QV4::Moth; -int Instr::size(Type type) +int InstrInfo::size(Instr::Type type) { -#define MOTH_RETURN_INSTR_SIZE(I) case Type::I: return InstrMeta<(int)Type::I>::Size; +#define MOTH_RETURN_INSTR_SIZE(I) case Instr::Type::I: return InstrMeta<int(Instr::Type::I)>::Size; switch (type) { FOR_EACH_MOTH_INSTR(MOTH_RETURN_INSTR_SIZE) } @@ -120,7 +120,7 @@ QT_BEGIN_NAMESPACE namespace QV4 { namespace Moth { -const int Instr::argumentCount[] = { +const int InstrInfo::argumentCount[] = { FOR_EACH_MOTH_INSTR(MOTH_COLLECT_NARGS) }; diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h index 8234f1261e..39309aad2b 100644 --- a/src/qml/compiler/qv4instr_moth_p.h +++ b/src/qml/compiler/qv4instr_moth_p.h @@ -475,13 +475,15 @@ union Instr FOR_EACH_MOTH_INSTR(MOTH_INSTR_ENUM) }; - static const int argumentCount[]; - FOR_EACH_MOTH_INSTR(MOTH_EMIT_STRUCTS) FOR_EACH_MOTH_INSTR(MOTH_EMIT_INSTR_MEMBERS) +}; - static int size(Type type); +struct InstrInfo +{ + static const int argumentCount[]; + static int size(Instr::Type type); }; Q_STATIC_ASSERT(MOTH_NUM_INSTRUCTIONS() < 128); |