提交 b4d78189 编写于 作者: P Peter Dillinger 提交者: Facebook GitHub Bot

Fix gflags_compat.h (#11346)

Summary:
Was getting compilation failure with old verison of gflags, examples in https://github.com/facebook/rocksdb/issues/11344.  Perhaps this is new since enabling C++17. Getting rid of std::reference_wrapper from https://github.com/facebook/rocksdb/issues/10729 seems to fix it.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/11346

Test Plan: manual, CI

Reviewed By: guowentian

Differential Revision: D44632776

Pulled By: pdillinger

fbshipit-source-id: 5c1f3f79a055698574538b6342c912a627b6d061
上级 891ced8b
......@@ -15,16 +15,15 @@
#endif
#ifndef DEFINE_uint32
// DEFINE_uint32 does not appear in older versions of gflags. This should be
// a sane definition for those versions.
// DEFINE_uint32 / DECLARE_uint32 do not appear in older versions of gflags.
// These should be sane definitions for those versions.
#include <cstdint>
#define DEFINE_uint32(name, val, txt) \
namespace gflags_compat { \
DEFINE_int32(name, val, txt); \
} \
std::reference_wrapper<uint32_t> FLAGS_##name = \
std::ref(*reinterpret_cast<uint32_t *>(&gflags_compat::FLAGS_##name));
#define DEFINE_uint32(name, val, txt) \
namespace gflags_compat { \
DEFINE_int32(name, val, txt); \
} \
uint32_t &FLAGS_##name = \
*reinterpret_cast<uint32_t *>(&gflags_compat::FLAGS_##name);
#define DECLARE_uint32(name) \
extern std::reference_wrapper<uint32_t> FLAGS_##name;
#define DECLARE_uint32(name) extern uint32_t &FLAGS_##name;
#endif // !DEFINE_uint32
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册