C++: Use soft asserts instead of assert()

Some qmake versions ignore "DEFINES += NDEBUG" on Windows.

Change-Id: Ibdf3b1036c2331dcef61dcd278463c02754044d2
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2013-05-13 10:20:00 +02:00
parent 9fa9c227db
commit c426b71334
11 changed files with 113 additions and 53 deletions

View File

@@ -23,7 +23,9 @@
#include "Names.h"
#include "Literals.h"
#include "Templates.h"
#include <cassert>
#include "cppassert.h"
#include <cstring>
using namespace CPlusPlus;
@@ -107,6 +109,8 @@ SymbolTable::~SymbolTable()
void SymbolTable::enterSymbol(Symbol *symbol)
{
CPP_ASSERT(! symbol->_scope || symbol->enclosingScope() == _owner, return);
if (++_symbolCount == _allocatedSymbols) {
_allocatedSymbols <<= 1;
if (! _allocatedSymbols)
@@ -115,7 +119,6 @@ void SymbolTable::enterSymbol(Symbol *symbol)
_symbols = reinterpret_cast<Symbol **>(realloc(_symbols, sizeof(Symbol *) * _allocatedSymbols));
}
assert(! symbol->_scope || symbol->enclosingScope() == _owner);
symbol->_index = _symbolCount;
symbol->_scope = _owner;
_symbols[_symbolCount] = symbol;