Export of internal Abseil changes
-- d447fdcb801036cf08197eece193a5a706661120 by Gennadiy Rozental <rogeeff@google.com>: Eliminate the need for static function holding help message. This decreases the cost of ABSL_FLAG abstraction by 120 bytes under clang. PiperOrigin-RevId: 281107806 -- 0aa6b91189f0e8b2381438c33465673a7ae02487 by Derek Mauro <dmauro@google.com>: Disable the weak symbol CCTZ extension in the time test_util on MinGW, which does not support it. PiperOrigin-RevId: 280719769 -- 67322c41c3e776eb541de90fa4526bdb49422eb6 by Abseil Team <absl-team@google.com>: Tune PeriodicSampler implementation (for internal-use only) PiperOrigin-RevId: 280708943 -- 3a48c346340c7ed03816645cd327e1ff07729aa4 by Abseil Team <absl-team@google.com>: Clean up public headers not to have warnings for "-Wcomma" PiperOrigin-RevId: 280695373 -- 981acd1ef3b13a83a84f04f11c8931f4ed4451c9 by Matthew Brown <matthewbr@google.com>: Release absl::int128. PiperOrigin-RevId: 280690817 -- d30fae9d2ec30b81322d2eb5afe7e13e45b4b422 by Derek Mauro <dmauro@google.com>: Fix -Wundef warnings in random platform detection PiperOrigin-RevId: 280669598 GitOrigin-RevId: d447fdcb801036cf08197eece193a5a706661120 Change-Id: Ie5e10e567c54b7de211833607689f233d4ddf734
This commit is contained in:
parent
3df7b52a6a
commit
2103fd9acd
23 changed files with 2800 additions and 136 deletions
|
|
@ -32,7 +32,7 @@ namespace {
|
|||
|
||||
namespace flags = absl::flags_internal;
|
||||
|
||||
std::string TestHelpMsg() { return "help"; }
|
||||
std::string TestHelpMsg() { return "dynamic help"; }
|
||||
template <typename T>
|
||||
void* TestMakeDflt() {
|
||||
return new T{};
|
||||
|
|
@ -41,19 +41,22 @@ void TestCallback() {}
|
|||
|
||||
template <typename T>
|
||||
bool TestConstructionFor() {
|
||||
constexpr flags::Flag<T> f1("f1", &TestHelpMsg, "file",
|
||||
constexpr flags::HelpInitArg help_arg{flags::FlagHelpSrc("literal help"),
|
||||
flags::FlagHelpSrcKind::kLiteral};
|
||||
constexpr flags::Flag<T> f1("f1", help_arg, "file",
|
||||
&flags::FlagMarshallingOps<T>, &TestMakeDflt<T>);
|
||||
EXPECT_EQ(f1.Name(), "f1");
|
||||
EXPECT_EQ(f1.Help(), "help");
|
||||
EXPECT_EQ(f1.Help(), "literal help");
|
||||
EXPECT_EQ(f1.Filename(), "file");
|
||||
|
||||
ABSL_CONST_INIT static flags::Flag<T> f2("f2", &TestHelpMsg, "file",
|
||||
&flags::FlagMarshallingOps<T>,
|
||||
&TestMakeDflt<T>);
|
||||
ABSL_CONST_INIT static flags::Flag<T> f2(
|
||||
"f2",
|
||||
{flags::FlagHelpSrc(&TestHelpMsg), flags::FlagHelpSrcKind::kGenFunc},
|
||||
"file", &flags::FlagMarshallingOps<T>, &TestMakeDflt<T>);
|
||||
flags::FlagRegistrar<T, false>(&f2).OnUpdate(TestCallback);
|
||||
|
||||
EXPECT_EQ(f2.Name(), "f2");
|
||||
EXPECT_EQ(f2.Help(), "help");
|
||||
EXPECT_EQ(f2.Help(), "dynamic help");
|
||||
EXPECT_EQ(f2.Filename(), "file");
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue