aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2013-11-01 12:38:32 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-04 02:16:04 +0100
commita79e400150e9d550cc4ddc0c0497778d8b78fe5d (patch)
tree5a66670d4c31aaf0d356042b6fe607728e237b5b /src/qml/compiler
parentb5991ce2a61219bda5a7fa6e33f323158d1eb78b (diff)
Fix various compiler warnings in order to remove warn_off in the near future
Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r--src/qml/compiler/qqmlcodegenerator.cpp23
-rw-r--r--src/qml/compiler/qv4codegen.cpp56
-rw-r--r--src/qml/compiler/qv4compileddata.cpp23
-rw-r--r--src/qml/compiler/qv4compiler.cpp4
-rw-r--r--src/qml/compiler/qv4isel_masm.cpp22
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp1
-rw-r--r--src/qml/compiler/qv4jsir.cpp4
-rw-r--r--src/qml/compiler/qv4jsir_p.h9
-rw-r--r--src/qml/compiler/qv4regalloc.cpp20
-rw-r--r--src/qml/compiler/qv4ssa.cpp22
10 files changed, 94 insertions, 90 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp
index 546c92cd04..c2f2feb6bf 100644
--- a/src/qml/compiler/qqmlcodegenerator.cpp
+++ b/src/qml/compiler/qqmlcodegenerator.cpp
@@ -542,7 +542,7 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
for (int typeIndex = 0; typeIndex < propTypeNameToTypesCount; ++typeIndex) {
const TypeNameToType *t = propTypeNameToTypes + typeIndex;
if (t->nameLength == size_t(memberType.length()) &&
- QHashedString::compare(memberType.constData(), t->name, t->nameLength)) {
+ QHashedString::compare(memberType.constData(), t->name, static_cast<int>(t->nameLength))) {
type = t;
break;
}
@@ -600,7 +600,7 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
QV4::CompiledData::Property::Type type;
if ((unsigned)memberType.length() == strlen("alias") &&
- QHashedString::compare(memberType.constData(), "alias", strlen("alias"))) {
+ QHashedString::compare(memberType.constData(), "alias", static_cast<int>(strlen("alias")))) {
type = QV4::CompiledData::Property::Alias;
typeFound = true;
}
@@ -608,7 +608,7 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
for (int ii = 0; !typeFound && ii < propTypeNameToTypesCount; ++ii) {
const TypeNameToType *t = propTypeNameToTypes + ii;
if (t->nameLength == size_t(memberType.length()) &&
- QHashedString::compare(memberType.constData(), t->name, t->nameLength)) {
+ QHashedString::compare(memberType.constData(), t->name, static_cast<int>(t->nameLength))) {
type = t->type;
typeFound = true;
}
@@ -620,7 +620,7 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
if (typeModifier.isEmpty()) {
type = QV4::CompiledData::Property::Custom;
} else if ((unsigned)typeModifier.length() == strlen("list") &&
- QHashedString::compare(typeModifier.constData(), "list", strlen("list"))) {
+ QHashedString::compare(typeModifier.constData(), "list", static_cast<int>(strlen("list")))) {
type = QV4::CompiledData::Property::CustomList;
} else {
QQmlError error;
@@ -1044,18 +1044,18 @@ bool QQmlCodeGenerator::isStatementNodeScript(AST::Statement *statement)
{
if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement *>(statement)) {
AST::ExpressionNode *expr = stmt->expression;
- if (AST::StringLiteral *lit = AST::cast<AST::StringLiteral *>(expr))
+ if (AST::cast<AST::StringLiteral *>(expr))
return false;
else if (expr->kind == AST::Node::Kind_TrueLiteral)
return false;
else if (expr->kind == AST::Node::Kind_FalseLiteral)
return false;
- else if (AST::NumericLiteral *lit = AST::cast<AST::NumericLiteral *>(expr))
+ else if (AST::cast<AST::NumericLiteral *>(expr))
return false;
else {
if (AST::UnaryMinusExpression *unaryMinus = AST::cast<AST::UnaryMinusExpression *>(expr)) {
- if (AST::NumericLiteral *lit = AST::cast<AST::NumericLiteral *>(unaryMinus->expression)) {
+ if (AST::cast<AST::NumericLiteral *>(unaryMinus->expression)) {
return false;
}
}
@@ -1068,7 +1068,6 @@ bool QQmlCodeGenerator::isStatementNodeScript(AST::Statement *statement)
QV4::CompiledData::QmlUnit *QmlUnitGenerator::generate(ParsedQML &output, const QVector<int> &runtimeFunctionIndices)
{
jsUnitGenerator = &output.jsGenerator;
- const QmlObject *rootObject = output.objects.at(output.indexOfRootObject);
int unitSize = 0;
QV4::CompiledData::Unit *jsUnit = jsUnitGenerator->generateUnit(&unitSize);
@@ -1232,7 +1231,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<AST::N
ScanFunctions scan(this, sourceCode, GlobalCode);
scan.enterEnvironment(0, QmlBinding);
- scan.enterQmlScope(qmlRoot, "context scope");
+ scan.enterQmlScope(qmlRoot, QStringLiteral("context scope"));
foreach (AST::Node *node, functions) {
Q_ASSERT(node != qmlRoot);
AST::FunctionDeclaration *function = AST::cast<AST::FunctionDeclaration*>(node);
@@ -1245,7 +1244,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<AST::N
scan.leaveEnvironment();
_env = 0;
- _function = _module->functions.at(defineFunction(QString("context scope"), qmlRoot, 0, 0));
+ _function = _module->functions.at(defineFunction(QStringLiteral("context scope"), qmlRoot, 0, 0));
for (int i = 0; i < functions.count(); ++i) {
AST::Node *node = functions.at(i);
@@ -1521,7 +1520,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio
QHash<QString, QStringList>::ConstIterator entry = customSignals.find(propertyName);
if (entry == customSignals.constEnd() && propertyName.endsWith(QStringLiteral("Changed"))) {
- QString alternateName = propertyName.mid(0, propertyName.length() - strlen("Changed"));
+ QString alternateName = propertyName.mid(0, propertyName.length() - static_cast<int>(strlen("Changed")));
entry = customSignals.find(alternateName);
}
@@ -1613,7 +1612,7 @@ QQmlPropertyData *PropertyResolver::signal(const QString &name, bool *notInRevis
}
if (name.endsWith(QStringLiteral("Changed"))) {
- QString propName = name.mid(0, name.length() - strlen("Changed"));
+ QString propName = name.mid(0, name.length() - static_cast<int>(strlen("Changed")));
d = property(propName, notInRevision);
if (d)
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index b4193a4253..58c9fc59bb 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -131,7 +131,7 @@ void Codegen::ScanFunctions::checkName(const QStringRef &name, const SourceLocat
|| name == QLatin1String("public")
|| name == QLatin1String("static")
|| name == QLatin1String("yield")) {
- _cg->throwSyntaxError(loc, QCoreApplication::translate("qv4codegen", "Unexpected strict mode reserved word"));
+ _cg->throwSyntaxError(loc, QStringLiteral("Unexpected strict mode reserved word"));
}
}
}
@@ -202,7 +202,7 @@ bool Codegen::ScanFunctions::visit(ArrayLiteral *ast)
bool Codegen::ScanFunctions::visit(VariableDeclaration *ast)
{
if (_env->isStrict && (ast->name == QLatin1String("eval") || ast->name == QLatin1String("arguments")))
- _cg->throwSyntaxError(ast->identifierToken, QCoreApplication::translate("qv4codegen", "Variable name may not be eval or arguments in strict mode"));
+ _cg->throwSyntaxError(ast->identifierToken, QStringLiteral("Variable name may not be eval or arguments in strict mode"));
checkName(ast->name, ast->identifierToken);
if (ast->name == QLatin1String("arguments"))
_env->usesArgumentsObject = Environment::ArgumentsObjectNotUsed;
@@ -222,7 +222,7 @@ bool Codegen::ScanFunctions::visit(ExpressionStatement *ast)
{
if (FunctionExpression* expr = AST::cast<AST::FunctionExpression*>(ast->expression)) {
if (!_allowFuncDecls)
- _cg->throwSyntaxError(expr->functionToken, QCoreApplication::translate("qv4codegen", "conditional function or closure declaration"));
+ _cg->throwSyntaxError(expr->functionToken, QStringLiteral("conditional function or closure declaration"));
enterFunction(expr, /*enterName*/ true);
Node::accept(expr->formals, this);
@@ -232,7 +232,7 @@ bool Codegen::ScanFunctions::visit(ExpressionStatement *ast)
} else {
SourceLocation firstToken = ast->firstSourceLocation();
if (_sourceCode.midRef(firstToken.offset, firstToken.length) == QStringLiteral("function")) {
- _cg->throwSyntaxError(firstToken, QCoreApplication::translate("qv4codegen", "unexpected token"));
+ _cg->throwSyntaxError(firstToken, QStringLiteral("unexpected token"));
}
}
return true;
@@ -247,7 +247,7 @@ bool Codegen::ScanFunctions::visit(FunctionExpression *ast)
void Codegen::ScanFunctions::enterFunction(FunctionExpression *ast, bool enterName, bool isExpression)
{
if (_env->isStrict && (ast->name == QLatin1String("eval") || ast->name == QLatin1String("arguments")))
- _cg->throwSyntaxError(ast->identifierToken, QCoreApplication::translate("qv4codegen", "Function name may not be eval or arguments in strict mode"));
+ _cg->throwSyntaxError(ast->identifierToken, QStringLiteral("Function name may not be eval or arguments in strict mode"));
enterFunction(ast, ast->name.toString(), ast->formals, ast->body, enterName ? ast : 0, isExpression);
}
@@ -297,7 +297,7 @@ void Codegen::ScanFunctions::endVisit(FunctionDeclaration *)
bool Codegen::ScanFunctions::visit(WithStatement *ast)
{
if (_env->isStrict) {
- _cg->throwSyntaxError(ast->withToken, QCoreApplication::translate("qv4codegen", "'with' statement is not allowed in strict mode"));
+ _cg->throwSyntaxError(ast->withToken, QStringLiteral("'with' statement is not allowed in strict mode"));
return false;
}
@@ -388,11 +388,11 @@ void Codegen::ScanFunctions::enterFunction(Node *ast, const QString &name, Forma
for (FormalParameterList *it = formals; it; it = it->next) {
QString arg = it->name.toString();
if (args.contains(arg)) {
- _cg->throwSyntaxError(it->identifierToken, QCoreApplication::translate("qv4codegen", "Duplicate parameter name '%1' is not allowed in strict mode").arg(arg));
+ _cg->throwSyntaxError(it->identifierToken, QStringLiteral("Duplicate parameter name '%1' is not allowed in strict mode").arg(arg));
return;
}
if (arg == QLatin1String("eval") || arg == QLatin1String("arguments")) {
- _cg->throwSyntaxError(it->identifierToken, QCoreApplication::translate("qv4codegen", "'%1' cannot be used as parameter name in strict mode").arg(arg));
+ _cg->throwSyntaxError(it->identifierToken, QStringLiteral("'%1' cannot be used as parameter name in strict mode").arg(arg));
return;
}
args += arg;
@@ -1177,7 +1177,7 @@ bool Codegen::visit(BinaryExpression *ast)
return false;
V4IR::Expr* right = *expression(ast->right);
if (! (left->asTemp() || left->asName() || left->asSubscript() || left->asMember())) {
- throwReferenceError(ast->operatorToken, QCoreApplication::translate("qv4codegen", "left-hand side of assignment operator is not an lvalue"));
+ throwReferenceError(ast->operatorToken, QStringLiteral("left-hand side of assignment operator is not an lvalue"));
return false;
}
@@ -1207,7 +1207,7 @@ bool Codegen::visit(BinaryExpression *ast)
return false;
V4IR::Expr* right = *expression(ast->right);
if (!left->isLValue()) {
- throwSyntaxError(ast->operatorToken, QCoreApplication::translate("qv4codegen", "left-hand side of inplace operator is not an lvalue"));
+ throwSyntaxError(ast->operatorToken, QStringLiteral("left-hand side of inplace operator is not an lvalue"));
return false;
}
@@ -1344,17 +1344,17 @@ bool Codegen::visit(DeleteExpression *ast)
V4IR::Expr* expr = *expression(ast->expression);
// Temporaries cannot be deleted
V4IR::Temp *t = expr->asTemp();
- if (t && t->index < _env->members.size()) {
+ if (t && t->index < static_cast<unsigned>(_env->members.size())) {
// Trying to delete a function argument might throw.
if (_function->isStrict) {
- throwSyntaxError(ast->deleteToken, "Delete of an unqualified identifier in strict mode.");
+ throwSyntaxError(ast->deleteToken, QStringLiteral("Delete of an unqualified identifier in strict mode."));
return false;
}
_expr.code = _block->CONST(V4IR::BoolType, 0);
return false;
}
if (_function->isStrict && expr->asName()) {
- throwSyntaxError(ast->deleteToken, "Delete of an unqualified identifier in strict mode.");
+ throwSyntaxError(ast->deleteToken, QStringLiteral("Delete of an unqualified identifier in strict mode."));
return false;
}
@@ -1371,7 +1371,7 @@ bool Codegen::visit(DeleteExpression *ast)
_expr.code = _block->CONST(V4IR::BoolType, 1);
return false;
}
- if (expr->asTemp() && expr->asTemp()->index >= _env->members.size()) {
+ if (expr->asTemp() && expr->asTemp()->index >= static_cast<unsigned>(_env->members.size())) {
_expr.code = _block->CONST(V4IR::BoolType, 1);
return false;
}
@@ -1432,7 +1432,7 @@ V4IR::Expr *Codegen::identifier(const QString &name, int line, int col)
Q_ASSERT (index < e->members.size());
if (index != -1) {
V4IR::Temp *t = _block->LOCAL(index, scope);
- if (name == "arguments" || name == "eval")
+ if (name == QStringLiteral("arguments") || name == QStringLiteral("eval"))
t->isArgumentsOrEval = true;
return t;
}
@@ -1595,7 +1595,7 @@ bool Codegen::visit(ObjectLiteral *ast)
ObjectPropertyValue &v = valueMap[name];
if (v.hasGetter() || v.hasSetter() || (_function->isStrict && v.value)) {
throwSyntaxError(nv->lastSourceLocation(),
- QCoreApplication::translate("qv4codegen", "Illegal duplicate key '%1' in object literal").arg(name));
+ QStringLiteral("Illegal duplicate key '%1' in object literal").arg(name));
return false;
}
@@ -1608,7 +1608,7 @@ bool Codegen::visit(ObjectLiteral *ast)
(gs->type == PropertyGetterSetter::Getter && v.hasGetter()) ||
(gs->type == PropertyGetterSetter::Setter && v.hasSetter())) {
throwSyntaxError(gs->lastSourceLocation(),
- QCoreApplication::translate("qv4codegen", "Illegal duplicate key '%1' in object literal").arg(name));
+ QStringLiteral("Illegal duplicate key '%1' in object literal").arg(name));
return false;
}
if (gs->type == PropertyGetterSetter::Getter)
@@ -1729,7 +1729,7 @@ bool Codegen::visit(PostDecrementExpression *ast)
Result expr = expression(ast->base);
if (!expr->isLValue()) {
- throwReferenceError(ast->base->lastSourceLocation(), "Invalid left-hand side expression in postfix operation");
+ throwReferenceError(ast->base->lastSourceLocation(), QStringLiteral("Invalid left-hand side expression in postfix operation"));
return false;
}
if (throwSyntaxErrorOnEvalOrArgumentsInStrictMode(*expr, ast->decrementToken))
@@ -1755,7 +1755,7 @@ bool Codegen::visit(PostIncrementExpression *ast)
Result expr = expression(ast->base);
if (!expr->isLValue()) {
- throwReferenceError(ast->base->lastSourceLocation(), "Invalid left-hand side expression in postfix operation");
+ throwReferenceError(ast->base->lastSourceLocation(), QStringLiteral("Invalid left-hand side expression in postfix operation"));
return false;
}
if (throwSyntaxErrorOnEvalOrArgumentsInStrictMode(*expr, ast->incrementToken))
@@ -1962,7 +1962,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
function->column = loc.startColumn;
if (function->usesArgumentsObject)
- _env->enter("arguments", Environment::VariableDeclaration);
+ _env->enter(QStringLiteral("arguments"), Environment::VariableDeclaration);
// variables in global code are properties of the global context object, not locals as with other functions.
if (_env->compilationMode == FunctionCode || _env->compilationMode == QmlBinding) {
@@ -2032,7 +2032,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
}
}
if (_function->usesArgumentsObject) {
- move(identifier("arguments", ast->firstSourceLocation().startLine, ast->firstSourceLocation().startColumn),
+ move(identifier(QStringLiteral("arguments"), ast->firstSourceLocation().startLine, ast->firstSourceLocation().startColumn),
_block->CALL(_block->NAME(V4IR::Name::builtin_setup_argument_object,
ast->firstSourceLocation().startLine, ast->firstSourceLocation().startColumn), 0));
}
@@ -2118,7 +2118,7 @@ bool Codegen::visit(BreakStatement *ast)
return false;
if (!_loop) {
- throwSyntaxError(ast->lastSourceLocation(), QCoreApplication::translate("qv4codegen", "Break outside of loop"));
+ throwSyntaxError(ast->lastSourceLocation(), QStringLiteral("Break outside of loop"));
return false;
}
Loop *loop = 0;
@@ -2130,7 +2130,7 @@ bool Codegen::visit(BreakStatement *ast)
break;
}
if (!loop) {
- throwSyntaxError(ast->lastSourceLocation(), QCoreApplication::translate("qv4codegen", "Undefined label '%1'").arg(ast->label.toString()));
+ throwSyntaxError(ast->lastSourceLocation(), QStringLiteral("Undefined label '%1'").arg(ast->label.toString()));
return false;
}
}
@@ -2159,12 +2159,12 @@ bool Codegen::visit(ContinueStatement *ast)
}
}
if (!loop) {
- throwSyntaxError(ast->lastSourceLocation(), QCoreApplication::translate("qv4codegen", "Undefined label '%1'").arg(ast->label.toString()));
+ throwSyntaxError(ast->lastSourceLocation(), QStringLiteral("Undefined label '%1'").arg(ast->label.toString()));
return false;
}
}
if (!loop) {
- throwSyntaxError(ast->lastSourceLocation(), QCoreApplication::translate("qv4codegen", "continue outside of loop"));
+ throwSyntaxError(ast->lastSourceLocation(), QStringLiteral("continue outside of loop"));
return false;
}
unwindException(loop->scopeAndFinally);
@@ -2451,7 +2451,7 @@ bool Codegen::visit(ReturnStatement *ast)
return true;
if (_env->compilationMode != FunctionCode && _env->compilationMode != QmlBinding) {
- throwSyntaxError(ast->returnToken, QCoreApplication::translate("qv4codegen", "Return statement outside of function"));
+ throwSyntaxError(ast->returnToken, QStringLiteral("Return statement outside of function"));
return false;
}
if (ast->expression) {
@@ -2580,7 +2580,7 @@ bool Codegen::visit(TryStatement *ast)
if (_function->isStrict && ast->catchExpression &&
(ast->catchExpression->name == QLatin1String("eval") || ast->catchExpression->name == QLatin1String("arguments"))) {
- throwSyntaxError(ast->catchExpression->identifierToken, QCoreApplication::translate("qv4codegen", "Catch variable name may not be eval or arguments in strict mode"));
+ throwSyntaxError(ast->catchExpression->identifierToken, QStringLiteral("Catch variable name may not be eval or arguments in strict mode"));
return false;
}
@@ -2827,7 +2827,7 @@ bool Codegen::throwSyntaxErrorOnEvalOrArgumentsInStrictMode(V4IR::Expr *expr, co
} else {
return false;
}
- throwSyntaxError(loc, QCoreApplication::translate("qv4codegen", "Variable name may not be eval or arguments in strict mode"));
+ throwSyntaxError(loc, QStringLiteral("Variable name may not be eval or arguments in strict mode"));
return true;
}
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp
index 0f5c1857c8..51f39e7e6c 100644
--- a/src/qml/compiler/qv4compileddata.cpp
+++ b/src/qml/compiler/qv4compileddata.cpp
@@ -55,13 +55,6 @@ namespace QV4 {
namespace CompiledData {
-namespace {
- bool functionSortHelper(QV4::Function *lhs, QV4::Function *rhs)
- {
- return reinterpret_cast<quintptr>(lhs->codePtr) < reinterpret_cast<quintptr>(rhs->codePtr);
- }
-}
-
CompilationUnit::~CompilationUnit()
{
unlink();
@@ -77,13 +70,13 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine)
runtimeStrings = (QV4::SafeString *)malloc(data->stringTableSize * sizeof(QV4::SafeString));
// memset the strings to 0 in case a GC run happens while we're within the loop below
memset(runtimeStrings, 0, data->stringTableSize * sizeof(QV4::SafeString));
- for (int i = 0; i < data->stringTableSize; ++i)
+ for (uint i = 0; i < data->stringTableSize; ++i)
runtimeStrings[i] = engine->newIdentifier(data->stringAt(i));
runtimeRegularExpressions = new QV4::SafeValue[data->regexpTableSize];
// memset the regexps to 0 in case a GC run happens while we're within the loop below
memset(runtimeRegularExpressions, 0, data->regexpTableSize * sizeof(QV4::SafeValue));
- for (int i = 0; i < data->regexpTableSize; ++i) {
+ for (uint i = 0; i < data->regexpTableSize; ++i) {
const CompiledData::RegExp *re = data->regexpAt(i);
int flags = 0;
if (re->flags & CompiledData::RegExp::RegExp_Global)
@@ -109,8 +102,8 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine)
else if (compiledLookups[i].type_and_flags == CompiledData::Lookup::Type_GlobalGetter)
l->globalGetter = QV4::Lookup::globalGetterGeneric;
- for (int i = 0; i < QV4::Lookup::Size; ++i)
- l->classList[i] = 0;
+ for (int j = 0; j < QV4::Lookup::Size; ++j)
+ l->classList[j] = 0;
l->level = -1;
l->index = UINT_MAX;
l->name = runtimeStrings[compiledLookups[i].nameIndex].asString();
@@ -120,7 +113,7 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine)
if (data->jsClassTableSize) {
runtimeClasses = (QV4::InternalClass**)malloc(data->jsClassTableSize * sizeof(QV4::InternalClass*));
- for (int i = 0; i < data->jsClassTableSize; ++i) {
+ for (uint i = 0; i < data->jsClassTableSize; ++i) {
int memberCount = 0;
const CompiledData::JSClassMember *member = data->jsClassAt(i, &memberCount);
QV4::InternalClass *klass = engine->objectClass;
@@ -167,17 +160,17 @@ void CompilationUnit::unlink()
void CompilationUnit::markObjects()
{
- for (int i = 0; i < data->stringTableSize; ++i)
+ for (uint i = 0; i < data->stringTableSize; ++i)
runtimeStrings[i].mark();
if (runtimeRegularExpressions) {
- for (int i = 0; i < data->regexpTableSize; ++i)
+ for (uint i = 0; i < data->regexpTableSize; ++i)
runtimeRegularExpressions[i].mark();
}
for (int i = 0; i < runtimeFunctions.count(); ++i)
if (runtimeFunctions[i])
runtimeFunctions[i]->mark();
if (runtimeLookups) {
- for (int i = 0; i < data->lookupTableSize; ++i)
+ for (uint i = 0; i < data->lookupTableSize; ++i)
runtimeLookups[i].name->mark();
}
}
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index 4ee34d8aec..a808e88afa 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -270,11 +270,11 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(int *total
}
uint *functionTable = (uint *)(data + unit->offsetToFunctionTable);
- for (uint i = 0; i < irModule->functions.size(); ++i)
+ for (int i = 0; i < irModule->functions.size(); ++i)
functionTable[i] = functionOffsets.value(irModule->functions.at(i));
char *f = data + unitSize + stringDataSize;
- for (uint i = 0; i < irModule->functions.size(); ++i) {
+ for (int i = 0; i < irModule->functions.size(); ++i) {
QQmlJS::V4IR::Function *function = irModule->functions.at(i);
if (function == irModule->rootFunction)
unit->indexOfRootFunction = i;
diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp
index 0b372fec03..e33d3fdaf9 100644
--- a/src/qml/compiler/qv4isel_masm.cpp
+++ b/src/qml/compiler/qv4isel_masm.cpp
@@ -235,6 +235,8 @@ void Assembler::registerBlock(V4IR::BasicBlock* block, V4IR::BasicBlock *nextBlo
void Assembler::jumpToBlock(V4IR::BasicBlock* current, V4IR::BasicBlock *target)
{
+ Q_UNUSED(current);
+
if (target != _nextBlock)
_patches[target].append(jump());
}
@@ -371,6 +373,8 @@ void Assembler::copyValue(Result result, V4IR::Expr* source)
storeDouble(toDoubleRegister(source), result);
} else if (V4IR::Temp *temp = source->asTemp()) {
#ifdef VALUE_FITS_IN_REGISTER
+ Q_UNUSED(temp);
+
// Use ReturnValueRegister as "scratch" register because loadArgument
// and storeArgument are functions that may need a scratch register themselves.
loadArgumentInRegister(source, ReturnValueRegister, 0);
@@ -706,7 +710,7 @@ void InstructionSelection::run(int functionIndex)
foreach (V4IR::Stmt *s, _block->statements) {
if (s->location.isValid()) {
_as->recordLineNumber(s->location.startLine);
- if (s->location.startLine != lastLine) {
+ if (int(s->location.startLine) != lastLine) {
_as->saveInstructionPointer(Assembler::ScratchRegister);
lastLine = s->location.startLine;
}
@@ -744,7 +748,7 @@ QV4::CompiledData::CompilationUnit *InstructionSelection::backendCompileStep()
void InstructionSelection::callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result)
{
- int argc = prepareCallData(args, 0);
+ prepareCallData(args, 0);
if (useFastLookups && func->global) {
uint index = registerGlobalGetterLookup(*func->id);
@@ -936,7 +940,7 @@ void InstructionSelection::callValue(V4IR::Temp *value, V4IR::ExprList *args, V4
{
Q_ASSERT(value);
- int argc = prepareCallData(args, 0);
+ prepareCallData(args, 0);
generateFunctionCall(result, __qmljs_call_value, Assembler::ContextRegister,
Assembler::Reference(value),
baseAddressForCallData());
@@ -1350,7 +1354,7 @@ void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::
}
}
-static inline Assembler::FPRegisterID getFreeFPReg(V4IR::Expr *shouldNotOverlap, int hint)
+static inline Assembler::FPRegisterID getFreeFPReg(V4IR::Expr *shouldNotOverlap, unsigned hint)
{
if (V4IR::Temp *t = shouldNotOverlap->asTemp())
if (t->type == V4IR::DoubleType)
@@ -1481,7 +1485,7 @@ void InstructionSelection::callProperty(V4IR::Expr *base, const QString &name, V
{
assert(base != 0);
- int argc = prepareCallData(args, base);
+ prepareCallData(args, base);
if (useFastLookups) {
uint index = registerGetterLookup(name);
@@ -1502,7 +1506,7 @@ void InstructionSelection::callSubscript(V4IR::Expr *base, V4IR::Expr *index, V4
{
assert(base != 0);
- int argc = prepareCallData(args, base);
+ prepareCallData(args, base);
generateFunctionCall(result, __qmljs_call_element, Assembler::ContextRegister,
Assembler::PointerToValue(index),
baseAddressForCallData());
@@ -1806,7 +1810,7 @@ void InstructionSelection::convertTypeToUInt32(V4IR::Temp *source, V4IR::Temp *t
void InstructionSelection::constructActivationProperty(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result)
{
assert(func != 0);
- int argc = prepareCallData(args, 0);
+ prepareCallData(args, 0);
if (useFastLookups && func->global) {
uint index = registerGlobalGetterLookup(*func->id);
@@ -1825,7 +1829,7 @@ void InstructionSelection::constructActivationProperty(V4IR::Name *func, V4IR::E
void InstructionSelection::constructProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result)
{
- int argc = prepareCallData(args, 0);
+ prepareCallData(args, 0);
generateFunctionCall(result, __qmljs_construct_property, Assembler::ContextRegister,
Assembler::Reference(base), Assembler::PointerToString(name),
baseAddressForCallData());
@@ -1835,7 +1839,7 @@ void InstructionSelection::constructValue(V4IR::Temp *value, V4IR::ExprList *arg
{
assert(value != 0);
- int argc = prepareCallData(args, 0);
+ prepareCallData(args, 0);
generateFunctionCall(result, __qmljs_construct_value,
Assembler::ContextRegister,
Assembler::Reference(value),
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index a67675ecdf..df206d7890 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -638,7 +638,6 @@ void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::
if (_stackSlotAllocator)
_stackSlotAllocator->addHint(*sourceTemp, *targetTemp);
- QV4::UnaryOpName op = 0;
switch (oper) {
case V4IR::OpIfTrue:
Q_ASSERT(!"unreachable"); break;
diff --git a/src/qml/compiler/qv4jsir.cpp b/src/qml/compiler/qv4jsir.cpp
index 4c5847f778..b4630793ef 100644
--- a/src/qml/compiler/qv4jsir.cpp
+++ b/src/qml/compiler/qv4jsir.cpp
@@ -474,7 +474,7 @@ void Closure::dump(QTextStream &out) const
{
QString name = functionName ? *functionName : QString();
if (name.isEmpty())
- name.sprintf("%p", value);
+ name.sprintf("%x", value);
out << "closure(" << name << ')';
}
@@ -597,6 +597,8 @@ void Ret::dump(QTextStream &out, Mode)
void Phi::dump(QTextStream &out, Stmt::Mode mode)
{
+ Q_UNUSED(mode);
+
targetTemp->dump(out);
out << " = phi(";
for (int i = 0, ei = d->incoming.size(); i < ei; ++i) {
diff --git a/src/qml/compiler/qv4jsir_p.h b/src/qml/compiler/qv4jsir_p.h
index 41191b0bec..933ba1321d 100644
--- a/src/qml/compiler/qv4jsir_p.h
+++ b/src/qml/compiler/qv4jsir_p.h
@@ -578,7 +578,14 @@ struct Stmt {
AST::SourceLocation location;
Stmt(): d(0), id(-1) {}
- virtual ~Stmt() { Q_UNREACHABLE(); }
+ virtual ~Stmt()
+ {
+#ifdef Q_CC_MSVC
+ // MSVC complains about potential memory leaks if a destructor never returns.
+#else
+ Q_UNREACHABLE();
+#endif
+ }
virtual Stmt *asTerminator() { return 0; }
virtual void accept(StmtVisitor *) = 0;
diff --git a/src/qml/compiler/qv4regalloc.cpp b/src/qml/compiler/qv4regalloc.cpp
index 62013fc2b7..9a1897d494 100644
--- a/src/qml/compiler/qv4regalloc.cpp
+++ b/src/qml/compiler/qv4regalloc.cpp
@@ -51,7 +51,7 @@ struct Use {
unsigned flag : 1;
unsigned pos : 31;
- Use(): pos(0), flag(MustHaveRegister) {}
+ Use(): flag(MustHaveRegister), pos(0) {}
Use(int pos, RegisterFlag flag): flag(flag), pos(pos) {}
bool mustHaveRegister() const { return flag == MustHaveRegister; }
@@ -219,6 +219,8 @@ protected: // IRDecoder
virtual void callProperty(V4IR::Expr *base, const QString &name, V4IR::ExprList *args,
V4IR::Temp *result)
{
+ Q_UNUSED(name)
+
addDef(result);
addUses(base->asTemp(), Use::CouldHaveRegister);
addUses(args, Use::CouldHaveRegister);
@@ -336,6 +338,7 @@ protected: // IRDecoder
virtual void loadQmlIdObject(int id, V4IR::Temp *temp)
{
+ Q_UNUSED(id);
addDef(temp);
addCall();
}
@@ -354,22 +357,30 @@ protected: // IRDecoder
virtual void loadQmlScopeObject(Temp *temp)
{
+ Q_UNUSED(temp);
+
addDef(temp);
addCall();
}
virtual void loadConst(V4IR::Const *sourceConst, V4IR::Temp *targetTemp)
{
+ Q_UNUSED(sourceConst);
+
addDef(targetTemp);
}
virtual void loadString(const QString &str, V4IR::Temp *targetTemp)
{
+ Q_UNUSED(str);
+
addDef(targetTemp);
}
virtual void loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *targetTemp)
{
+ Q_UNUSED(sourceRegexp);
+
addDef(targetTemp);
addCall();
}
@@ -388,6 +399,8 @@ protected: // IRDecoder
virtual void initClosure(V4IR::Closure *closure, V4IR::Temp *target)
{
+ Q_UNUSED(closure);
+
addDef(target);
addCall();
}
@@ -534,7 +547,7 @@ protected: // IRDecoder
#endif
} else if (Binop *b = s->cond->asBinop()) {
binop(b->op, b->left, b->right, 0);
- } else if (Const *c = s->cond->asConst()) {
+ } else if (s->cond->asConst()) {
// TODO: SSA optimization for constant condition evaluation should remove this.
// See also visitCJump() in masm.
addCall();
@@ -873,7 +886,7 @@ private:
if (_info->def(it.temp()) != successorStart && !it.isSplitFromInterval()) {
const int successorEnd = successor->statements.last()->id;
foreach (const Use &use, _info->uses(it.temp()))
- Q_ASSERT(use.pos < successorStart || use.pos > successorEnd);
+ Q_ASSERT(use.pos < static_cast<unsigned>(successorStart) || use.pos > static_cast<unsigned>(successorEnd));
}
#endif
@@ -954,7 +967,6 @@ protected:
int pReg = platformRegister(i);
t->kind = Temp::PhysicalRegister;
t->index = pReg;
- Q_ASSERT(t->index >= 0);
} else {
int stackSlot = _assignedSpillSlots.value(*t, -1);
Q_ASSERT(stackSlot >= 0);
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index 1c88740ef1..6b8c8af8e4 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -1274,7 +1274,7 @@ private:
}
protected:
- virtual void visitConst(Const *e) {}
+ virtual void visitConst(Const *) {}
virtual void visitString(String *) {}
virtual void visitRegExp(RegExp *) {}
virtual void visitName(Name *) {}
@@ -1897,8 +1897,8 @@ QHash<BasicBlock *, BasicBlock *> scheduleBlocks(Function *function, const Domin
I(const DominatorTree &df, QVector<BasicBlock *> &sequence,
QHash<BasicBlock *, BasicBlock *> &startEndLoops)
: df(df)
- , sequence(sequence)
, startEndLoops(startEndLoops)
+ , sequence(sequence)
, currentGroup(0)
{}
@@ -1963,6 +1963,7 @@ QHash<BasicBlock *, BasicBlock *> scheduleBlocks(Function *function, const Domin
return startEndLoops;
}
+#ifndef QT_NO_DEBUG
void checkCriticalEdges(QVector<BasicBlock *> basicBlocks) {
foreach (BasicBlock *bb, basicBlocks) {
if (bb && bb->out.size() > 1) {
@@ -1976,6 +1977,7 @@ void checkCriticalEdges(QVector<BasicBlock *> basicBlocks) {
}
}
}
+#endif
void cleanupBasicBlocks(Function *function)
{
@@ -2038,20 +2040,6 @@ inline Const *isConstPhi(Phi *phi)
return 0;
}
-inline Temp *isSameTempPhi(Phi *phi)
-{
- if (Temp *t = phi->d->incoming[0]->asTemp()) {
- for (int i = 1, ei = phi->d->incoming.size(); i != ei; ++i) {
- if (Temp *tt = phi->d->incoming[i]->asTemp())
- if (t->index == tt->index)
- continue;
- return 0;
- }
- return t;
- }
- return 0;
-}
-
static Expr *clone(Expr *e, Function *function) {
if (Temp *t = e->asTemp()) {
return CloneExpr::cloneTemp(t, function);
@@ -2636,7 +2624,7 @@ protected:
virtual void visitJump(Jump *) {}
virtual void visitCJump(CJump *s) { s->cond->accept(this); }
virtual void visitRet(Ret *s) { s->expr->accept(this); }
- virtual void visitPhi(Phi *s) {
+ virtual void visitPhi(Phi *) {
// Handled separately
}
};