Commit a93de007 authored by Andreas Schuh's avatar Andreas Schuh

Define GFLAGS_NAMESPACE in public headers.

This avoids any mistakes where once @GFLAGS_NAMESPACE@ was used in public .h.in files, or the #define GFLAGS_NAMESPACE in internal source files.
parent 05b155ff
......@@ -70,9 +70,6 @@
// Define to the address where bug reports for this package should be sent.
#define PACKAGE_BUGREPORT @PACKAGE_BUGREPORT@
// Namespace of gflags library symbols.
#define GFLAGS_NAMESPACE @GFLAGS_NAMESPACE@
// ---------------------------------------------------------------------------
// Path separator
#ifndef PATH_SEPARATOR
......
......@@ -94,7 +94,7 @@
#endif
namespace @GFLAGS_NAMESPACE@ {
namespace GFLAGS_NAMESPACE {
// --------------------------------------------------------------------
......@@ -136,7 +136,7 @@ extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const std::string* flag, bool
// Convenience macro for the registration of a flag validator
#define DEFINE_validator(name, validator) \
static const bool name##_validator_registered = \
@GFLAGS_NAMESPACE@::RegisterFlagValidator(&FLAGS_##name, validator)
GFLAGS_NAMESPACE::RegisterFlagValidator(&FLAGS_##name, validator)
// --------------------------------------------------------------------
......@@ -442,7 +442,7 @@ class GFLAGS_DLL_DECL FlagRegisterer {
extern GFLAGS_DLL_DECL const char kStrippedFlagHelp[];
} // namespace @GFLAGS_NAMESPACE@
} // namespace GFLAGS_NAMESPACE
#ifndef SWIG // In swig, ignore the main flag declarations
......@@ -450,7 +450,7 @@ extern GFLAGS_DLL_DECL const char kStrippedFlagHelp[];
#if defined(STRIP_FLAG_HELP) && STRIP_FLAG_HELP > 0
// Need this construct to avoid the 'defined but not used' warning.
#define MAYBE_STRIPPED_HELP(txt) \
(false ? (txt) : @GFLAGS_NAMESPACE@::kStrippedFlagHelp)
(false ? (txt) : GFLAGS_NAMESPACE::kStrippedFlagHelp)
#else
#define MAYBE_STRIPPED_HELP(txt) txt
#endif
......@@ -472,7 +472,7 @@ extern GFLAGS_DLL_DECL const char kStrippedFlagHelp[];
/* We always want to export defined variables, dll or no */ \
GFLAGS_DLL_DEFINE_FLAG type FLAGS_##name = FLAGS_nono##name; \
type FLAGS_no##name = FLAGS_nono##name; \
static @GFLAGS_NAMESPACE@::FlagRegisterer o_##name( \
static GFLAGS_NAMESPACE::FlagRegisterer o_##name( \
#name, #type, MAYBE_STRIPPED_HELP(help), __FILE__, \
&FLAGS_##name, &FLAGS_no##name); \
} \
......@@ -500,20 +500,20 @@ GFLAGS_DLL_DECL bool IsBoolFlag(bool from);
#define DEFINE_bool(name, val, txt) \
namespace fLB { \
typedef ::fLB::CompileAssert FLAG_##name##_value_is_not_a_bool[ \
(sizeof(::fLB::IsBoolFlag(val)) != sizeof(double)) ? 1 : -1]; \
(sizeof(::fLB::IsBoolFlag(val)) != sizeof(double))? 1: -1]; \
} \
DEFINE_VARIABLE(bool, B, name, val, txt)
#define DEFINE_int32(name, val, txt) \
DEFINE_VARIABLE(@GFLAGS_NAMESPACE@::int32, I, \
DEFINE_VARIABLE(GFLAGS_NAMESPACE::int32, I, \
name, val, txt)
#define DEFINE_int64(name, val, txt) \
DEFINE_VARIABLE(@GFLAGS_NAMESPACE@::int64, I64, \
DEFINE_VARIABLE(GFLAGS_NAMESPACE::int64, I64, \
name, val, txt)
#define DEFINE_uint64(name,val, txt) \
DEFINE_VARIABLE(@GFLAGS_NAMESPACE@::uint64, U64, \
DEFINE_VARIABLE(GFLAGS_NAMESPACE::uint64, U64, \
name, val, txt)
#define DEFINE_double(name, val, txt) \
......@@ -554,7 +554,7 @@ inline clstring* dont_pass0toDEFINE_string(char *stringspot,
clstring* const FLAGS_no##name = ::fLS:: \
dont_pass0toDEFINE_string(s_##name[0].s, \
val); \
static @GFLAGS_NAMESPACE@::FlagRegisterer o_##name( \
static GFLAGS_NAMESPACE::FlagRegisterer o_##name( \
#name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \
s_##name[0].s, new (s_##name[1].s) clstring(*FLAGS_no##name)); \
extern GFLAGS_DLL_DEFINE_FLAG clstring& FLAGS_##name; \
......
......@@ -37,6 +37,11 @@
#ifndef GFLAGS_DECLARE_H_
#define GFLAGS_DECLARE_H_
// ---------------------------------------------------------------------------
// Namespace of gflags library symbols.
#define GFLAGS_NAMESPACE @GFLAGS_NAMESPACE@
// ---------------------------------------------------------------------------
// Windows DLL import/export.
......@@ -69,7 +74,7 @@
# include <inttypes.h> // a third place for uint32_t or u_int32_t
#endif
namespace @GFLAGS_NAMESPACE@ {
namespace GFLAGS_NAMESPACE {
#if @GFLAGS_INTTYPES_FORMAT_C99@ // C99
typedef int32_t int32;
......@@ -90,7 +95,7 @@ typedef unsigned __int64 uint64;
# error Do not know how to define a 32-bit integer quantity on your system
#endif
} // namespace @GFLAGS_NAMESPACE@
} // namespace GFLAGS_NAMESPACE
namespace fLS {
......@@ -113,13 +118,13 @@ typedef std::string clstring;
DECLARE_VARIABLE(bool, B, name)
#define DECLARE_int32(name) \
DECLARE_VARIABLE(::@GFLAGS_NAMESPACE@::int32, I, name)
DECLARE_VARIABLE(::GFLAGS_NAMESPACE::int32, I, name)
#define DECLARE_int64(name) \
DECLARE_VARIABLE(::@GFLAGS_NAMESPACE@::int64, I64, name)
DECLARE_VARIABLE(::GFLAGS_NAMESPACE::int64, I64, name)
#define DECLARE_uint64(name) \
DECLARE_VARIABLE(::@GFLAGS_NAMESPACE@::uint64, U64, name)
DECLARE_VARIABLE(::GFLAGS_NAMESPACE::uint64, U64, name)
#define DECLARE_double(name) \
DECLARE_VARIABLE(double, D, name)
......
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