diff --git a/CMakeLists.txt b/CMakeLists.txt index 54e6de280..cd6e11133 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,7 +148,7 @@ if(MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FC /d2Zi+ /W3 /wd4127 /wd4800 /wd4996 /wd4351") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wextra -Wall") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-compare -Wshadow -Wno-unused-parameter -Wno-unused-variable -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-compare -Wshadow -Wno-unused-parameter -Wno-unused-variable -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-strict-aliasing") if(MINGW) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format") endif() diff --git a/port/win/port_win.h b/port/win/port_win.h index 408bc63db..e32d0a932 100644 --- a/port/win/port_win.h +++ b/port/win/port_win.h @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -80,19 +81,8 @@ namespace rocksdb { namespace port { -// VS 15 -#if (defined _MSC_VER) && (_MSC_VER >= 1900) - -#define ROCKSDB_NOEXCEPT noexcept - -// For use at db/file_indexer.h kLevelMaxIndex -const int kMaxInt32 = std::numeric_limits::max(); -const uint64_t kMaxUint64 = std::numeric_limits::max(); -const int64_t kMaxInt64 = std::numeric_limits::max(); - -const size_t kMaxSizet = std::numeric_limits::max(); - -#else //_MSC_VER +// VS < 2015 +#if defined(_MSC_VER) && (_MSC_VER < 1900) // VS 15 has snprintf #define snprintf _snprintf @@ -112,6 +102,17 @@ const size_t kMaxSizet = UINT64_MAX; const size_t kMaxSizet = UINT_MAX; #endif +#else // VS >= 2015 or MinGW + +#define ROCKSDB_NOEXCEPT noexcept + +// For use at db/file_indexer.h kLevelMaxIndex +const int kMaxInt32 = std::numeric_limits::max(); +const uint64_t kMaxUint64 = std::numeric_limits::max(); +const int64_t kMaxInt64 = std::numeric_limits::max(); + +const size_t kMaxSizet = std::numeric_limits::max(); + #endif //_MSC_VER const bool kLittleEndian = true;