summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-06-03 16:55:08 +0200
committerPatric Stout <github@truebrain.nl>2021-06-03 17:30:00 +0200
commit28e90769f74e55ea7c8f75146d5b33e0aa777da8 (patch)
treeeeff0974346ef9da7cbc2b33b040d016c341ff0b /src/saveload
parentf8dd5dd00a7aa3cc5769b4bce0a1b7a63073c8ce (diff)
downloadopenttd-28e90769f74e55ea7c8f75146d5b33e0aa777da8.tar.xz
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.
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/saveload.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index f056404b5..01f0e0fd3 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -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) {