Commit e1c9577a authored by Dominik Charousset's avatar Dominik Charousset

Merge pull request #310 from actor-framework/topic/remove_gcc47_workarounds

Remove GCC 4.7 workarounds
parents f5aa0825 70db21f9
...@@ -13,7 +13,7 @@ using namespace caf::io; ...@@ -13,7 +13,7 @@ using namespace caf::io;
using tick_atom = atom_constant<atom("tick")>; using tick_atom = atom_constant<atom("tick")>;
const char http_ok[] = R"__(HTTP/1.1 200 OK constexpr const char http_ok[] = R"__(HTTP/1.1 200 OK
Content-Type: text/plain Content-Type: text/plain
Connection: keep-alive Connection: keep-alive
Transfer-Encoding: chunked Transfer-Encoding: chunked
......
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
* *
* @section GettingStarted Getting Started * @section GettingStarted Getting Started
* *
* To build `libcaf,` you need `GCC >= 4.7 or <tt>Clang >= * To build `libcaf,` you need `GCC >= 4.8 or <tt>Clang >=
*3.2</tt>, *3.2</tt>,
* and `CMake`. * and `CMake`.
* *
......
...@@ -65,7 +65,7 @@ struct ieee_754_trait<uint64_t> : ieee_754_trait<double> {}; ...@@ -65,7 +65,7 @@ struct ieee_754_trait<uint64_t> : ieee_754_trait<double> {};
template <class T> template <class T>
typename ieee_754_trait<T>::packed_type pack754(T f) { typename ieee_754_trait<T>::packed_type pack754(T f) {
typedef ieee_754_trait<T> trait; // using trait = ... fails on GCC 4.7 using trait = ieee_754_trait<T>;
using result_type = typename trait::packed_type; using result_type = typename trait::packed_type;
// filter special type // filter special type
if (std::fabs(f) <= trait::zero) { if (std::fabs(f) <= trait::zero) {
...@@ -106,7 +106,7 @@ typename ieee_754_trait<T>::packed_type pack754(T f) { ...@@ -106,7 +106,7 @@ typename ieee_754_trait<T>::packed_type pack754(T f) {
template <class T> template <class T>
typename ieee_754_trait<T>::float_type unpack754(T i) { typename ieee_754_trait<T>::float_type unpack754(T i) {
typedef ieee_754_trait<T> trait; // using trait = ... fails on GCC 4.7 using trait = ieee_754_trait<T>;
using signed_type = typename trait::signed_packed_type; using signed_type = typename trait::signed_packed_type;
using result_type = typename trait::float_type; using result_type = typename trait::float_type;
if (i == 0) return trait::zero; if (i == 0) return trait::zero;
......
...@@ -89,7 +89,7 @@ class singletons { ...@@ -89,7 +89,7 @@ class singletons {
static std::atomic<abstract_singleton*>& get_plugin_singleton(size_t id); static std::atomic<abstract_singleton*>& get_plugin_singleton(size_t id);
// Get instance from @p ptr or crate it on-the-fly using DCLP // Get instance from @p ptr or create it on-the-fly using DCLP
template <class T, class Factory> template <class T, class Factory>
static T* lazy_get(std::atomic<T*>& ptr, std::mutex& mtx, Factory f) { static T* lazy_get(std::atomic<T*>& ptr, std::mutex& mtx, Factory f) {
auto result = ptr.load(std::memory_order_acquire); auto result = ptr.load(std::memory_order_acquire);
......
...@@ -49,16 +49,14 @@ class split_join_collector : public event_based_actor { ...@@ -49,16 +49,14 @@ class split_join_collector : public event_based_actor {
behavior make_behavior() override { behavior make_behavior() override {
return { return {
others >> [=] { others >> [=] {
m_rp = this->make_response_promise(); m_rp = make_response_promise();
m_split(m_workset, this->current_message()); m_split(m_workset, current_message());
// first message is the forwarded request // first message is the forwarded request
// GCC 4.7 workaround; `for (auto& x : m_workset)` doesn't compile for (auto& x : m_workset) {
for (size_t i = 0; i < m_workset.size(); ++i) { sync_send(x.first, std::move(x.second)).then(
auto& x = m_workset[i];
this->sync_send(x.first, std::move(x.second)).then(
others >> [=] { others >> [=] {
m_join(m_value, this->current_message()); m_join(m_value, this->current_message());
if (--this->m_awaited_results == 0) { if (--m_awaited_results == 0) {
m_rp.deliver(make_message(m_value)); m_rp.deliver(make_message(m_value));
quit(); quit();
} }
...@@ -66,7 +64,7 @@ class split_join_collector : public event_based_actor { ...@@ -66,7 +64,7 @@ class split_join_collector : public event_based_actor {
); );
} }
// no longer needed // no longer needed
this->m_workset.clear(); m_workset.clear();
} }
}; };
} }
......
...@@ -193,7 +193,7 @@ class work_stealing { ...@@ -193,7 +193,7 @@ class work_stealing {
template <class Worker, class UnaryFunction> template <class Worker, class UnaryFunction>
void foreach_resumable(Worker* self, UnaryFunction f) { void foreach_resumable(Worker* self, UnaryFunction f) {
auto next = [&] { return this->d(self).queue.take_head(); }; auto next = [&] { return d(self).queue.take_head(); };
for (auto job = next(); job != nullptr; job = next()) { for (auto job = next(); job != nullptr; job = next()) {
f(job); f(job);
} }
......
...@@ -67,7 +67,7 @@ inline void insert_dmsg(Map& storage, const duration& d, Ts&&... xs) { ...@@ -67,7 +67,7 @@ inline void insert_dmsg(Map& storage, const duration& d, Ts&&... xs) {
auto tout = hrc::now(); auto tout = hrc::now();
tout += d; tout += d;
delayed_msg dmsg{std::forward<Ts>(xs)...}; delayed_msg dmsg{std::forward<Ts>(xs)...};
storage.insert(std::make_pair(std::move(tout), std::move(dmsg))); storage.emplace(std::move(tout), std::move(dmsg));
} }
class timer_actor : public blocking_actor { class timer_actor : public blocking_actor {
...@@ -165,7 +165,7 @@ void printer_loop(blocking_actor* self) { ...@@ -165,7 +165,7 @@ void printer_loop(blocking_actor* self) {
} }
auto i = out.find(s); auto i = out.find(s);
if (i == out.end()) { if (i == out.end()) {
i = out.insert(make_pair(s, std::move(str))).first; i = out.emplace(s, move(str)).first;
// monitor actor to flush its output on exit // monitor actor to flush its output on exit
self->monitor(s); self->monitor(s);
} else { } else {
......
...@@ -64,10 +64,10 @@ void actor_registry::put(actor_id key, const abstract_actor_ptr& val) { ...@@ -64,10 +64,10 @@ void actor_registry::put(actor_id key, const abstract_actor_ptr& val) {
if (val == nullptr) { if (val == nullptr) {
return; return;
} }
auto entry = std::make_pair(key, value_type(val, exit_reason::not_exited));
{ // lifetime scope of guard { // lifetime scope of guard
exclusive_guard guard(m_instances_mtx); exclusive_guard guard(m_instances_mtx);
if (!m_entries.insert(entry).second) { if (!m_entries.emplace(key,
value_type{val, exit_reason::not_exited}).second) {
// already defined // already defined
return; return;
} }
......
...@@ -335,7 +335,7 @@ class local_group_module : public abstract_group::module { ...@@ -335,7 +335,7 @@ class local_group_module : public abstract_group::module {
} }
auto tmp = make_counted<local_group>(true, this, identifier); auto tmp = make_counted<local_group>(true, this, identifier);
upgrade_to_unique_guard uguard(guard); upgrade_to_unique_guard uguard(guard);
auto p = m_instances.insert(make_pair(identifier, tmp)); auto p = m_instances.emplace(identifier, tmp);
auto result = p.first->second; auto result = p.first->second;
uguard.unlock(); uguard.unlock();
// someone might preempt us // someone might preempt us
...@@ -365,7 +365,7 @@ class local_group_module : public abstract_group::module { ...@@ -365,7 +365,7 @@ class local_group_module : public abstract_group::module {
local_group_ptr tmp = make_counted<local_group_proxy>(broker, this, local_group_ptr tmp = make_counted<local_group_proxy>(broker, this,
identifier); identifier);
upgrade_to_unique_guard uguard(guard); upgrade_to_unique_guard uguard(guard);
auto p = m_proxies.insert(std::make_pair(broker, tmp)); auto p = m_proxies.emplace(broker, tmp);
// someone might preempt us // someone might preempt us
return {p.first->second}; return {p.first->second};
} }
...@@ -443,7 +443,7 @@ group_manager::~group_manager() { ...@@ -443,7 +443,7 @@ group_manager::~group_manager() {
group_manager::group_manager() { group_manager::group_manager() {
abstract_group::unique_module_ptr ptr{new local_group_module}; abstract_group::unique_module_ptr ptr{new local_group_module};
m_mmap.insert(std::make_pair(std::string("local"), std::move(ptr))); m_mmap.emplace(std::string("local"), std::move(ptr));
} }
group group_manager::anonymous() { group group_manager::anonymous() {
...@@ -471,7 +471,7 @@ void group_manager::add_module(std::unique_ptr<abstract_group::module> mptr) { ...@@ -471,7 +471,7 @@ void group_manager::add_module(std::unique_ptr<abstract_group::module> mptr) {
auto& mname = mptr->name(); auto& mname = mptr->name();
{ // lifetime scope of guard { // lifetime scope of guard
std::lock_guard<std::mutex> guard(m_mmap_mtx); std::lock_guard<std::mutex> guard(m_mmap_mtx);
if (m_mmap.insert(std::make_pair(mname, std::move(mptr))).second) { if (m_mmap.emplace(mname, std::move(mptr)).second) {
return; // success; don't throw return; // success; don't throw
} }
} }
......
...@@ -420,8 +420,7 @@ struct pending_response_predicate { ...@@ -420,8 +420,7 @@ struct pending_response_predicate {
message_id local_actor::new_request_id(message_priority mp) { message_id local_actor::new_request_id(message_priority mp) {
auto result = ++m_last_request_id; auto result = ++m_last_request_id;
m_pending_responses.push_front(std::make_pair(result.response_id(), m_pending_responses.emplace_front(result.response_id(), behavior{});
behavior{}));
return mp == message_priority::normal ? result : result.with_high_priority(); return mp == message_priority::normal ? result : result.with_high_priority();
} }
...@@ -484,7 +483,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) { ...@@ -484,7 +483,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) {
scheduler::inc_detached_threads(); scheduler::inc_detached_threads();
} }
//intrusive_ptr<local_actor> mself{this}; //intrusive_ptr<local_actor> mself{this};
std::thread([hide](intrusive_ptr<local_actor> mself) { std::thread{[hide](intrusive_ptr<local_actor> mself) {
// this extra scope makes sure that the trace logger is // this extra scope makes sure that the trace logger is
// destructed before dec_detached_threads() is called // destructed before dec_detached_threads() is called
{ {
...@@ -501,7 +500,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) { ...@@ -501,7 +500,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) {
if (!hide) { if (!hide) {
scheduler::dec_detached_threads(); scheduler::dec_detached_threads();
} }
}, intrusive_ptr<local_actor>{this}).detach(); }, intrusive_ptr<local_actor>{this}}.detach();
return; return;
} }
// actor is cooperatively scheduled // actor is cooperatively scheduled
......
...@@ -78,7 +78,7 @@ class logging_impl : public logging { ...@@ -78,7 +78,7 @@ class logging_impl : public logging {
public: public:
void initialize() override { void initialize() override {
const char* log_level_table[] = {"ERROR", "WARN", "INFO", "DEBUG", "TRACE"}; const char* log_level_table[] = {"ERROR", "WARN", "INFO", "DEBUG", "TRACE"};
m_thread = std::thread([this] { (*this)(); }); m_thread = std::thread{[this] { (*this)(); }};
std::string msg = "ENTRY log level = "; std::string msg = "ENTRY log level = ";
msg += log_level_table[global_log_level]; msg += log_level_table[global_log_level];
log("TRACE", "logging", "run", __FILE__, __LINE__, msg); log("TRACE", "logging", "run", __FILE__, __LINE__, msg);
...@@ -217,7 +217,7 @@ actor_id logging::set_aid(actor_id aid) { ...@@ -217,7 +217,7 @@ actor_id logging::set_aid(actor_id aid) {
} }
// upgrade to unique lock and insert new element // upgrade to unique lock and insert new element
upgrade_to_unique_lock<detail::shared_spinlock> uguard{guard}; upgrade_to_unique_lock<detail::shared_spinlock> uguard{guard};
m_aids.insert(std::make_pair(tid, aid)); m_aids.emplace(tid, aid);
return 0; // was empty before return 0; // was empty before
} }
......
...@@ -66,7 +66,7 @@ cache_map& get_cache_map() { ...@@ -66,7 +66,7 @@ cache_map& get_cache_map() {
pthread_setspecific(s_key, cache); pthread_setspecific(s_key, cache);
// insert default types // insert default types
std::unique_ptr<memory_cache> tmp(new basic_memory_cache<mailbox_element>); std::unique_ptr<memory_cache> tmp(new basic_memory_cache<mailbox_element>);
cache->insert(std::make_pair(&typeid(mailbox_element), move(tmp))); cache->emplace(&typeid(mailbox_element), move(tmp));
} }
return *cache; return *cache;
} }
......
...@@ -36,7 +36,7 @@ std::thread caf::detail::run_program_impl(actor rc, const char* cpath, ...@@ -36,7 +36,7 @@ std::thread caf::detail::run_program_impl(actor rc, const char* cpath,
} }
oss << " 2>&1"; oss << " 2>&1";
string cmdstr = oss.str(); string cmdstr = oss.str();
return thread([cmdstr, rc] { return std::thread{ [cmdstr, rc] {
string output; string output;
auto fp = popen(cmdstr.c_str(), "r"); auto fp = popen(cmdstr.c_str(), "r");
if (!fp) { if (!fp) {
...@@ -50,5 +50,5 @@ std::thread caf::detail::run_program_impl(actor rc, const char* cpath, ...@@ -50,5 +50,5 @@ std::thread caf::detail::run_program_impl(actor rc, const char* cpath,
} }
pclose(fp); pclose(fp);
anon_send(rc, output); anon_send(rc, output);
}); }};
} }
...@@ -312,12 +312,12 @@ class string_deserializer : public deserializer, public dummy_backend { ...@@ -312,12 +312,12 @@ class string_deserializer : public deserializer, public dummy_backend {
void operator()(atom_value& what) { void operator()(atom_value& what) {
what = static_cast<atom_value>(detail::atom_val(str.c_str(), 0xF)); what = static_cast<atom_value>(detail::atom_val(str.c_str(), 0xF));
} }
void operator()(u16string&) { void operator() [[noreturn]] (u16string&) {
throw std::runtime_error( throw std::runtime_error(
"u16string currently not supported " "u16string currently not supported "
"by string_deserializer"); "by string_deserializer");
} }
void operator()(u32string&) { void operator() [[noreturn]] (u32string&) {
throw std::runtime_error( throw std::runtime_error(
"u32string currently not supported " "u32string currently not supported "
"by string_deserializer"); "by string_deserializer");
...@@ -452,7 +452,7 @@ class string_deserializer : public deserializer, public dummy_backend { ...@@ -452,7 +452,7 @@ class string_deserializer : public deserializer, public dummy_backend {
++m_pos; ++m_pos;
} }
void throw_malformed(const string& error_msg) { void throw_malformed [[noreturn]] (const string& error_msg) {
throw std::runtime_error("malformed string: " + error_msg); throw std::runtime_error("malformed string: " + error_msg);
} }
......
...@@ -197,7 +197,7 @@ struct is_message { ...@@ -197,7 +197,7 @@ struct is_message {
template <class T, class... Ts> template <class T, class... Ts>
bool equal(T&& v, Ts&&... vs) { bool equal(T&& v, Ts&&... vs) {
bool ok = false; bool ok = false;
// work around for gcc bug // work around for gcc 4.8.4 bug
auto tup = tie(v, vs...); auto tup = tie(v, vs...);
message_handler impl { message_handler impl {
[&](T const& u, Ts const&... us) { [&](T const& u, Ts const&... us) {
......
...@@ -241,14 +241,14 @@ class broker : public abstract_event_based_actor<behavior, false> { ...@@ -241,14 +241,14 @@ class broker : public abstract_event_based_actor<behavior, false> {
m_scribes.erase(i); m_scribes.erase(i);
return spawn_functor(nullptr, [sptr](broker* forked) { return spawn_functor(nullptr, [sptr](broker* forked) {
sptr->set_broker(forked); sptr->set_broker(forked);
forked->m_scribes.insert( forked->m_scribes.emplace(sptr->hdl(),
std::make_pair(sptr->hdl(), sptr)); sptr);
}, },
fun, hdl, std::forward<Ts>(xs)...); fun, hdl, std::forward<Ts>(xs)...);
} }
inline void add_scribe(const scribe_pointer& ptr) { inline void add_scribe(const scribe_pointer& ptr) {
m_scribes.insert(std::make_pair(ptr->hdl(), ptr)); m_scribes.emplace(ptr->hdl(), ptr);
} }
connection_handle add_tcp_scribe(const std::string& host, uint16_t port); connection_handle add_tcp_scribe(const std::string& host, uint16_t port);
...@@ -258,7 +258,7 @@ class broker : public abstract_event_based_actor<behavior, false> { ...@@ -258,7 +258,7 @@ class broker : public abstract_event_based_actor<behavior, false> {
connection_handle add_tcp_scribe(network::native_socket fd); connection_handle add_tcp_scribe(network::native_socket fd);
inline void add_doorman(const doorman_pointer& ptr) { inline void add_doorman(const doorman_pointer& ptr) {
m_doormen.insert(std::make_pair(ptr->hdl(), ptr)); m_doormen.emplace(ptr->hdl(), ptr);
if (is_initialized()) { if (is_initialized()) {
ptr->launch(); ptr->launch();
} }
......
...@@ -70,7 +70,7 @@ class middleman : public detail::abstract_singleton { ...@@ -70,7 +70,7 @@ class middleman : public detail::abstract_singleton {
auto result = make_counted<Impl>(*this); auto result = make_counted<Impl>(*this);
CAF_ASSERT(result->unique()); CAF_ASSERT(result->unique());
result->launch(nullptr, false, true); result->launch(nullptr, false, true);
m_named_brokers.insert(std::make_pair(name, result)); m_named_brokers.emplace(name, result);
return result; return result;
} }
......
...@@ -59,6 +59,7 @@ actor spawn_io_client(F fun, const std::string& host, ...@@ -59,6 +59,7 @@ actor spawn_io_client(F fun, const std::string& host,
// works around an issue with older GCC releases that could not handle // works around an issue with older GCC releases that could not handle
// variadic template parameter packs inside lambdas by storing into a // variadic template parameter packs inside lambdas by storing into a
// std::function first (using `auto init =` won't compile on Clang) // std::function first (using `auto init =` won't compile on Clang)
// This bug still exsist in GCC 4.8.4
auto mfptr = &broker::functor_based::init<F, connection_handle, Ts...>; auto mfptr = &broker::functor_based::init<F, connection_handle, Ts...>;
using bi = std::function<void (broker::functor_based*, F, connection_handle)>; using bi = std::function<void (broker::functor_based*, F, connection_handle)>;
using namespace std::placeholders; using namespace std::placeholders;
......
...@@ -800,8 +800,8 @@ void basp_broker::add_published_actor(accept_handle hdl, ...@@ -800,8 +800,8 @@ void basp_broker::add_published_actor(accept_handle hdl,
if (!ptr) { if (!ptr) {
return; return;
} }
m_acceptors.insert(std::make_pair(hdl, std::make_pair(ptr, port))); m_acceptors.emplace(hdl, std::make_pair(ptr, port));
m_open_ports.insert(std::make_pair(port, hdl)); m_open_ports.emplace(port, hdl);
ptr->attach_functor([port](abstract_actor* self, uint32_t) { ptr->attach_functor([port](abstract_actor* self, uint32_t) {
unpublish_impl(self->address(), port, false); unpublish_impl(self->address(), port, false);
}); });
......
...@@ -257,7 +257,7 @@ class middleman_actor_impl : public middleman_actor_base::base { ...@@ -257,7 +257,7 @@ class middleman_actor_impl : public middleman_actor_base::base {
auto req_id = m_next_request_id++; auto req_id = m_next_request_id++;
send(m_broker, get_atom::value, hdl, req_id, send(m_broker, get_atom::value, hdl, req_id,
actor{this}, std::move(expected_ifs)); actor{this}, std::move(expected_ifs));
m_pending_gets.insert(std::make_pair(req_id, result)); m_pending_gets.emplace(req_id, result);
} }
catch (network_error& err) { catch (network_error& err) {
// fullfil promise immediately // fullfil promise immediately
...@@ -273,7 +273,7 @@ class middleman_actor_impl : public middleman_actor_base::base { ...@@ -273,7 +273,7 @@ class middleman_actor_impl : public middleman_actor_base::base {
auto result = make_response_promise(); auto result = make_response_promise();
auto req_id = m_next_request_id++; auto req_id = m_next_request_id++;
send(m_broker, delete_atom::value, req_id, whom, port); send(m_broker, delete_atom::value, req_id, whom, port);
m_pending_deletes.insert(std::make_pair(req_id, result)); m_pending_deletes.emplace(req_id, result);
return result; return result;
} }
...@@ -344,10 +344,10 @@ void middleman::initialize() { ...@@ -344,10 +344,10 @@ void middleman::initialize() {
CAF_LOG_TRACE(""); CAF_LOG_TRACE("");
m_backend = network::multiplexer::make(); m_backend = network::multiplexer::make();
m_backend_supervisor = m_backend->make_supervisor(); m_backend_supervisor = m_backend->make_supervisor();
m_thread = std::thread([this] { m_thread = std::thread{[this] {
CAF_LOG_TRACE(""); CAF_LOG_TRACE("");
m_backend->run(); m_backend->run();
}); }};
m_backend->thread_id(m_thread.get_id()); m_backend->thread_id(m_thread.get_id());
// announce io-related types // announce io-related types
do_announce<new_data_msg>("caf::io::new_data_msg"); do_announce<new_data_msg>("caf::io::new_data_msg");
......
...@@ -83,7 +83,7 @@ bool check_types(const std::map<std::string, uint16_t>& expected) { ...@@ -83,7 +83,7 @@ bool check_types(const std::map<std::string, uint16_t>& expected) {
// fetch all available type names // fetch all available type names
auto types = uniform_type_info::instances(); auto types = uniform_type_info::instances();
for (auto tinfo : types) { for (auto tinfo : types) {
found.insert(std::make_pair(tinfo->name(), tinfo->type_nr())); found.emplace(tinfo->name(), tinfo->type_nr());
} }
// compare the two maps // compare the two maps
if (expected == found) { if (expected == found) {
...@@ -127,7 +127,7 @@ T& append(T& storage) { ...@@ -127,7 +127,7 @@ T& append(T& storage) {
template <class T, typename U, class... Us> template <class T, typename U, class... Us>
T& append(T& storage, U&& u, Us&&... us) { T& append(T& storage, U&& u, Us&&... us) {
storage.insert(std::make_pair(std::forward<U>(u), uint16_t{0})); storage.emplace(std::forward<U>(u), uint16_t{0});
return append(storage, std::forward<Us>(us)...); return append(storage, std::forward<Us>(us)...);
} }
...@@ -144,11 +144,11 @@ CAF_TEST(test_uniform_type) { ...@@ -144,11 +144,11 @@ CAF_TEST(test_uniform_type) {
CAF_CHECK(announce1 == announce2); CAF_CHECK(announce1 == announce2);
CAF_CHECK(announce1 == announce3); CAF_CHECK(announce1 == announce3);
CAF_CHECK(announce1 == announce4); CAF_CHECK(announce1 == announce4);
//CAF_CHECK_EQUAL(announce1->name(), "foo"); // fails ... CAF_CHECK(strcmp(announce1->name(), "foo") == 0);
{ {
auto uti = uniform_typeid<atom_value>(); auto uti = uniform_typeid<atom_value>();
CAF_CHECK(uti != nullptr); CAF_CHECK(uti != nullptr);
//CAF_CHECK_EQUAL(uti->name(), "@atom"); // fails... CAF_CHECK(strcmp(uti->name(), "@atom") == 0);
} }
using detail::type_nr; using detail::type_nr;
// these types (and only those) are present if // these types (and only those) are present if
......
...@@ -44,7 +44,7 @@ class watchdog { ...@@ -44,7 +44,7 @@ class watchdog {
private: private:
watchdog() { watchdog() {
m_thread = std::thread([&] { m_thread = std::thread{[&] {
auto tp = auto tp =
std::chrono::high_resolution_clock::now() + std::chrono::seconds(30); std::chrono::high_resolution_clock::now() + std::chrono::seconds(30);
std::unique_lock<std::mutex> guard{m_mtx}; std::unique_lock<std::mutex> guard{m_mtx};
...@@ -57,7 +57,7 @@ class watchdog { ...@@ -57,7 +57,7 @@ class watchdog {
<< "WATCHDOG: unit test did finish within 10s, abort\n"; << "WATCHDOG: unit test did finish within 10s, abort\n";
abort(); abort();
} }
}); }};
} }
~watchdog() { ~watchdog() {
{ // lifetime scope of guard { // lifetime scope of guard
...@@ -148,7 +148,7 @@ logger::stream::stream(logger& l, level lvl) : m_logger(l), m_level(lvl) { ...@@ -148,7 +148,7 @@ logger::stream::stream(logger& l, level lvl) : m_logger(l), m_level(lvl) {
logger::stream::stream(stream&& other) logger::stream::stream(stream&& other)
: m_logger(other.m_logger) : m_logger(other.m_logger)
, m_level(other.m_level) { , m_level(other.m_level) {
// ostringstream does have swap since C++11... but not in GCC 4.7 // ostringstream does have swap since C++11... but not in GCC 4.8.4
m_buf.str(other.m_buf.str()); m_buf.str(other.m_buf.str());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment