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
oxigraph-8.3.2
Peter Dillinger 2 years ago committed by Facebook GitHub Bot
parent 891ced8b15
commit b4d78189b3
  1. 19
      util/gflags_compat.h

@ -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

Loading…
Cancel
Save