summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.lib3
-rw-r--r--src/saveload/saveload.cpp6
2 files changed, 9 insertions, 0 deletions
diff --git a/config.lib b/config.lib
index bf52a94c1..196e908f5 100644
--- a/config.lib
+++ b/config.lib
@@ -1404,6 +1404,9 @@ make_compiler_cflags() {
# warning: narrowing conversion of '...' from 'unsigned int' to 'int' inside { } [-Wnarrowing]
# They are valid according to the C++ standard, but useless.
cxxflags="$cxxflags -Wno-narrowing"
+ fi
+
+ if [ $cc_version -ge 407 ]; then
# Disable bogus 'attempt to free a non-heap object' warning
flags="$flags -Wno-free-nonheap-object"
fi
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 87df2c3a6..fcda489fa 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -1484,6 +1484,8 @@ 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.
@@ -1524,9 +1526,13 @@ 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) {