From c23c6c6fc84a4b58ef6f6368c7aa68aa904d0602 Mon Sep 17 00:00:00 2001 From: Craig Silverstein Date: Thu, 3 Nov 2011 23:25:32 +0000 Subject: [PATCH] Starting the rollback of flag categories. I left in the old FlagRegisterer constructor. I also left in 'categories' in CommandLineFlagInfo for now, though I never use it. I doubt anyone else does either, but I want to minimize the number of ways this rollback can break the build. I will remove it in a subsequent CL. R=ncalvin DELTA=121 (28 added, 55 deleted, 38 changed) Revision created by MOE tool push_codebase. MOE_MIGRATION=3574 git-svn-id: https://gflags.googlecode.com/svn/trunk@68 6586e3c6-dcc4-952a-343f-ff74eb82781d --- src/gflags.cc | 38 ++++++++++++-------- src/gflags/gflags.h.in | 69 ++++++++++++++----------------------- src/gflags_reporting.cc | 1 - src/gflags_unittest.cc | 27 +++------------ src/gflags_unittest.sh | 2 -- src/windows/gflags/gflags.h | 69 ++++++++++++++----------------------- 6 files changed, 80 insertions(+), 126 deletions(-) diff --git a/src/gflags.cc b/src/gflags.cc index ffb0955..9f7df7e 100644 --- a/src/gflags.cc +++ b/src/gflags.cc @@ -112,8 +112,6 @@ #include "mutex.h" #include "util.h" -using fL::OptionalDefineArgs; - #ifndef PATH_SEPARATOR #define PATH_SEPARATOR '/' #endif @@ -484,14 +482,12 @@ class CommandLineFlag { public: // Note: we take over memory-ownership of current_val and default_val. CommandLineFlag(const char* name, const char* help, const char* filename, - const char* categories, FlagValue* current_val, FlagValue* default_val); ~CommandLineFlag(); const char* name() const { return name_; } const char* help() const { return help_; } const char* filename() const { return file_; } - const char* categories() const { return categories_ ? categories_ : ""; } const char* CleanFileName() const; // nixes irrelevant prefix such as homedir string current_value() const { return current_->ToString(); } string default_value() const { return defvalue_->ToString(); } @@ -520,7 +516,6 @@ class CommandLineFlag { const char* const name_; // Flag name const char* const help_; // Help message const char* const file_; // Which file did this come from? - const char* categories_; // Comma-separated list of flag's 'categories' bool modified_; // Set after default assignment? FlagValue* defvalue_; // Default value for flag FlagValue* current_; // Current value for flag @@ -535,11 +530,10 @@ class CommandLineFlag { }; CommandLineFlag::CommandLineFlag(const char* name, const char* help, - const char* filename, const char* categories, + const char* filename, FlagValue* current_val, FlagValue* default_val) - : name_(name), help_(help), file_(filename), categories_(categories), - modified_(false), defvalue_(default_val), current_(current_val), - validate_fn_proto_(NULL) { + : name_(name), help_(help), file_(filename), modified_(false), + defvalue_(default_val), current_(current_val), validate_fn_proto_(NULL) { } CommandLineFlag::~CommandLineFlag() { @@ -575,7 +569,6 @@ void CommandLineFlag::FillCommandLineFlagInfo( result->name = name(); result->type = type_name(); result->description = help(); - result->categories = categories(); result->current_value = current_value(); result->default_value = default_value(); result->filename = CleanFileName(); @@ -1407,8 +1400,26 @@ bool AddFlagValidator(const void* flag_ptr, ValidateFnProto validate_fn_proto) { FlagRegisterer::FlagRegisterer(const char* name, const char* type, const char* help, const char* filename, - void* current_storage, void* defvalue_storage, - const OptionalDefineArgs& optional_args) { + void* current_storage, void* defvalue_storage) { + if (help == NULL) + help = ""; + // FlagValue expects the type-name to not include any namespace + // components, so we get rid of those, if any. + if (strchr(type, ':')) + type = strrchr(type, ':') + 1; + FlagValue* current = new FlagValue(current_storage, type, false); + FlagValue* defvalue = new FlagValue(defvalue_storage, type, false); + // Importantly, flag_ will never be deleted, so storage is always good. + CommandLineFlag* flag = new CommandLineFlag(name, help, filename, + current, defvalue); + FlagRegistry::GlobalRegistry()->RegisterFlag(flag); // default registry +} + +// TODO(csilvers): remove +FlagRegisterer::FlagRegisterer(const char* name, const char* type, + const char* help, const char* filename, + void* current_storage, void* defvalue_storage, + const fL::OptionalDefineArgs& optional_args) { if (help == NULL) help = ""; // FlagValue expects the type-name to not include any namespace @@ -1419,7 +1430,6 @@ FlagRegisterer::FlagRegisterer(const char* name, const char* type, FlagValue* defvalue = new FlagValue(defvalue_storage, type, false); // Importantly, flag_ will never be deleted, so storage is always good. CommandLineFlag* flag = new CommandLineFlag(name, help, filename, - optional_args.categories, current, defvalue); FlagRegistry::GlobalRegistry()->RegisterFlag(flag); // default registry } @@ -1664,7 +1674,7 @@ class FlagSaverImpl { const CommandLineFlag* main = it->second; // Sets up all the const variables in backup correctly CommandLineFlag* backup = new CommandLineFlag( - main->name(), main->help(), main->filename(), main->categories(), + main->name(), main->help(), main->filename(), main->current_->New(), main->defvalue_->New()); // Sets up all the non-const variables in backup correctly backup->CopyFrom(*main); diff --git a/src/gflags/gflags.h.in b/src/gflags/gflags.h.in index 47bb027..e2411da 100644 --- a/src/gflags/gflags.h.in +++ b/src/gflags/gflags.h.in @@ -40,7 +40,7 @@ // // DEFINE_int32(end, 1000, "The last record to read"); // -// DEFINE_string(filename, "my_file.txt", "The file to read", "important"); +// DEFINE_string(filename, "my_file.txt", "The file to read"); // // Crash if the specified file does not exist. // static bool dummy = RegisterFlagValidator(&FLAGS_filename, // &ValidateIsFile); @@ -81,6 +81,9 @@ #include #include #include // IWYU pragma: export +@ac_google_start_namespace@ + +namespace fL { struct OptionalDefineArgs { }; } // TODO(csilvers): remove // // NOTE: all functions below MUST have an explicit 'extern' before @@ -90,10 +93,6 @@ #define GFLAGS_DLL_DECL /* rewritten to be non-empty in windows dir */ #define GFLAGS_DLL_DEFINE_FLAG /* rewritten to be non-empty in windows dir */ -namespace fL { struct OptionalDefineArgs; } // defined below - - -@ac_google_start_namespace@ // -------------------------------------------------------------------- // To actually define a flag in a file, use DEFINE_bool, @@ -154,7 +153,7 @@ struct GFLAGS_DLL_DECL CommandLineFlagInfo { std::string name; // the name of the flag std::string type; // the type of the flag: int32, etc std::string description; // the "help text" associated with the flag - std::string categories; // the value of the "categories" arg to DEFINE_*() + std::string categories; // unused (TODO(csilvers): remove this) std::string current_value; // the current value, as a string std::string default_value; // the default value, as a string std::string filename; // 'cleaned' version of filename holding the flag @@ -429,6 +428,10 @@ extern void ShutDownCommandLineFlags(); class GFLAGS_DLL_DECL FlagRegisterer { public: + FlagRegisterer(const char* name, const char* type, + const char* help, const char* filename, + void* current_storage, void* defvalue_storage); + // TODO(csilvers): remove this once FlagRegisterer(const char* name, const char* type, const char* help, const char* filename, void* current_storage, void* defvalue_storage, @@ -454,19 +457,6 @@ extern const char kStrippedFlagHelp[]; #define MAYBE_STRIPPED_HELP(txt) txt #endif -// This holds all the optional macro argument fields that *may* be -// present in DEFINE_* after the helpstring, but are not required to -// be. We use static initialization, so they must all be POD types, -// and if not specified they default to 0. -namespace fL { -struct OptionalDefineArgs { - // A comma-separated list of "categories" this flag falls into. - // For details on categories, see gflags_categories.h. - const char* categories; -}; -typedef OptionalDefineArgs ODA; // used in macros to save on code size -} - // Each command-line flag has two variables associated with it: one // with the current value, and one with the default value. However, // we have a third variable, which is where value is assigned; it's a @@ -478,18 +468,15 @@ typedef OptionalDefineArgs ODA; // used in macros to save on code size // FLAGS_no. This serves the second purpose of assuring a // compile error if someone tries to define a flag named no // which is illegal (--foo and --nofoo both affect the "foo" flag). -// The ... maps to the fields in OptionalDefineArgs, above. It may -// be omitted entirely if no optional args need to be specified. -#define DEFINE_VARIABLE(type, shorttype, name, value, help, ...) \ +#define DEFINE_VARIABLE(type, shorttype, name, value, help) \ namespace fL##shorttype { \ - static const type v_##name = value; \ - static const ::fL::ODA e_##name = { __VA_ARGS__ }; \ + static const type FLAGS_nono##name = value; \ /* We always want to export defined variables, dll or no */ \ - GFLAGS_DLL_DEFINE_FLAG type FLAGS_##name = v_##name; \ - type FLAGS_no##name = v_##name; \ + GFLAGS_DLL_DEFINE_FLAG type FLAGS_##name = FLAGS_nono##name; \ + type FLAGS_no##name = FLAGS_nono##name; \ static @ac_google_namespace@::FlagRegisterer o_##name( \ #name, #type, MAYBE_STRIPPED_HELP(help), __FILE__, \ - &FLAGS_##name, &FLAGS_no##name, e_##name); \ + &FLAGS_##name, &FLAGS_no##name); \ } \ using fL##shorttype::FLAGS_##name @@ -512,28 +499,27 @@ GFLAGS_DLL_DECL bool IsBoolFlag(bool from); // Here are the actual DEFINE_*-macros. The respective DECLARE_*-macros // are in a separate include, gflags_declare.h, for reducing // the physical transitive size for DECLARE use. -// As always, the ... maps to the fields in OptionalDefineArgs, above. -#define DEFINE_bool(name, val, txt, ...) \ +#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]; \ } \ - DEFINE_VARIABLE(bool, B, name, val, txt, __VA_ARGS__) + DEFINE_VARIABLE(bool, B, name, val, txt) -#define DEFINE_int32(name, val, txt, ...) \ +#define DEFINE_int32(name, val, txt) \ DEFINE_VARIABLE(@ac_google_namespace@::int32, I, \ - name, val, txt, __VA_ARGS__) + name, val, txt) -#define DEFINE_int64(name, val, txt, ...) \ +#define DEFINE_int64(name, val, txt) \ DEFINE_VARIABLE(@ac_google_namespace@::int64, I64, \ - name, val, txt, __VA_ARGS__) + name, val, txt) -#define DEFINE_uint64(name,val, txt, ...) \ +#define DEFINE_uint64(name,val, txt) \ DEFINE_VARIABLE(@ac_google_namespace@::uint64, U64, \ - name, val, txt, __VA_ARGS__) + name, val, txt) -#define DEFINE_double(name, val, txt, ...) \ - DEFINE_VARIABLE(double, D, name, val, txt, __VA_ARGS__) +#define DEFINE_double(name, val, txt) \ + DEFINE_VARIABLE(double, D, name, val, txt) // Strings are trickier, because they're not a POD, so we can't // construct them at static-initialization time (instead they get @@ -563,19 +549,16 @@ inline clstring* dont_pass0toDEFINE_string(char *stringspot, // The weird 'using' + 'extern' inside the fLS namespace is to work around // an unknown compiler bug/issue with the gcc 4.2.1 on SUSE 10. See // http://code.google.com/p/google-gflags/issues/detail?id=20 -// As always, the ... maps to the fields in OptionalDefineArgs, above. -#define DEFINE_string(name, val, txt, ...) \ +#define DEFINE_string(name, val, txt) \ namespace fLS { \ using ::fLS::clstring; \ static union { void* align; char s[sizeof(clstring)]; } s_##name[2]; \ clstring* const FLAGS_no##name = ::fLS:: \ dont_pass0toDEFINE_string(s_##name[0].s, \ val); \ - static const ::fL::ODA e_##name = { __VA_ARGS__ }; \ static @ac_google_namespace@::FlagRegisterer o_##name( \ #name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \ - s_##name[0].s, new (s_##name[1].s) clstring(*FLAGS_no##name), \ - e_##name); \ + s_##name[0].s, new (s_##name[1].s) clstring(*FLAGS_no##name)); \ extern GFLAGS_DLL_DEFINE_FLAG clstring& FLAGS_##name; \ using fLS::FLAGS_##name; \ clstring& FLAGS_##name = *FLAGS_no##name; \ diff --git a/src/gflags_reporting.cc b/src/gflags_reporting.cc index f280fad..8afcb95 100644 --- a/src/gflags_reporting.cc +++ b/src/gflags_reporting.cc @@ -212,7 +212,6 @@ static string DescribeOneFlagInXML(const CommandLineFlagInfo& flag) { AddXMLTag(&r, "file", flag.filename); AddXMLTag(&r, "name", flag.name); AddXMLTag(&r, "meaning", flag.description); - AddXMLTag(&r, "categories", flag.categories); AddXMLTag(&r, "default", flag.default_value); AddXMLTag(&r, "current", flag.current_value); AddXMLTag(&r, "type", flag.type); diff --git a/src/gflags_unittest.cc b/src/gflags_unittest.cc index 25bd748..08abc1b 100644 --- a/src/gflags_unittest.cc +++ b/src/gflags_unittest.cc @@ -77,8 +77,7 @@ DEFINE_string(srcdir, StringFromEnv("SRCDIR", "."), DECLARE_string(tryfromenv); // in gflags.cc -// This 4th arg specifies the 'categories' the flag belongs to. -DEFINE_bool(test_bool, false, "tests bool-ness", "important,has_category"); +DEFINE_bool(test_bool, false, "tests bool-ness"); DEFINE_int32(test_int32, -1, ""); DEFINE_int64(test_int64, -2, ""); DEFINE_uint64(test_uint64, 2, ""); @@ -96,7 +95,6 @@ DEFINE_bool(test_bool_with_quite_quite_quite_quite_quite_quite_quite_quite_quite DEFINE_string(test_str1, "initial", ""); DEFINE_string(test_str2, "initial", ""); DEFINE_string(test_str3, "initial", ""); -DEFINE_string(test_str_with_category, "", "", "required,filename"); // This is used to test setting tryfromenv manually DEFINE_string(test_tryfromenv, "initial", ""); @@ -218,8 +216,6 @@ MAKEFLAG100(15); #undef MAKEFLAG10 #undef MAKEFLAG -static fL::OptionalDefineArgs no_optional_args = { }; - // This is a pseudo-flag -- we want to register a flag with a filename // at the top level, but there is no way to do this except by faking // the filename. @@ -230,7 +226,7 @@ namespace fLI { static FlagRegisterer o_tldflag1( "tldflag1", "int32", "should show up in --helpshort", "gflags_unittest.cc", - &FLAGS_tldflag1, &FLAGS_notldflag1, no_optional_args); + &FLAGS_tldflag1, &FLAGS_notldflag1); } using fLI::FLAGS_tldflag1; @@ -241,7 +237,7 @@ namespace fLI { static FlagRegisterer o_tldflag2( "tldflag2", "int32", "should show up in --helpshort", "gflags_unittest.", - &FLAGS_tldflag2, &FLAGS_notldflag2, no_optional_args); + &FLAGS_tldflag2, &FLAGS_notldflag2); } using fLI::FLAGS_tldflag2; @@ -991,32 +987,18 @@ TEST(GetCommandLineFlagInfoTest, FlagExists) { EXPECT_EQ("test_int32", info.name); EXPECT_EQ("int32", info.type); EXPECT_EQ("", info.description); - EXPECT_EQ("", info.categories); EXPECT_EQ("-1", info.current_value); EXPECT_EQ("-1", info.default_value); EXPECT_TRUE(info.is_default); EXPECT_FALSE(info.has_validator_fn); EXPECT_EQ(&FLAGS_test_int32, info.flag_ptr); - r = GetCommandLineFlagInfo("test_str_with_category", &info); - EXPECT_TRUE(r); - EXPECT_EQ("test_str_with_category", info.name); - EXPECT_EQ("string", info.type); - EXPECT_EQ("", info.description); - EXPECT_EQ("required,filename", info.categories); - EXPECT_EQ("", info.current_value); - EXPECT_EQ("", info.default_value); - EXPECT_TRUE(info.is_default); - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_str_with_category, info.flag_ptr); - FLAGS_test_bool = true; r = GetCommandLineFlagInfo("test_bool", &info); EXPECT_TRUE(r); EXPECT_EQ("test_bool", info.name); EXPECT_EQ("bool", info.type); EXPECT_EQ("tests bool-ness", info.description); - EXPECT_EQ("important,has_category", info.categories); EXPECT_EQ("true", info.current_value); EXPECT_EQ("false", info.default_value); EXPECT_FALSE(info.is_default); @@ -1029,7 +1011,6 @@ TEST(GetCommandLineFlagInfoTest, FlagExists) { EXPECT_EQ("test_bool", info.name); EXPECT_EQ("bool", info.type); EXPECT_EQ("tests bool-ness", info.description); - EXPECT_EQ("important,has_category", info.categories); EXPECT_EQ("false", info.current_value); EXPECT_EQ("false", info.default_value); EXPECT_FALSE(info.is_default); // value is same, but flag *was* modified @@ -1364,7 +1345,7 @@ TEST(ParseCommandLineFlagsWrongFields, static bool current_storage; static bool defvalue_storage; FlagRegisterer fr("flag_name", "bool", 0, "filename", - ¤t_storage, &defvalue_storage, no_optional_args); + ¤t_storage, &defvalue_storage); CommandLineFlagInfo fi; EXPECT_TRUE(GetCommandLineFlagInfo("flag_name", &fi)); EXPECT_EQ("", fi.description); diff --git a/src/gflags_unittest.sh b/src/gflags_unittest.sh index 61ad72a..c81e41e 100755 --- a/src/gflags_unittest.sh +++ b/src/gflags_unittest.sh @@ -182,8 +182,6 @@ Expect $LINENO 1 "/gflags_reporting.cc" "" --helppackage # xml! Expect $LINENO 1 "/gflags_unittest.cc" \ "/gflags_unittest.cc:" --helpxml -Expect $LINENO 1 "test_booltests bool-nessimportant,has_categoryfalsefalsebool" \ - "/gflags_unittest.cc:" --helpxml # just print the version info and exit Expect $LINENO 0 "gflags_unittest" "gflags_unittest.cc" --version diff --git a/src/windows/gflags/gflags.h b/src/windows/gflags/gflags.h index 337f3dc..e240d1a 100644 --- a/src/windows/gflags/gflags.h +++ b/src/windows/gflags/gflags.h @@ -40,7 +40,7 @@ // // DEFINE_int32(end, 1000, "The last record to read"); // -// DEFINE_string(filename, "my_file.txt", "The file to read", "important"); +// DEFINE_string(filename, "my_file.txt", "The file to read"); // // Crash if the specified file does not exist. // static bool dummy = RegisterFlagValidator(&FLAGS_filename, // &ValidateIsFile); @@ -81,6 +81,9 @@ #include #include #include // IWYU pragma: export +namespace google { + +namespace fL { struct OptionalDefineArgs { }; } // TODO(csilvers): remove // // NOTE: all functions below MUST have an explicit 'extern' before @@ -94,10 +97,6 @@ # define GFLAGS_DLL_DEFINE_FLAG __declspec(dllexport) #endif -namespace fL { struct OptionalDefineArgs; } // defined below - - -namespace google { // -------------------------------------------------------------------- // To actually define a flag in a file, use DEFINE_bool, @@ -158,7 +157,7 @@ struct GFLAGS_DLL_DECL CommandLineFlagInfo { std::string name; // the name of the flag std::string type; // the type of the flag: int32, etc std::string description; // the "help text" associated with the flag - std::string categories; // the value of the "categories" arg to DEFINE_*() + std::string categories; // unused (TODO(csilvers): remove this) std::string current_value; // the current value, as a string std::string default_value; // the default value, as a string std::string filename; // 'cleaned' version of filename holding the flag @@ -433,6 +432,10 @@ extern GFLAGS_DLL_DECL void ShutDownCommandLineFlags(); class GFLAGS_DLL_DECL FlagRegisterer { public: + FlagRegisterer(const char* name, const char* type, + const char* help, const char* filename, + void* current_storage, void* defvalue_storage); + // TODO(csilvers): remove this once FlagRegisterer(const char* name, const char* type, const char* help, const char* filename, void* current_storage, void* defvalue_storage, @@ -458,19 +461,6 @@ extern GFLAGS_DLL_DECL const char kStrippedFlagHelp[]; #define MAYBE_STRIPPED_HELP(txt) txt #endif -// This holds all the optional macro argument fields that *may* be -// present in DEFINE_* after the helpstring, but are not required to -// be. We use static initialization, so they must all be POD types, -// and if not specified they default to 0. -namespace fL { -struct OptionalDefineArgs { - // A comma-separated list of "categories" this flag falls into. - // For details on categories, see gflags_categories.h. - const char* categories; -}; -typedef OptionalDefineArgs ODA; // used in macros to save on code size -} - // Each command-line flag has two variables associated with it: one // with the current value, and one with the default value. However, // we have a third variable, which is where value is assigned; it's a @@ -482,18 +472,15 @@ typedef OptionalDefineArgs ODA; // used in macros to save on code size // FLAGS_no. This serves the second purpose of assuring a // compile error if someone tries to define a flag named no // which is illegal (--foo and --nofoo both affect the "foo" flag). -// The ... maps to the fields in OptionalDefineArgs, above. It may -// be omitted entirely if no optional args need to be specified. -#define DEFINE_VARIABLE(type, shorttype, name, value, help, ...) \ +#define DEFINE_VARIABLE(type, shorttype, name, value, help) \ namespace fL##shorttype { \ - static const type v_##name = value; \ - static const ::fL::ODA e_##name = { __VA_ARGS__ }; \ + static const type FLAGS_nono##name = value; \ /* We always want to export defined variables, dll or no */ \ - GFLAGS_DLL_DEFINE_FLAG type FLAGS_##name = v_##name; \ - type FLAGS_no##name = v_##name; \ + GFLAGS_DLL_DEFINE_FLAG type FLAGS_##name = FLAGS_nono##name; \ + type FLAGS_no##name = FLAGS_nono##name; \ static ::google::FlagRegisterer o_##name( \ #name, #type, MAYBE_STRIPPED_HELP(help), __FILE__, \ - &FLAGS_##name, &FLAGS_no##name, e_##name); \ + &FLAGS_##name, &FLAGS_no##name); \ } \ using fL##shorttype::FLAGS_##name @@ -516,28 +503,27 @@ GFLAGS_DLL_DECL bool IsBoolFlag(bool from); // Here are the actual DEFINE_*-macros. The respective DECLARE_*-macros // are in a separate include, gflags_declare.h, for reducing // the physical transitive size for DECLARE use. -// As always, the ... maps to the fields in OptionalDefineArgs, above. -#define DEFINE_bool(name, val, txt, ...) \ +#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]; \ } \ - DEFINE_VARIABLE(bool, B, name, val, txt, __VA_ARGS__) + DEFINE_VARIABLE(bool, B, name, val, txt) -#define DEFINE_int32(name, val, txt, ...) \ +#define DEFINE_int32(name, val, txt) \ DEFINE_VARIABLE(::google::int32, I, \ - name, val, txt, __VA_ARGS__) + name, val, txt) -#define DEFINE_int64(name, val, txt, ...) \ +#define DEFINE_int64(name, val, txt) \ DEFINE_VARIABLE(::google::int64, I64, \ - name, val, txt, __VA_ARGS__) + name, val, txt) -#define DEFINE_uint64(name,val, txt, ...) \ +#define DEFINE_uint64(name,val, txt) \ DEFINE_VARIABLE(::google::uint64, U64, \ - name, val, txt, __VA_ARGS__) + name, val, txt) -#define DEFINE_double(name, val, txt, ...) \ - DEFINE_VARIABLE(double, D, name, val, txt, __VA_ARGS__) +#define DEFINE_double(name, val, txt) \ + DEFINE_VARIABLE(double, D, name, val, txt) // Strings are trickier, because they're not a POD, so we can't // construct them at static-initialization time (instead they get @@ -567,19 +553,16 @@ inline clstring* dont_pass0toDEFINE_string(char *stringspot, // The weird 'using' + 'extern' inside the fLS namespace is to work around // an unknown compiler bug/issue with the gcc 4.2.1 on SUSE 10. See // http://code.google.com/p/google-gflags/issues/detail?id=20 -// As always, the ... maps to the fields in OptionalDefineArgs, above. -#define DEFINE_string(name, val, txt, ...) \ +#define DEFINE_string(name, val, txt) \ namespace fLS { \ using ::fLS::clstring; \ static union { void* align; char s[sizeof(clstring)]; } s_##name[2]; \ clstring* const FLAGS_no##name = ::fLS:: \ dont_pass0toDEFINE_string(s_##name[0].s, \ val); \ - static const ::fL::ODA e_##name = { __VA_ARGS__ }; \ static ::google::FlagRegisterer o_##name( \ #name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \ - s_##name[0].s, new (s_##name[1].s) clstring(*FLAGS_no##name), \ - e_##name); \ + s_##name[0].s, new (s_##name[1].s) clstring(*FLAGS_no##name)); \ extern GFLAGS_DLL_DEFINE_FLAG clstring& FLAGS_##name; \ using fLS::FLAGS_##name; \ clstring& FLAGS_##name = *FLAGS_no##name; \