Skip to content

Commit

Permalink
Fix compiler errors.
Browse files Browse the repository at this point in the history
On Mavericks with Apple's Clang 5.0 (3.3 based):
../3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.h:320:117: error: non-const reference cannot bind to bit-field 'm_attributesInPrevious'
  ...add(StructureTransitionTableHash::Key(RefPtr<UString::Rep>(existingTransition->m_nameInPrevious.get()), existingTransition->m_attributesInPrevious), exi...
                                                                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C++11 specific:
../3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.h:179:35: error: non-constant-expression cannot be narrowed from type 'size_t'
      (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
                LineInfo info = { instructions().size(), n->lineNo() };
                                  ^~~~~~~~~~~~~~~~~~~~~

Both occur in multiple places.

Task-number: QTBUG-34842

Change-Id: I98a29b51718a6e0db8749ac1b495e071e9fe479d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
  • Loading branch information
erikjv authored and The Qt Project committed Nov 18, 2013
1 parent 78985c5 commit 15bb30b
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1837,7 +1837,12 @@ RegisterID* BytecodeGenerator::emitCatch(RegisterID* targetRegister, Label* star
#if ENABLE(JIT)
HandlerInfo info = { start->bind(0, 0), end->bind(0, 0), instructions().size(), m_dynamicScopeDepth + m_baseScopeDepth, CodeLocationLabel() };
#else
HandlerInfo info = { start->bind(0, 0), end->bind(0, 0), instructions().size(), m_dynamicScopeDepth + m_baseScopeDepth };
HandlerInfo info = {
static_cast<uint32_t>(start->bind(0, 0)),
static_cast<uint32_t>(end->bind(0, 0)),
static_cast<uint32_t>(instructions().size()),
static_cast<uint32_t>(m_dynamicScopeDepth + m_baseScopeDepth)
};
#endif

m_codeBlock->addExceptionHandler(info);
Expand Down Expand Up @@ -1889,7 +1894,7 @@ void BytecodeGenerator::emitPushNewScope(RegisterID* dst, const Identifier& prop

void BytecodeGenerator::beginSwitch(RegisterID* scrutineeRegister, SwitchInfo::SwitchType type)
{
SwitchInfo info = { instructions().size(), type };
SwitchInfo info = { static_cast<uint32_t>(instructions().size()), type };
switch (type) {
case SwitchInfo::SwitchImmediate:
emitOpcode(op_switch_imm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ namespace JSC {
// Node::emitCode assumes that dst, if provided, is either a local or a referenced temporary.
ASSERT(!dst || dst == ignoredResult() || !dst->isTemporary() || dst->refCount());
if (!m_codeBlock->numberOfLineInfos() || m_codeBlock->lastLineInfo().lineNumber != n->lineNo()) {
LineInfo info = { instructions().size(), n->lineNo() };
LineInfo info = { static_cast<uint32_t>(instructions().size()), n->lineNo() };
m_codeBlock->addLineInfo(info);
}
if (m_emitNodeDepth >= s_maxEmitNodeDepth)
Expand All @@ -195,7 +195,7 @@ namespace JSC {
void emitNodeInConditionContext(ExpressionNode* n, Label* trueTarget, Label* falseTarget, bool fallThroughMeansTrue)
{
if (!m_codeBlock->numberOfLineInfos() || m_codeBlock->lastLineInfo().lineNumber != n->lineNo()) {
LineInfo info = { instructions().size(), n->lineNo() };
LineInfo info = { static_cast<uint32_t>(instructions().size()), n->lineNo() };
m_codeBlock->addLineInfo(info);
}
if (m_emitNodeDepth >= s_maxEmitNodeDepth)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ PassRefPtr<UString::Rep> Identifier::add(JSGlobalData* globalData, const UChar*
UString::Rep::empty().hash();
return &UString::Rep::empty();
}
UCharBuffer buf = {s, length};
UCharBuffer buf = {s, static_cast<unsigned>(length)};
pair<HashSet<UString::Rep*>::iterator, bool> addResult = globalData->identifierTable->add<UCharBuffer, UCharBufferTranslator>(buf);

// If the string is newly-translated, then we need to adopt it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,11 @@ void Stringifier::appendQuotedString(StringBuilder& builder, const UString& valu
default:
static const char hexDigits[] = "0123456789abcdef";
UChar ch = data[i];
UChar hex[] = { '\\', 'u', hexDigits[(ch >> 12) & 0xF], hexDigits[(ch >> 8) & 0xF], hexDigits[(ch >> 4) & 0xF], hexDigits[ch & 0xF] };
UChar hex[] = { '\\', 'u',
static_cast<UChar>(hexDigits[(ch >> 12) & 0xF]),
static_cast<UChar>(hexDigits[(ch >> 8) & 0xF]),
static_cast<UChar>(hexDigits[(ch >> 4) & 0xF]),
static_cast<UChar>(hexDigits[ch & 0xF]) };
builder.append(hex, sizeof(hex) / sizeof(UChar));
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,10 @@ Structure::Structure(JSValue prototype, const TypeInfo& typeInfo)
Structure::~Structure()
{
if (m_previous) {
if (m_nameInPrevious)
m_previous->table.remove(StructureTransitionTableHash::Key(RefPtr<UString::Rep>(m_nameInPrevious.get()), m_attributesInPrevious), m_specificValueInPrevious);
else
if (m_nameInPrevious) {
unsigned attrInPrev = m_attributesInPrevious;
m_previous->table.remove(StructureTransitionTableHash::Key(RefPtr<UString::Rep>(m_nameInPrevious.get()), attrInPrev), m_specificValueInPrevious);
} else
m_previous->table.removeAnonymousSlotTransition(m_anonymousSlotsInPrevious);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,10 @@ namespace JSC {
Structure* existingTransition = singleTransition();
TransitionTable* transitionTable = new TransitionTable;
setTransitionTable(transitionTable);
if (existingTransition)
add(StructureTransitionTableHash::Key(RefPtr<UString::Rep>(existingTransition->m_nameInPrevious.get()), existingTransition->m_attributesInPrevious), existingTransition, existingTransition->m_specificValueInPrevious);
if (existingTransition) {
const unsigned attrsInPrev = existingTransition->m_attributesInPrevious;
add(StructureTransitionTableHash::Key(RefPtr<UString::Rep>(existingTransition->m_nameInPrevious.get()), attrsInPrev), existingTransition, existingTransition->m_specificValueInPrevious);
}
}
} // namespace JSC

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static bool isLegalUTF8(const unsigned char* source, int length)
// This table contains as many values as there might be trailing bytes
// in a UTF-8 sequence.
static const UChar32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
0x03C82080UL, 0xFA082080UL, 0x82082080UL };
0x03C82080UL, static_cast<UChar32>(0xFA082080UL), static_cast<UChar32>(0x82082080UL) };

ConversionResult convertUTF8ToUTF16(
const char** sourceStart, const char* sourceEnd,
Expand Down

0 comments on commit 15bb30b

Please sign in to comment.