You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2016/10/18 15:41:16 UTC

[1/4] mesos git commit: Fully qualified addresses of flag members in `add` calls in stout.

Repository: mesos
Updated Branches:
  refs/heads/master 757319357 -> 92fb8e7ee


Fully qualified addresses of flag members in `add` calls in stout.

While right now we can technically `add` variables to `Flags` classes
which are not members, the in order to have correct copy semantics for
`Flags` only member variables should be used.

Here we changed all instances to a full pointer-to-member syntax in
the current code.

Review: https://reviews.apache.org/r/52390/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5aeecca3
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5aeecca3
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5aeecca3

Branch: refs/heads/master
Commit: 5aeecca345f80d5d34c9a8c8b64d460bcd773e30
Parents: 7573193
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Tue Oct 18 03:29:14 2016 -0400
Committer: Michael Park <mp...@apache.org>
Committed: Tue Oct 18 04:28:36 2016 -0400

----------------------------------------------------------------------
 3rdparty/stout/README.md                     |   4 +-
 3rdparty/stout/include/stout/flags.hpp       |   6 +-
 3rdparty/stout/include/stout/flags/flags.hpp |   7 +-
 3rdparty/stout/tests/flags_tests.cpp         | 431 ++++++++++++----------
 3rdparty/stout/tests/subcommand_tests.cpp    |  16 +-
 5 files changed, 248 insertions(+), 216 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5aeecca3/3rdparty/stout/README.md
----------------------------------------------------------------------
diff --git a/3rdparty/stout/README.md b/3rdparty/stout/README.md
index 693e3a3..80beb44 100644
--- a/3rdparty/stout/README.md
+++ b/3rdparty/stout/README.md
@@ -384,7 +384,7 @@ String formatting is provided via `strings::format`. The `strings::format` funct
 One frustration with existing command line flags libraries was the burden they put on writing tests that attempted to have many different instantiations of the flags. For example, running two instances of the same component within a test where each instance was started with different command line flags. To solve this, we provide a command line flags abstraction called `Flags` (in the `flags` namespace) that you can extend to define your own flags:
 
 ~~~{.cpp}
