Define DECLARE_VARIABLE in portability/GFlags.h
authorChristopher Dykes <cdykes@fb.com>
Tue, 26 Apr 2016 16:38:18 +0000 (09:38 -0700)
committerFacebook Github Bot 9 <facebook-github-bot-9-bot@fb.com>
Tue, 26 Apr 2016 16:50:20 +0000 (09:50 -0700)
Summary: If we don't, then anywhere we include `glog/logging.h` after the portability header will get the `DECLARE_*` and `DEFINE_*` macros undefined -_-....

Reviewed By: mzlee

Differential Revision: D3220797

fb-gh-sync-id: 52907ddcd6b222fb1c6423034ea999eac5ce09ab
fbshipit-source-id: 52907ddcd6b222fb1c6423034ea999eac5ce09ab

folly/portability/GFlags.h

index e3890eab869237d3092f25ed6dd85eebfdaa3372..846bdc1ec4bc89bc5257a4f73f76f3b27d701835 100644 (file)
 #if FOLLY_HAVE_LIBGFLAGS
 #include <gflags/gflags.h>
 #else
+// glog/logging.h is dependent on this implementation detail
+// being defined otherwise it undefines all of this -_-....
+//
+// Also, this is deliberately expanded such that places using
+// it directly break loudly. (C will break louder than C++, but oh well)
+#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)