Commit b609f8ee authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 5

Have the GFlags portability header stick things in namespaces

Summary:
Just like the real thing does.
This was causing some issues when trying to link against glog, which expects the flags to be namespaced like this.

Reviewed By: mzlee

Differential Revision: D3230630

fb-gh-sync-id: a73ab3044560d561a39eb91ceee1588c147a46c5
fbshipit-source-id: a73ab3044560d561a39eb91ceee1588c147a46c5
parent 5022d546
......@@ -27,25 +27,35 @@
#define DECLARE_VARIABLE() \
static_assert(false, "You shouldn't be using GFlags internals.");
#define FOLLY_DECLARE_FLAG(_type, _name) extern _type FLAGS_##_name
#define DECLARE_bool(_name) FOLLY_DECLARE_FLAG(bool, _name)
#define DECLARE_double(_name) FOLLY_DECLARE_FLAG(double, _name)
#define DECLARE_int32(_name) FOLLY_DECLARE_FLAG(int, _name)
#define DECLARE_int64(_name) FOLLY_DECLARE_FLAG(long long, _name)
#define DECLARE_uint64(_name) FOLLY_DECLARE_FLAG(unsigned long long, _name)
#define DECLARE_string(_name) FOLLY_DECLARE_FLAG(std::string, _name)
#define FOLLY_DECLARE_FLAG(_type, _shortType, _name) \
namespace fL##_shortType { \
extern _type FLAGS_##_name; \
} \
using fL##_shortType::FLAGS_##_name
#define DECLARE_bool(_name) FOLLY_DECLARE_FLAG(bool, B, _name)
#define DECLARE_double(_name) FOLLY_DECLARE_FLAG(double, D, _name)
#define DECLARE_int32(_name) FOLLY_DECLARE_FLAG(int, I, _name)
#define DECLARE_int64(_name) FOLLY_DECLARE_FLAG(long long, I64, _name)
#define DECLARE_uint64(_name) FOLLY_DECLARE_FLAG(unsigned long long, U64, _name)
#define DECLARE_string(_name) FOLLY_DECLARE_FLAG(std::string, S, _name)
#define FOLLY_DEFINE_FLAG(_type, _shortType, _name, _default) \
namespace fL##_shortType { \
_type FLAGS_##_name = _default; \
} \
using fL##_shortType::FLAGS_##_name
#define FOLLY_DEFINE_FLAG(_type, _name, _default) _type FLAGS_##_name = _default
#define DEFINE_bool(_name, _default, _description) \
FOLLY_DEFINE_FLAG(bool, _name, _default)
FOLLY_DEFINE_FLAG(bool, B, _name, _default)
#define DEFINE_double(_name, _default, _description) \
FOLLY_DEFINE_FLAG(double, _name, _default)
FOLLY_DEFINE_FLAG(double, D, _name, _default)
#define DEFINE_int32(_name, _default, _description) \
FOLLY_DEFINE_FLAG(int, _name, _default)
FOLLY_DEFINE_FLAG(int, I, _name, _default)
#define DEFINE_int64(_name, _default, _description) \
FOLLY_DEFINE_FLAG(long long, _name, _default)
FOLLY_DEFINE_FLAG(long long, I64, _name, _default)
#define DEFINE_uint64(_name, _default, _description) \
FOLLY_DEFINE_FLAG(unsigned long long, _name, _default)
FOLLY_DEFINE_FLAG(unsigned long long, U64, _name, _default)
#define DEFINE_string(_name, _default, _description) \
FOLLY_DEFINE_FLAG(std::string, _name, _default)
FOLLY_DEFINE_FLAG(std::string, S, _name, _default)
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment