mirror of https://github.com/facebook/rocksdb.git
Fix mingw compilation with -DNDEBUG
Summary:
This was exposed by a48a62d
, which made NDEBUG the default for cmake
builds.
Closes https://github.com/facebook/rocksdb/pull/2315
Differential Revision: D5079583
Pulled By: sagar0
fbshipit-source-id: c614e96a40df016a834a62b6236852265e7ee4db
This commit is contained in:
parent
a36220ccfb
commit
146b7718f0
|
@ -1079,13 +1079,19 @@ std::string Env::GenerateUniqueId() {
|
||||||
UuidCreateSequential(&uuid);
|
UuidCreateSequential(&uuid);
|
||||||
|
|
||||||
RPC_CSTR rpc_str;
|
RPC_CSTR rpc_str;
|
||||||
auto status = UuidToStringA(&uuid, &rpc_str);
|
#ifndef NDEBUG
|
||||||
assert(status == RPC_S_OK);
|
assert(UuidToStringA(&uuid, &rpc_str) == RPC_S_OK);
|
||||||
|
#else
|
||||||
|
UuidToStringA(&uuid, &rpc_str);
|
||||||
|
#endif
|
||||||
|
|
||||||
result = reinterpret_cast<char*>(rpc_str);
|
result = reinterpret_cast<char*>(rpc_str);
|
||||||
|
|
||||||
status = RpcStringFreeA(&rpc_str);
|
#ifndef NDEBUG
|
||||||
assert(status == RPC_S_OK);
|
assert(RpcStringFreeA(&rpc_str) == RPC_S_OK);
|
||||||
|
#else
|
||||||
|
RpcStringFreeA(&rpc_str);
|
||||||
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ bool IsPowerOfTwo(const size_t alignment) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
bool IsSectorAligned(const size_t off) {
|
bool IsSectorAligned(const size_t off) {
|
||||||
return (off & (kSectorSize - 1)) == 0;
|
return (off & (kSectorSize - 1)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,11 +194,13 @@ WinMmapReadableFile::WinMmapReadableFile(const std::string& fileName,
|
||||||
length_(length) {}
|
length_(length) {}
|
||||||
|
|
||||||
WinMmapReadableFile::~WinMmapReadableFile() {
|
WinMmapReadableFile::~WinMmapReadableFile() {
|
||||||
BOOL ret = ::UnmapViewOfFile(mapped_region_);
|
#ifndef NDEBUG
|
||||||
assert(ret);
|
assert(::UnmapViewOfFile(mapped_region_));
|
||||||
|
assert(::CloseHandle(hMap_));
|
||||||
ret = ::CloseHandle(hMap_);
|
#else
|
||||||
assert(ret);
|
::UnmapViewOfFile(mapped_region_);
|
||||||
|
::CloseHandle(hMap_);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Status WinMmapReadableFile::Read(uint64_t offset, size_t n, Slice* result,
|
Status WinMmapReadableFile::Read(uint64_t offset, size_t n, Slice* result,
|
||||||
|
@ -745,7 +747,9 @@ Status WinWritableImpl::AppendImpl(const Slice& data) {
|
||||||
|
|
||||||
assert(data.size() < std::numeric_limits<DWORD>::max());
|
assert(data.size() < std::numeric_limits<DWORD>::max());
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
uint64_t written = 0;
|
uint64_t written = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (file_data_->use_direct_io()) {
|
if (file_data_->use_direct_io()) {
|
||||||
|
|
||||||
|
@ -765,7 +769,9 @@ Status WinWritableImpl::AppendImpl(const Slice& data) {
|
||||||
"Failed to pwrite for: " + file_data_->GetName(), lastError);
|
"Failed to pwrite for: " + file_data_->GetName(), lastError);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
#ifndef NDEBUG
|
||||||
written = ret;
|
written = ret;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -779,7 +785,9 @@ Status WinWritableImpl::AppendImpl(const Slice& data) {
|
||||||
lastError);
|
lastError);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
#ifndef NDEBUG
|
||||||
written = bytesWritten;
|
written = bytesWritten;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue