Codechange: use "[[maybe_unused]]" instead of a wide variety of other ways we had

While at it, replace OTTD_ASSERT with WITH_ASSERT, as this
is always set if assert() is valid. No matter if NDEBUG is set
or not.
This commit is contained in:
Patric Stout
2021-06-03 16:55:08 +02:00
committed by Patric Stout
parent f8dd5dd00a
commit 28e90769f7
21 changed files with 37 additions and 73 deletions

View File

@@ -835,8 +835,7 @@ public:
nkeys++;
SQInteger val = _fs->PopTarget();
SQInteger key = _fs->PopTarget();
SQInteger attrs = hasattrs ? _fs->PopTarget():-1;
(void)attrs; // assert only
[[maybe_unused]] SQInteger attrs = hasattrs ? _fs->PopTarget():-1;
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

View File

@@ -1471,9 +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)
{
#ifdef WITH_ASSERT
SQInteger prevstackbase = _stackbase;
#endif
[[maybe_unused]] SQInteger prevstackbase = _stackbase;
switch(type(closure)) {
case OT_CLOSURE: {
assert(!can_suspend || this->_can_suspend);
@@ -1504,11 +1502,9 @@ bool SQVM::Call(SQObjectPtr &closure,SQInteger nparams,SQInteger stackbase,SQObj
default:
return false;
}
#ifdef WITH_ASSERT
if(!_suspended) {
assert(_stackbase == prevstackbase);
}
#endif
return true;
}