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/05/04 18:57:02 UTC

[1/2] mesos git commit: Renamed a shadowing variable.

Repository: mesos
Updated Branches:
  refs/heads/master 557cab591 -> dee6963e9


Renamed a shadowing variable.

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


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

Branch: refs/heads/master
Commit: 80b5adb6acb9b045c4c1420e689a89e1c6400dfe
Parents: 557cab5
Author: Michael Park <mp...@apache.org>
Authored: Wed May 4 11:53:39 2016 -0700
Committer: Michael Park <mp...@apache.org>
Committed: Wed May 4 11:53:39 2016 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/80b5adb6/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
index d1f4ae6..a1740a9 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
@@ -739,16 +739,15 @@ inline Value convert(const picojson::value& value)
   } else if (value.is<picojson::value::object>()) {
     Object object;
     foreachpair (const std::string& name,
-                 const picojson::value& value,
+                 const picojson::value& v,
                  value.get<picojson::value::object>()) {
-      object.values[name] = convert(value);
+      object.values[name] = convert(v);
     }
     return object;
   } else if (value.is<picojson::value::array>()) {
     Array array;
-    foreach (const picojson::value& value,
-             value.get<picojson::value::array>()) {
-      array.values.push_back(convert(value));
+    foreach (const picojson::value& v, value.get<picojson::value::array>()) {
+      array.values.push_back(convert(v));
     }
     return array;
   } else if (value.is<int64_t>()) {


[2/2] mesos git commit: Removed dependency on Boost.Foreach.

Posted by mp...@apache.org.
Removed dependency on Boost.Foreach.

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


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

Branch: refs/heads/master
Commit: dee6963e9cac3998d325b4b74cb112a88f35c82d
Parents: 80b5adb
Author: Michael Park <mp...@apache.org>
Authored: Wed May 4 11:53:45 2016 -0700
Committer: Michael Park <mp...@apache.org>
Committed: Wed May 4 11:53:45 2016 -0700

----------------------------------------------------------------------
 .../3rdparty/stout/include/stout/foreach.hpp    | 106 +++++++++++--------
 1 file changed, 62 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/dee6963e/3rdparty/libprocess/3rdparty/stout/include/stout/foreach.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/foreach.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/foreach.hpp
index 7fb0044..abd661e 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/foreach.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/foreach.hpp
@@ -13,49 +13,67 @@
 #ifndef __STOUT_FOREACH_HPP__
 #define __STOUT_FOREACH_HPP__
 
-#include <boost/foreach.hpp>
-
-namespace __foreach__ {
-
-// NOTE: This is a copied from Boost
-// (boost/tuple/detail/tuple_basic_no_partial_spec.hpp) because the
-// new 'boost::tuples::ignore' does not work in our 'foreachkey' and
-// 'foreachvalue'.
-struct swallow_assign {
-  template <typename T>
-  swallow_assign const& operator=(const T&) const {
-    return *this;
-  }
-};
-
-swallow_assign const ignore = swallow_assign();
-
-} // namespace __foreach__ {
-
-#define BOOST_FOREACH_PAIR(VARFIRST, VARSECOND, COL)                    \
-  BOOST_FOREACH_PREAMBLE()                                              \
-  if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_col) = BOOST_FOREACH_CONTAIN(COL)) {} else /* NOLINT(whitespace/line_length) */ \
-    if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_cur) = BOOST_FOREACH_BEGIN(COL)) {} else /* NOLINT(whitespace/line_length) */ \
-      if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_end) = BOOST_FOREACH_END(COL)) {} else /* NOLINT(whitespace/line_length) */ \
-        for (bool BOOST_FOREACH_ID(_foreach_continue) = true, BOOST_FOREACH_ID(_foreach_onetime) = true; /* NOLINT(whitespace/line_length) */ \
-             BOOST_FOREACH_ID(_foreach_continue) && !BOOST_FOREACH_DONE(COL); /* NOLINT(whitespace/line_length) */ \
-             BOOST_FOREACH_ID(_foreach_continue) ? BOOST_FOREACH_NEXT(COL) : (void)0) /* NOLINT(whitespace/line_length) */ \
-          if (boost::foreach_detail_::set_false(BOOST_FOREACH_ID(_foreach_onetime))) {} else /* NOLINT(whitespace/line_length) */ \
-            for (VARFIRST = BOOST_FOREACH_DEREF(COL).first;             \
-                 !BOOST_FOREACH_ID(_foreach_onetime);                   \
-                 BOOST_FOREACH_ID(_foreach_onetime) = true)             \
-              if (boost::foreach_detail_::set_false(BOOST_FOREACH_ID(_foreach_continue))) {} else /* NOLINT(whitespace/line_length) */ \
-                for (VARSECOND = BOOST_FOREACH_DEREF(COL).second;       \
-                     !BOOST_FOREACH_ID(_foreach_continue);              \
-                     BOOST_FOREACH_ID(_foreach_continue) = true)
-
-#define foreach BOOST_FOREACH
-#define foreachpair BOOST_FOREACH_PAIR
-
-#define foreachkey(VAR, COL)                    \
-  foreachpair (VAR, __foreach__::ignore, COL)
-
-#define foreachvalue(VAR, COL)                  \
-  foreachpair (__foreach__::ignore, VAR, COL)
+#include <tuple>
+#include <utility>
+
+#include <stout/preprocessor.hpp>
+
+#define STOUT_FOREACH_PREFIX CAT(__foreach_, __LINE__)
+#define STOUT_FOREACH_BODY CAT(STOUT_FOREACH_PREFIX, _body__)
+#define STOUT_FOREACH_BREAK CAT(STOUT_FOREACH_PREFIX, _break__)
+#define STOUT_FOREACH_CONTINUE CAT(STOUT_FOREACH_PREFIX, _continue__)
+#define STOUT_FOREACH_ELEM CAT(STOUT_FOREACH_PREFIX, _elem__)
+#define STOUT_FOREACH_ONCE CAT(STOUT_FOREACH_PREFIX, _once__)
+
+
+// `foreach` is a trivial expansion to the range-based `for`.
+#define foreach(ELEM, ELEMS) for (ELEM : ELEMS)
+
+
+// `foreachpair` is used to unpack the key and value of the pairs coming out of
+// a sequence. e.g., std::map.
+//
+// Control flow:
+//
+// Labels:
+//   * `STOUT_FOREACH_BREAK` is the label that when jumped to, breaks out of
+//     the loop.
+//   * `STOUT_FOREACH_BODY` is the label that helps to skip the loop exit checks
+//     (break or continue) until we finish the current iteration.
+//
+// Flags:
+//   * `STOUT_FOREACH_CONTINUE` determines whether the loop should continue or
+//     not. If we encounter a `break`, this will be `false`. If we encounter a
+//     `continue` or run the current iteration to completion,
+//     `STOUT_FOREACH_CONTINUE` will be set to `true`.
+//   * `STOUT_FOREACH_ONCE` is used to execute a `for` loop exactly once.
+//
+#define foreachpair(KEY, VALUE, ELEMS)                                       \
+  foreach (auto&& STOUT_FOREACH_ELEM, ELEMS)                                 \
+    if (false) STOUT_FOREACH_BREAK: break; /* set up the break path */       \
+    else if (bool STOUT_FOREACH_CONTINUE = false) {} /* var decl */          \
+    else if (true) goto STOUT_FOREACH_BODY; /* skip the loop exit checks */  \
+    else for (;;) /* determine whether we should break or continue. */       \
+      if (!STOUT_FOREACH_CONTINUE) goto STOUT_FOREACH_BREAK; /* break */     \
+      else if (true) break; /* continue */                                   \
+      else                                                                   \
+        STOUT_FOREACH_BODY:                                                  \
+        if (bool STOUT_FOREACH_ONCE = false) {} /* var decl */               \
+        else for (KEY = std::get<0>(                                         \
+                      std::forward<decltype(STOUT_FOREACH_ELEM)>(            \
+                          STOUT_FOREACH_ELEM));                              \
+                  !STOUT_FOREACH_ONCE;                                       \
+                  STOUT_FOREACH_ONCE = true)                                 \
+          for (VALUE = std::get<1>(                                          \
+                   std::forward<decltype(STOUT_FOREACH_ELEM)>(               \
+                       STOUT_FOREACH_ELEM));                                 \
+               !STOUT_FOREACH_CONTINUE;                                      \
+               STOUT_FOREACH_CONTINUE = true)
+
+
+#define foreachkey(KEY, ELEMS) foreachpair (KEY, std::ignore, ELEMS)
+
+
+#define foreachvalue(VALUE, ELEMS) foreachpair (std::ignore, VALUE, ELEMS)
 
 #endif // __STOUT_FOREACH_HPP__