You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2016/01/13 12:46:39 UTC

[1/2] mesos git commit: Used std::list as opposed to List from stout.

Repository: mesos
Updated Branches:
  refs/heads/master 885bc5b8b -> 1f01b7ab4


Used std::list as opposed to List from stout.

List from stout provides no advantage over std::list now that C++11 is
available.

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


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

Branch: refs/heads/master
Commit: f195eeb2ba2e3227df24c09ba8c5dcd22c448414
Parents: 885bc5b
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Wed Jan 13 11:39:08 2016 +0100
Committer: Till Toenshoff <to...@me.com>
Committed: Wed Jan 13 12:01:42 2016 +0100

----------------------------------------------------------------------
 .../libprocess/src/tests/subprocess_tests.cpp   |  1 -
 .../libprocess/src/tests/timeseries_tests.cpp   | 57 +++++++++++---------
 2 files changed, 31 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f195eeb2/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 8f0a313..09e46eb 100644
--- a/3rdparty/libprocess/src/tests/subprocess_tests.cpp
+++ b/3rdparty/libprocess/src/tests/subprocess_tests.cpp
@@ -28,7 +28,6 @@
 
 #include <stout/foreach.hpp>
 #include <stout/gtest.hpp>
-#include <stout/list.hpp>
 #include <stout/path.hpp>
 
 #include <stout/os/read.hpp>

http://git-wip-us.apache.org/repos/asf/mesos/blob/f195eeb2/3rdparty/libprocess/src/tests/timeseries_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/timeseries_tests.cpp b/3rdparty/libprocess/src/tests/timeseries_tests.cpp
index 274598e..59e4657 100644
--- a/3rdparty/libprocess/src/tests/timeseries_tests.cpp
+++ b/3rdparty/libprocess/src/tests/timeseries_tests.cpp
@@ -10,6 +10,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License
 
+#include <list>
+
 #include <gmock/gmock.h>
 
 #include <process/clock.hpp>
@@ -17,15 +19,16 @@
 
 #include <stout/foreach.hpp>
 #include <stout/gtest.hpp>
-#include <stout/list.hpp>
+
+using std::list;
 
 using process::Clock;
 using process::Time;
 using process::TimeSeries;
 
-List<int> toList(const TimeSeries<int>& series)
+list<int> toList(const TimeSeries<int>& series)
 {
-  List<int> result;
+  list<int> result;
   foreach (const TimeSeries<int>::Value& value, series.get()) {
     result.push_back(value.data);
   }
@@ -71,40 +74,40 @@ TEST(TimeSeriesTest, Sparsify)
   series.set(8, now + Seconds(8));
   series.set(9, now + Seconds(9));
 
-  ASSERT_EQ(List<int>(0, 1, 2, 3, 4, 5, 6, 7, 8, 9), toList(series));
+  ASSERT_EQ(list<int>({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}), toList(series));
 
   // Verify the sparsification pattern.
   series.set(10, now + Seconds(10));
-  ASSERT_EQ(List<int>(0, 2, 3, 4, 5, 6, 7, 8, 9, 10), toList(series));
+  ASSERT_EQ(list<int>({0, 2, 3, 4, 5, 6, 7, 8, 9, 10}), toList(series));
 
   series.set(11, now + Seconds(11));
-  ASSERT_EQ(List<int>(0, 2, 4, 5, 6, 7, 8, 9, 10, 11), toList(series));
+  ASSERT_EQ(list<int>({0, 2, 4, 5, 6, 7, 8, 9, 10, 11}), toList(series));
 
   series.set(12, now + Seconds(12));
-  ASSERT_EQ(List<int>(0, 2, 4, 6, 7, 8, 9, 10, 11, 12), toList(series));
+  ASSERT_EQ(list<int>({0, 2, 4, 6, 7, 8, 9, 10, 11, 12}), toList(series));
 
   series.set(13, now + Seconds(13));
-  ASSERT_EQ(List<int>(0, 2, 4, 6, 8, 9, 10, 11, 12, 13), toList(series));
+  ASSERT_EQ(list<int>({0, 2, 4, 6, 8, 9, 10, 11, 12, 13}), toList(series));
 
   series.set(14, now + Seconds(14));
-  ASSERT_EQ(List<int>(0, 2, 4, 6, 8, 10, 11, 12, 13, 14), toList(series));
+  ASSERT_EQ(list<int>({0, 2, 4, 6, 8, 10, 11, 12, 13, 14}), toList(series));
 
   // Now we expect a new round of sparsification to occur, starting
   // again from the beginning.
   series.set(15, now + Seconds(15));
-  ASSERT_EQ(List<int>(0, 4, 6, 8, 10, 11, 12, 13, 14, 15), toList(series));
+  ASSERT_EQ(list<int>({0, 4, 6, 8, 10, 11, 12, 13, 14, 15}), toList(series));
 
   series.set(16, now + Seconds(16));
-  ASSERT_EQ(List<int>(0, 4, 8, 10, 11, 12, 13, 14, 15, 16), toList(series));
+  ASSERT_EQ(list<int>({0, 4, 8, 10, 11, 12, 13, 14, 15, 16}), toList(series));
 
   series.set(17, now + Seconds(17));
-  ASSERT_EQ(List<int>(0, 4, 8, 11, 12, 13, 14, 15, 16, 17), toList(series));
+  ASSERT_EQ(list<int>({0, 4, 8, 11, 12, 13, 14, 15, 16, 17}), toList(series));
 
   series.set(18, now + Seconds(18));
-  ASSERT_EQ(List<int>(0, 4, 8, 11, 13, 14, 15, 16, 17, 18), toList(series));
+  ASSERT_EQ(list<int>({0, 4, 8, 11, 13, 14, 15, 16, 17, 18}), toList(series));
 
   series.set(19, now + Seconds(19));
-  ASSERT_EQ(List<int>(0, 4, 8, 11, 13, 15, 16, 17, 18, 19), toList(series));
+  ASSERT_EQ(list<int>({0, 4, 8, 11, 13, 15, 16, 17, 18, 19}), toList(series));
 
   Clock::resume();
 }
