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 val = _fs->PopTarget();
|
||||||
SQInteger key = _fs->PopTarget();
|
SQInteger key = _fs->PopTarget();
|
||||||
SQInteger attrs = hasattrs ? _fs->PopTarget():-1;
|
SQInteger attrs = hasattrs ? _fs->PopTarget():-1;
|
||||||
|
(void)attrs; // assert only
|
||||||
assert((hasattrs && attrs == key-1) || !hasattrs);
|
assert((hasattrs && attrs == key-1) || !hasattrs);
|
||||||
unsigned char flags = (hasattrs?NEW_SLOT_ATTRIBUTES_FLAG:0)|(isstatic?NEW_SLOT_STATIC_FLAG:0);
|
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
|
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);
|
SQVM *vms = _thread(_root_vm);
|
||||||
|
|
||||||
vms->Mark(&tchain);
|
vms->Mark(&tchain);
|
||||||
|
#ifndef NDEBUG
|
||||||
SQInteger x = _table(_thread(_root_vm)->_roottable)->CountUsed();
|
SQInteger x = _table(_thread(_root_vm)->_roottable)->CountUsed();
|
||||||
|
#endif
|
||||||
_refs_table.Mark(&tchain);
|
_refs_table.Mark(&tchain);
|
||||||
MarkObject(_registry,&tchain);
|
MarkObject(_registry,&tchain);
|
||||||
MarkObject(_consts,&tchain);
|
MarkObject(_consts,&tchain);
|
||||||
|
@ -289,8 +291,10 @@ SQInteger SQSharedState::CollectGarbage(SQVM *vm)
|
||||||
t = t->_next;
|
t = t->_next;
|
||||||
}
|
}
|
||||||
_gc_chain = tchain;
|
_gc_chain = tchain;
|
||||||
|
#ifndef NDEBUG
|
||||||
SQInteger z = _table(_thread(_root_vm)->_roottable)->CountUsed();
|
SQInteger z = _table(_thread(_root_vm)->_roottable)->CountUsed();
|
||||||
assert(z == x);
|
assert(z == x);
|
||||||
|
#endif
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1471,7 +1471,7 @@ 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)
|
bool SQVM::Call(SQObjectPtr &closure,SQInteger nparams,SQInteger stackbase,SQObjectPtr &outres,SQBool raiseerror,SQBool can_suspend)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
SQInteger prevstackbase = _stackbase;
|
SQInteger prevstackbase = _stackbase;
|
||||||
#endif
|
#endif
|
||||||
switch(type(closure)) {
|
switch(type(closure)) {
|
||||||
|
@ -1504,7 +1504,7 @@ SQInteger prevstackbase = _stackbase;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
if(!_suspended) {
|
if(!_suspended) {
|
||||||
assert(_stackbase == prevstackbase);
|
assert(_stackbase == prevstackbase);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,13 +61,14 @@ protected:
|
||||||
name(name), description(description)
|
name(name), description(description)
|
||||||
{
|
{
|
||||||
if (usable) {
|
if (usable) {
|
||||||
|
Blitters &blitters = GetBlitters();
|
||||||
|
assert(blitters.find(this->name) == blitters.end());
|
||||||
/*
|
/*
|
||||||
* Only add when the blitter is usable. Do not bail out or
|
* Only add when the blitter is usable. Do not bail out or
|
||||||
* do more special things since the blitters are always
|
* do more special things since the blitters are always
|
||||||
* instantiated upon start anyhow and freed upon shutdown.
|
* instantiated upon start anyhow and freed upon shutdown.
|
||||||
*/
|
*/
|
||||||
std::pair<Blitters::iterator, bool> P = GetBlitters().insert(Blitters::value_type(this->name, this));
|
blitters.insert(Blitters::value_type(this->name, this));
|
||||||
assert(P.second);
|
|
||||||
} else {
|
} else {
|
||||||
DEBUG(driver, 1, "Not registering blitter %s as it is not usable", name);
|
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)
|
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 */
|
/* Initialize procs */
|
||||||
_npf_aystar.max_path_cost = max_penalty;
|
_npf_aystar.max_path_cost = max_penalty;
|
||||||
_npf_aystar.CalculateH = heuristic_proc;
|
_npf_aystar.CalculateH = heuristic_proc;
|
||||||
|
@ -1032,6 +1029,7 @@ static NPFFoundTargetData NPFRouteInternal(AyStarNode *start1, bool ignore_start
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize result */
|
/* Initialize result */
|
||||||
|
NPFFoundTargetData result;
|
||||||
result.best_bird_dist = UINT_MAX;
|
result.best_bird_dist = UINT_MAX;
|
||||||
result.best_path_dist = UINT_MAX;
|
result.best_path_dist = UINT_MAX;
|
||||||
result.best_trackdir = INVALID_TRACKDIR;
|
result.best_trackdir = INVALID_TRACKDIR;
|
||||||
|
@ -1046,7 +1044,8 @@ static NPFFoundTargetData NPFRouteInternal(AyStarNode *start1, bool ignore_start
|
||||||
_npf_aystar.user_data = user;
|
_npf_aystar.user_data = user;
|
||||||
|
|
||||||
/* GO! */
|
/* GO! */
|
||||||
r = _npf_aystar.Main();
|
int r = _npf_aystar.Main();
|
||||||
|
(void)r; // assert only
|
||||||
assert(r != AYSTAR_STILL_BUSY);
|
assert(r != AYSTAR_STILL_BUSY);
|
||||||
|
|
||||||
if (result.best_bird_dist != 0) {
|
if (result.best_bird_dist != 0) {
|
||||||
|
|
Loading…
Reference in New Issue