Made to compile by MSVC 2015/2017 32 bit compilers (#101)

Patches by @anatoly-spb :
1. Get rid of -DWIN64, -DZLIB_WINAPI in 32-bit build for fixing zlib linkage;
2. Work around MSVC2015 limitation based on lacking the C++14 features (like void as literal type) and document it.
This commit is contained in:
Anatoly Shirokov 2018-02-13 16:13:14 +03:00 committed by Alex
parent 7320149f22
commit b1c7c6fc61
3 changed files with 11 additions and 4 deletions

View File

@ -582,9 +582,9 @@ endif()
if (WIN32) if (WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_USING_V110_SDK71_ add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_USING_V110_SDK71_
-DWIN32 -D_WINDOWS -D_UNICODE -DUNICODE -DWIN64 -DWIN32 -D_WINDOWS -D_UNICODE -DUNICODE
-DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP
-DHAVE_STDINT_H -DZLIB_WINAPI) -DHAVE_STDINT_H)
endif() endif()
add_definitions(-DAL_LIBTYPE_STATIC) add_definitions(-DAL_LIBTYPE_STATIC)

View File

@ -43,10 +43,17 @@ inline constexpr void noop() {
std::abort(); std::abort();
} }
inline constexpr void validate(bool condition, const char *message, const char *file, int line) { // Since MSVC 2015 cannot understand "constexpr void" (void is literal since C++14)
// we have to use conditional compilation
inline
#if !defined(_MSC_VER) || (_MSC_VER > 1900)
constexpr
#endif
void validate(bool condition, const char *message, const char *file, int line) {
(GSL_UNLIKELY(!(condition))) ? fail(message, file, line) : noop(); (GSL_UNLIKELY(!(condition))) ? fail(message, file, line) : noop();
} }
} // namespace assertion } // namespace assertion
} // namespace base } // namespace base

View File

@ -54,4 +54,4 @@ void as_const(const T&&) = delete;
#include <cstdint> #include <cstdint>
#define qsl(s) QStringLiteral(s) #define qsl(s) QStringLiteral(s)
#define qstr(s) QLatin1String(s, sizeof(s) - 1) #define qstr(s) QLatin1String(s, static_cast<int>(sizeof(s)-1))