Make glog ABI compatible with gflags
The ABI incompatibility is bad when - Build glog without gflags (glog package in most distributions doesn't depend on gflags) - Use both glog and gflags git-svn-id: https://google-glog.googlecode.com/svn/trunk@125 eb4d4688-79bd-11dd-afb4-1d65580434c0
This commit is contained in:
parent
3b59339f08
commit
c4c25e85fd
@ -61,43 +61,44 @@
|
|||||||
|
|
||||||
#include "glog/logging.h"
|
#include "glog/logging.h"
|
||||||
|
|
||||||
#define DECLARE_VARIABLE(type, name, tn) \
|
#define DECLARE_VARIABLE(type, shorttype, name, tn) \
|
||||||
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead { \
|
namespace fL##shorttype { \
|
||||||
extern GOOGLE_GLOG_DLL_DECL type FLAGS_##name; \
|
extern GOOGLE_GLOG_DLL_DECL type FLAGS_##name; \
|
||||||
} \
|
} \
|
||||||
using FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead::FLAGS_##name
|
using fL##shorttype::FLAGS_##name
|
||||||
#define DEFINE_VARIABLE(type, name, value, meaning, tn) \
|
#define DEFINE_VARIABLE(type, shorttype, name, value, meaning, tn) \
|
||||||
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead { \
|
namespace fL##shorttype { \
|
||||||
GOOGLE_GLOG_DLL_DECL type FLAGS_##name(value); \
|
GOOGLE_GLOG_DLL_DECL type FLAGS_##name(value); \
|
||||||
char FLAGS_no##name; \
|
char FLAGS_no##name; \
|
||||||
} \
|
} \
|
||||||
using FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead::FLAGS_##name
|
using fL##shorttype::FLAGS_##name
|
||||||
|
|
||||||
// bool specialization
|
// bool specialization
|
||||||
#define DECLARE_bool(name) \
|
#define DECLARE_bool(name) \
|
||||||
DECLARE_VARIABLE(bool, name, bool)
|
DECLARE_VARIABLE(bool, B, name, bool)
|
||||||
#define DEFINE_bool(name, value, meaning) \
|
#define DEFINE_bool(name, value, meaning) \
|
||||||
DEFINE_VARIABLE(bool, name, value, meaning, bool)
|
DEFINE_VARIABLE(bool, B, name, value, meaning, bool)
|
||||||
|
|
||||||
// int32 specialization
|
// int32 specialization
|
||||||
#define DECLARE_int32(name) \
|
#define DECLARE_int32(name) \
|
||||||
DECLARE_VARIABLE(GOOGLE_NAMESPACE::int32, name, int32)
|
DECLARE_VARIABLE(GOOGLE_NAMESPACE::int32, I, name, int32)
|
||||||
#define DEFINE_int32(name, value, meaning) \
|
#define DEFINE_int32(name, value, meaning) \
|
||||||
DEFINE_VARIABLE(GOOGLE_NAMESPACE::int32, name, value, meaning, int32)
|
DEFINE_VARIABLE(GOOGLE_NAMESPACE::int32, I, name, value, meaning, int32)
|
||||||
|
|
||||||
// Special case for string, because we have to specify the namespace
|
// Special case for string, because we have to specify the namespace
|
||||||
// std::string, which doesn't play nicely with our FLAG__namespace hackery.
|
// std::string, which doesn't play nicely with our FLAG__namespace hackery.
|
||||||
#define DECLARE_string(name) \
|
#define DECLARE_string(name) \
|
||||||
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead { \
|
namespace fLS { \
|
||||||
extern GOOGLE_GLOG_DLL_DECL std::string FLAGS_##name; \
|
extern GOOGLE_GLOG_DLL_DECL std::string& FLAGS_##name; \
|
||||||
} \
|
} \
|
||||||
using FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead::FLAGS_##name
|
using fLS::FLAGS_##name
|
||||||
#define DEFINE_string(name, value, meaning) \
|
#define DEFINE_string(name, value, meaning) \
|
||||||
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead { \
|
namespace fLS { \
|
||||||
GOOGLE_GLOG_DLL_DECL std::string FLAGS_##name(value); \
|
std::string FLAGS_##name##_buf(value); \
|
||||||
|
GOOGLE_GLOG_DLL_DECL std::string& FLAGS_##name = FLAGS_##name##_buf; \
|
||||||
char FLAGS_no##name; \
|
char FLAGS_no##name; \
|
||||||
} \
|
} \
|
||||||
using FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead::FLAGS_##name
|
using fLS::FLAGS_##name
|
||||||
|
|
||||||
#endif // HAVE_LIB_GFLAGS
|
#endif // HAVE_LIB_GFLAGS
|
||||||
|
|
||||||
|
|||||||
@ -293,27 +293,27 @@ typedef unsigned __int64 uint64;
|
|||||||
|
|
||||||
#ifndef DECLARE_VARIABLE
|
#ifndef DECLARE_VARIABLE
|
||||||
#define MUST_UNDEF_GFLAGS_DECLARE_MACROS
|
#define MUST_UNDEF_GFLAGS_DECLARE_MACROS
|
||||||
#define DECLARE_VARIABLE(type, name, tn) \
|
#define DECLARE_VARIABLE(type, shorttype, name, tn) \
|
||||||
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead { \
|
namespace fL##shorttype { \
|
||||||
extern GOOGLE_GLOG_DLL_DECL type FLAGS_##name; \
|
extern GOOGLE_GLOG_DLL_DECL type FLAGS_##name; \
|
||||||
} \
|
} \
|
||||||
using FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead::FLAGS_##name
|
using fL##shorttype::FLAGS_##name
|
||||||
|
|
||||||
// bool specialization
|
// bool specialization
|
||||||
#define DECLARE_bool(name) \
|
#define DECLARE_bool(name) \
|
||||||
DECLARE_VARIABLE(bool, name, bool)
|
DECLARE_VARIABLE(bool, B, name, bool)
|
||||||
|
|
||||||
// int32 specialization
|
// int32 specialization
|
||||||
#define DECLARE_int32(name) \
|
#define DECLARE_int32(name) \
|
||||||
DECLARE_VARIABLE(@ac_google_namespace@::int32, name, int32)
|
DECLARE_VARIABLE(@ac_google_namespace@::int32, I, name, int32)
|
||||||
|
|
||||||
// Special case for string, because we have to specify the namespace
|
// Special case for string, because we have to specify the namespace
|
||||||
// std::string, which doesn't play nicely with our FLAG__namespace hackery.
|
// std::string, which doesn't play nicely with our FLAG__namespace hackery.
|
||||||
#define DECLARE_string(name) \
|
#define DECLARE_string(name) \
|
||||||
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead { \
|
namespace fLS { \
|
||||||
extern GOOGLE_GLOG_DLL_DECL std::string FLAGS_##name; \
|
extern GOOGLE_GLOG_DLL_DECL std::string& FLAGS_##name; \
|
||||||
} \
|
} \
|
||||||
using FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead::FLAGS_##name
|
using fLS::FLAGS_##name
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set whether log messages go to stderr instead of logfiles
|
// Set whether log messages go to stderr instead of logfiles
|
||||||
|
|||||||
@ -297,27 +297,27 @@ typedef unsigned __int64 uint64;
|
|||||||
|
|
||||||
#ifndef DECLARE_VARIABLE
|
#ifndef DECLARE_VARIABLE
|
||||||
#define MUST_UNDEF_GFLAGS_DECLARE_MACROS
|
#define MUST_UNDEF_GFLAGS_DECLARE_MACROS
|
||||||
#define DECLARE_VARIABLE(type, name, tn) \
|
#define DECLARE_VARIABLE(type, shorttype, name, tn) \
|
||||||
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead { \
|
namespace fL##shorttype { \
|
||||||
extern GOOGLE_GLOG_DLL_DECL type FLAGS_##name; \
|
extern GOOGLE_GLOG_DLL_DECL type FLAGS_##name; \
|
||||||
} \
|
} \
|
||||||
using FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead::FLAGS_##name
|
using fL##shorttype::FLAGS_##name
|
||||||
|
|
||||||
// bool specialization
|
// bool specialization
|
||||||
#define DECLARE_bool(name) \
|
#define DECLARE_bool(name) \
|
||||||
DECLARE_VARIABLE(bool, name, bool)
|
DECLARE_VARIABLE(bool, B, name, bool)
|
||||||
|
|
||||||
// int32 specialization
|
// int32 specialization
|
||||||
#define DECLARE_int32(name) \
|
#define DECLARE_int32(name) \
|
||||||
DECLARE_VARIABLE(google::int32, name, int32)
|
DECLARE_VARIABLE(google::int32, I, name, int32)
|
||||||
|
|
||||||
// Special case for string, because we have to specify the namespace
|
// Special case for string, because we have to specify the namespace
|
||||||
// std::string, which doesn't play nicely with our FLAG__namespace hackery.
|
// std::string, which doesn't play nicely with our FLAG__namespace hackery.
|
||||||
#define DECLARE_string(name) \
|
#define DECLARE_string(name) \
|
||||||
namespace FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead { \
|
namespace fLS { \
|
||||||
extern GOOGLE_GLOG_DLL_DECL std::string FLAGS_##name; \
|
extern GOOGLE_GLOG_DLL_DECL std::string& FLAGS_##name; \
|
||||||
} \
|
} \
|
||||||
using FLAG__namespace_do_not_use_directly_use_DECLARE_string_instead::FLAGS_##name
|
using fLS::FLAGS_##name
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set whether log messages go to stderr instead of logfiles
|
// Set whether log messages go to stderr instead of logfiles
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user