diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-03-18 09:20:45 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-19 08:14:56 +0100 |
commit | 3b2e7bf03b656b38ba7b24acf7ed38de555635f1 (patch) | |
tree | 0a7c9ae7ef73f1fb7d186e4470330b1668477604 /src | |
parent | 44ca5f1be03420978cc8d5468c4c40dcd5174a06 (diff) |
Use Q_ASSERT instead of assert
Change-Id: I6185b59a7dfd6977ce82581ab4385e07d78f13f6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/compiler/qv4codegen_p.h | 3 | ||||
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 4 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_moth.cpp | 10 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_p.cpp | 24 | ||||
-rw-r--r-- | src/qml/compiler/qv4jsir.cpp | 15 | ||||
-rw-r--r-- | src/qml/jit/qv4assembler.cpp | 1 | ||||
-rw-r--r-- | src/qml/jit/qv4assembler_p.h | 20 | ||||
-rw-r--r-- | src/qml/jit/qv4binop.cpp | 2 | ||||
-rw-r--r-- | src/qml/jit/qv4isel_masm.cpp | 15 | ||||
-rw-r--r-- | src/qml/jsapi/qjsvalue.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4dateobject.cpp | 3 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4errorobject.cpp | 1 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4executableallocator.cpp | 15 |
13 files changed, 55 insertions, 64 deletions
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h index 9c43dc17fe..c495437622 100644 --- a/src/qml/compiler/qv4codegen_p.h +++ b/src/qml/compiler/qv4codegen_p.h @@ -48,7 +48,6 @@ #include <QtCore/QStringList> #include <QStack> #include <qqmlerror.h> -#include <assert.h> #include <private/qv4util_p.h> QT_BEGIN_NAMESPACE @@ -180,7 +179,7 @@ protected: MemberMap::const_iterator it = members.find(name); if (it == members.end()) return -1; - assert((*it).index != -1 || !parent); + Q_ASSERT((*it).index != -1 || !parent); return (*it).index; } diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index ae495e0ffa..2220fd5de5 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -66,8 +66,8 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) this->engine = engine; engine->compilationUnits.insert(this); - assert(!runtimeStrings); - assert(data); + Q_ASSERT(!runtimeStrings); + Q_ASSERT(data); runtimeStrings = (QV4::StringValue *)malloc(data->stringTableSize * sizeof(QV4::StringValue)); // 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::StringValue)); diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp index b8f56e990e..df0625b48e 100644 --- a/src/qml/compiler/qv4isel_moth.cpp +++ b/src/qml/compiler/qv4isel_moth.cpp @@ -118,7 +118,7 @@ inline QV4::Runtime::BinaryOperation aluOpFunction(IR::AluOp op) case IR::OpOr: return 0; default: - assert(!"Unknown AluOp"); + Q_ASSERT(!"Unknown AluOp"); return 0; } }; @@ -377,7 +377,7 @@ void InstructionSelection::run(int functionIndex) qSwap(_currentStatement, cs); int locals = frameSize(); - assert(locals >= 0); + Q_ASSERT(locals >= 0); IR::BasicBlock *exceptionHandler = 0; @@ -607,7 +607,7 @@ void InstructionSelection::loadQmlSingleton(const QString &name, IR::Temp *temp) void InstructionSelection::loadConst(IR::Const *sourceConst, IR::Temp *targetTemp) { - assert(sourceConst); + Q_ASSERT(sourceConst); Instruction::MoveConst move; move.source = convertToValue(sourceConst).asReturnedValue(); @@ -1009,7 +1009,7 @@ void InstructionSelection::prepareCallArgs(IR::ExprList *e, quint32 &argc, quint *args = argLocation; if (e) { // We need to move all the temps into the function arg array - assert(argLocation >= 0); + Q_ASSERT(argLocation >= 0); while (e) { if (IR::Const *c = e->expr->asConst()) { Instruction::MoveConst move; @@ -1467,7 +1467,7 @@ QByteArray InstructionSelection::squeezeCode() const } Param InstructionSelection::getParam(IR::Expr *e) { - assert(e); + Q_ASSERT(e); if (IR::Const *c = e->asConst()) { int idx = jsUnitGenerator()->registerConstant(convertToValue(c).asReturnedValue()); diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp index 0dbf58ad5c..9864135702 100644 --- a/src/qml/compiler/qv4isel_p.cpp +++ b/src/qml/compiler/qv4isel_p.cpp @@ -50,8 +50,6 @@ #include <QString> -#include <cassert> - namespace { Q_GLOBAL_STATIC_WITH_ARGS(QTextStream, qout, (stderr, QIODevice::WriteOnly)); #define qout *qout() @@ -70,8 +68,8 @@ EvalInstructionSelection::EvalInstructionSelection(QV4::ExecutableAllocator *exe ownJSGenerator.reset(jsGenerator); } this->jsGenerator = jsGenerator; - assert(execAllocator); - assert(module); + Q_ASSERT(execAllocator); + Q_ASSERT(module); } EvalInstructionSelection::~EvalInstructionSelection() @@ -221,7 +219,7 @@ void IRDecoder::visitMove(IR::Move *s) Q_UNIMPLEMENTED(); s->dump(qout, IR::Stmt::MIR); qout << endl; - assert(!"TODO"); + Q_ASSERT(!"TODO"); } IRDecoder::~IRDecoder() @@ -252,7 +250,7 @@ void IRDecoder::visitExp(IR::Exp *s) void IRDecoder::callBuiltin(IR::Call *call, IR::Temp *result) { IR::Name *baseName = call->base->asName(); - assert(baseName != 0); + Q_ASSERT(baseName != 0); switch (baseName->builtin) { case IR::Name::builtin_invalid: @@ -294,7 +292,7 @@ void IRDecoder::callBuiltin(IR::Call *call, IR::Temp *result) case IR::Name::builtin_throw: { IR::Expr *arg = call->args->expr; - assert(arg->asTemp() || arg->asConst()); + Q_ASSERT(arg->asTemp() || arg->asConst()); callBuiltinThrow(arg); } return; @@ -314,18 +312,18 @@ void IRDecoder::callBuiltin(IR::Call *call, IR::Temp *result) case IR::Name::builtin_foreach_iterator_object: { IR::Expr *arg = call->args->expr; - assert(arg != 0); + Q_ASSERT(arg != 0); callBuiltinForeachIteratorObject(arg, result); } return; case IR::Name::builtin_foreach_next_property_name: { IR::Temp *arg = call->args->expr->asTemp(); - assert(arg != 0); + Q_ASSERT(arg != 0); callBuiltinForeachNextPropertyname(arg, result); } return; case IR::Name::builtin_push_with_scope: { IR::Temp *arg = call->args->expr->asTemp(); - assert(arg != 0); + Q_ASSERT(arg != 0); callBuiltinPushWithScope(arg); } return; @@ -337,10 +335,10 @@ void IRDecoder::callBuiltin(IR::Call *call, IR::Temp *result) if (!call->args) return; IR::Const *deletable = call->args->expr->asConst(); - assert(deletable->type == IR::BoolType); + Q_ASSERT(deletable->type == IR::BoolType); for (IR::ExprList *it = call->args->next; it; it = it->next) { IR::Name *arg = it->expr->asName(); - assert(arg != 0); + Q_ASSERT(arg != 0); callBuiltinDeclareVar(deletable->value != 0, *arg->id); } } return; @@ -396,6 +394,6 @@ void IRDecoder::callBuiltin(IR::Call *call, IR::Temp *result) Q_UNIMPLEMENTED(); call->dump(qout); qout << endl; - assert(!"TODO!"); + Q_ASSERT(!"TODO!"); Q_UNREACHABLE(); } diff --git a/src/qml/compiler/qv4jsir.cpp b/src/qml/compiler/qv4jsir.cpp index a656f4dffe..efce64bf7a 100644 --- a/src/qml/compiler/qv4jsir.cpp +++ b/src/qml/compiler/qv4jsir.cpp @@ -47,7 +47,6 @@ #include <QtCore/qdebug.h> #include <QtCore/qset.h> #include <cmath> -#include <cassert> #ifdef CONST #undef CONST @@ -632,7 +631,7 @@ Function *Module::newFunction(const QString &name, Function *outer) functions.append(f); if (!outer) { if (!isQmlModule) { - assert(!rootFunction); + Q_ASSERT(!rootFunction); rootFunction = f; } } else { @@ -882,10 +881,10 @@ Stmt *BasicBlock::JUMP(BasicBlock *target) s->init(target); appendStatement(s); - assert(! out.contains(target)); + Q_ASSERT(! out.contains(target)); out.append(target); - assert(! target->in.contains(this)); + Q_ASSERT(! target->in.contains(this)); target->in.append(this); return s; @@ -905,16 +904,16 @@ Stmt *BasicBlock::CJUMP(Expr *cond, BasicBlock *iftrue, BasicBlock *iffalse) s->init(cond, iftrue, iffalse); appendStatement(s); - assert(! out.contains(iftrue)); + Q_ASSERT(! out.contains(iftrue)); out.append(iftrue); - assert(! iftrue->in.contains(this)); + Q_ASSERT(! iftrue->in.contains(this)); iftrue->in.append(this); - assert(! out.contains(iffalse)); + Q_ASSERT(! out.contains(iffalse)); out.append(iffalse); - assert(! iffalse->in.contains(this)); + Q_ASSERT(! iffalse->in.contains(this)); iffalse->in.append(this); return s; diff --git a/src/qml/jit/qv4assembler.cpp b/src/qml/jit/qv4assembler.cpp index 2393c9a8ca..cd44b537df 100644 --- a/src/qml/jit/qv4assembler.cpp +++ b/src/qml/jit/qv4assembler.cpp @@ -54,7 +54,6 @@ #include <WTFStubs.h> #include <iostream> -#include <cassert> #if ENABLE(ASSEMBLER) diff --git a/src/qml/jit/qv4assembler_p.h b/src/qml/jit/qv4assembler_p.h index d8efea17af..085da34ed3 100644 --- a/src/qml/jit/qv4assembler_p.h +++ b/src/qml/jit/qv4assembler_p.h @@ -150,7 +150,7 @@ public: static const int RegisterArgumentCount = 0; static RegisterID registerForArgument(int) { - assert(false); + Q_ASSERT(false); // Not reached. return JSC::X86Registers::eax; } @@ -187,7 +187,7 @@ public: JSC::X86Registers::r8, JSC::X86Registers::r9 }; - assert(index >= 0 && index < RegisterArgumentCount); + Q_ASSERT(index >= 0 && index < RegisterArgumentCount); return regs[index]; }; static const int StackShadowSpace = 32; @@ -203,7 +203,7 @@ public: JSC::X86Registers::r8, JSC::X86Registers::r9 }; - assert(index >= 0 && index < RegisterArgumentCount); + Q_ASSERT(index >= 0 && index < RegisterArgumentCount); return regs[index]; }; static const int StackShadowSpace = 0; @@ -238,7 +238,7 @@ public: static const int RegisterArgumentCount = 4; static RegisterID registerForArgument(int index) { - assert(index >= 0 && index < RegisterArgumentCount); + Q_ASSERT(index >= 0 && index < RegisterArgumentCount); return static_cast<RegisterID>(JSC::ARMRegisters::r0 + index); }; @@ -582,7 +582,7 @@ public: void loadArgumentInRegister(Reference temp, RegisterID dest, int argumentNumber) { - assert(temp.value); + Q_ASSERT(temp.value); Pointer addr = loadTempAddress(dest, temp.value); loadArgumentInRegister(addr, dest, argumentNumber); } @@ -591,7 +591,7 @@ public: { Q_UNUSED(argumentNumber); - assert(block.block); + Q_ASSERT(block.block); DataLabelPtr patch = moveWithPatch(TrustedImmPtr(0), dest); addPatch(patch, block.block); } @@ -630,13 +630,13 @@ public: } else if (expr->asConst()) { loadArgumentInRegister(expr->asConst(), dest, argumentNumber); } else { - assert(!"unimplemented expression type in loadArgument"); + Q_ASSERT(!"unimplemented expression type in loadArgument"); } } #else void loadArgumentInRegister(IR::Expr*, RegisterID) { - assert(!"unimplemented: expression in loadArgument"); + Q_ASSERT(!"unimplemented: expression in loadArgument"); } #endif @@ -771,7 +771,7 @@ public: template <int StackSlot> void loadArgumentOnStack(Reference temp, int argumentNumber) { - assert (temp.value); + Q_ASSERT (temp.value); Pointer ptr = loadTempAddress(ScratchRegister, temp.value); loadArgumentOnStack<StackSlot>(ptr, argumentNumber); @@ -782,7 +782,7 @@ public: { Q_UNUSED(argumentNumber); - assert(block.block); + Q_ASSERT(block.block); DataLabelPtr patch = moveWithPatch(TrustedImmPtr(0), ScratchRegister); poke(ScratchRegister, StackSlot); addPatch(patch, block.block); diff --git a/src/qml/jit/qv4binop.cpp b/src/qml/jit/qv4binop.cpp index e584f1142f..a505221e87 100644 --- a/src/qml/jit/qv4binop.cpp +++ b/src/qml/jit/qv4binop.cpp @@ -148,7 +148,7 @@ void Binop::generate(IR::Expr *lhs, IR::Expr *rhs, IR::Temp *target) Assembler::PointerToValue(lhs), Assembler::PointerToValue(rhs)); } else { - assert(!"unreachable"); + Q_ASSERT(!"unreachable"); } if (done.isSet()) diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp index d30d69e68f..5cda52832e 100644 --- a/src/qml/jit/qv4isel_masm.cpp +++ b/src/qml/jit/qv4isel_masm.cpp @@ -58,7 +58,6 @@ #include <WTFStubs.h> #include <iostream> -#include <cassert> #if ENABLE(ASSEMBLER) @@ -132,7 +131,7 @@ JSC::MacroAssemblerCodeRef Assembler::link(int *codeSize) it.next(); IR::BasicBlock *block = it.key(); Label target = _addrs.value(block); - assert(target.isSet()); + Q_ASSERT(target.isSet()); foreach (Jump jump, it.value()) jump.linkTo(target, this); } @@ -160,7 +159,7 @@ JSC::MacroAssemblerCodeRef Assembler::link(int *codeSize) it.next(); IR::BasicBlock *block = it.key(); Label target = _addrs.value(block); - assert(target.isSet()); + Q_ASSERT(target.isSet()); foreach (DataLabelPtr label, it.value()) linkBuffer.patch(label, linkBuffer.locationOf(target)); } @@ -941,7 +940,7 @@ void InstructionSelection::binop(IR::AluOp oper, IR::Expr *leftSource, IR::Expr void InstructionSelection::callProperty(IR::Expr *base, const QString &name, IR::ExprList *args, IR::Temp *result) { - assert(base != 0); + Q_ASSERT(base != 0); prepareCallData(args, base); @@ -961,7 +960,7 @@ void InstructionSelection::callProperty(IR::Expr *base, const QString &name, IR: void InstructionSelection::callSubscript(IR::Expr *base, IR::Expr *index, IR::ExprList *args, IR::Temp *result) { - assert(base != 0); + Q_ASSERT(base != 0); prepareCallData(args, base); generateFunctionCall(result, Runtime::callElement, Assembler::ContextRegister, @@ -1264,7 +1263,7 @@ void InstructionSelection::convertTypeToUInt32(IR::Temp *source, IR::Temp *targe void InstructionSelection::constructActivationProperty(IR::Name *func, IR::ExprList *args, IR::Temp *result) { - assert(func != 0); + Q_ASSERT(func != 0); prepareCallData(args, 0); if (useFastLookups && func->global) { @@ -1301,7 +1300,7 @@ void InstructionSelection::constructProperty(IR::Temp *base, const QString &name void InstructionSelection::constructValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result) { - assert(value != 0); + Q_ASSERT(value != 0); prepareCallData(args, 0); generateFunctionCall(result, Runtime::constructValue, @@ -1371,7 +1370,7 @@ void InstructionSelection::visitCJump(IR::CJump *s) Runtime::CompareOperationContext opContext = 0; const char *opName = 0; switch (b->op) { - default: Q_UNREACHABLE(); assert(!"todo"); break; + default: Q_UNREACHABLE(); Q_ASSERT(!"todo"); break; case IR::OpGt: setOp(op, opName, Runtime::compareGreaterThan); break; case IR::OpLt: setOp(op, opName, Runtime::compareLessThan); break; case IR::OpGe: setOp(op, opName, Runtime::compareGreaterEqual); break; diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp index 5fba40edac..b17ac17752 100644 --- a/src/qml/jsapi/qjsvalue.cpp +++ b/src/qml/jsapi/qjsvalue.cpp @@ -522,7 +522,7 @@ QJSValue QJSValue::call(const QJSValueList &args) return QJSValue(); ExecutionEngine *engine = d->engine; - assert(engine); + Q_ASSERT(engine); Scope scope(engine); ScopedCallData callData(scope, args.length()); @@ -571,7 +571,7 @@ QJSValue QJSValue::callWithInstance(const QJSValue &instance, const QJSValueList return QJSValue(); ExecutionEngine *engine = d->engine; - assert(engine); + Q_ASSERT(engine); Scope scope(engine); if (!instance.d->checkEngine(engine)) { @@ -623,7 +623,7 @@ QJSValue QJSValue::callAsConstructor(const QJSValueList &args) return QJSValue(); ExecutionEngine *engine = d->engine; - assert(engine); + Q_ASSERT(engine); Scope scope(engine); ScopedCallData callData(scope, args.size()); diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index bbf064b6f8..f2e7573452 100644 --- a/src/qml/jsruntime/qv4dateobject.cpp +++ b/src/qml/jsruntime/qv4dateobject.cpp @@ -51,7 +51,6 @@ #include <cmath> #include <qmath.h> #include <qnumeric.h> -#include <cassert> #include <time.h> #include <private/qqmljsengine_p.h> @@ -157,7 +156,7 @@ static inline bool InLeapYear(double t) if (x == 365) return 0; - assert(x == 366); + Q_ASSERT(x == 366); return 1; } diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp index 29615e8ec2..9d6403e7dd 100644 --- a/src/qml/jsruntime/qv4errorobject.cpp +++ b/src/qml/jsruntime/qv4errorobject.cpp @@ -50,7 +50,6 @@ #include <cmath> #include <qmath.h> #include <qnumeric.h> -#include <cassert> #include <private/qqmljsengine_p.h> #include <private/qqmljslexer_p.h> diff --git a/src/qml/jsruntime/qv4executableallocator.cpp b/src/qml/jsruntime/qv4executableallocator.cpp index 9b31524614..5c3419fd79 100644 --- a/src/qml/jsruntime/qv4executableallocator.cpp +++ b/src/qml/jsruntime/qv4executableallocator.cpp @@ -41,7 +41,6 @@ #include "qv4executableallocator_p.h" -#include <assert.h> #include <wtf/StdLibExtras.h> #include <wtf/PageAllocation.h> @@ -81,7 +80,7 @@ ExecutableAllocator::Allocation *ExecutableAllocator::Allocation::split(size_t d bool ExecutableAllocator::Allocation::mergeNext(ExecutableAllocator *allocator) { - assert(free); + Q_ASSERT(free); if (!next || !next->free) return false; @@ -101,7 +100,7 @@ bool ExecutableAllocator::Allocation::mergeNext(ExecutableAllocator *allocator) bool ExecutableAllocator::Allocation::mergePrevious(ExecutableAllocator *allocator) { - assert(free); + Q_ASSERT(free); if (!prev || !prev->free) return false; @@ -185,8 +184,8 @@ ExecutableAllocator::Allocation *ExecutableAllocator::allocate(size_t size) chunk->firstAllocation = allocation; } - assert(allocation); - assert(allocation->free); + Q_ASSERT(allocation); + Q_ASSERT(allocation->free); allocation->free = false; @@ -204,16 +203,16 @@ void ExecutableAllocator::free(Allocation *allocation) { QMutexLocker locker(&mutex); - assert(allocation); + Q_ASSERT(allocation); allocation->free = true; QMap<quintptr, ChunkOfPages*>::Iterator it = chunks.lowerBound(allocation->addr); if (it != chunks.begin()) --it; - assert(it != chunks.end()); + Q_ASSERT(it != chunks.end()); ChunkOfPages *chunk = *it; - assert(chunk->contains(allocation)); + Q_ASSERT(chunk->contains(allocation)); bool merged = allocation->mergeNext(this); merged |= allocation->mergePrevious(this); |