From 28e90769f74e55ea7c8f75146d5b33e0aa777da8 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Thu, 3 Jun 2021 16:55:08 +0200 Subject: 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. --- src/saveload/saveload.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/saveload') 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) { -- cgit v1.2.3-70-g09d2