diff options
-rw-r--r-- | src/core/math_func.hpp | 4 | ||||
-rw-r--r-- | src/saveload/oldloader.cpp | 2 | ||||
-rw-r--r-- | src/saveload/saveload.cpp | 5 | ||||
-rw-r--r-- | src/stdafx.h | 10 |
4 files changed, 10 insertions, 11 deletions
diff --git a/src/core/math_func.hpp b/src/core/math_func.hpp index 35e660d88..2088f253c 100644 --- a/src/core/math_func.hpp +++ b/src/core/math_func.hpp @@ -116,12 +116,10 @@ static FORCEINLINE T Align(const T x, uint n) * @return The smallest multiple of n equal or greater than x * @see Align() */ - -assert_compile(sizeof(size_t) == sizeof(void *)); - template <typename T> static FORCEINLINE T *AlignPtr(T *x, uint n) { + assert_compile(sizeof(size_t) == sizeof(void *)); return (T *)Align((size_t)x, n); } diff --git a/src/saveload/oldloader.cpp b/src/saveload/oldloader.cpp index ba26d66a2..812b8ad99 100644 --- a/src/saveload/oldloader.cpp +++ b/src/saveload/oldloader.cpp @@ -237,9 +237,9 @@ static inline bool CheckOldSavegameType(FILE *f, char *temp, const char *last, u return ret; } -assert_compile(TTD_HEADER_SIZE >= TTO_HEADER_SIZE); static SavegameType DetermineOldSavegameType(FILE *f, char *title, const char *last) { + assert_compile(TTD_HEADER_SIZE >= TTO_HEADER_SIZE); char temp[TTD_HEADER_SIZE]; SavegameType type = SGT_TTO; diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 1ac00f7ab..46c6104e6 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -1498,11 +1498,10 @@ static size_t ReferenceToInt(const void *obj, SLRefType rt) * @param rt SLRefType type of the object the pointer is sought of * @return Return the index converted to a pointer of any type */ - -assert_compile(sizeof(size_t) <= sizeof(void *)); - static void *IntToReference(size_t index, SLRefType rt) { + assert_compile(sizeof(size_t) <= sizeof(void *)); + assert(_sl.action == SLA_PTRS); /* After version 4.3 REF_VEHICLE_OLD is saved as REF_VEHICLE, diff --git a/src/stdafx.h b/src/stdafx.h index 24c9e799d..ca6504091 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -123,6 +123,7 @@ #define CDECL #define __int64 long long #define GCC_PACK __attribute__((packed)) + #define UNUSED __attribute__((unused)) /* Warn about functions using 'printf' format syntax. First argument determines which parameter * is the format string, second argument is start of values passed to printf. */ #define WARN_FORMAT(string, args) __attribute__ ((format (printf, string, args))) @@ -133,6 +134,7 @@ #define FORCEINLINE inline #define CDECL #define GCC_PACK + #define UNUSED #define WARN_FORMAT(string, args) #include <malloc.h> #endif /* __WATCOMC__ */ @@ -184,6 +186,9 @@ #define CDECL _cdecl #endif + #define GCC_PACK + #define UNUSED + int CDECL snprintf(char *str, size_t size, const char *format, ...) WARN_FORMAT(3, 4); #if defined(WINCE) int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap); @@ -202,9 +207,6 @@ #define fseek _fseeki64 #endif /* _WIN64 || WIN64 */ - - #define GCC_PACK - /* This is needed to zlib uses the stdcall calling convention on visual studio */ #if defined(WITH_ZLIB) || defined(WITH_PNG) #if !defined(ZLIB_WINAPI) @@ -304,7 +306,7 @@ typedef unsigned char byte; #if defined(__OS2__) #define assert_compile(expr) #else - #define assert_compile(expr) extern const int __ct_assert__[1 - 2 * !(expr)] + #define assert_compile(expr) extern const int __ct_assert__[1 - 2 * !(expr)] UNUSED #endif /* __OS2__ */ /* Check if the types have the bitsizes like we are using them */ |