mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Suppress warnings when asserts are disabled (#8916)
parent
088964a091
commit
591ea9862d
|
@ -836,6 +836,7 @@ public:
|
|||
SQInteger val = _fs->PopTarget();
|
||||
SQInteger key = _fs->PopTarget();
|
||||
SQInteger attrs = hasattrs ? _fs->PopTarget():-1;
|
||||
(void)attrs; // assert only
|
||||
assert((hasattrs && attrs == key-1) || !hasattrs);
|
||||
unsigned char flags = (hasattrs?NEW_SLOT_ATTRIBUTES_FLAG:0)|(isstatic?NEW_SLOT_STATIC_FLAG:0);
|
||||
SQInteger table = _fs->TopTarget(); //<<BECAUSE OF THIS NO COMMON EMIT FUNC IS POSSIBLE
|
||||
|
|
|
@ -252,7 +252,9 @@ SQInteger SQSharedState::CollectGarbage(SQVM *vm)
|
|||
SQVM *vms = _thread(_root_vm);
|
||||
|
||||
vms->Mark(&tchain);
|
||||
#ifndef NDEBUG
|
||||
SQInteger x = _table(_thread(_root_vm)->_roottable)->CountUsed();
|
||||
#endif
|
||||
_refs_table.Mark(&tchain);
|
||||
MarkObject(_registry,&tchain);
|
||||
MarkObject(_consts,&tchain);
|
||||
|
@ -289,8 +291,10 @@ SQInteger SQSharedState::CollectGarbage(SQVM *vm)
|
|||
t = t->_next;
|
||||
}
|
||||
_gc_chain = tchain;
|
||||
#ifndef NDEBUG
|
||||
SQInteger z = _table(_thread(_root_vm)->_roottable)->CountUsed();
|
||||
assert(z == x);
|
||||
#endif
|
||||
return n;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1471,8 +1471,8 @@ bool SQVM::DeleteSlot(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr
|
|||
|
||||
bool SQVM::Call(SQObjectPtr &closure,SQInteger nparams,SQInteger stackbase,SQObjectPtr &outres,SQBool raiseerror,SQBool can_suspend)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
SQInteger prevstackbase = _stackbase;
|
||||
#ifndef NDEBUG
|
||||
SQInteger prevstackbase = _stackbase;
|
||||
#endif
|
||||
switch(type(closure)) {
|
||||
case OT_CLOSURE: {
|
||||
|
@ -1504,7 +1504,7 @@ SQInteger prevstackbase = _stackbase;
|
|||
default:
|
||||
return false;
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
if(!_suspended) {
|
||||
assert(_stackbase == prevstackbase);
|
||||
}
|
||||
|
|
|
@ -61,13 +61,14 @@ protected:
|
|||
name(name), description(description)
|
||||
{
|
||||
if (usable) {
|
||||
Blitters &blitters = GetBlitters();
|
||||
assert(blitters.find(this->name) == blitters.end());
|
||||
/*
|
||||
* Only add when the blitter is usable. Do not bail out or
|
||||
* do more special things since the blitters are always
|
||||
* instantiated upon start anyhow and freed upon shutdown.
|
||||
*/
|
||||
std::pair<Blitters::iterator, bool> P = GetBlitters().insert(Blitters::value_type(this->name, this));
|
||||
assert(P.second);
|
||||
blitters.insert(Blitters::value_type(this->name, this));
|
||||
} else {
|
||||
DEBUG(driver, 1, "Not registering blitter %s as it is not usable", name);
|
||||
}
|
||||
|
|
|
@ -1000,9 +1000,6 @@ static void NPFFollowTrack(AyStar *aystar, OpenListNode *current)
|
|||
*/
|
||||
static NPFFoundTargetData NPFRouteInternal(AyStarNode *start1, bool ignore_start_tile1, AyStarNode *start2, bool ignore_start_tile2, NPFFindStationOrTileData *target, AyStar_EndNodeCheck target_proc, AyStar_CalculateH heuristic_proc, AyStarUserData *user, uint reverse_penalty, bool ignore_reserved = false, int max_penalty = 0)
|
||||
{
|
||||
int r;
|
||||
NPFFoundTargetData result;
|
||||
|
||||
/* Initialize procs */
|
||||
_npf_aystar.max_path_cost = max_penalty;
|
||||
_npf_aystar.CalculateH = heuristic_proc;
|
||||
|
@ -1032,6 +1029,7 @@ static NPFFoundTargetData NPFRouteInternal(AyStarNode *start1, bool ignore_start
|
|||
}
|
||||
|
||||
/* Initialize result */
|
||||
NPFFoundTargetData result;
|
||||
result.best_bird_dist = UINT_MAX;
|
||||
result.best_path_dist = UINT_MAX;
|
||||
result.best_trackdir = INVALID_TRACKDIR;
|
||||
|
@ -1046,7 +1044,8 @@ static NPFFoundTargetData NPFRouteInternal(AyStarNode *start1, bool ignore_start
|
|||
_npf_aystar.user_data = user;
|
||||
|
||||
/* GO! */
|
||||
r = _npf_aystar.Main();
|
||||
int r = _npf_aystar.Main();
|
||||
(void)r; // assert only
|
||||
assert(r != AYSTAR_STILL_BUSY);
|
||||
|
||||
if (result.best_bird_dist != 0) {
|
||||
|
|
Loading…
Reference in New Issue