Removed `void` parameters in libprocess.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/05f9fb2f Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/05f9fb2f Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/05f9fb2f Branch: refs/heads/master Commit: 05f9fb2fa66968f37418d28fc8cebd0770a54dca Parents: 93a5708 Author: Michael Park <[email protected]> Authored: Wed Jan 20 14:14:54 2016 -0800 Committer: Michael Park <[email protected]> Committed: Wed Jan 20 15:29:05 2016 -0800 ---------------------------------------------------------------------- 3rdparty/libprocess/include/process/async.hpp | 34 +++++++------- 3rdparty/libprocess/include/process/clock.hpp | 2 +- 3rdparty/libprocess/include/process/defer.hpp | 42 +++++------------ .../libprocess/include/process/deferred.hpp | 12 ++--- .../libprocess/include/process/dispatch.hpp | 48 +++++--------------- 3rdparty/libprocess/include/process/future.hpp | 4 +- .../include/process/metrics/gauge.hpp | 11 ++--- 3rdparty/libprocess/include/process/run.hpp | 14 +++--- .../libprocess/include/process/sequence.hpp | 8 ++-- 3rdparty/libprocess/include/process/timer.hpp | 4 +- 3rdparty/libprocess/m4/ax_pthread.m4 | 2 +- 3rdparty/libprocess/src/clock.cpp | 2 +- 3rdparty/libprocess/src/event_loop.hpp | 2 +- 3rdparty/libprocess/src/libev.cpp | 17 ++++--- 3rdparty/libprocess/src/libev.hpp | 6 +-- 3rdparty/libprocess/src/libevent.cpp | 12 ++--- 3rdparty/libprocess/src/libevent.hpp | 2 +- 3rdparty/libprocess/src/tests/process_tests.cpp | 20 ++++---- .../libprocess/src/tests/sequence_tests.cpp | 14 +++--- 19 files changed, 105 insertions(+), 151 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/include/process/async.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/async.hpp b/3rdparty/libprocess/include/process/async.hpp index d2d6945..84fd211 100644 --- a/3rdparty/libprocess/include/process/async.hpp +++ b/3rdparty/libprocess/include/process/async.hpp @@ -34,15 +34,15 @@ namespace process { // brittle). template <typename F> -Future<typename result_of<F(void)>::type> async( +Future<typename result_of<F()>::type> async( const F& f, - typename boost::disable_if<boost::is_void<typename result_of<F(void)>::type> >::type* = NULL); // NOLINT(whitespace/line_length) + typename boost::disable_if<boost::is_void<typename result_of<F()>::type> >::type* = NULL); // NOLINT(whitespace/line_length) template <typename F> Future<Nothing> async( const F& f, - typename boost::enable_if<boost::is_void<typename result_of<F(void)>::type> >::type* = NULL); // NOLINT(whitespace/line_length) + typename boost::enable_if<boost::is_void<typename result_of<F()>::type> >::type* = NULL); // NOLINT(whitespace/line_length) #define TEMPLATE(Z, N, DATA) \ @@ -77,9 +77,9 @@ private: AsyncExecutorProcess& operator=(const AsyncExecutorProcess&); template <typename F> - typename result_of<F(void)>::type execute( + typename result_of<F()>::type execute( const F& f, - typename boost::disable_if<boost::is_void<typename result_of<F(void)>::type> >::type* = NULL) // NOLINT(whitespace/line_length) + typename boost::disable_if<boost::is_void<typename result_of<F()>::type> >::type* = NULL) // NOLINT(whitespace/line_length) { terminate(self()); // Terminate process after function returns. return f(); @@ -88,7 +88,7 @@ private: template <typename F> Nothing execute( const F& f, - typename boost::enable_if<boost::is_void<typename result_of<F(void)>::type> >::type* = NULL) // NOLINT(whitespace/line_length) + typename boost::enable_if<boost::is_void<typename result_of<F()>::type> >::type* = NULL) // NOLINT(whitespace/line_length) { terminate(self()); // Terminate process after function returns. f(); @@ -128,14 +128,14 @@ class AsyncExecutor private: // Declare async functions as friends. template <typename F> - friend Future<typename result_of<F(void)>::type> async( + friend Future<typename result_of<F()>::type> async( const F& f, - typename boost::disable_if<boost::is_void<typename result_of<F(void)>::type> >::type*); // NOLINT(whitespace/line_length) + typename boost::disable_if<boost::is_void<typename result_of<F()>::type> >::type*); // NOLINT(whitespace/line_length) template <typename F> friend Future<Nothing> async( const F& f, - typename boost::enable_if<boost::is_void<typename result_of<F(void)>::type> >::type*); // NOLINT(whitespace/line_length) + typename boost::enable_if<boost::is_void<typename result_of<F()>::type> >::type*); // NOLINT(whitespace/line_length) #define TEMPLATE(Z, N, DATA) \ template <typename F, ENUM_PARAMS(N, typename A)> \ @@ -166,12 +166,12 @@ private: AsyncExecutor& operator=(const AsyncExecutor&); template <typename F> - Future<typename result_of<F(void)>::type> execute( + Future<typename result_of<F()>::type> execute( const F& f, - typename boost::disable_if<boost::is_void<typename result_of<F(void)>::type> >::type* = NULL) // NOLINT(whitespace/line_length) + typename boost::disable_if<boost::is_void<typename result_of<F()>::type> >::type* = NULL) // NOLINT(whitespace/line_length) { // Need to disambiguate overloaded method. - typename result_of<F(void)>::type(AsyncExecutorProcess::*method)(const F&, typename boost::disable_if<boost::is_void<typename result_of<F(void)>::type> >::type*) = // NOLINT(whitespace/line_length) + typename result_of<F()>::type(AsyncExecutorProcess::*method)(const F&, typename boost::disable_if<boost::is_void<typename result_of<F()>::type> >::type*) = // NOLINT(whitespace/line_length) &AsyncExecutorProcess::execute<F>; return dispatch(process, method, f, (void*) NULL); @@ -180,10 +180,10 @@ private: template <typename F> Future<Nothing> execute( const F& f, - typename boost::enable_if<boost::is_void<typename result_of<F(void)>::type> >::type* = NULL) // NOLINT(whitespace/line_length) + typename boost::enable_if<boost::is_void<typename result_of<F()>::type> >::type* = NULL) // NOLINT(whitespace/line_length) { // Need to disambiguate overloaded method. - Nothing(AsyncExecutorProcess::*method)(const F&, typename boost::enable_if<boost::is_void<typename result_of<F(void)>::type> >::type*) = // NOLINT(whitespace/line_length) + Nothing(AsyncExecutorProcess::*method)(const F&, typename boost::enable_if<boost::is_void<typename result_of<F()>::type> >::type*) = // NOLINT(whitespace/line_length) &AsyncExecutorProcess::execute<F>; return dispatch(process, method, f, (void*) NULL); @@ -225,9 +225,9 @@ private: // Provides an abstraction for asynchronously executing a function. template <typename F> -Future<typename result_of<F(void)>::type> async( +Future<typename result_of<F()>::type> async( const F& f, - typename boost::disable_if<boost::is_void<typename result_of<F(void)>::type> >::type*) // NOLINT(whitespace/line_length) + typename boost::disable_if<boost::is_void<typename result_of<F()>::type> >::type*) // NOLINT(whitespace/line_length) { return AsyncExecutor().execute(f); } @@ -236,7 +236,7 @@ Future<typename result_of<F(void)>::type> async( template <typename F> Future<Nothing> async( const F& f, - typename boost::enable_if<boost::is_void<typename result_of<F(void)>::type> >::type*) // NOLINT(whitespace/line_length) + typename boost::enable_if<boost::is_void<typename result_of<F()>::type> >::type*) // NOLINT(whitespace/line_length) { return AsyncExecutor().execute(f); } http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/include/process/clock.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/clock.hpp b/3rdparty/libprocess/include/process/clock.hpp index 5875847..d7d5ff7 100644 --- a/3rdparty/libprocess/include/process/clock.hpp +++ b/3rdparty/libprocess/include/process/clock.hpp @@ -71,7 +71,7 @@ public: static Timer timer( const Duration& duration, - const lambda::function<void(void)>& thunk); + const lambda::function<void()>& thunk); static bool cancel(const Timer& timer); http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/include/process/defer.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/defer.hpp b/3rdparty/libprocess/include/process/defer.hpp index 464aa9e..6bb79cd 100644 --- a/3rdparty/libprocess/include/process/defer.hpp +++ b/3rdparty/libprocess/include/process/defer.hpp @@ -32,29 +32,21 @@ namespace process { // First, definitions of defer for methods returning void: template <typename T> -Deferred<void(void)> defer( - const PID<T>& pid, - void (T::*method)(void)) +Deferred<void()> defer(const PID<T>& pid, void (T::*method)()) { - return Deferred<void(void)>([=]() { - dispatch(pid, method); - }); + return Deferred<void()>([=]() { dispatch(pid, method); }); } template <typename T> -Deferred<void(void)> defer( - const Process<T>& process, - void (T::*method)(void)) +Deferred<void()> defer(const Process<T>& process, void (T::*method)()) { return defer(process.self(), method); } template <typename T> -Deferred<void(void)> defer( - const Process<T>* process, - void (T::*method)(void)) +Deferred<void()> defer(const Process<T>* process, void (T::*method)()) { return defer(process->self(), method); } @@ -111,24 +103,19 @@ Deferred<void(void)> defer( // Next, definitions of defer for methods returning future: template <typename R, typename T> -Deferred<Future<R>(void)> -defer(const PID<T>& pid, Future<R> (T::*method)(void)) +Deferred<Future<R>()> defer(const PID<T>& pid, Future<R> (T::*method)()) { - return Deferred<Future<R>(void)>([=]() { - return dispatch(pid, method); - }); + return Deferred<Future<R>()>([=]() { return dispatch(pid, method); }); } template <typename R, typename T> -Deferred<Future<R>(void)> -defer(const Process<T>& process, Future<R> (T::*method)(void)) +Deferred<Future<R>()> defer(const Process<T>& process, Future<R> (T::*method)()) { return defer(process.self(), method); } template <typename R, typename T> -Deferred<Future<R>(void)> -defer(const Process<T>* process, Future<R> (T::*method)(void)) +Deferred<Future<R>()> defer(const Process<T>* process, Future<R> (T::*method)()) { return defer(process->self(), method); } @@ -181,24 +168,19 @@ defer(const Process<T>* process, Future<R> (T::*method)(void)) // Finaly, definitions of defer for methods returning a value: template <typename R, typename T> -Deferred<Future<R>(void)> -defer(const PID<T>& pid, R (T::*method)(void)) +Deferred<Future<R>()> defer(const PID<T>& pid, R (T::*method)()) { - return Deferred<Future<R>(void)>([=]() { - return dispatch(pid, method); - }); + return Deferred<Future<R>()>([=]() { return dispatch(pid, method); }); } template <typename R, typename T> -Deferred<Future<R>(void)> -defer(const Process<T>& process, R (T::*method)(void)) +Deferred<Future<R>()> defer(const Process<T>& process, R (T::*method)()) { return defer(process.self(), method); } template <typename R, typename T> -Deferred<Future<R>(void)> -defer(const Process<T>* process, R (T::*method)(void)) +Deferred<Future<R>()> defer(const Process<T>* process, R (T::*method)()) { return defer(process->self(), method); } http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/include/process/deferred.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/deferred.hpp b/3rdparty/libprocess/include/process/deferred.hpp index 1cb9f89..eb4739c 100644 --- a/3rdparty/libprocess/include/process/deferred.hpp +++ b/3rdparty/libprocess/include/process/deferred.hpp @@ -36,16 +36,16 @@ private: // TODO(benh): Consider removing these in favor of having these // functions return _Deferred. template <typename T> - friend Deferred<void(void)> - defer(const PID<T>& pid, void (T::*method)(void)); + friend Deferred<void()> + defer(const PID<T>& pid, void (T::*method)()); template <typename R, typename T> - friend Deferred<Future<R>(void)> - defer(const PID<T>& pid, Future<R> (T::*method)(void)); + friend Deferred<Future<R>()> + defer(const PID<T>& pid, Future<R> (T::*method)()); template <typename R, typename T> - friend Deferred<Future<R>(void)> - defer(const PID<T>& pid, R (T::*method)(void)); + friend Deferred<Future<R>()> + defer(const PID<T>& pid, R (T::*method)()); /*implicit*/ Deferred(const std::function<F>& f) : std::function<F>(f) {} }; http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/include/process/dispatch.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/dispatch.hpp b/3rdparty/libprocess/include/process/dispatch.hpp index dca3d73..a4c35b2 100644 --- a/3rdparty/libprocess/include/process/dispatch.hpp +++ b/3rdparty/libprocess/include/process/dispatch.hpp @@ -77,9 +77,7 @@ void dispatch( // First, definitions of dispatch for methods returning void: template <typename T> -void dispatch( - const PID<T>& pid, - void (T::*method)()) +void dispatch(const PID<T>& pid, void (T::*method)()) { std::shared_ptr<std::function<void(ProcessBase*)>> f( new std::function<void(ProcessBase*)>( @@ -94,17 +92,13 @@ void dispatch( } template <typename T> -void dispatch( - const Process<T>& process, - void (T::*method)()) +void dispatch(const Process<T>& process, void (T::*method)()) { dispatch(process.self(), method); } template <typename T> -void dispatch( - const Process<T>* process, - void (T::*method)()) +void dispatch(const Process<T>* process, void (T::*method)()) { dispatch(process->self(), method); } @@ -162,9 +156,7 @@ void dispatch( // Next, definitions of methods returning a future: template <typename R, typename T> -Future<R> dispatch( - const PID<T>& pid, - Future<R> (T::*method)()) +Future<R> dispatch(const PID<T>& pid, Future<R> (T::*method)()) { std::shared_ptr<Promise<R>> promise(new Promise<R>()); @@ -183,17 +175,13 @@ Future<R> dispatch( } template <typename R, typename T> -Future<R> dispatch( - const Process<T>& process, - Future<R> (T::*method)(void)) +Future<R> dispatch(const Process<T>& process, Future<R> (T::*method)()) { return dispatch(process.self(), method); } template <typename R, typename T> -Future<R> dispatch( - const Process<T>* process, - Future<R> (T::*method)(void)) +Future<R> dispatch(const Process<T>* process, Future<R> (T::*method)()) { return dispatch(process->self(), method); } @@ -255,9 +243,7 @@ Future<R> dispatch( // Next, definitions of methods returning a value. template <typename R, typename T> -Future<R> dispatch( - const PID<T>& pid, - R (T::*method)(void)) +Future<R> dispatch(const PID<T>& pid, R (T::*method)()) { std::shared_ptr<Promise<R>> promise(new Promise<R>()); @@ -276,17 +262,13 @@ Future<R> dispatch( } template <typename R, typename T> -Future<R> dispatch( - const Process<T>& process, - R (T::*method)()) +Future<R> dispatch(const Process<T>& process, R (T::*method)()) { return dispatch(process.self(), method); } template <typename R, typename T> -Future<R> dispatch( - const Process<T>* process, - R (T::*method)()) +Future<R> dispatch(const Process<T>* process, R (T::*method)()) { return dispatch(process->self(), method); } @@ -345,9 +327,7 @@ Future<R> dispatch( #undef TEMPLATE -inline void dispatch( - const UPID& pid, - const std::function<void()>& f) +inline void dispatch(const UPID& pid, const std::function<void()>& f) { std::shared_ptr<std::function<void(ProcessBase*)>> f_( new std::function<void(ProcessBase*)>( @@ -360,9 +340,7 @@ inline void dispatch( template <typename R> -Future<R> dispatch( - const UPID& pid, - const std::function<Future<R>()>& f) +Future<R> dispatch(const UPID& pid, const std::function<Future<R>()>& f) { std::shared_ptr<Promise<R>> promise(new Promise<R>()); @@ -379,9 +357,7 @@ Future<R> dispatch( template <typename R> -Future<R> dispatch( - const UPID& pid, - const std::function<R()>& f) +Future<R> dispatch(const UPID& pid, const std::function<R()>& f) { std::shared_ptr<Promise<R>> promise(new Promise<R>()); http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/include/process/future.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/future.hpp b/3rdparty/libprocess/include/process/future.hpp index a05d9e4..80f3a39 100644 --- a/3rdparty/libprocess/include/process/future.hpp +++ b/3rdparty/libprocess/include/process/future.hpp @@ -151,10 +151,10 @@ public: // Type of the callback functions that can get invoked when the // future gets set, fails, or is discarded. - typedef lambda::function<void(void)> DiscardCallback; + typedef lambda::function<void()> DiscardCallback; typedef lambda::function<void(const T&)> ReadyCallback; typedef lambda::function<void(const std::string&)> FailedCallback; - typedef lambda::function<void(void)> DiscardedCallback; + typedef lambda::function<void()> DiscardedCallback; typedef lambda::function<void(const Future<T>&)> AnyCallback; // Installs callbacks for the specified events and returns a const http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/include/process/metrics/gauge.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/metrics/gauge.hpp b/3rdparty/libprocess/include/process/metrics/gauge.hpp index d5e7f5e..c5bbeaf 100644 --- a/3rdparty/libprocess/include/process/metrics/gauge.hpp +++ b/3rdparty/libprocess/include/process/metrics/gauge.hpp @@ -31,10 +31,8 @@ public: // 'name' is the unique name for the instance of Gauge being constructed. // It will be the key exposed in the JSON endpoint. // 'f' is the deferred object called when the Metric value is requested. - Gauge(const std::string& name, - const Deferred<Future<double> (void)>& f) - : Metric(name, None()), - data(new Data(f)) {} + Gauge(const std::string& name, const Deferred<Future<double>()>& f) + : Metric(name, None()), data(new Data(f)) {} virtual ~Gauge() {} @@ -43,10 +41,9 @@ public: private: struct Data { - explicit Data(const Deferred<Future<double> (void)>& _f) - : f(_f) {} + explicit Data(const Deferred<Future<double>()>& _f) : f(_f) {} - const Deferred<Future<double> (void)> f; + const Deferred<Future<double>()> f; }; std::shared_ptr<Data> data; http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/include/process/run.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/run.hpp b/3rdparty/libprocess/include/process/run.hpp index 2afe8ed..d141fb0 100644 --- a/3rdparty/libprocess/include/process/run.hpp +++ b/3rdparty/libprocess/include/process/run.hpp @@ -28,7 +28,7 @@ template <typename R> class ThunkProcess : public Process<ThunkProcess<R>> { public: - ThunkProcess(std::shared_ptr<lambda::function<R(void)>> _thunk, + ThunkProcess(std::shared_ptr<lambda::function<R()>> _thunk, std::shared_ptr<Promise<R>> _promise) : thunk(_thunk), promise(_promise) {} @@ -42,7 +42,7 @@ protected: } private: - std::shared_ptr<lambda::function<R(void)>> thunk; + std::shared_ptr<lambda::function<R()>> thunk; std::shared_ptr<Promise<R>> promise; }; @@ -50,10 +50,10 @@ private: template <typename R> -Future<R> run(R (*method)(void)) +Future<R> run(R (*method)()) { - std::shared_ptr<lambda::function<R(void)>> thunk( - new lambda::function<R(void)>( + std::shared_ptr<lambda::function<R()>> thunk( + new lambda::function<R()>( lambda::bind(method))); std::shared_ptr<Promise<R>> promise(new Promise<R>()); @@ -73,8 +73,8 @@ Future<R> run(R (*method)(void)) R (*method)(ENUM_PARAMS(N, P)), \ ENUM_BINARY_PARAMS(N, A, a)) \ { \ - std::shared_ptr<lambda::function<R(void)>> thunk( \ - new lambda::function<R(void)>( \ + std::shared_ptr<lambda::function<R()>> thunk( \ + new lambda::function<R()>( \ lambda::bind(method, ENUM_PARAMS(N, a)))); \ \ std::shared_ptr<Promise<R>> promise(new Promise<R>()); \ http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/include/process/sequence.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/sequence.hpp b/3rdparty/libprocess/include/process/sequence.hpp index 296978c..78ccdb9 100644 --- a/3rdparty/libprocess/include/process/sequence.hpp +++ b/3rdparty/libprocess/include/process/sequence.hpp @@ -48,7 +48,7 @@ public: // affected. The subsequent callbacks will not be invoked until the // future is actually DISCARDED. template <typename T> - Future<T> add(const lambda::function<Future<T>(void)>& callback); + Future<T> add(const lambda::function<Future<T>()>& callback); private: // Not copyable, not assignable. @@ -65,7 +65,7 @@ public: SequenceProcess() : last(Nothing()) {} template <typename T> - Future<T> add(const lambda::function<Future<T>(void)>& callback) + Future<T> add(const lambda::function<Future<T>()>& callback) { // This is the future that is used to notify the next callback // (denoted by 'N' in the following graph). @@ -147,7 +147,7 @@ private: template <typename T> static void notified( Owned<Promise<T> > promise, - const lambda::function<Future<T>(void)>& callback) + const lambda::function<Future<T>()>& callback) { if (promise->future().hasDiscard()) { // The user has shown the intention to discard this callback @@ -179,7 +179,7 @@ inline Sequence::~Sequence() template <typename T> -Future<T> Sequence::add(const lambda::function<Future<T>(void)>& callback) +Future<T> Sequence::add(const lambda::function<Future<T>()>& callback) { return dispatch(process, &SequenceProcess::add<T>, callback); } http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/include/process/timer.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/timer.hpp b/3rdparty/libprocess/include/process/timer.hpp index ff9680a..6bf7216 100644 --- a/3rdparty/libprocess/include/process/timer.hpp +++ b/3rdparty/libprocess/include/process/timer.hpp @@ -62,7 +62,7 @@ private: Timer(long _id, const Timeout& _t, const process::UPID& _pid, - const lambda::function<void(void)>& _thunk) + const lambda::function<void()>& _thunk) : id(_id), t(_t), pid(_pid), thunk(_thunk) {} @@ -77,7 +77,7 @@ private: // valid and get a refernce to it.) process::UPID pid; - lambda::function<void(void)> thunk; + lambda::function<void()> thunk; }; } // namespace process { http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/m4/ax_pthread.m4 ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/m4/ax_pthread.m4 b/3rdparty/libprocess/m4/ax_pthread.m4 index d383ad5..0b2071d 100644 --- a/3rdparty/libprocess/m4/ax_pthread.m4 +++ b/3rdparty/libprocess/m4/ax_pthread.m4 @@ -172,7 +172,7 @@ AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags]) save_CFLAGS="$CFLAGS" ax_pthread_extra_flags="-Werror" CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument" -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])], +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo();],[foo()])], [AC_MSG_RESULT([yes])], [ax_pthread_extra_flags= AC_MSG_RESULT([no])]) http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/src/clock.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/clock.cpp b/3rdparty/libprocess/src/clock.cpp index 124d527..6c32792 100644 --- a/3rdparty/libprocess/src/clock.cpp +++ b/3rdparty/libprocess/src/clock.cpp @@ -264,7 +264,7 @@ Time Clock::now(ProcessBase* process) Timer Clock::timer( const Duration& duration, - const lambda::function<void(void)>& thunk) + const lambda::function<void()>& thunk) { // Start at 1 since Timer() instances use id 0. static std::atomic<uint64_t> id(1); http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/src/event_loop.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/event_loop.hpp b/3rdparty/libprocess/src/event_loop.hpp index 60ec2bc..17a24a4 100644 --- a/3rdparty/libprocess/src/event_loop.hpp +++ b/3rdparty/libprocess/src/event_loop.hpp @@ -32,7 +32,7 @@ public: // TODO(bmahler): Update this to use rvalue references. static void delay( const Duration& duration, - const lambda::function<void(void)>& function); + const lambda::function<void()>& function); // Returns the current time w.r.t. the event loop. static double time(); http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/src/libev.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/libev.cpp b/3rdparty/libprocess/src/libev.cpp index 91e2d81..1269bf8 100644 --- a/3rdparty/libprocess/src/libev.cpp +++ b/3rdparty/libprocess/src/libev.cpp @@ -37,15 +37,15 @@ std::queue<ev_io*>* watchers = new std::queue<ev_io*>(); std::mutex* watchers_mutex = new std::mutex(); -std::queue<lambda::function<void(void)>>* functions = - new std::queue<lambda::function<void(void)>>(); +std::queue<lambda::function<void()>>* functions = + new std::queue<lambda::function<void()>>(); THREAD_LOCAL bool* _in_event_loop_ = NULL; void handle_async(struct ev_loop* loop, ev_async* _, int revents) { - std::queue<lambda::function<void(void)>> run_functions; + std::queue<lambda::function<void()>> run_functions; synchronized (watchers_mutex) { // Start all the new I/O watchers. while (!watchers->empty()) { @@ -96,8 +96,8 @@ namespace internal { void handle_delay(struct ev_loop* loop, ev_timer* timer, int revents) { - lambda::function<void(void)>* function = - reinterpret_cast<lambda::function<void(void)>*>(timer->data); + lambda::function<void()>* function = + reinterpret_cast<lambda::function<void()>*>(timer->data); (*function)(); delete function; ev_timer_stop(loop, timer); @@ -107,11 +107,10 @@ void handle_delay(struct ev_loop* loop, ev_timer* timer, int revents) Future<Nothing> delay( const Duration& duration, - const lambda::function<void(void)>& function) + const lambda::function<void()>& function) { ev_timer* timer = new ev_timer(); - timer->data = reinterpret_cast<void*>( - new lambda::function<void(void)>(function)); + timer->data = reinterpret_cast<void*>(new lambda::function<void()>(function)); // Determine the 'after' parameter to pass to libev and set it to 0 // in the event that it's negative so that we always make sure to @@ -136,7 +135,7 @@ Future<Nothing> delay( void EventLoop::delay( const Duration& duration, - const lambda::function<void(void)>& function) + const lambda::function<void()>& function) { run_in_event_loop<Nothing>( lambda::bind(&internal::delay, duration, function)); http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/src/libev.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/libev.hpp b/3rdparty/libprocess/src/libev.hpp index 7785640..3995a2e 100644 --- a/3rdparty/libprocess/src/libev.hpp +++ b/3rdparty/libprocess/src/libev.hpp @@ -43,7 +43,7 @@ extern std::mutex* watchers_mutex; // Queue of functions to be invoked asynchronously within the vent // loop (protected by 'watchers' above). -extern std::queue<lambda::function<void(void)>>* functions; +extern std::queue<lambda::function<void()>>* functions; // Per thread bool pointer. We use a pointer to lazily construct the // actual bool. @@ -56,7 +56,7 @@ extern THREAD_LOCAL bool* _in_event_loop_; // Wrapper around function we want to run in the event loop. template <typename T> void _run_in_event_loop( - const lambda::function<Future<T>(void)>& f, + const lambda::function<Future<T>()>& f, const Owned<Promise<T>>& promise) { // Don't bother running the function if the future has been discarded. @@ -70,7 +70,7 @@ void _run_in_event_loop( // Helper for running a function in the event loop. template <typename T> -Future<T> run_in_event_loop(const lambda::function<Future<T>(void)>& f) +Future<T> run_in_event_loop(const lambda::function<Future<T>()>& f) { // If this is already the event loop then just run the function. if (__in_event_loop__) { http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/src/libevent.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/libevent.cpp b/3rdparty/libprocess/src/libevent.cpp index 61d056b..c787fa9 100644 --- a/3rdparty/libprocess/src/libevent.cpp +++ b/3rdparty/libprocess/src/libevent.cpp @@ -33,8 +33,8 @@ event_base* base = NULL; static std::mutex* functions_mutex = new std::mutex(); -std::queue<lambda::function<void(void)>>* functions = - new std::queue<lambda::function<void(void)>>(); +std::queue<lambda::function<void()>>* functions = + new std::queue<lambda::function<void()>>(); THREAD_LOCAL bool* _in_event_loop_ = NULL; @@ -45,7 +45,7 @@ void async_function(int socket, short which, void* arg) event* ev = reinterpret_cast<event*>(arg); event_free(ev); - std::queue<lambda::function<void(void)>> q; + std::queue<lambda::function<void()>> q; synchronized (functions_mutex) { std::swap(q, *functions); @@ -59,7 +59,7 @@ void async_function(int socket, short which, void* arg) void run_in_event_loop( - const lambda::function<void(void)>& f, + const lambda::function<void()>& f, EventLoopLogicFlow event_loop_logic_flow) { if (__in_event_loop__ && event_loop_logic_flow == ALLOW_SHORT_CIRCUIT) { @@ -124,7 +124,7 @@ namespace internal { struct Delay { - lambda::function<void(void)> function; + lambda::function<void()> function; event* timer; }; @@ -141,7 +141,7 @@ void handle_delay(int, short, void* arg) void EventLoop::delay( const Duration& duration, - const lambda::function<void(void)>& function) + const lambda::function<void()>& function) { internal::Delay* delay = new internal::Delay(); delay->timer = evtimer_new(base, &internal::handle_delay, delay); http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/src/libevent.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/libevent.hpp b/3rdparty/libprocess/src/libevent.hpp index 61129b3..4d0647e 100644 --- a/3rdparty/libprocess/src/libevent.hpp +++ b/3rdparty/libprocess/src/libevent.hpp @@ -41,7 +41,7 @@ enum EventLoopLogicFlow void run_in_event_loop( - const lambda::function<void(void)>& f, + const lambda::function<void()>& f, EventLoopLogicFlow event_loop_logic_flow = ALLOW_SHORT_CIRCUIT); } // namespace process { http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/src/tests/process_tests.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/tests/process_tests.cpp b/3rdparty/libprocess/src/tests/process_tests.cpp index df388ed..df1c7b3 100644 --- a/3rdparty/libprocess/src/tests/process_tests.cpp +++ b/3rdparty/libprocess/src/tests/process_tests.cpp @@ -541,8 +541,8 @@ TEST(ProcessTest, Discard3) class SpawnProcess : public Process<SpawnProcess> { public: - MOCK_METHOD0(initialize, void(void)); - MOCK_METHOD0(finalize, void(void)); + MOCK_METHOD0(initialize, void()); + MOCK_METHOD0(finalize, void()); }; @@ -572,7 +572,7 @@ TEST(ProcessTest, Spawn) class DispatchProcess : public Process<DispatchProcess> { public: - MOCK_METHOD0(func0, void(void)); + MOCK_METHOD0(func0, void()); MOCK_METHOD1(func1, bool(bool)); MOCK_METHOD1(func2, Future<bool>(bool)); MOCK_METHOD1(func3, int(int)); @@ -639,7 +639,7 @@ TEST(ProcessTest, Defer1) ASSERT_FALSE(!pid); { - Deferred<void(void)> func0 = + Deferred<void()> func0 = defer(pid, &DispatchProcess::func0); func0(); } @@ -647,21 +647,21 @@ TEST(ProcessTest, Defer1) Future<bool> future; { - Deferred<Future<bool>(void)> func1 = + Deferred<Future<bool>()> func1 = defer(pid, &DispatchProcess::func1, true); future = func1(); EXPECT_TRUE(future.get()); } { - Deferred<Future<bool>(void)> func2 = + Deferred<Future<bool>()> func2 = defer(pid, &DispatchProcess::func2, true); future = func2(); EXPECT_TRUE(future.get()); } { - Deferred<Future<bool>(void)> func4 = + Deferred<Future<bool>()> func4 = defer(pid, &DispatchProcess::func4, true, 42); future = func4(); EXPECT_TRUE(future.get()); @@ -1622,7 +1622,7 @@ TEST(ProcessTest, Defers) std::bind(baz, std::placeholders::_1)); Future<string>().then(std::function<int(string)>()); - Future<string>().then(std::function<int(void)>()); + Future<string>().then(std::function<int()>()); Future<int> future11 = Future<string>().then( defer(std::bind(bam, std::placeholders::_1))); @@ -1680,10 +1680,10 @@ TEST(ProcessTest, Defers) // } { - std::function<Future<int>(void)> f = + std::function<Future<int>()> f = defer(std::bind(baz, "42")); - std::function<Future<int>(void)> f2 = + std::function<Future<int>()> f2 = defer([]() { return baz("42"); }); } http://git-wip-us.apache.org/repos/asf/mesos/blob/05f9fb2f/3rdparty/libprocess/src/tests/sequence_tests.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/tests/sequence_tests.cpp b/3rdparty/libprocess/src/tests/sequence_tests.cpp index f7e84b9..566393f 100644 --- a/3rdparty/libprocess/src/tests/sequence_tests.cpp +++ b/3rdparty/libprocess/src/tests/sequence_tests.cpp @@ -71,7 +71,7 @@ TEST(SequenceTest, Serialize) Future<Nothing> bar = FUTURE_DISPATCH(_, &TestProcess::bar); - lambda::function<Future<Nothing>(void)> f; + lambda::function<Future<Nothing>()> f; f = defer(process, &TestProcess::foo); sequence.add(f); @@ -103,9 +103,9 @@ class DiscardProcess : public Process<DiscardProcess> public: Future<Nothing> func0() { return promise.future(); } - MOCK_METHOD0(func1, Nothing(void)); - MOCK_METHOD0(func2, Nothing(void)); - MOCK_METHOD0(func3, Nothing(void)); + MOCK_METHOD0(func1, Nothing()); + MOCK_METHOD0(func2, Nothing()); + MOCK_METHOD0(func3, Nothing()); Promise<Nothing> promise; }; @@ -119,7 +119,7 @@ TEST(SequenceTest, DiscardOne) Sequence sequence; - lambda::function<Future<Nothing>(void)> f; + lambda::function<Future<Nothing>()> f; f = defer(process, &DiscardProcess::func0); Future<Nothing> f0 = sequence.add(f); @@ -169,7 +169,7 @@ TEST(SequenceTest, DiscardAll) Sequence* sequence = new Sequence(); - lambda::function<Future<Nothing>(void)> f; + lambda::function<Future<Nothing>()> f; f = defer(process, &DiscardProcess::func0); Future<Nothing> f0 = sequence->add(f); @@ -250,7 +250,7 @@ TEST(SequenceTest, Random) Sequence sequence; for (int i = 0; i < 100; i++) { - lambda::function<Future<Nothing>(void)> f; + lambda::function<Future<Nothing>()> f; // We randomly do 'pulse' and 'verify'. The idea here is that: if // sequence is not used, a 'verify' may see an intermediate