-    struct MyFlags : flags::Flags
+    struct MyFlags : virtual flags::Flags // Use `virtual` for composition!
     {
       MyFlags()
       {
@@ -394,7 +394,7 @@ One frustration with existing command line flags libraries was the burden they p
             "Some information about foo",
             DEFAULT_VALUE_FOR_FOO);
 
-        // A flag with out a default value,
+        // A flag without a default value,
         // defined below with an `Option`.
         add(&MyFlags::bar,
             "bar",

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aeecca3/3rdparty/stout/include/stout/flags.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/flags.hpp b/3rdparty/stout/include/stout/flags.hpp
index b23b6f6..75925b8 100644
--- a/3rdparty/stout/include/stout/flags.hpp
+++ b/3rdparty/stout/include/stout/flags.hpp
@@ -21,14 +21,14 @@
 // class MyFlags : public virtual FlagsBase // Use 'virtual' for composition!
 // {
 // public:
-//   Flags()
+//   MyFlags()
 //   {
-//     add(&debug,
+//     add(&MyFlags::debug,
 //         "debug",
 //         "Help string for debug",
 //         false);
 //
-//     add(&name,
+//     add(&MyFlags::name,
 //         "name",
 //         "Help string for name");
 //   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aeecca3/3rdparty/stout/include/stout/flags/flags.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/flags/flags.hpp b/3rdparty/stout/include/stout/flags/flags.hpp
index e00aedf..de029d2 100644
--- a/3rdparty/stout/include/stout/flags/flags.hpp
+++ b/3rdparty/stout/include/stout/flags/flags.hpp
@@ -44,7 +44,11 @@ namespace flags {
 class FlagsBase
 {
 public:
-  FlagsBase() { add(&help, "help", "Prints this help message", false); }
+  FlagsBase()
+  {
+    add(&FlagsBase::help, "help", "Prints this help message", false);
+  }
+
   virtual ~FlagsBase() = default;
 
   // Explicitly disable rvalue constructors and assignment operators
@@ -62,7 +66,6 @@ public:
   FlagsBase& operator=(const FlagsBase&) = default;
   FlagsBase& operator=(FlagsBase&&) = delete;
 
-
   // Load any flags from the environment given the variable prefix,
   // i.e., given prefix 'STOUT_' will load a flag named 'foo' via
   // environment variables 'STOUT_foo' or 'STOUT_FOO'.

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aeecca3/3rdparty/stout/tests/flags_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/flags_tests.cpp b/3rdparty/stout/tests/flags_tests.cpp
index b2de02d..da4deb9 100644
--- a/3rdparty/stout/tests/flags_tests.cpp
+++ b/3rdparty/stout/tests/flags_tests.cpp
@@ -48,31 +48,31 @@ using utils::arraySize;
 class EmptyFlags : public virtual FlagsBase {};
 
 
-class TestFlags : public virtual FlagsBase
+class TestFlagsBase : public virtual FlagsBase
 {
 public:
-  TestFlags()
+  TestFlagsBase()
   {
-    add(&TestFlags::name1,
+    add(&TestFlagsBase::name1,
         "name1",
         "Set name1",
         "ben folds");
 
-    add(&TestFlags::name2,
+    add(&TestFlagsBase::name2,
         "name2",
         "Set name2",
         42);
 
-    add(&TestFlags::name3,
+    add(&TestFlagsBase::name3,
         "name3",
         "Set name3",
         false);
 
-    add(&TestFlags::name4,
+    add(&TestFlagsBase::name4,
         "name4",
         "Set name4");
 
-    add(&TestFlags::name5,
+    add(&TestFlagsBase::name5,
         "name5",
         "Set name5");
   }
@@ -87,7 +87,7 @@ public:
 
 TEST(FlagsTest, Load)
 {
-  TestFlags flags;
+  TestFlagsBase flags;
 
   const map<string, Option<string>> values = {
     {"name1", Some("billy joel")},
@@ -111,101 +111,100 @@ TEST(FlagsTest, Load)
 
 TEST(FlagsTest, Add)
 {
-  TestFlags flags;
-
-  Option<string> name6;
-
-  flags.add(&name6,
-            "name6",
-            "Also set name6");
-
-  bool name7;
-
-  flags.add(&name7,
-            "name7",
-            "Also set name7",
-            true);
-
-  Option<string> name8;
-
-  flags.add(&name8,
-            "name8",
-            "Also set name8");
+  class TestFlags : public virtual FlagsBase
+  {
+  public:
+    TestFlags()
+    {
+      add(&TestFlags::name1, "name1", "Also set name1");
+      add(&TestFlags::name2, "name2", "Also set name2", true);
+      add(&TestFlags::name3, "name3", "Also set name3");
+      add(&TestFlags::name4, "name4", "Also set name4");
+    }
 
-  Option<string> name9;
+    Option<string> name1;
+    bool name2;
+    Option<string> name3;
+    Option<string> name4;
+  };
 
-  flags.add(&name9,
-            "name9",
-            "Also set name9");
+  TestFlags flags;
 
   const map<string, Option<string>> values = {
-    {"name6", Some("ben folds")},
-    {"no-name7", None()},
-    {"name9", Some("")}
+    {"name1", Some("ben folds")},
+    {"no-name2", None()},
+    {"name4", Some("")}
   };
 
   flags.load(values);
 
-  ASSERT_SOME(name6);
-  EXPECT_EQ("ben folds", name6.get());
+  ASSERT_SOME(flags.name1);
+  EXPECT_EQ("ben folds", flags.name1.get());
 
-  EXPECT_FALSE(name7);
+  EXPECT_FALSE(flags.name2);
 
-  EXPECT_NONE(name8);
+  EXPECT_NONE(flags.name3);
 
-  ASSERT_SOME(name9);
-  EXPECT_EQ("", name9.get());
+  ASSERT_SOME(flags.name4);
+  EXPECT_EQ("", flags.name4.get());
 }
 
 
 TEST(FlagsTest, Alias)
 {
-  TestFlags flags;
-
-  Option<string> name6;
-
-  flags.add(&name6,
-            "name6",
-            Some("alias6"),
-            "Also set name6");
+  class TestFlags : public virtual FlagsBase
+  {
+  public:
+    TestFlags()
+    {
+      add(
+        &TestFlags::name1,
+        "name1",
+        Some("alias1"),
+        "Also set name1");
 
-  bool name7;
+      add(&TestFlags::name2,
+        "name2",
+        Some("alias2"),
+        "Also set name2",
+        true);
 
-  flags.add(&name7,
-            "name7",
-            Some("alias7"),
-            "Also set name7",
-            true);
+      add(
+        &TestFlags::name3,
+        "name3",
+        Some("alias3"),
+        "Also set name3",
+        "value8");
+    }
 
-  string name8;
+    Option<string> name1;
+    bool name2;
+    string name3;
+  };
 
-  flags.add(&name8,
-            "name8",
-            Some("alias8"),
-            "Also set name8",
-            "value8");
+  TestFlags flags;
 
   // Load with alias names.
   const map<string, Option<string>> values = {
-     {"alias6", Some("foo")},
-     {"no-alias7", None()},
-     {"alias8", Some("bar")}
+     {"alias1", Some("foo")},
+     {"no-alias2", None()},
+     {"alias3", Some("bar")}
   };
 
   flags.load(values);
 
-  ASSERT_SOME(name6);
-  EXPECT_EQ("foo", name6.get());
+  ASSERT_SOME(flags.name1);
+  EXPECT_EQ("foo", flags.name1.get());
 
-  EXPECT_FALSE(name7);
+  EXPECT_FALSE(flags.name2);
 
-  EXPECT_EQ("bar", name8);
+  EXPECT_EQ("bar", flags.name3);
 }
 
 
 TEST(FlagsTest, Flags)
 {
-  TestFlags flags;
+  TestFlagsBase flags;
 
   const map<string, Option<string>> values = {
     {"name1", Some("billy joel")},
@@ -232,7 +231,7 @@ TEST(FlagsTest, Flags)
 // to be deleted on Windows. See MESOS-5880.
 TEST_TEMP_DISABLED_ON_WINDOWS(FlagsTest, LoadFromEnvironment)
 {
-  TestFlags flags;
+  TestFlagsBase flags;
 
   os::setenv("FLAGSTEST_name1", "billy joel");
   os::setenv("FLAGSTEST_name2", "43");
@@ -262,7 +261,7 @@ TEST_TEMP_DISABLED_ON_WINDOWS(FlagsTest, LoadFromEnvironment)
 
 TEST(FlagsTest, LoadFromCommandLine)
 {
-  TestFlags flags;
+  TestFlagsBase flags;
 
   const char* argv[] = {
     "/path/to/program",
@@ -289,7 +288,7 @@ TEST(FlagsTest, LoadFromCommandLine)
 
 TEST(FlagsTest, LoadFromCommandLineWithNonFlags)
 {
-  TestFlags flags;
+  TestFlagsBase flags;
 
   const char* argv[] = {
     "/path/to/program",
@@ -321,7 +320,7 @@ TEST(FlagsTest, LoadFromCommandLineWithNonFlags)
 
 TEST(FlagsTest, LoadFromCommandLineWithDashDash)
 {
-  TestFlags flags;
+  TestFlagsBase flags;
 
   const char* argv[] = {
     "/path/to/program",
@@ -351,7 +350,7 @@ TEST(FlagsTest, LoadFromCommandLineWithDashDash)
 
 TEST(FlagsTest, LoadFromCommandLineAndUpdateArgcArgv)
 {
-  TestFlags flags;
+  TestFlagsBase flags;
 
   char* argv[] = {
     (char*)"/path/to/program",
@@ -396,26 +395,22 @@ TEST(FlagsTest, LoadFromCommandLineAndUpdateArgcArgv)
 
 TEST(FlagsTest, Stringification)
 {
-  TestFlags flags;
-
-  Duration name6;
-
-  flags.add(&name6,
-            "name6",
-            "Also set name6",
-            Milliseconds(42));
-
-  Option<bool> name7;
-
-  flags.add(&name7,
-            "name7",
-            "Optional name7");
+  class TestFlags : public virtual TestFlagsBase
+  {
+  public:
+    TestFlags()
+    {
+      add(&TestFlags::name6, "name6", "Also set name6", Milliseconds(42));
+      add(&TestFlags::name7, "name7", "Optional name7");
+      add(&TestFlags::name8, "name8", "Optional name8");
+    }
 
-  Option<bool> name8;
+    Duration name6;
+    Option<bool> name7;
+    Option<bool> name8;
+  };
 
-  flags.add(&name8,
-            "name8",
-            "Optional name8");
+  TestFlags flags;
 
   const map<string, Option<string>> values = {
     {"name2", Some("43")},
@@ -456,35 +451,43 @@ TEST(FlagsTest, Stringification)
 
 TEST(FlagsTest, EffectiveName)
 {
-  TestFlags flags;
-
-  Option<string> name6;
-
-  flags.add(&name6,
-            "name6",
-            Some("alias6"),
-            "Also set name6");
+  class TestFlags : public virtual FlagsBase
+  {
+  public:
+    TestFlags()
+    {
+       add(
+         &TestFlags::name1,
+         "name1",
+         Some("alias1"),
+         "Also set name1");
+
+       add(
+         &TestFlags::name2,
+         "name2",
+         Some("alias2"),
+         "Also set name2",
+         "value7");
+    }
 
-  string name7;
+    Option<string> name1;
+    string name2;
+  };
 
-  flags.add(&name7,
-            "name7",
-            Some("alias7"),
-            "Also set name7",
-            "value7");
+  TestFlags flags;
 
-  // Only load "name6" flag explicitly.
+  // Only load "name1" flag explicitly.
   const map<string, Option<string>> values = {
-    {"alias6", Some("value6")}
+    {"alias1", Some("value6")}
   };
 
   flags.load(values);
 
   foreachvalue (const Flag& flag, flags) {
-    if (flag.name == "name6") {
-      EXPECT_EQ("alias6", flag.effective_name().value);
-    } else if (flag.name == "name7") {
-      EXPECT_EQ("name7", flag.effective_name().value);
+    if (flag.name == "name1") {
+      EXPECT_EQ("alias1", flag.effective_name().value);
+    } else if (flag.name == "name2") {
+      EXPECT_EQ("name2", flag.effective_name().value);
     }
   }
 }
@@ -492,24 +495,32 @@ TEST(FlagsTest, EffectiveName)
 
 TEST(FlagsTest, DeprecationWarning)
 {
-  TestFlags flags;
+  class TestFlags : public virtual FlagsBase
+  {
+  public:
+    TestFlags()
+    {
+      add(
+        &TestFlags::name,
+        "name",
+        flags::DeprecatedName("alias"),
+        "Also set name");
+    }
 
-  Option<string> name6;
+    Option<string> name;
+  };
 
-  flags.add(&name6,
-            "name6",
-            flags::DeprecatedName("alias6"),
-            "Also set name6");
+  TestFlags flags;
 
   const map<string, Option<string>> values = {
-    {"alias6", Some("value6")}
+    {"alias", Some("value6")}
   };
 
   Try<Warnings> load = flags.load(values);
   ASSERT_SOME(load);
 
   EXPECT_EQ(1u, load->warnings.size());
-  EXPECT_EQ("Loaded deprecated flag 'alias6'", load->warnings[0].message);
+  EXPECT_EQ("Loaded deprecated flag 'alias'", load->warnings[0].message);
 }
 
 
@@ -517,7 +528,7 @@ TEST(FlagsTest, DeprecationWarning)
 // assumes filesystems are rooted at '/'. See MESOS-5937.
 TEST_TEMP_DISABLED_ON_WINDOWS(FlagsTest, DuplicatesFromEnvironment)
 {
-  TestFlags flags;
+  TestFlagsBase flags;
 
   os::setenv("FLAGSTEST_name1", "ben folds");
   os::setenv("FLAGSTEST_name2", "50");
@@ -537,7 +548,7 @@ TEST_TEMP_DISABLED_ON_WINDOWS(FlagsTest, DuplicatesFromEnvironment)
   EXPECT_EQ(flags.name2, 50);
 
   {
-    flags = TestFlags();
+    flags = TestFlagsBase();
     std::map<std::string, std::string> values;
     values["name1"] = "billy joel";
 
@@ -551,7 +562,7 @@ TEST_TEMP_DISABLED_ON_WINDOWS(FlagsTest, DuplicatesFromEnvironment)
   }
 
   {
-    flags = TestFlags();
+    flags = TestFlagsBase();
     std::map<std::string, Option<std::string>> values;
     values["name1"] = "billy joel";
     values["name2"] = "51";
@@ -573,7 +584,7 @@ TEST_TEMP_DISABLED_ON_WINDOWS(FlagsTest, DuplicatesFromEnvironment)
 
 TEST(FlagsTest, DuplicatesFromCommandLine)
 {
-  TestFlags flags;
+  TestFlagsBase flags;
 
   const char* argv[] = {
     "/path/to/program",
@@ -590,19 +601,23 @@ TEST(FlagsTest, DuplicatesFromCommandLine)
 
 TEST(FlagsTest, AliasDuplicateFromCommandLine)
 {
-  TestFlags flags;
+  class TestFlags : public virtual FlagsBase
+  {
+  public:
+    TestFlags()
+    {
+      add(&TestFlags::name, "name", Some("alias"), "Also set name");
+    }
 
-  Option<string> name6;
+    Option<string> name;
+  };
 
-  flags.add(&name6,
-            "name6",
-            Some("alias6"),
-            "Also set name6");
+  TestFlags flags;
 
   const char* argv[] = {
     "/path/to/program",
-    "--name6=billy joel",
-    "--alias6=ben folds"
+    "--name=billy joel",
+    "--alias=ben folds"
   };
 
   // Loading the same flag with the name and alias should be an error.
@@ -613,6 +628,14 @@ TEST(FlagsTest, AliasDuplicateFromCommandLine)
 
 TEST(FlagsTest, Errors)
 {
+  class TestFlags : public virtual TestFlagsBase
+  {
+  public:
+    TestFlags() { add(&TestFlags::name6, "name6", "Also set name6"); }
+
+    Option<int> name6;
+  };
+
   TestFlags flags;
 
   const int argc = 2;
@@ -680,9 +703,6 @@ TEST(FlagsTest, Errors)
   EXPECT_EQ("Failed to load non-boolean flag 'name2' "
             "via 'no-name2'", load.error());
 
-  Option<int> name6;
-  flags.add(&name6, "name6", "Also set name6");
-
   // Now test a non-boolean flag using empty string value.
   argv[1] = (char*) "--name6=";
 
@@ -698,14 +718,22 @@ TEST(FlagsTest, Errors)
 // result in an error.
 TEST(FlagsTest, MissingRequiredFlag)
 {
-  TestFlags flags;
+  class TestFlags : public virtual TestFlagsBase
+  {
+  public:
+    TestFlags()
+    {
+      add(
+        &TestFlags::requiredFlag,
+        "required_flag",
+        "This flag is required and has no default value.");
+    }
+
+    // A required flag which must be set and has no default value.
+    string requiredFlag;
+  };
 
-  // A required flag which must be set and has no default value.
-  string requiredFlag;
-  flags.add(
-      &requiredFlag,
-      "required_flag",
-      "This flag is required and has no default value.");
+  TestFlags flags;
 
   const int argc = 2;
   char* argv[argc];
@@ -730,7 +758,7 @@ TEST(FlagsTest, Validate)
   public:
     ValidatingTestFlags()
     {
-      add(&duration,
+      add(&ValidatingTestFlags::duration,
           "duration",
           "Duration to test validation",
           Seconds(10),
@@ -761,30 +789,22 @@ TEST(FlagsTest, Validate)
 
 TEST(FlagsTest, Usage)
 {
-  TestFlags flags;
-
-  Option<string> name6;
-
-  flags.add(&name6,
-            "z6",
-            Some("a6"),
-            "Also set name6");
-
-  bool name7;
-
-  flags.add(&name7,
-            "z7",
-            Some("a7"),
-            "Also set name7",
-            true);
+  class TestFlags : public virtual TestFlagsBase
+  {
+  public:
+    TestFlags()
+    {
+      add(&TestFlags::name6, "z6", Some("a6"), "Also set name6");
+      add(&TestFlags::name7, "z7", Some("a7"), "Also set name7", true);
+      add(&TestFlags::name8, "z8", Some("a8"), "Also set name8", "value8");
+    }
 
-  string name8;
+    Option<string> name6;
+    bool name7;
+    string name8;
+  };
 
-  flags.add(&name8,
-            "z8",
-            Some("a8"),
-            "Also set name8",
-            "value8");
+  TestFlags flags;
 
   EXPECT_EQ(
       "Usage:  [options]\n"
@@ -804,7 +824,7 @@ TEST(FlagsTest, Usage)
 
 TEST(FlagsTest, UsageMessage)
 {
-  TestFlags flags;
+  TestFlagsBase flags;
   flags.setUsageMessage("This is a test");
 
   EXPECT_EQ(
@@ -853,7 +873,7 @@ TEST(FlagsTest, ProgramName)
 
 TEST(FlagsTest, OptionalMessage)
 {
-  TestFlags flags;
+  TestFlagsBase flags;
 
   EXPECT_EQ(
       "Good news: this test passed!\n"
@@ -872,43 +892,45 @@ TEST(FlagsTest, OptionalMessage)
 
 TEST(FlagsTest, Duration)
 {
-  TestFlags flags;
-
-  Duration name6;
-
-  flags.add(&name6,
-            "name6",
-            "Amount of time",
-            Milliseconds(100));
+  class TestFlags : public virtual FlagsBase
+  {
+  public:
+    TestFlags()
+    {
+      add(&TestFlags::name1, "name1", "Amount of time", Milliseconds(100));
+      add(&TestFlags::name2, "name2", "Also some amount of time");
+    }
 
-  Option<Duration> name7;
+    Duration name1;
+    Option<Duration> name2;
+  };
 
-  flags.add(&name7,
-            "name7",
-            "Also some amount of time");
+  TestFlags flags;
 
   const map<string, Option<string>> values = {
-    {"name6", Some("2mins")},
-    {"name7", Some("3hrs")}
+    {"name1", Some("2mins")},
+    {"name2", Some("3hrs")}
   };
 
   ASSERT_SOME(flags.load(values));
 
-  EXPECT_EQ(Minutes(2), name6);
+  EXPECT_EQ(Minutes(2), flags.name1);
 
-  EXPECT_SOME_EQ(Hours(3), name7);
+  EXPECT_SOME_EQ(Hours(3), flags.name2);
 }
 
 
 TEST(FlagsTest, JSON)
 {
-  TestFlags flags;
+  class TestFlags : public virtual FlagsBase
+  {
+  public:
+    TestFlags() { add(&TestFlags::json, "json", "JSON string"); }
 
-  Option<JSON::Object> json;
+    Option<JSON::Object> json;
+  };
 
-  flags.add(&json,
-            "json",
-            "JSON string");
+  TestFlags flags;
 
   JSON::Object object;
 
@@ -926,7 +948,7 @@ TEST(FlagsTest, JSON)
 
   ASSERT_SOME(flags.load(values));
 
-  ASSERT_SOME_EQ(object, json);
+  ASSERT_SOME_EQ(object, flags.json);
 }
 
 
@@ -937,13 +959,15 @@ class FlagsFileTest : public TemporaryDirectoryTest {};
 // assumes filesystems are rooted at '/'. See MESOS-5937.
 TEST_F_TEMP_DISABLED_ON_WINDOWS(FlagsFileTest, JSONFile)
 {
-  TestFlags flags;
+  class TestFlags : public virtual FlagsBase
+  {
+  public:
+    TestFlags() { add(&TestFlags::json, "json", "JSON string"); }
 
-  Option<JSON::Object> json;
+    Option<JSON::Object> json;
+  };
 
-  flags.add(&json,
-            "json",
-            "JSON string");
+  TestFlags flags;
 
   JSON::Object object;
 
@@ -966,19 +990,24 @@ TEST_F_TEMP_DISABLED_ON_WINDOWS(FlagsFileTest, JSONFile)
 
   ASSERT_SOME(flags.load(values));
 
-  ASSERT_SOME_EQ(object, json);
+  ASSERT_SOME_EQ(object, flags.json);
 }
 
 
 TEST_F(FlagsFileTest, FilePrefix)
 {
-  TestFlags flags;
+  class TestFlags : public virtual FlagsBase
+  {
+  public:
+    TestFlags()
+    {
+      add(&TestFlags::something, "something", "arg to be loaded from file");
+    }
 
-  Option<string> something;
+    Option<string> something;
+  };
 
-  flags.add(&something,
-            "something",
-            "arg to be loaded from file");
+  TestFlags flags;
 
   // Write the JSON to a file.
   const string file = path::join(os::getcwd(), "file");
@@ -990,5 +1019,5 @@ TEST_F(FlagsFileTest, FilePrefix)
 
   ASSERT_SOME(flags.load(values));
 
-  ASSERT_SOME_EQ("testing", something);
+  ASSERT_SOME_EQ("testing", flags.something);
 }

http://git-wip-us.apache.org/repos/asf/mesos/blob/5aeecca3/3rdparty/stout/tests/subcommand_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/subcommand_tests.cpp b/3rdparty/stout/tests/subcommand_tests.cpp
index 9cdb1ad..54d70c9 100644
--- a/3rdparty/stout/tests/subcommand_tests.cpp
+++ b/3rdparty/stout/tests/subcommand_tests.cpp
@@ -33,14 +33,14 @@ public:
   {
     Flags()
     {
-      add(&b, "b", "bool");
-      add(&i, "i", "int");
-      add(&s, "s", "string");
-      add(&s2, "s2", "string with single quote");
-      add(&s3, "s3", "string with double quote");
-      add(&d, "d", "Duration");
-      add(&y, "y", "Bytes");
-      add(&j, "j", "JSON::Object");
+      add(&Flags::b, "b", "bool");
+      add(&Flags::i, "i", "int");
+      add(&Flags::s, "s", "string");
+      add(&Flags::s2, "s2", "string with single quote");
+      add(&Flags::s3, "s3", "string with double quote");
+      add(&Flags::d, "d", "Duration");
+      add(&Flags::y, "y", "Bytes");
+      add(&Flags::j, "j", "JSON::Object");
     }
 
     void populate()


[2/4] mesos git commit: Fully qualified addresses of flag members in `add` calls in libprocess.

Posted by mp...@apache.org.
Fully qualified addresses of flag members in `add` calls in libprocess.

While right now we can technically `add` variables to `Flags` classes
which are not members, the in order to have correct copy semantics for
`Flags` only member variables should be used.

Here we changed all instances to a full pointer-to-member syntax in
the current code.

Review: https://reviews.apache.org/r/46823/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/dde5eee7
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/dde5eee7
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/dde5eee7

Branch: refs/heads/master
Commit: dde5eee7b11be8df874571316e29a9a25ae59150
Parents: 5aeecca
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Tue Oct 18 03:29:39 2016 -0400
Committer: Michael Park <mp...@apache.org>
Committed: Tue Oct 18 04:28:39 2016 -0400

----------------------------------------------------------------------
 3rdparty/libprocess/src/tests/subprocess_tests.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/dde5eee7/3rdparty/libprocess/src/tests/subprocess_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/subprocess_tests.cpp b/3rdparty/libprocess/src/tests/subprocess_tests.cpp
index 630a714..0dc1c62 100644
--- a/3rdparty/libprocess/src/tests/subprocess_tests.cpp
+++ b/3rdparty/libprocess/src/tests/subprocess_tests.cpp
@@ -623,14 +623,14 @@ struct Flags : public virtual flags::FlagsBase
 {
   Flags()
   {
-    add(&b, "b", "bool");
-    add(&i, "i", "int");
-    add(&s, "s", "string");
-    add(&s2, "s2", "string with single quote");
-    add(&s3, "s3", "string with double quote");
-    add(&d, "d", "Duration");
-    add(&y, "y", "Bytes");
-    add(&j, "j", "JSON::Object");
+    add(&Flags::b, "b", "bool");
+    add(&Flags::i, "i", "int");
+    add(&Flags::s, "s", "string");
+    add(&Flags::s2, "s2", "string with single quote");
+    add(&Flags::s3, "s3", "string with double quote");
+    add(&Flags::d, "d", "Duration");
+    add(&Flags::y, "y", "Bytes");
+    add(&Flags::j, "j", "JSON::Object");
   }
 
   Option<bool> b;


[4/4] mesos git commit: Removed the non-member pointer overloads of `FlagsBase::add`.

Posted by mp...@apache.org.
Removed the non-member pointer overloads of `FlagsBase::add`.

Review: https://reviews.apache.org/r/46825/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/92fb8e7e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/92fb8e7e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/92fb8e7e

Branch: refs/heads/master
Commit: 92fb8e7ee2280b5b5784eeee0fd3d2f5f3e3814c
Parents: f441eb9
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Tue Oct 18 03:29:54 2016 -0400
Committer: Michael Park <mp...@apache.org>
Committed: Tue Oct 18 06:09:42 2016 -0400

----------------------------------------------------------------------
 3rdparty/stout/include/stout/flags/flags.hpp | 212 ----------------------
 1 file changed, 212 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/92fb8e7e/3rdparty/stout/include/stout/flags/flags.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/flags/flags.hpp b/3rdparty/stout/include/stout/flags/flags.hpp
index de029d2..15446de 100644
--- a/3rdparty/stout/include/stout/flags/flags.hpp
+++ b/3rdparty/stout/include/stout/flags/flags.hpp
@@ -182,99 +182,6 @@ public:
   // `Option` infers a character array type, which causes problems in the
   // current implementation of `Option`. See MESOS-5471.
 
-  template <typename T1, typename T2, typename F>
-  void add(
-      T1* t1,
-      const Name& name,
-      const Option<Name>& alias,
-      const std::string& help,
-      const T2* t2,
-      F validate);
-
-  template <typename T1, typename T2, typename F>
-  void add(
-      T1* t1,
-      const Name& name,
-      const std::string& help,
-      const T2& t2,
-      F validate)
-  {
-    add(t1, name, None(), help, &t2, validate);
-  }
-
-  template <typename T1, typename T2>
-  void add(
-      T1* t1,
-      const Name& name,
-      const std::string& help,
-      const T2& t2)
-  {
-    add(t1, name, None(), help, &t2, [](const T1&) { return None(); });
-  }
-
-  template <typename T1>
-  void add(
-      T1* t1,
-      const Name& name,
-      const std::string& help)
-  {
-    add(t1,
-        name,
-        None(),
-        help,
-        static_cast<const T1*>(nullptr),
-        [](const T1&) { return None(); });
-  }
-
-  template <typename T1, typename T2>
-  void add(
-      T1* t1,
-      const Name& name,
-      const Option<Name>& alias,
-      const std::string& help,
-      const T2& t2)
-  {
-    add(t1, name, alias, help, &t2, [](const T1&) { return None(); });
-  }
-
-  template <typename T, typename F>
-  void add(
-      Option<T>* option,
-      const Name& name,
-      const Option<Name>& alias,
-      const std::string& help,
-      F validate);
-
-  template <typename T, typename F>
-  void add(
-      Option<T>* option,
-      const Name& name,
-      const std::string& help,
-      F validate)
-  {
-    add(option, name, None(), help, validate);
-  }
-
-  template <typename T>
-  void add(
-      Option<T>* option,
-      const Name& name,
-      const std::string& help)
-  {
-    add(option, name, None(), help, [](const Option<T>&) { return None(); });
-  }
-
-  template <typename T>
-  void add(
-      Option<T>* option,
-      const Name& name,
-      const Option<Name>& alias,
-      const std::string& help)
-  {
-    add(option, name, alias, help, [](const Option<T>&) { return None(); });
-  }
-
-protected:
   template <typename Flags, typename T1, typename T2, typename F>
   void add(
       T1 Flags::*t1,
@@ -381,7 +288,6 @@ protected:
 
   void add(const Flag& flag);
 
-public:
   // TODO(marco): IMO the entire --help functionality should be
   // encapsulated inside the FlagsBase class.
   // For now, exposing this for the caller(s) to decide what to
@@ -419,124 +325,6 @@ private:
 };
 
 
-template <typename T1, typename T2, typename F>
-void FlagsBase::add(
-    T1* t1,
-    const Name& name,
-    const Option<Name>& alias,
-    const std::string& help,
-    const T2* t2,
-    F validate)
-{
-  // Don't bother adding anything if the pointer is `nullptr`.
-  if (t1 == nullptr) {
-    return;
-  }
-
-  Flag flag;
-  flag.name = name;
-  flag.alias = alias;
-  flag.help = help;
-  flag.boolean = typeid(T1) == typeid(bool);
-
-  if (t2 != nullptr) {
-    *t1 = *t2; // Set the default.
-    flag.required = false;
-  } else {
-    flag.required = true;
-  }
-
-  // NOTE: We need to take FlagsBase* (or const FlagsBase&) as the
-  // first argument to match the function signature of the 'load',
-  // 'stringify', and 'validate' lambdas used in other overloads of
-  // FlagsBase::add. Since we don't need to use the pointer here we
-  // don't name it as a parameter.
-
-  flag.load = [t1](FlagsBase*, const std::string& value) -> Try<Nothing> {
-    // NOTE: 'fetch' "retrieves" the value if necessary and then
-    // invokes 'parse'. See 'fetch' for more details.
-    Try<T1> t = fetch<T1>(value);
-    if (t.isSome()) {
-      *t1 = t.get();
-    } else {
-      return Error("Failed to load value '" + value + "': " + t.error());
-    }
-
-    return Nothing();
-  };
-
-  flag.stringify = [t1](const FlagsBase&) -> Option<std::string> {
-    return stringify(*t1);
-  };
-
-  flag.validate = [t1, validate](const FlagsBase&) -> Option<Error> {
-    return validate(*t1);
-  };
-
-  // Update the help string to include the default value.
-  flag.help += help.size() > 0 && help.find_last_of("\n\r") != help.size() - 1
-    ? " (default: " // On same line, add space.
-    : "(default: "; // On newline.
-  if (t2 != nullptr) {
-    flag.help += stringify(*t2);
-  }
-  flag.help += ")";
-
-  add(flag);
-}
-
-
-template <typename T, typename F>
-void FlagsBase::add(
-    Option<T>* option,
-    const Name& name,
-    const Option<Name>& alias,
-    const std::string& help,
-    F validate)
-{
-  // Don't bother adding anything if the pointer is `nullptr`.
-  if (option == nullptr) {
-    return;
-  }
-
-  Flag flag;
-  flag.name = name;
-  flag.alias = alias;
-  flag.help = help;
-  flag.boolean = typeid(T) == typeid(bool);
-  flag.required = false;
-
-  // NOTE: See comment above in T* overload of FlagsBase::add for why
-  // we need to take the FlagsBase* parameter.
-
-  flag.load = [option](FlagsBase*, const std::string& value) -> Try<Nothing> {
-    // NOTE: 'fetch' "retrieves" the value if necessary and then
-    // invokes 'parse'. See 'fetch' for more details.
-    Try<T> t = fetch<T>(value);
-    if (t.isSome()) {
-      *option = Some(t.get());
-    } else {
-      return Error("Failed to load value '" + value + "': " + t.error());
-    }
-
-    return Nothing();
-  };
-
-  flag.stringify = [option](const FlagsBase&) -> Option<std::string> {
-    if (option->isSome()) {
-      return stringify(option->get());
-    }
-    return None();
-  };
-
-  flag.validate = [option, validate](const FlagsBase&) -> Option<Error> {
-    return validate(*option);
-  };
-
-  add(flag);
-}
-
-
 template <typename Flags, typename T1, typename T2, typename F>
 void FlagsBase::add(
     T1 Flags::*t1,


[3/4] mesos git commit: Fully qualified addresses of flag members in `add` calls in mesos.

Posted by mp...@apache.org.
Fully qualified addresses of flag members in `add` calls in mesos.

While right now we can technically `add` variables to `Flags` classes
which are not members, the in order to have correct copy semantics for
`Flags` only member variables should be used.

Here we changed all instances to a full pointer-to-member syntax in
the current code.

Review: https://reviews.apache.org/r/46824/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f441eb9a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f441eb9a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f441eb9a

Branch: refs/heads/master
Commit: f441eb9adb8c1443e62e10d17ed4019b66391168
Parents: dde5eee
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Tue Oct 18 04:48:10 2016 -0400
Committer: Michael Park <mp...@apache.org>
Committed: Tue Oct 18 06:09:33 2016 -0400

----------------------------------------------------------------------
 src/cli/execute.cpp                             |  44 +++---
 src/cli/resolve.cpp                             |  33 +++--
 src/docker/executor.hpp                         |  16 +--
 src/examples/balloon_framework.cpp              |  16 +--
 src/examples/disk_full_framework.cpp            |  10 +-
 src/examples/dynamic_reservation_framework.cpp  |   8 +-
 src/examples/load_generator_framework.cpp       |   2 +-
 src/examples/long_lived_framework.cpp           |  14 +-
 src/examples/no_executor_framework.cpp          |  16 +--
 src/examples/persistent_volume_framework.cpp    |  10 +-
 src/examples/test_framework.cpp                 |  37 ++---
 src/examples/test_http_framework.cpp            |  33 +++--
 src/launcher/executor.cpp                       |  14 +-
 src/local/main.cpp                              |  35 +++--
 src/master/main.cpp                             | 139 ++++++++++---------
 src/slave/container_loggers/lib_logrotate.hpp   |  16 +--
 src/slave/container_loggers/logrotate.hpp       |   8 +-
 .../mesos/isolators/network/cni/cni.cpp         |  14 +-
 .../mesos/isolators/network/port_mapping.cpp    |  20 +--
 src/slave/containerizer/mesos/launch.cpp        |  22 +--
 src/slave/containerizer/mesos/mount.cpp         |   4 +-
 src/slave/main.cpp                              | 134 +++++++++---------
 src/tests/active_user_test_helper.cpp           |   2 +-
 .../containerizer/capabilities_test_helper.cpp  |   4 +-
 24 files changed, 344 insertions(+), 307 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/cli/execute.cpp
----------------------------------------------------------------------
diff --git a/src/cli/execute.cpp b/src/cli/execute.cpp
index 94ac463..f308b34 100644
--- a/src/cli/execute.cpp
+++ b/src/cli/execute.cpp
@@ -91,11 +91,11 @@ class Flags : public virtual flags::FlagsBase
 public:
   Flags()
   {
-    add(&master,
+    add(&Flags::master,
         "master",
         "Mesos master (e.g., IP:PORT).");
 
-    add(&task_group,
+    add(&Flags::task_group,
         "task_group",
         "The value could be a JSON-formatted string of `TaskGroupInfo` or a\n"
         "file path containing the JSON-formatted `TaskGroupInfo`. Path must\n"
@@ -135,11 +135,11 @@ public:
         "     ]\n"
         "}");
 
-    add(&name,
+    add(&Flags::name,
         "name",
         "Name for the command.");
 
-    add(&shell,
+    add(&Flags::shell,
         "shell",
         "Determine the command is a shell or not. If not, 'command' will be\n"
         "treated as executable value and arguments (TODO).",
@@ -147,11 +147,11 @@ public:
 
     // TODO(alexr): Once MESOS-4882 lands, elaborate on what `command` can
     // mean: an executable, a shell command, an entrypoint for a container.
-    add(&command,
+    add(&Flags::command,
         "command",
         "Command to launch.");
 
-    add(&environment,
+    add(&Flags::environment,
         "env",
         "Shell command environment variables.\n"
         "The value could be a JSON formatted string of environment variables\n"
@@ -159,80 +159,80 @@ public:
         "formatted environment variables. Path should be of the form\n"
         "'file:///path/to/file'.");
 
-    add(&resources,
+    add(&Flags::resources,
         "resources",
         "Resources for the command.",
         "cpus:1;mem:128");
 
-    add(&hadoop,
+    add(&Flags::hadoop,
         "hadoop",
         "Path to 'hadoop' script (used for copying packages).",
         "hadoop");
 
-    add(&hdfs,
+    add(&Flags::hdfs,
         "hdfs",
         "The ip:port of the NameNode service.",
         "localhost:9000");
 
-    add(&package,
+    add(&Flags::package,
         "package",
         "Package to upload into HDFS and copy into command's\n"
         "working directory (requires 'hadoop', see --hadoop).");
 
-    add(&overwrite,
+    add(&Flags::overwrite,
         "overwrite",
         "Overwrite the package in HDFS if it already exists.",
         false);
 
-    add(&checkpoint,
+    add(&Flags::checkpoint,
         "checkpoint",
         "Enable checkpointing for the framework.",
         false);
 
-    add(&appc_image,
+    add(&Flags::appc_image,
         "appc_image",
         "Appc image name that follows the Appc spec\n"
         "(e.g., ubuntu, example.com/reduce-worker).");
 
-    add(&docker_image,
+    add(&Flags::docker_image,
         "docker_image",
         "Docker image that follows the Docker CLI naming <image>:<tag>\n"
         "(i.e., ubuntu, busybox:latest).");
 
-    add(&framework_capabilities,
+    add(&Flags::framework_capabilities,
         "framework_capabilities",
         "Comma separated list of optional framework capabilities to enable.\n"
         "(the only valid value is currently 'GPU_RESOURCES')");
 
-    add(&containerizer,
+    add(&Flags::containerizer,
         "containerizer",
         "Containerizer to be used (i.e., docker, mesos).",
         "mesos");
 
-    add(&role,
+    add(&Flags::role,
         "role",
         "Role to use when registering.",
         "*");
 
-    add(&kill_after,
+    add(&Flags::kill_after,
         "kill_after",
         "Specifies a delay after which the task is killed\n"
         "(e.g., 10secs, 2mins, etc).");
 
-    add(&networks,
+    add(&Flags::networks,
         "networks",
         "Comma-separated list of networks that the container will join,\n"
         "e.g., `net1,net2`.");
 
-    add(&principal,
+    add(&Flags::principal,
         "principal",
         "The principal to use for framework authentication.");
 
-    add(&secret,
+    add(&Flags::secret,
         "secret",
         "The secret to use for framework authentication.");
 
-    add(&volumes,
+    add(&Flags::volumes,
         "volumes",
         "The value could be a JSON-formatted string of volumes or a\n"
         "file path containing the JSON-formatted volumes. Path must\n"

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/cli/resolve.cpp
----------------------------------------------------------------------
diff --git a/src/cli/resolve.cpp b/src/cli/resolve.cpp
index 3a12f12..b3cba87 100644
--- a/src/cli/resolve.cpp
+++ b/src/cli/resolve.cpp
@@ -41,23 +41,30 @@ using std::endl;
 using std::string;
 
 
-int main(int argc, char** argv)
+class Flags : public virtual flags::FlagsBase
 {
-  flags::FlagsBase flags;
-  flags.setUsageMessage("Usage: " + Path(argv[0]).basename() + " <master>");
+public:
+  Flags()
+  {
+    add(&Flags::timeout,
+        "timeout",
+        "How long to wait to resolve master",
+        Seconds(5));
+
+    add(&Flags::verbose, "verbose", "Be verbose", false);
+  }
 
   Duration timeout;
-  flags.add(&timeout,
-            "timeout",
-            "How long to wait to resolve master",
-            Seconds(5));
 
   // TODO(marco): `verbose` is also a great candidate for FlagsBase.
   bool verbose;
-  flags.add(&verbose,
-            "verbose",
-            "Be verbose",
-            false);
+};
+
+
+int main(int argc, char** argv)
+{
+  Flags flags;
+  flags.setUsageMessage("Usage: " + Path(argv[0]).basename() + " <master>");
 
   // Load flags from environment and command line, and remove
   // them from argv.
@@ -95,9 +102,9 @@ int main(int argc, char** argv)
 
   Future<Option<MasterInfo>> masterInfo = detector.get()->detect();
 
-  if (!masterInfo.await(timeout)) {
+  if (!masterInfo.await(flags.timeout)) {
     cerr << "Failed to detect master from '" << master
-         << "' within " << timeout << endl;
+         << "' within " << flags.timeout << endl;
     return -1;
   } else {
     CHECK(!masterInfo.isDiscarded());

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/docker/executor.hpp
----------------------------------------------------------------------
diff --git a/src/docker/executor.hpp b/src/docker/executor.hpp
index 495fad5..8385631 100644
--- a/src/docker/executor.hpp
+++ b/src/docker/executor.hpp
@@ -35,41 +35,41 @@ namespace docker {
 struct Flags : public virtual mesos::internal::logging::Flags
 {
   Flags() {
-    add(&container,
+    add(&Flags::container,
         "container",
         "The name of the docker container to run.");
 
-    add(&docker,
+    add(&Flags::docker,
         "docker",
         "The path to the docker executable.");
 
-    add(&docker_socket,
+    add(&Flags::docker_socket,
         "docker_socket",
         "The UNIX socket path to be used by docker CLI for accessing docker\n"
         "daemon.");
 
-    add(&sandbox_directory,
+    add(&Flags::sandbox_directory,
         "sandbox_directory",
         "The path to the container sandbox holding stdout and stderr files\n"
         "into which docker container logs will be redirected.");
 
-    add(&mapped_directory,
+    add(&Flags::mapped_directory,
         "mapped_directory",
         "The sandbox directory path that is mapped in the docker container.");
 
     // TODO(alexr): Remove this after the deprecation cycle (started in 1.0).
-    add(&stop_timeout,
+    add(&Flags::stop_timeout,
         "stop_timeout",
         "The duration for docker to wait after stopping a running container\n"
         "before it kills that container. This flag is deprecated; use task's\n"
         "kill policy instead.");
 
-    add(&launcher_dir,
+    add(&Flags::launcher_dir,
         "launcher_dir",
         "Directory path of Mesos binaries. Mesos would find fetcher,\n"
         "containerizer and executor binary files under this directory.");
 
-    add(&task_environment,
+    add(&Flags::task_environment,
         "task_environment",
         "A JSON map of environment variables and values that should\n"
         "be passed into the task launched by this executor.");

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/examples/balloon_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/balloon_framework.cpp b/src/examples/balloon_framework.cpp
index 50add6a..79495ae 100644
--- a/src/examples/balloon_framework.cpp
+++ b/src/examples/balloon_framework.cpp
@@ -63,11 +63,11 @@ class Flags : public virtual flags::FlagsBase
 public:
   Flags()
   {
-    add(&master,
+    add(&Flags::master,
         "master",
         "Master to connect to.");
 
-    add(&task_memory_usage_limit,
+    add(&Flags::task_memory_usage_limit,
         "task_memory_usage_limit",
         None(),
         "Maximum size, in bytes, of the task's memory usage.\n"
@@ -83,33 +83,33 @@ public:
           return None();
         });
 
-    add(&task_memory,
+    add(&Flags::task_memory,
         "task_memory",
         "How much memory the framework will require per task.\n"
         "If not specified, the task(s) will use all available memory in\n"
         "applicable offers.");
 
-    add(&build_dir,
+    add(&Flags::build_dir,
         "build_dir",
         "The build directory of Mesos. If set, the framework will assume\n"
         "that the executor, framework, and agent(s) all live on the same\n"
         "machine.");
 
-    add(&executor_uri,
+    add(&Flags::executor_uri,
         "executor_uri",
         "URI the fetcher should use to get the executor.");
 
-    add(&executor_command,
+    add(&Flags::executor_command,
         "executor_command",
         "The command that should be used to start the executor.\n"
         "This will override the value set by `--build_dir`.");
 
-    add(&checkpoint,
+    add(&Flags::checkpoint,
         "checkpoint",
         "Whether this framework should be checkpointed.\n",
         false);
 
-    add(&long_running,
+    add(&Flags::long_running,
         "long_running",
         "Whether this framework should launch tasks repeatedly\n"
         "or exit after finishing a single task.",

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/examples/disk_full_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/disk_full_framework.cpp b/src/examples/disk_full_framework.cpp
index 78f13d3..e13d4c8 100644
--- a/src/examples/disk_full_framework.cpp
+++ b/src/examples/disk_full_framework.cpp
@@ -62,17 +62,17 @@ class Flags : public virtual flags::FlagsBase
 public:
   Flags()
   {
-    add(&master,
+    add(&Flags::master,
         "master",
         "Master to connect to.");
 
-    add(&run_once,
+    add(&Flags::run_once,
         "run_once",
         "Whether this framework should exit after running a single task.\n"
         "By default framework will keep running tasks forever.\n",
         false);
 
-    add(&pre_sleep_duration,
+    add(&Flags::pre_sleep_duration,
         "pre_sleep_duration",
         "Duration of sleep before the task starts to consume the disk. The\n"
         "purpose of this is to allow an operator to control the frequency at\n"
@@ -81,7 +81,7 @@ public:
         "disk usage.\n",
         Seconds(600));
 
-    add(&post_sleep_duration,
+    add(&Flags::post_sleep_duration,
         "post_sleep_duration",
         "Duration of sleep after the task consumed the disk. The purpose\n"
         "of this is to allow an operator to control how long it takes for\n"
@@ -90,7 +90,7 @@ public:
         "duration.\n",
         Seconds(600));
 
-    add(&disk_use_limit,
+    add(&Flags::disk_use_limit,
         "disk_use_limit",
         "The amount of disk (rounded to the nearest KB) the task should\n"
         "consume. The task requests 5MB of disk, so if the limit is set\n"

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/examples/dynamic_reservation_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/dynamic_reservation_framework.cpp b/src/examples/dynamic_reservation_framework.cpp
index c9a6863..4d3db96 100644
--- a/src/examples/dynamic_reservation_framework.cpp
+++ b/src/examples/dynamic_reservation_framework.cpp
@@ -323,7 +323,7 @@ class Flags : public virtual flags::FlagsBase
 public:
   Flags()
   {
-    add(&master,
+    add(&Flags::master,
         "master",
         "The master to connect to. May be one of:\n"
         "  master@addr:port (The PID of the master)\n"
@@ -331,16 +331,16 @@ public:
         "  zk://username:password@host1:port1,host2:port2,.../path\n"
         "  file://path/to/file (where file contains one of the above)");
 
-    add(&role,
+    add(&Flags::role,
         "role",
         "Role to use when registering");
 
-    add(&principal,
+    add(&Flags::principal,
         "principal",
         "The principal used to identify this framework",
         "test");
 
-    add(&command,
+    add(&Flags::command,
         "command",
         "The command to run for each task.",
         "echo hello");

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/examples/load_generator_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/load_generator_framework.cpp b/src/examples/load_generator_framework.cpp
index 81c8c23..99fa760 100644
--- a/src/examples/load_generator_framework.cpp
+++ b/src/examples/load_generator_framework.cpp
@@ -229,7 +229,7 @@ class Flags : public virtual mesos::internal::logging::Flags
 public:
   Flags()
   {
-    add(&master,
+    add(&Flags::master,
         "master",
         "Required. The master to connect to. May be one of:\n"
         "  master@addr:port (The PID of the master)\n"

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/examples/long_lived_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/long_lived_framework.cpp b/src/examples/long_lived_framework.cpp
index bfb253e..03c26d9 100644
--- a/src/examples/long_lived_framework.cpp
+++ b/src/examples/long_lived_framework.cpp
@@ -465,7 +465,7 @@ class Flags : public virtual flags::FlagsBase
 public:
   Flags()
   {
-    add(&master,
+    add(&Flags::master,
         "master",
         "Master to connect to.",
         [](const Option<string>& value) -> Option<Error> {
@@ -476,31 +476,31 @@ public:
           return None();
         });
 
-    add(&build_dir,
+    add(&Flags::build_dir,
         "build_dir",
         "The build directory of Mesos. If set, the framework will assume\n"
         "that the executor, framework, and agent(s) all live on the same\n"
         "machine.");
 
-    add(&executor_uri,
+    add(&Flags::executor_uri,
         "executor_uri",
         "URI the fetcher should use to get the executor.");
 
-    add(&executor_command,
+    add(&Flags::executor_command,
         "executor_command",
         "The command that should be used to start the executor.\n"
         "This will override the value set by `--build_dir`.");
 
-    add(&checkpoint,
+    add(&Flags::checkpoint,
         "checkpoint",
         "Whether this framework should be checkpointed.",
         false);
 
-    add(&principal,
+    add(&Flags::principal,
         "principal",
         "The principal to use for framework authentication.");
 
-    add(&secret,
+    add(&Flags::secret,
         "secret",
         "The secret to use for framework authentication.");
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/examples/no_executor_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/no_executor_framework.cpp b/src/examples/no_executor_framework.cpp
index 4668542..e82ae9a 100644
--- a/src/examples/no_executor_framework.cpp
+++ b/src/examples/no_executor_framework.cpp
@@ -236,7 +236,7 @@ class Flags : public virtual logging::Flags
 public:
   Flags()
   {
-    add(&master,
+    add(&Flags::master,
         "master",
         "The master to connect to. May be one of:\n"
         "  master@addr:port (The PID of the master)\n"
@@ -244,27 +244,27 @@ public:
         "  zk://username:password@host1:port1,host2:port2,.../path\n"
         "  file://path/to/file (where file contains one of the above)");
 
-    add(&checkpoint,
+    add(&Flags::checkpoint,
         "checkpoint",
         "Whether to enable checkpointing (true by default).",
         true);
 
-    add(&principal,
+    add(&Flags::principal,
         "principal",
         "To enable authentication, both --principal and --secret\n"
         "must be supplied.");
 
-    add(&secret,
+    add(&Flags::secret,
         "secret",
         "To enable authentication, both --principal and --secret\n"
         "must be supplied.");
 
-    add(&command,
+    add(&Flags::command,
         "command",
         "The command to run for each task.",
         "echo hello");
 
-    add(&task_resources,
+    add(&Flags::task_resources,
         "task_resources",
         "The resources that the task uses.",
         "cpus:0.1;mem:32;disk:32");
@@ -272,11 +272,11 @@ public:
     // TODO(bmahler): We need to take a separate flag for
     // revocable resources because there is no support yet
     // for specifying revocable resources in a resource string.
-    add(&task_revocable_resources,
+    add(&Flags::task_revocable_resources,
         "task_revocable_resources",
         "The revocable resources that the task uses.");
 
-    add(&num_tasks,
+    add(&Flags::num_tasks,
         "num_tasks",
         "Optionally, the number of tasks to run to completion before exiting.\n"
         "If unset, as many tasks as possible will be launched.");

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/examples/persistent_volume_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/persistent_volume_framework.cpp b/src/examples/persistent_volume_framework.cpp
index a2a6944..9d45bb4 100644
--- a/src/examples/persistent_volume_framework.cpp
+++ b/src/examples/persistent_volume_framework.cpp
@@ -381,7 +381,7 @@ class Flags : public virtual logging::Flags
 public:
   Flags()
   {
-    add(&master,
+    add(&Flags::master,
         "master",
         "The master to connect to. May be one of:\n"
         "  master@addr:port (The PID of the master)\n"
@@ -389,22 +389,22 @@ public:
         "  zk://username:password@host1:port1,host2:port2,.../path\n"
         "  file://path/to/file (where file contains one of the above)");
 
-    add(&role,
+    add(&Flags::role,
         "role",
         "Role to use when registering",
         "test");
 
-    add(&principal,
+    add(&Flags::principal,
         "principal",
         "The principal used to identify this framework",
         "test");
 
-    add(&num_shards,
+    add(&Flags::num_shards,
         "num_shards",
         "The number of shards the framework will run.",
         3);
 
-    add(&tasks_per_shard,
+    add(&Flags::tasks_per_shard,
         "tasks_per_shard",
         "The number of tasks should be launched per shard.",
         2);

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/examples/test_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_framework.cpp b/src/examples/test_framework.cpp
index a910640..753b4de 100644
--- a/src/examples/test_framework.cpp
+++ b/src/examples/test_framework.cpp
@@ -191,6 +191,20 @@ void usage(const char* argv0, const flags::FlagsBase& flags)
 }
 
 
+class Flags : public mesos::internal::logging::Flags
+{
+public:
+  Flags()
+  {
+    add(&Flags::role, "role", "Role to use when registering", "*");
+    add(&Flags::master, "master", "ip:port of master to connect");
+  }
+
+  string role;
+  Option<string> master;
+};
+
+
 int main(int argc, char** argv)
 {
   // Find this executable's directory to locate executor.
@@ -204,18 +218,7 @@ int main(int argc, char** argv)
         "test-executor");
   }
 
-  mesos::internal::logging::Flags flags;
-
-  string role;
-  flags.add(&role,
-            "role",
-            "Role to use when registering",
-            "*");
-
-  Option<string> master;
-  flags.add(&master,
-            "master",
-            "ip:port of master to connect");
+  Flags flags;
 
   Try<flags::Warnings> load = flags.load(None(), argc, argv);
 
@@ -223,7 +226,7 @@ int main(int argc, char** argv)
     cerr << load.error() << endl;
     usage(argv[0], flags);
     exit(EXIT_FAILURE);
-  } else if (master.isNone()) {
+  } else if (flags.master.isNone()) {
     cerr << "Missing --master" << endl;
     usage(argv[0], flags);
     exit(EXIT_FAILURE);
@@ -245,7 +248,7 @@ int main(int argc, char** argv)
   FrameworkInfo framework;
   framework.set_user(""); // Have Mesos fill in the current user.
   framework.set_name("Test Framework (C++)");
-  framework.set_role(role);
+  framework.set_role(flags.role);
 
   value = os::getenv("MESOS_CHECKPOINT");
   if (value.isSome()) {
@@ -261,7 +264,7 @@ int main(int argc, char** argv)
   }
 
   MesosSchedulerDriver* driver;
-  TestScheduler scheduler(implicitAcknowledgements, executor, role);
+  TestScheduler scheduler(implicitAcknowledgements, executor, flags.role);
 
   if (os::getenv("MESOS_AUTHENTICATE_FRAMEWORKS").isSome()) {
     cout << "Enabling authentication for the framework" << endl;
@@ -288,7 +291,7 @@ int main(int argc, char** argv)
     driver = new MesosSchedulerDriver(
         &scheduler,
         framework,
-        master.get(),
+        flags.master.get(),
         implicitAcknowledgements,
         credential);
   } else {
@@ -297,7 +300,7 @@ int main(int argc, char** argv)
     driver = new MesosSchedulerDriver(
         &scheduler,
         framework,
-        master.get(),
+        flags.master.get(),
         implicitAcknowledgements);
   }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/examples/test_http_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/test_http_framework.cpp b/src/examples/test_http_framework.cpp
index d6e248c..579a0c5 100644
--- a/src/examples/test_http_framework.cpp
+++ b/src/examples/test_http_framework.cpp
@@ -377,6 +377,20 @@ void usage(const char* argv0, const flags::FlagsBase& flags)
 }
 
 
+class Flags : public mesos::internal::logging::Flags
+{
+public:
+  Flags()
+  {
+    add(&Flags::role, "role", "Role to use when registering", "*");
+    add(&Flags::master, "master", "ip:port of master to connect");
+  }
+
+  string role;
+  Option<string> master;
+};
+
+
 int main(int argc, char** argv)
 {
   // Find this executable's directory to locate executor.
@@ -390,18 +404,7 @@ int main(int argc, char** argv)
         "test-http-executor");
   }
 
-  mesos::internal::logging::Flags flags;
-
-  string role;
-  flags.add(&role,
-            "role",
-            "Role to use when registering",
-            "*");
-
-  Option<string> master;
-  flags.add(&master,
-            "master",
-            "ip:port of master to connect");
+  Flags flags;
 
   Try<flags::Warnings> load = flags.load(None(), argc, argv);
 
@@ -409,7 +412,7 @@ int main(int argc, char** argv)
     cerr << load.error() << endl;
     usage(argv[0], flags);
     EXIT(EXIT_FAILURE);
-  } else if (master.isNone()) {
+  } else if (flags.master.isNone()) {
     cerr << "Missing --master" << endl;
     usage(argv[0], flags);
     EXIT(EXIT_FAILURE);
@@ -425,7 +428,7 @@ int main(int argc, char** argv)
 
   FrameworkInfo framework;
   framework.set_name("Event Call Scheduler using libprocess (C++)");
-  framework.set_role(role);
+  framework.set_role(flags.role);
 
   const Result<string> user = os::user();
 
@@ -453,7 +456,7 @@ int main(int argc, char** argv)
   framework.set_principal(value.get());
 
   process::Owned<HTTPScheduler> scheduler(
-      new HTTPScheduler(framework, executor, master.get()));
+      new HTTPScheduler(framework, executor, flags.master.get()));
 
   process::spawn(scheduler.get());
   process::wait(scheduler.get());

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/launcher/executor.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/executor.cpp b/src/launcher/executor.cpp
index dec1e07..0544121 100644
--- a/src/launcher/executor.cpp
+++ b/src/launcher/executor.cpp
@@ -821,35 +821,35 @@ class Flags : public virtual flags::FlagsBase
 public:
   Flags()
   {
-    add(&rootfs,
+    add(&Flags::rootfs,
         "rootfs",
         "The path to the root filesystem for the task");
 
     // The following flags are only applicable when a rootfs is
     // provisioned for this command.
-    add(&sandbox_directory,
+    add(&Flags::sandbox_directory,
         "sandbox_directory",
         "The absolute path for the directory in the container where the\n"
         "sandbox is mapped to");
 
-    add(&working_directory,
+    add(&Flags::working_directory,
         "working_directory",
         "The working directory for the task in the container.");
 
-    add(&user,
+    add(&Flags::user,
         "user",
         "The user that the task should be running as.");
 
-    add(&task_command,
+    add(&Flags::task_command,
         "task_command",
         "If specified, this is the overrided command for launching the\n"
         "task (instead of the command from TaskInfo).");
 
-    add(&capabilities,
+    add(&Flags::capabilities,
         "capabilities",
         "Capabilities the command can use.");
 
-    add(&launcher_dir,
+    add(&Flags::launcher_dir,
         "launcher_dir",
         "Directory path of Mesos binaries.",
         PKGLIBEXECDIR);

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/local/main.cpp
----------------------------------------------------------------------
diff --git a/src/local/main.cpp b/src/local/main.cpp
index 578b65e..f0d7e8c 100644
--- a/src/local/main.cpp
+++ b/src/local/main.cpp
@@ -45,6 +45,24 @@ using std::endl;
 using std::string;
 
 
+class Flags : public virtual local::Flags
+{
+public:
+  Flags()
+  {
+    add(&Flags::port, "port", "Port to listen on", 5050);
+    add(&Flags::ip, "ip", "IP address to listen on");
+  }
+
+  // The following flags are executable specific (e.g., since we only
+  // have one instance of libprocess per execution, we only want to
+  // advertise the port and ip option once, here).
+
+  uint16_t port;
+  Option<string> ip;
+};
+
+
 int main(int argc, char **argv)
 {
   GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -53,21 +71,12 @@ int main(int argc, char **argv)
   // order to pass those flags on to the master. Alternatively, add a
   // way to load flags and ignore unknowns in order to load
   // master::flags, then slave::Flags, then local::Flags.
-  local::Flags flags;
+  Flags flags;
 
   flags.setUsageMessage(
       "Usage: " + Path(argv[0]).basename() + " [...]\n\n" +
       "Launches an in-memory cluster within a single process.");
 
-  // The following flags are executable specific (e.g., since we only
-  // have one instance of libprocess per execution, we only want to
-  // advertise the port and ip option once, here).
-  uint16_t port;
-  flags.add(&port, "port", "Port to listen on", 5050);
-
-  Option<string> ip;
-  flags.add(&ip, "ip", "IP address to listen on");
-
   // Load flags from environment and command line but allow unknown
   // flags since we might have some master/slave flags as well.
   Try<flags::Warnings> load = flags.load("MESOS_", argc, argv, true);
@@ -83,10 +92,10 @@ int main(int argc, char **argv)
   }
 
   // Initialize libprocess.
-  os::setenv("LIBPROCESS_PORT", stringify(port));
+  os::setenv("LIBPROCESS_PORT", stringify(flags.port));
 
-  if (ip.isSome()) {
-    os::setenv("LIBPROCESS_IP", ip.get());
+  if (flags.ip.isSome()) {
+    os::setenv("LIBPROCESS_IP", flags.ip.get());
   }
 
   process::initialize("master");

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/master/main.cpp
----------------------------------------------------------------------
diff --git a/src/master/main.cpp b/src/master/main.cpp
index 9d2fd92..2d2dfb7 100644
--- a/src/master/main.cpp
+++ b/src/master/main.cpp
@@ -120,6 +120,62 @@ using std::string;
 using std::vector;
 
 
+class Flags : public virtual master::Flags
+{
+public:
+  Flags()
+  {
+    add(&Flags::ip,
+        "ip",
+        "IP address to listen on. This cannot be used in conjunction\n"
+        "with `--ip_discovery_command`.");
+
+    add(&Flags::port, "port", "Port to listen on.", MasterInfo().port());
+
+    add(&Flags::advertise_ip,
+        "advertise_ip",
+        "IP address advertised to reach this Mesos master.\n"
+        "The master does not bind using this IP address.\n"
+        "However, this IP address may be used to access this master.");
+
+    add(&Flags::advertise_port,
+        "advertise_port",
+        "Port advertised to reach Mesos master (along with\n"
+        "`advertise_ip`). The master does not bind to this port.\n"
+        "However, this port (along with `advertise_ip`) may be used to\n"
+        "access this master.");
+
+    add(&Flags::zk,
+        "zk",
+        "ZooKeeper URL (used for leader election amongst masters)\n"
+        "May be one of:\n"
+        "  `zk://host1:port1,host2:port2,.../path`\n"
+        "  `zk://username:password@host1:port1,host2:port2,.../path`\n"
+        "  `file:///path/to/file` (where file contains one of the above)\n"
+        "NOTE: Not required if master is run in standalone mode (non-HA).");
+
+    add(&Flags::ip_discovery_command,
+        "ip_discovery_command",
+        "Optional IP discovery binary: if set, it is expected to emit\n"
+        "the IP address which the master will try to bind to.\n"
+        "Cannot be used in conjunction with `--ip`.");
+    }
+
+    // The following flags are executable specific (e.g., since we only
+    // have one instance of libprocess per execution, we only want to
+    // advertise the IP and port option once, here).
+
+    Option<string> ip;
+    uint16_t port;
+    Option<string> advertise_ip;
+    Option<string> advertise_port;
+    Option<string> zk;
+
+    // Optional IP discover script that will set the Master IP.
+    // If set, its output is expected to be a valid parseable IP string.
+    Option<string> ip_discovery_command;
+};
+
 
 int main(int argc, char** argv)
 {
@@ -149,56 +205,7 @@ int main(int argc, char** argv)
 
   GOOGLE_PROTOBUF_VERIFY_VERSION;
 
-  master::Flags flags;
-
-  // The following flags are executable specific (e.g., since we only
-  // have one instance of libprocess per execution, we only want to
-  // advertise the IP and port option once, here).
-  Option<string> ip;
-  flags.add(&ip,
-            "ip",
-            "IP address to listen on. This cannot be used in conjunction\n"
-            "with `--ip_discovery_command`.");
-
-  uint16_t port;
-  flags.add(&port,
-            "port",
-            "Port to listen on.",
-            MasterInfo().port());
-
-  Option<string> advertise_ip;
-  flags.add(&advertise_ip,
-            "advertise_ip",
-            "IP address advertised to reach this Mesos master.\n"
-            "The master does not bind using this IP address.\n"
-            "However, this IP address may be used to access this master.");
-
-  Option<string> advertise_port;
-  flags.add(&advertise_port,
-            "advertise_port",
-            "Port advertised to reach Mesos master (along with\n"
-            "`advertise_ip`). The master does not bind to this port.\n"
-            "However, this port (along with `advertise_ip`) may be used to\n"
-            "access this master.");
-
-  Option<string> zk;
-  flags.add(&zk,
-            "zk",
-            "ZooKeeper URL (used for leader election amongst masters)\n"
-            "May be one of:\n"
-            "  `zk://host1:port1,host2:port2,.../path`\n"
-            "  `zk://username:password@host1:port1,host2:port2,.../path`\n"
-            "  `file:///path/to/file` (where file contains one of the above)\n"
-            "NOTE: Not required if master is run in standalone mode (non-HA).");
-
-  // Optional IP discover script that will set the Master IP.
-  // If set, its output is expected to be a valid parseable IP string.
-  Option<string> ip_discovery_command;
-  flags.add(&ip_discovery_command,
-            "ip_discovery_command",
-            "Optional IP discovery binary: if set, it is expected to emit\n"
-            "the IP address which the master will try to bind to.\n"
-            "Cannot be used in conjunction with `--ip`.");
+  ::Flags flags;
 
   Try<flags::Warnings> load = flags.load("MESOS_", argc, argv);
 
@@ -217,34 +224,34 @@ int main(int argc, char** argv)
     return EXIT_FAILURE;
   }
 
-  if (ip_discovery_command.isSome() && ip.isSome()) {
+  if (flags.ip_discovery_command.isSome() && flags.ip.isSome()) {
     EXIT(EXIT_FAILURE) << flags.usage(
         "Only one of `--ip` or `--ip_discovery_command` should be specified");
   }
 
-  if (ip_discovery_command.isSome()) {
-    Try<string> ipAddress = os::shell(ip_discovery_command.get());
+  if (flags.ip_discovery_command.isSome()) {
+    Try<string> ipAddress = os::shell(flags.ip_discovery_command.get());
 
     if (ipAddress.isError()) {
       EXIT(EXIT_FAILURE) << ipAddress.error();
     }
 
     os::setenv("LIBPROCESS_IP", strings::trim(ipAddress.get()));
-  } else if (ip.isSome()) {
-    os::setenv("LIBPROCESS_IP", ip.get());
+  } else if (flags.ip.isSome()) {
+    os::setenv("LIBPROCESS_IP", flags.ip.get());
   }
 
-  os::setenv("LIBPROCESS_PORT", stringify(port));
+  os::setenv("LIBPROCESS_PORT", stringify(flags.port));
 
-  if (advertise_ip.isSome()) {
-    os::setenv("LIBPROCESS_ADVERTISE_IP", advertise_ip.get());
+  if (flags.advertise_ip.isSome()) {
+    os::setenv("LIBPROCESS_ADVERTISE_IP", flags.advertise_ip.get());
   }
 
-  if (advertise_port.isSome()) {
-    os::setenv("LIBPROCESS_ADVERTISE_PORT", advertise_port.get());
+  if (flags.advertise_port.isSome()) {
+    os::setenv("LIBPROCESS_ADVERTISE_PORT", flags.advertise_port.get());
   }
 
-  if (zk.isNone()) {
+  if (flags.zk.isNone()) {
     if (flags.master_contender.isSome() ^ flags.master_detector.isSome()) {
       EXIT(EXIT_FAILURE)
         << flags.usage("Both --master_contender and --master_detector should "
@@ -390,7 +397,7 @@ int main(int argc, char** argv)
         << "': " << mkdir.error();
     }
 
-    if (zk.isSome()) {
+    if (flags.zk.isSome()) {
       // Use replicated log with ZooKeeper.
       if (flags.quorum.isNone()) {
         EXIT(EXIT_FAILURE)
@@ -398,7 +405,7 @@ int main(int argc, char** argv)
           << " registry when using ZooKeeper";
       }
 
-      Try<zookeeper::URL> url = zookeeper::URL::parse(zk.get());
+      Try<zookeeper::URL> url = zookeeper::URL::parse(flags.zk.get());
       if (url.isError()) {
         EXIT(EXIT_FAILURE) << "Error parsing ZooKeeper URL: " << url.error();
       }
@@ -439,7 +446,7 @@ int main(int argc, char** argv)
   MasterDetector* detector;
 
   Try<MasterContender*> contender_ = MasterContender::create(
-      zk, flags.master_contender);
+      flags.zk, flags.master_contender);
 
   if (contender_.isError()) {
     EXIT(EXIT_FAILURE)
@@ -449,7 +456,7 @@ int main(int argc, char** argv)
   contender = contender_.get();
 
   Try<MasterDetector*> detector_ = MasterDetector::create(
-      zk, flags.master_detector);
+      flags.zk, flags.master_detector);
 
   if (detector_.isError()) {
     EXIT(EXIT_FAILURE)
@@ -551,7 +558,7 @@ int main(int argc, char** argv)
       slaveRemovalLimiter,
       flags);
 
-  if (zk.isNone() && flags.master_detector.isNone()) {
+  if (flags.zk.isNone() && flags.master_detector.isNone()) {
     // It means we are using the standalone detector so we need to
     // appoint this Master as the leader.
     dynamic_cast<StandaloneMasterDetector*>(detector)->appoint(master->info());

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/slave/container_loggers/lib_logrotate.hpp
----------------------------------------------------------------------
diff --git a/src/slave/container_loggers/lib_logrotate.hpp b/src/slave/container_loggers/lib_logrotate.hpp
index f91db3e..28fdf3b 100644
--- a/src/slave/container_loggers/lib_logrotate.hpp
+++ b/src/slave/container_loggers/lib_logrotate.hpp
@@ -47,14 +47,14 @@ struct LoggerFlags : public virtual flags::FlagsBase
 {
   LoggerFlags()
   {
-    add(&max_stdout_size,
+    add(&LoggerFlags::max_stdout_size,
         "max_stdout_size",
         "Maximum size, in bytes, of a single stdout log file.\n"
         "Defaults to 10 MB.  Must be at least 1 (memory) page.",
         Megabytes(10),
         &LoggerFlags::validateSize);
 
-    add(&logrotate_stdout_options,
+    add(&LoggerFlags::logrotate_stdout_options,
         "logrotate_stdout_options",
         "Additional config options to pass into 'logrotate' for stdout.\n"
         "This string will be inserted into a 'logrotate' configuration file.\n"
@@ -65,14 +65,14 @@ struct LoggerFlags : public virtual flags::FlagsBase
         "  }\n"
         "NOTE: The 'size' option will be overriden by this module.");
 
-    add(&max_stderr_size,
+    add(&LoggerFlags::max_stderr_size,
         "max_stderr_size",
         "Maximum size, in bytes, of a single stderr log file.\n"
         "Defaults to 10 MB.  Must be at least 1 (memory) page.",
         Megabytes(10),
         &LoggerFlags::validateSize);
 
-    add(&logrotate_stderr_options,
+    add(&LoggerFlags::logrotate_stderr_options,
         "logrotate_stderr_options",
         "Additional config options to pass into 'logrotate' for stderr.\n"
         "This string will be inserted into a 'logrotate' configuration file.\n"
@@ -107,7 +107,7 @@ struct Flags : public virtual LoggerFlags
 {
   Flags()
   {
-    add(&environment_variable_prefix,
+    add(&Flags::environment_variable_prefix,
         "environment_variable_prefix",
         "Prefix for environment variables meant to modify the behavior of\n"
         "the logrotate logger for the specific executor being launched.\n"
@@ -121,7 +121,7 @@ struct Flags : public virtual LoggerFlags
         "via module parameters.",
         "CONTAINER_LOGGER_");
 
-    add(&launcher_dir,
+    add(&Flags::launcher_dir,
         "launcher_dir",
         "Directory path of Mesos binaries.  The logrotate container logger\n"
         "will find the '" + mesos::internal::logger::rotate::NAME + "'\n"
@@ -138,7 +138,7 @@ struct Flags : public virtual LoggerFlags
           return None();
         });
 
-    add(&logrotate_path,
+    add(&Flags::logrotate_path,
         "logrotate_path",
         "If specified, the logrotate container logger will use the specified\n"
         "'logrotate' instead of the system's 'logrotate'.",
@@ -157,7 +157,7 @@ struct Flags : public virtual LoggerFlags
           return None();
         });
 
-    add(&libprocess_num_worker_threads,
+    add(&Flags::libprocess_num_worker_threads,
         "libprocess_num_worker_threads",
         "Number of Libprocess worker threads.\n"
         "Defaults to 8.  Must be at least 1.",

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/slave/container_loggers/logrotate.hpp
----------------------------------------------------------------------
diff --git a/src/slave/container_loggers/logrotate.hpp b/src/slave/container_loggers/logrotate.hpp
index f906a16..d1db692 100644
--- a/src/slave/container_loggers/logrotate.hpp
+++ b/src/slave/container_loggers/logrotate.hpp
@@ -51,7 +51,7 @@ struct Flags : public virtual flags::FlagsBase
       "are supported.  See '--logrotate_options'.\n"
       "\n");
 
-    add(&max_size,
+    add(&Flags::max_size,
         "max_size",
         "Maximum size, in bytes, of a single log file.\n"
         "Defaults to 10 MB.  Must be at least 1 (memory) page.",
@@ -65,7 +65,7 @@ struct Flags : public virtual flags::FlagsBase
           return None();
         });
 
-    add(&logrotate_options,
+    add(&Flags::logrotate_options,
         "logrotate_options",
         "Additional config options to pass into 'logrotate'.\n"
         "This string will be inserted into a 'logrotate' configuration file.\n"
@@ -76,7 +76,7 @@ struct Flags : public virtual flags::FlagsBase
         "  }\n"
         "NOTE: The 'size' option will be overriden by this command.");
 
-    add(&log_filename,
+    add(&Flags::log_filename,
         "log_filename",
         "Absolute path to the leading log file.\n"
         "NOTE: This command will also create two files by appending\n"
@@ -94,7 +94,7 @@ struct Flags : public virtual flags::FlagsBase
           return None();
         });
 
-    add(&logrotate_path,
+    add(&Flags::logrotate_path,
         "logrotate_path",
         "If specified, this command will use the specified\n"
         "'logrotate' instead of the system's 'logrotate'.",

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
index c87e671..939142e 100644
--- a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
+++ b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
@@ -1578,27 +1578,27 @@ const char* NetworkCniIsolatorSetup::NAME = "network-cni-setup";
 
 NetworkCniIsolatorSetup::Flags::Flags()
 {
-  add(&pid, "pid", "PID of the container");
+  add(&Flags::pid, "pid", "PID of the container");
 
-  add(&hostname, "hostname", "Hostname of the container");
+  add(&Flags::hostname, "hostname", "Hostname of the container");
 
-  add(&rootfs,
+  add(&Flags::rootfs,
       "rootfs",
       "Path to rootfs for the container on the host-file system");
 
-  add(&etc_hosts_path,
+  add(&Flags::etc_hosts_path,
       "etc_hosts_path",
       "Path in the host file system for 'hosts' file");
 
-  add(&etc_hostname_path,
+  add(&Flags::etc_hostname_path,
       "etc_hostname_path",
       "Path in the host file system for 'hostname' file");
 
-  add(&etc_resolv_conf,
+  add(&Flags::etc_resolv_conf,
       "etc_resolv_conf",
       "Path in the host file system for 'resolv.conf'");
 
-  add(&bind_host_files,
+  add(&Flags::bind_host_files,
       "bind_host_files",
       "Bind mount the container's network files to the network files "
       "present on host filesystem",

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp b/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
index 20fb6ab..48202fb 100644
--- a/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
+++ b/src/slave/containerizer/mesos/isolators/network/port_mapping.cpp
@@ -394,25 +394,25 @@ const char* PortMappingUpdate::NAME = "update";
 
 PortMappingUpdate::Flags::Flags()
 {
-  add(&eth0_name,
+  add(&Flags::eth0_name,
       "eth0_name",
       "The name of the public network interface (e.g., eth0)");
 
-  add(&lo_name,
+  add(&Flags::lo_name,
       "lo_name",
       "The name of the loopback network interface (e.g., lo)");
 
-  add(&pid,
+  add(&Flags::pid,
       "pid",
       "The pid of the process whose namespaces we will enter");
 
-  add(&ports_to_add,
+  add(&Flags::ports_to_add,
       "ports_to_add",
       "A collection of port ranges (formatted as a JSON object)\n"
       "for which to add IP filters. E.g.,\n"
       "--ports_to_add={\"range\":[{\"begin\":4,\"end\":8}]}");
 
-  add(&ports_to_remove,
+  add(&Flags::ports_to_remove,
       "ports_to_remove",
       "A collection of port ranges (formatted as a JSON object)\n"
       "for which to remove IP filters. E.g.,\n"
@@ -658,26 +658,26 @@ const char* PortMappingStatistics::NAME = "statistics";
 
 PortMappingStatistics::Flags::Flags()
 {
-  add(&eth0_name,
+  add(&Flags::eth0_name,
       "eth0_name",
       "The name of the public network interface (e.g., eth0)");
 
-  add(&pid,
+  add(&Flags::pid,
       "pid",
       "The pid of the process whose namespaces we will enter");
 
-  add(&enable_socket_statistics_summary,
+  add(&Flags::enable_socket_statistics_summary,
       "enable_socket_statistics_summary",
       "Whether to collect socket statistics summary for this container\n",
       false);
 
-  add(&enable_socket_statistics_details,
+  add(&Flags::enable_socket_statistics_details,
       "enable_socket_statistics_details",
       "Whether to collect socket statistics details (e.g., TCP RTT)\n"
       "for this container.",
       false);
 
-  add(&enable_snmp_statistics,
+  add(&Flags::enable_snmp_statistics,
       "enable_snmp_statistics",
       "Whether to collect SNMP statistics details (e.g., TCPRetransSegs)\n"
       "for this container.",

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/slave/containerizer/mesos/launch.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launch.cpp b/src/slave/containerizer/mesos/launch.cpp
index 8a30ff8..4a41aaf 100644
--- a/src/slave/containerizer/mesos/launch.cpp
+++ b/src/slave/containerizer/mesos/launch.cpp
@@ -67,35 +67,35 @@ const string MesosContainerizerLaunch::NAME = "launch";
 
 MesosContainerizerLaunch::Flags::Flags()
 {
-  add(&command,
+  add(&Flags::command,
       "command",
       "The command to execute.");
 
-  add(&environment,
+  add(&Flags::environment,
       "environment",
       "The environment variables for the command.");
 
-  add(&working_directory,
+  add(&Flags::working_directory,
       "working_directory",
       "The working directory for the command. It has to be an absolute path \n"
       "w.r.t. the root filesystem used for the command.");
 
 #ifndef __WINDOWS__
-  add(&runtime_directory,
+  add(&Flags::runtime_directory,
       "runtime_directory",
       "The runtime directory for the container (used for checkpointing)");
 
-  add(&rootfs,
+  add(&Flags::rootfs,
       "rootfs",
       "Absolute path to the container root filesystem. The command will be \n"
       "interpreted relative to this path");
 
-  add(&user,
+  add(&Flags::user,
       "user",
       "The user to change to.");
 #endif // __WINDOWS__
 
-  add(&pipe_read,
+  add(&Flags::pipe_read,
       "pipe_read",
       "The read end of the control pipe. This is a file descriptor \n"
       "on Posix, or a handle on Windows. It's caller's responsibility \n"
@@ -103,7 +103,7 @@ MesosContainerizerLaunch::Flags::Flags()
       "properly in the subprocess. It's used to synchronize with the \n"
       "parent process. If not specified, no synchronization will happen.");
 
-  add(&pipe_write,
+  add(&Flags::pipe_write,
       "pipe_write",
       "The write end of the control pipe. This is a file descriptor \n"
       "on Posix, or a handle on Windows. It's caller's responsibility \n"
@@ -111,17 +111,17 @@ MesosContainerizerLaunch::Flags::Flags()
       "properly in the subprocess. It's used to synchronize with the \n"
       "parent process. If not specified, no synchronization will happen.");
 
-  add(&pre_exec_commands,
+  add(&Flags::pre_exec_commands,
       "pre_exec_commands",
       "The additional preparation commands to execute before\n"
       "executing the command.");
 
 #ifdef __linux__
-  add(&capabilities,
+  add(&Flags::capabilities,
       "capabilities",
       "Capabilities the command can use.");
 
-  add(&unshare_namespace_mnt,
+  add(&Flags::unshare_namespace_mnt,
       "unshare_namespace_mnt",
       "Whether to launch the command in a new mount namespace.",
       false);

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/slave/containerizer/mesos/mount.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/mount.cpp b/src/slave/containerizer/mesos/mount.cpp
index 4b90666..73a4861 100644
--- a/src/slave/containerizer/mesos/mount.cpp
+++ b/src/slave/containerizer/mesos/mount.cpp
@@ -40,11 +40,11 @@ const string MesosContainerizerMount::MAKE_RSLAVE = "make-rslave";
 
 MesosContainerizerMount::Flags::Flags()
 {
-  add(&operation,
+  add(&Flags::operation,
       "operation",
       "The mount operation to apply.");
 
-  add(&path,
+  add(&Flags::path,
       "path",
       "The path to apply mount operation to.");
 }

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/slave/main.cpp
----------------------------------------------------------------------
diff --git a/src/slave/main.cpp b/src/slave/main.cpp
index 219914d..8010f8e 100644
--- a/src/slave/main.cpp
+++ b/src/slave/main.cpp
@@ -94,6 +94,63 @@ using std::string;
 using std::vector;
 
 
+class Flags : public slave::Flags
+{
+public:
+  Flags()
+  {
+    add(&Flags::ip,
+        "ip",
+        "IP address to listen on. This cannot be used in conjunction\n"
+        "with `--ip_discovery_command`.");
+
+    add(&Flags::port, "port", "Port to listen on.", SlaveInfo().port());
+
+    add(&Flags::advertise_ip,
+        "advertise_ip",
+        "IP address advertised to reach this Mesos slave.\n"
+        "The slave does not bind to this IP address.\n"
+        "However, this IP address may be used to access this slave.");
+
+    add(&Flags::advertise_port,
+        "advertise_port",
+        "Port advertised to reach this Mesos slave (along with\n"
+        "`advertise_ip`). The slave does not bind to this port.\n"
+        "However, this port (along with `advertise_ip`) may be used to\n"
+        "access this slave.");
+
+    add(&Flags::master,
+        "master",
+        "May be one of:\n"
+        "  `host:port`\n"
+        "  `zk://host1:port1,host2:port2,.../path`\n"
+        "  `zk://username:password@host1:port1,host2:port2,.../path`\n"
+        "  `file:///path/to/file` (where file contains one of the above)");
+
+
+    add(&Flags::ip_discovery_command,
+        "ip_discovery_command",
+        "Optional IP discovery binary: if set, it is expected to emit\n"
+        "the IP address which the slave will try to bind to.\n"
+        "Cannot be used in conjunction with `--ip`.");
+  }
+
+  // The following flags are executable specific (e.g., since we only
+  // have one instance of libprocess per execution, we only want to
+  // advertise the IP and port option once, here).
+
+  Option<string> ip;
+  uint16_t port;
+  Option<string> advertise_ip;
+  Option<string> advertise_port;
+  Option<string> master;
+
+  // Optional IP discover script that will set the slave's IP.
+  // If set, its output is expected to be a valid parseable IP string.
+  Option<string> ip_discovery_command;
+};
+
+
 int main(int argc, char** argv)
 {
   // The order of initialization is as follows:
@@ -129,56 +186,7 @@ int main(int argc, char** argv)
 
   GOOGLE_PROTOBUF_VERIFY_VERSION;
 
-  slave::Flags flags;
-
-  // The following flags are executable specific (e.g., since we only
-  // have one instance of libprocess per execution, we only want to
-  // advertise the IP and port option once, here).
-  Option<string> ip;
-  flags.add(&ip,
-            "ip",
-            "IP address to listen on. This cannot be used in conjunction\n"
-            "with `--ip_discovery_command`.");
-
-  uint16_t port;
-  flags.add(&port,
-            "port",
-            "Port to listen on.",
-            SlaveInfo().port());
-
-  Option<string> advertise_ip;
-  flags.add(&advertise_ip,
-            "advertise_ip",
-            "IP address advertised to reach this Mesos agent.\n"
-            "The agent does not bind to this IP address.\n"
-            "However, this IP address may be used to access this agent.");
-
-  Option<string> advertise_port;
-  flags.add(&advertise_port,
-            "advertise_port",
-            "Port advertised to reach this Mesos agent (along with\n"
-            "`advertise_ip`). The agent does not bind to this port.\n"
-            "However, this port (along with `advertise_ip`) may be used to\n"
-            "access this agent.");
-
-  Option<string> master;
-  flags.add(&master,
-            "master",
-            "May be one of:\n"
-            "  `host:port`\n"
-            "  `zk://host1:port1,host2:port2,.../path`\n"
-            "  `zk://username:password@host1:port1,host2:port2,.../path`\n"
-            "  `file:///path/to/file` (where file contains one of the above)");
-
-
-  // Optional IP discover script that will set the slave's IP.
-  // If set, its output is expected to be a valid parseable IP string.
-  Option<string> ip_discovery_command;
-  flags.add(&ip_discovery_command,
-            "ip_discovery_command",
-            "Optional IP discovery binary: if set, it is expected to emit\n"
-            "the IP address which the agent will try to bind to.\n"
-            "Cannot be used in conjunction with `--ip`.");
+  ::Flags flags;
 
   Try<flags::Warnings> load = flags.load("MESOS_", argc, argv);
 
@@ -199,44 +207,44 @@ int main(int argc, char** argv)
     return EXIT_FAILURE;
   }
 
-  if (master.isNone() && flags.master_detector.isNone()) {
+  if (flags.master.isNone() && flags.master_detector.isNone()) {
     cerr << flags.usage("Missing required option `--master` or "
                         "`--master_detector`.") << endl;
     return EXIT_FAILURE;
   }
 
-  if (master.isSome() && flags.master_detector.isSome()) {
+  if (flags.master.isSome() && flags.master_detector.isSome()) {
     cerr << flags.usage("Only one of --master or --master_detector options "
                         "should be specified.");
     return EXIT_FAILURE;
   }
 
   // Initialize libprocess.
-  if (ip_discovery_command.isSome() && ip.isSome()) {
+  if (flags.ip_discovery_command.isSome() && flags.ip.isSome()) {
     EXIT(EXIT_FAILURE) << flags.usage(
         "Only one of `--ip` or `--ip_discovery_command` should be specified");
   }
 
-  if (ip_discovery_command.isSome()) {
-    Try<string> ipAddress = os::shell(ip_discovery_command.get());
+  if (flags.ip_discovery_command.isSome()) {
+    Try<string> ipAddress = os::shell(flags.ip_discovery_command.get());
 
     if (ipAddress.isError()) {
       EXIT(EXIT_FAILURE) << ipAddress.error();
     }
 
     os::setenv("LIBPROCESS_IP", strings::trim(ipAddress.get()));
-  } else if (ip.isSome()) {
-    os::setenv("LIBPROCESS_IP", ip.get());
+  } else if (flags.ip.isSome()) {
+    os::setenv("LIBPROCESS_IP", flags.ip.get());
   }
 
-  os::setenv("LIBPROCESS_PORT", stringify(port));
+  os::setenv("LIBPROCESS_PORT", stringify(flags.port));
 
-  if (advertise_ip.isSome()) {
-    os::setenv("LIBPROCESS_ADVERTISE_IP", advertise_ip.get());
+  if (flags.advertise_ip.isSome()) {
+    os::setenv("LIBPROCESS_ADVERTISE_IP", flags.advertise_ip.get());
   }
 
-  if (advertise_port.isSome()) {
-    os::setenv("LIBPROCESS_ADVERTISE_PORT", advertise_port.get());
+  if (flags.advertise_port.isSome()) {
+    os::setenv("LIBPROCESS_ADVERTISE_PORT", flags.advertise_port.get());
   }
 
   // Log build information.
@@ -365,7 +373,7 @@ int main(int argc, char** argv)
   }
 
   Try<MasterDetector*> detector_ = MasterDetector::create(
-      master, flags.master_detector);
+      flags.master, flags.master_detector);
 
   if (detector_.isError()) {
     EXIT(EXIT_FAILURE)

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/tests/active_user_test_helper.cpp
----------------------------------------------------------------------
diff --git a/src/tests/active_user_test_helper.cpp b/src/tests/active_user_test_helper.cpp
index 80bd0ac..f056d9d 100644
--- a/src/tests/active_user_test_helper.cpp
+++ b/src/tests/active_user_test_helper.cpp
@@ -31,7 +31,7 @@ const char ActiveUserTestHelper::NAME[] = "ActiveUser";
 
 ActiveUserTestHelper::Flags::Flags()
 {
-  add(&user,
+  add(&Flags::user,
       "user",
       "The expected user name.");
 }

http://git-wip-us.apache.org/repos/asf/mesos/blob/f441eb9a/src/tests/containerizer/capabilities_test_helper.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/capabilities_test_helper.cpp b/src/tests/containerizer/capabilities_test_helper.cpp
index 2d7be6d..17f00b00 100644
--- a/src/tests/containerizer/capabilities_test_helper.cpp
+++ b/src/tests/containerizer/capabilities_test_helper.cpp
@@ -56,11 +56,11 @@ const char CapabilitiesTestHelper::NAME[] = "Capabilities";
 
 CapabilitiesTestHelper::Flags::Flags()
 {
-  add(&user,
+  add(&Flags::user,
       "user",
       "User to be used for the test.");
 
-  add(&capabilities,
+  add(&Flags::capabilities,
       "capabilities",
       "Capabilities to be set for the process.");
 }