@@ -130,13 +133,13 @@ TEST(TimeSeriesTest, Truncate)
   series.set(8, now + Seconds(8));
   series.set(9, now + Seconds(9));
 
-  ASSERT_EQ(List<int>(0, 1, 2, 3, 4, 5, 6, 7, 8, 9), toList(series));
+  ASSERT_EQ(list<int>({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}), toList(series));
 
   // Cause the first 6 tasks to be truncated from the window.
   Clock::advance(Seconds(10 + 6));
   series.set(10, now + Seconds(10));
 
-  ASSERT_EQ(List<int>(7, 8, 9, 10), toList(series));
+  ASSERT_EQ(list<int>({7, 8, 9, 10}), toList(series));
 
   Clock::resume();
 
@@ -158,41 +161,41 @@ TEST(TimeSeriesTest, Truncate)
   series.set(8, now + Seconds(8));
   series.set(9, now + Seconds(9));
 
-  ASSERT_EQ(List<int>(0, 1, 2, 3, 4, 5, 6, 7, 8, 9), toList(series));
+  ASSERT_EQ(list<int>({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}), toList(series));
 
   // Move the sparsification candidate forward to ensure sparsification
   // is correct after a truncation occurs.
   series.set(10, now + Seconds(10));
-  ASSERT_EQ(List<int>(0, 2, 3, 4, 5, 6, 7, 8, 9, 10), toList(series));
+  ASSERT_EQ(list<int>({0, 2, 3, 4, 5, 6, 7, 8, 9, 10}), toList(series));
 
   series.set(11, now + Seconds(11));
-  ASSERT_EQ(List<int>(0, 2, 4, 5, 6, 7, 8, 9, 10, 11), toList(series));
+  ASSERT_EQ(list<int>({0, 2, 4, 5, 6, 7, 8, 9, 10, 11}), toList(series));
 
   series.set(12, now + Seconds(12));
-  ASSERT_EQ(List<int>(0, 2, 4, 6, 7, 8, 9, 10, 11, 12), toList(series));
+  ASSERT_EQ(list<int>({0, 2, 4, 6, 7, 8, 9, 10, 11, 12}), toList(series));
 
   // Now the next sparsification candidate is '7'. First, we will
   // truncate exluding '7' and ensure sparsification proceeds as
   // expected.
   Clock::advance(Seconds(10 + 2));
   series.truncate();
-  ASSERT_EQ(List<int>(4, 6, 7, 8, 9, 10, 11, 12), toList(series));
+  ASSERT_EQ(list<int>({4, 6, 7, 8, 9, 10, 11, 12}), toList(series));
 
   // Add 2 more items to return to capacity.
   series.set(13, now + Seconds(13));
   series.set(14, now + Seconds(14));
