提交 b47cfec5 编写于 作者: H Huisheng Liu 提交者: Facebook Github Bot

fix compilation error on MSVC (#5458)

Summary:
"__attribute__((__weak__))" was introduced in port\jemalloc_helper.h. It's not supported by Microsoft VS 2015, resulting in compile error. This fix adds a #if branch to work around the compile issue.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5458

Differential Revision: D15827285

fbshipit-source-id: 8c5f7ad31de1ac677bd96f16c4450767de834beb
上级 58c78358
......@@ -16,6 +16,14 @@
#define JEMALLOC_CXX_THROW
#endif
#if defined(OS_WIN) && defined(_MSC_VER)
// MSVC does not have weak symbol support. As long as ROCKSDB_JEMALLOC is defined,
// Jemalloc memory allocator is used.
static inline bool HasJemalloc() { return true; }
#else
// Declare non-standard jemalloc APIs as weak symbols. We can null-check these
// symbols to detect whether jemalloc is linked with the binary.
extern "C" void* mallocx(size_t, int) __attribute__((__weak__));
......@@ -50,4 +58,6 @@ static inline bool HasJemalloc() {
malloc_stats_print != nullptr && malloc_usable_size != nullptr;
}
#endif
#endif // ROCKSDB_JEMALLOC
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册