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

@@ -1474,14 +1474,12 @@ size_t SlCalcObjMemberLength(const void *object, const SaveLoad &sld)
return 0;
}
#ifdef OTTD_ASSERT
/**
* Check whether the variable size of the variable in the saveload configuration
* matches with the actual variable size.
* @param sld The saveload configuration to test.
*/
static bool IsVariableSizeRight(const SaveLoad &sld)
[[maybe_unused]] static bool IsVariableSizeRight(const SaveLoad &sld)
{
switch (sld.cmd) {
case SL_VAR:
@@ -1522,13 +1520,9 @@ static bool IsVariableSizeRight(const SaveLoad &sld)
}
}
#endif /* OTTD_ASSERT */
bool SlObjectMember(void *ptr, const SaveLoad &sld)
{
#ifdef OTTD_ASSERT
assert(IsVariableSizeRight(sld));
#endif
VarType conv = GB(sld.conv, 0, 8);
switch (sld.cmd) {