-  ASSERT_EQ(List<int>(4, 6, 7, 8, 9, 10, 11, 12, 13, 14), toList(series));
+  ASSERT_EQ(list<int>({4, 6, 7, 8, 9, 10, 11, 12, 13, 14}), toList(series));
 
   // Now cause the time series to exceed capacity and ensure we
   // correctly remove '7'.
   series.set(15, now + Seconds(15));
-  ASSERT_EQ(List<int>(4, 6, 8, 9, 10, 11, 12, 13, 14, 15), toList(series));
+  ASSERT_EQ(list<int>({4, 6, 8, 9, 10, 11, 12, 13, 14, 15}), toList(series));
 
   // Finally, let's truncate into the next sparsification candidate
   // '9', and ensure sparsification is reset.
   Clock::advance(Seconds(7)); // 2 + 7 = 9.
   series.truncate();
-  ASSERT_EQ(List<int>(10, 11, 12, 13, 14, 15), toList(series));
+  ASSERT_EQ(list<int>({10, 11, 12, 13, 14, 15}), toList(series));
 
   // Get back to capacity and ensure sparsification starts from the
   // beginning.
@@ -200,11 +203,13 @@ TEST(TimeSeriesTest, Truncate)
   series.set(17, now + Seconds(17));
   series.set(18, now + Seconds(18));
   series.set(19, now + Seconds(19));
-  ASSERT_EQ(List<int>(10, 11, 12, 13, 14, 15, 16, 17, 18, 19), toList(series));
+  ASSERT_EQ(list<int>({10, 11, 12, 13, 14, 15, 16, 17, 18, 19}),
+            toList(series));
 
   // Did we sparsify from the beginning?
   series.set(20, now + Seconds(20));
-  ASSERT_EQ(List<int>(10, 12, 13, 14, 15, 16, 17, 18, 19, 20), toList(series));
+  ASSERT_EQ(list<int>({10, 12, 13, 14, 15, 16, 17, 18, 19, 20}),
+            toList(series));
 
   // Done!
   Clock::resume();


[2/2] mesos git commit: Removed List type which is not needed anymore with C++11.

Posted by ti...@apache.org.
Removed List type which is not needed anymore with C++11.

This type was added to provide a variadic constructor around a
std::list. Now that C++11 is used this is not needed anymore as we can
directly invoke std::list's constructor taking a std::initializer_list.

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


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

Branch: refs/heads/master
Commit: 1f01b7ab4f92800f94f9b8c4f70fce18ff2fbde0
Parents: f195eeb
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Wed Jan 13 11:49:11 2016 +0100
Committer: Till Toenshoff <to...@me.com>
Committed: Wed Jan 13 12:01:54 2016 +0100

----------------------------------------------------------------------
 .../3rdparty/stout/include/Makefile.am          |  1 -
 .../3rdparty/stout/include/stout/list.hpp       | 40 --------------------
 2 files changed, 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/1f01b7ab/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
index ec851dc..1307b0a 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
+++ b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am
@@ -44,7 +44,6 @@ nobase_include_HEADERS =		\
   stout/json.hpp			\
   stout/lambda.hpp			\
   stout/linkedhashmap.hpp		\
-  stout/list.hpp			\
   stout/mac.hpp				\
   stout/multihashmap.hpp		\
   stout/multimap.hpp			\

http://git-wip-us.apache.org/repos/asf/mesos/blob/1f01b7ab/3rdparty/libprocess/3rdparty/stout/include/stout/list.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/list.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/list.hpp
deleted file mode 100644
index 864d8c9..0000000
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/list.hpp
+++ /dev/null
@@ -1,40 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//  http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef __STOUT_LIST_HPP__
-#define __STOUT_LIST_HPP__
-
-#include <list>
-
-#include <stout/preprocessor.hpp>
-
-template <typename T>
-class List : public std::list<T>
-{
-public:
-  List() {}
-
-  // TODO(bmahler): Revisit when C++11 is required: we'll be able to
-  // use the std::list constructor with an std::initiliazer_list.
-#define INSERT(z, N, _) std::list<T>::push_back( t ## N );
-#define TEMPLATE(Z, N, DATA) \
-  List(ENUM_PARAMS(N, const T& t)) \
-  { \
-    REPEAT_FROM_TO(0, N, INSERT, _) \
-  }
-
-  REPEAT_FROM_TO(1, 21, TEMPLATE, _) // Args T1 -> T21.
-#undef TEMPLATE
-#undef INSERT
-};
-
-#endif // __STOUT_LIST_HPP__