Fix MinGW build
Summary: snprintf is defined as _snprintf, which doesn't exist in the std namespace. Closes https://github.com/facebook/rocksdb/pull/2298 Differential Revision: D5070457 Pulled By: yiwu-arbug fbshipit-source-id: 6e1659ac3e86170653b174578da5a8ed16812cbb
This commit is contained in:
parent
e4234fbdcf
commit
34ebadf930
@ -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()
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <limits>
|
||||
#include <condition_variable>
|
||||
#include <malloc.h>
|
||||
#include <intrin.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -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<int>::max();
|
||||
const uint64_t kMaxUint64 = std::numeric_limits<uint64_t>::max();
|
||||
const int64_t kMaxInt64 = std::numeric_limits<int64_t>::max();
|
||||
|
||||
const size_t kMaxSizet = std::numeric_limits<size_t>::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<int>::max();
|
||||
const uint64_t kMaxUint64 = std::numeric_limits<uint64_t>::max();
|
||||
const int64_t kMaxInt64 = std::numeric_limits<int64_t>::max();
|
||||
|
||||
const size_t kMaxSizet = std::numeric_limits<size_t>::max();
|
||||
|
||||
#endif //_MSC_VER
|
||||
|
||||
const bool kLittleEndian = true;
|
||||
|
Loading…
Reference in New Issue
Block a user