Commit aa516656 authored by Dominik Charousset's avatar Dominik Charousset

Change coding style: "! " -> "!"

parent 82e8830d
......@@ -8,7 +8,7 @@ build-gcc/*
Makefile
bin/*
lib/*
manual/*
manual
*.swp
bii/*
libcaf_core/caf/detail/build_config.hpp
......@@ -211,15 +211,6 @@ General
- Keywords are always followed by a whitespace: `if (...)`, `template <...>`,
`while (...)`, etc.
- Leave a whitespace after `!` to make negations easily recognizable:
```cpp
if (! sunny())
stay_home();
else
go_outside();
```
- Opening braces belong to the same line:
```cpp
......
Subproject commit c6eee3dd511f670b5ef106b91e1a6cc7f39ac67e
Subproject commit fab6e944be3b3d2575b5a893409ac825738e6461
......@@ -195,7 +195,7 @@ void caf_main(actor_system& system, const config& cfg) {
auto pong_actor = system.spawn(pong);
auto server_actor = system.middleman().spawn_server(server, cfg.port,
pong_actor);
if (! server_actor) {
if (!server_actor) {
std::cerr << "failed to spawn server: "
<< system.render(server_actor.error()) << endl;
return;
......@@ -207,7 +207,7 @@ void caf_main(actor_system& system, const config& cfg) {
auto ping_actor = system.spawn(ping, size_t{20});
auto io_actor = system.middleman().spawn_client(broker_impl, cfg.host,
cfg.port, ping_actor);
if (! io_actor) {
if (!io_actor) {
std::cerr << "failed to spawn client: "
<< system.render(io_actor.error()) << endl;
return;
......
......@@ -78,7 +78,7 @@ public:
void caf_main(actor_system& system, const config& cfg) {
auto server_actor = system.middleman().spawn_server(server, cfg.port);
if (! server_actor) {
if (!server_actor) {
cerr << "*** cannot spawn server: "
<< system.render(server_actor.error()) << endl;
return;
......
......@@ -203,7 +203,7 @@ struct curl_state : base_state {
void init(std::string m_name, std::string m_color) override {
curl = curl_easy_init();
if (! curl)
if (!curl)
throw std::runtime_error("Unable initialize CURL.");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curl_state::callback);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
......@@ -349,7 +349,7 @@ void caf_main(actor_system& system) {
auto master = self->spawn<detached>(curl_master);
self->spawn<detached>(client, master);
// poll CTRL+C flag every second
while (! shutdown_flag)
while (!shutdown_flag)
std::this_thread::sleep_for(std::chrono::seconds(1));
aout(self) << color::cyan << "received CTRL+C" << color::reset_endl;
// shutdown actors
......
......@@ -80,7 +80,7 @@ void caf_main(actor_system& system) {
// drain stack
aout(self) << "stack: { ";
bool stack_empty = false;
while (! stack_empty) {
while (!stack_empty) {
self->request(st, std::chrono::seconds(10), pop_atom::value).receive(
[&](int x) {
aout(self) << x << " ";
......
......@@ -111,7 +111,7 @@ private:
send(mm, connect_atom::value, host_, port_);
return {
[=](ok_atom, node_id&, strong_actor_ptr& new_server, std::set<std::string>&) {
if (! new_server) {
if (!new_server) {
aout(this) << "*** received invalid remote actor" << endl;
return;
}
......@@ -161,7 +161,7 @@ private:
// removes leading and trailing whitespaces
string trim(std::string s) {
auto not_space = [](char c) { return ! isspace(c); };
auto not_space = [](char c) { return !isspace(c); };
// trim left
s.erase(s.begin(), find_if(s.begin(), s.end(), not_space));
// trim right
......@@ -238,11 +238,11 @@ void client_repl(actor_system& system, string host, uint16_t port) {
};
// read next line, split it, and feed to the eval handler
string line;
while (! done && std::getline(std::cin, line)) {
while (!done && std::getline(std::cin, line)) {
line = trim(std::move(line)); // ignore leading and trailing whitespaces
std::vector<string> words;
split(words, line, is_any_of(" "), token_compress_on);
if (! message_builder(words.begin(), words.end()).apply(eval))
if (!message_builder(words.begin(), words.end()).apply(eval))
usage();
}
}
......@@ -262,7 +262,7 @@ public:
};
void caf_main(actor_system& system, const config& cfg) {
if (! cfg.server_mode && cfg.port == 0) {
if (!cfg.server_mode && cfg.port == 0) {
cerr << "*** no port to server specified" << endl;
return;
}
......@@ -271,7 +271,7 @@ void caf_main(actor_system& system, const config& cfg) {
// try to publish math actor at given port
cout << "*** try publish at port " << cfg.port << endl;
auto expected_port = system.middleman().publish(calc, cfg.port);
if (! expected_port) {
if (!expected_port) {
std::cerr << "*** publish failed: "
<< system.render(expected_port.error()) << endl;
} else {
......
......@@ -79,14 +79,14 @@ void caf_main(actor_system& system, const config& cfg) {
auto name = cfg.name;
while (name.empty()) {
cout << "please enter your name: " << flush;
if (! getline(cin, name)) {
if (!getline(cin, name)) {
cerr << "*** no name given... terminating" << endl;
return;
}
}
auto client_actor = system.spawn(client, name);
// evaluate group parameters
if (! cfg.group_id.empty()) {
if (!cfg.group_id.empty()) {
auto p = cfg.group_id.find(':');
if (p == std::string::npos) {
cerr << "*** error parsing argument " << cfg.group_id
......@@ -95,7 +95,7 @@ void caf_main(actor_system& system, const config& cfg) {
auto module = cfg.group_id.substr(0, p);
auto group_uri = cfg.group_id.substr(p + 1);
auto g = system.groups().get(module, group_uri);
if (! g) {
if (!g) {
cerr << "*** unable to get group " << group_uri
<< " from module " << module << ": "
<< system.render(g.error()) << endl;
......@@ -109,7 +109,7 @@ void caf_main(actor_system& system, const config& cfg) {
vector<string> words;
for (istream_iterator<line> i(cin); i != eof; ++i) {
auto send_input = [&] {
if (! i->str.empty())
if (!i->str.empty())
anon_send(client_actor, broadcast_atom::value, i->str);
};
words.clear();
......@@ -140,7 +140,7 @@ void caf_main(actor_system& system, const config& cfg) {
}
}
});
if (! res)
if (!res)
send_input();
}
// force actor to quit
......
......@@ -52,7 +52,7 @@ calculator::behavior_type calculator_fun(calculator::pointer self) {
// removes leading and trailing whitespaces
string trim(std::string s) {
auto not_space = [](char c) { return ! isspace(c); };
auto not_space = [](char c) { return !isspace(c); };
// trim left
s.erase(s.begin(), find_if(s.begin(), s.end(), not_space));
// trim right
......@@ -100,7 +100,7 @@ void client_repl(function_view<calculator> f) {
void client(actor_system& system, const std::string& host, uint16_t port) {
auto node = system.middleman().connect(host, port);
if (! node) {
if (!node) {
std::cerr << "*** connect failed: "
<< system.render(node.error()) << std::endl;
return;
......@@ -110,7 +110,7 @@ void client(actor_system& system, const std::string& host, uint16_t port) {
auto tout = std::chrono::seconds(30); // wait no longer than 30s
auto worker = system.middleman().remote_spawn<calculator>(*node, type,
args, tout);
if (! worker) {
if (!worker) {
std::cerr << "*** remote spawn failed: "
<< system.render(worker.error()) << std::endl;
return;
......@@ -124,7 +124,7 @@ void client(actor_system& system, const std::string& host, uint16_t port) {
void server(actor_system& system, uint16_t port) {
auto res = system.middleman().open(port);
if (! res) {
if (!res) {
std::cerr << "*** cannot open port: "
<< system.render(res.error()) << std::endl;
}
......
......@@ -42,7 +42,7 @@ namespace caf {
template <class T>
struct is_convertible_to_actor {
static constexpr bool value =
! std::is_base_of<statically_typed_actor_base, T>::value
!std::is_base_of<statically_typed_actor_base, T>::value
&& (std::is_base_of<actor_proxy, T>::value
|| std::is_base_of<local_actor, T>::value);
};
......@@ -144,7 +144,7 @@ public:
/// Queries whether this object was constructed using
/// `unsafe_actor_handle_init` or is in moved-from state.
bool unsafe() const {
return ! ptr_;
return !ptr_;
}
/// @cond PRIVATE
......
......@@ -81,7 +81,7 @@ struct is_non_null_handle<T*> {
template <class T>
struct is_strong_non_null_handle {
static constexpr bool value = ! is_weak_ptr<T>::value
static constexpr bool value = !is_weak_ptr<T>::value
&& is_non_null_handle<T>::value;
};
......@@ -102,7 +102,7 @@ public:
}
template <class T,
class = typename std::enable_if<! std::is_pointer<T>::value>::type>
class = typename std::enable_if<!std::is_pointer<T>::value>::type>
To operator()(const T& x) const {
return x.get();
}
......@@ -120,7 +120,7 @@ public:
}
template <class T,
class = typename std::enable_if<! std::is_pointer<T>::value>::type>
class = typename std::enable_if<!std::is_pointer<T>::value>::type>
To* operator()(const T& x) const {
return (*this)(x.get());
}
......@@ -138,7 +138,7 @@ public:
}
template <class T,
class = typename std::enable_if<! std::is_pointer<T>::value>::type>
class = typename std::enable_if<!std::is_pointer<T>::value>::type>
actor_control_block* operator()(const T& x) const {
return x.get();
}
......@@ -187,7 +187,7 @@ T actor_cast(U&& what) {
constexpr bool from_raw = std::is_pointer<from_type>::value;
constexpr bool from_weak = is_weak_ptr<from_type>::value;
// check whether this cast is legal
static_assert(! from_weak || ! is_strong_non_null_handle<T>::value,
static_assert(!from_weak || !is_strong_non_null_handle<T>::value,
"casts from actor_addr to actor or typed_actor are prohibited");
// calculate x and y
......
......@@ -68,7 +68,7 @@ public:
template <class U>
typename std::enable_if<
! std::is_convertible<U, Bhvr>::value,
!std::is_convertible<U, Bhvr>::value,
behavior
>::type
apply(detail::type_list<U>, Ts... xs) {
......@@ -105,7 +105,7 @@ public:
template <class U>
typename std::enable_if<
! std::is_convertible<U, Bhvr>::value,
!std::is_convertible<U, Bhvr>::value,
behavior
>::type
apply(detail::type_list<U>, Ts... xs) {
......@@ -147,7 +147,7 @@ actor_factory make_actor_factory(F fun) {
using behavior_t = typename trait::behavior_type;
spawn_mode_token<trait::mode> tk;
message_verifier<typename trait::arg_types> mv;
if (! mv(msg, tk))
if (!mv(msg, tk))
return {};
cfg.init_fun = [=](local_actor* x) -> behavior {
CAF_ASSERT(cfg.host);
......@@ -159,7 +159,7 @@ actor_factory make_actor_factory(F fun) {
empty_type_erased_tuple dummy_;
auto& ct = msg.empty() ? dummy_ : const_cast<message&>(msg).content();
auto opt = ct.apply(f);
if (! opt)
if (!opt)
return {};
return std::move(*opt);
};
......
......@@ -350,12 +350,12 @@ public:
bool check_interface = true,
const mpi* expected_ifs = nullptr) {
mpi tmp;
if (check_interface && ! expected_ifs) {
if (check_interface && !expected_ifs) {
tmp = message_types<Handle>();
expected_ifs = &tmp;
}
auto res = dyn_spawn_impl(name, args, ctx, check_interface, expected_ifs);
if (! res)
if (!res)
return std::move(res.error());
return actor_cast<Handle>(std::move(*res));
}
......@@ -464,7 +464,7 @@ public:
private:
template <class T>
void check_invariants() {
static_assert(! std::is_base_of<prohibit_top_level_spawn_marker, T>::value,
static_assert(!std::is_base_of<prohibit_top_level_spawn_marker, T>::value,
"This actor type cannot be spawned throught an actor system. "
"Probably you have tried to spawn a broker or opencl actor.");
}
......@@ -485,7 +485,7 @@ private:
: 0;
if (has_detach_flag(Os) || std::is_base_of<blocking_actor, C>::value)
cfg.flags |= abstract_actor::is_detached_flag;
if (! cfg.host)
if (!cfg.host)
cfg.host = dummy_execution_unit();
auto res = make_actor<C>(next_actor_id(), node(), this,
cfg, std::forward<Ts>(xs)...);
......
......@@ -131,7 +131,7 @@ public:
template <class T, class... Ts>
actor_system_config& add_actor_type(std::string name) {
using handle = typename infer_handle_from_class<T>::type;
if (! std::is_same<handle, actor>::value)
if (!std::is_same<handle, actor>::value)
add_message_type<handle>(name);
return add_actor_factory(std::move(name), make_actor_factory<T, Ts...>());
}
......@@ -142,7 +142,7 @@ public:
template <class F>
actor_system_config& add_actor_type(std::string name, F f) {
using handle = typename infer_handle_from_fun<F>::type;
if (! std::is_same<handle, actor>::value)
if (!std::is_same<handle, actor>::value)
add_message_type<handle>(name);
return add_actor_factory(std::move(name), make_actor_factory(std::move(f)));
}
......@@ -178,7 +178,7 @@ public:
result = to_string(category);
result += ": ";
result += to_string(static_cast<T>(val));
if (! ctx.empty()) {
if (!ctx.empty()) {
result += " (";
result += ctx;
result += ")";
......
......@@ -162,7 +162,7 @@ public:
// nop
}
bool post() override {
return ! f();
return !f();
}
};
cond rc{std::move(stmt)};
......
......@@ -45,7 +45,7 @@ struct signatures_of {
template <class T>
constexpr bool statically_typed() {
return ! std::is_same<
return !std::is_same<
none_t,
typename std::remove_pointer<T>::type::signatures
>::value;
......
......@@ -28,7 +28,7 @@ namespace caf {
template <class State, class Base = typename State::actor_base>
class composable_behavior_based_actor : public stateful_actor<State, Base> {
public:
static_assert(! std::is_abstract<State>::value,
static_assert(!std::is_abstract<State>::value,
"State is abstract, please make sure to override all "
"virtual operator() member functions");
......
......@@ -155,7 +155,7 @@
# define CAF_IOS
# else
# define CAF_MACOS
# if defined(CAF_GCC) && ! defined(_GLIBCXX_HAS_GTHREADS)
# if defined(CAF_GCC) && !defined(_GLIBCXX_HAS_GTHREADS)
# define _GLIBCXX_HAS_GTHREADS
# endif
# endif
......
......@@ -151,7 +151,7 @@ public:
// the INI parser accepts all integers as int64_t
using cfg_type =
typename std::conditional<
std::is_integral<T>::value && ! std::is_same<bool, T>::value,
std::is_integral<T>::value && !std::is_same<bool, T>::value,
int64_t,
T
>::type;
......
......@@ -143,7 +143,7 @@ public:
template <class T>
typename std::enable_if<
std::is_integral<T>::value
&& ! std::is_same<bool, T>::value,
&& !std::is_same<bool, T>::value,
error
>::type
apply(T& x) {
......@@ -185,7 +185,7 @@ public:
template <class T>
typename std::enable_if<
std::is_enum<T>::value
&& ! detail::has_serialize<T>::value,
&& !detail::has_serialize<T>::value,
error
>::type
apply(T& x) {
......@@ -275,7 +275,7 @@ public:
// Applies this processor as Derived to `xs` in saving mode.
template <class D, class T>
static typename std::enable_if<
D::reads_state && ! detail::is_byte_sequence<T>::value,
D::reads_state && !detail::is_byte_sequence<T>::value,
error
>::type
apply_sequence(D& self, T& xs) {
......@@ -288,7 +288,7 @@ public:
// Applies this processor as Derived to `xs` in loading mode.
template <class D, class T>
static typename std::enable_if<
! D::reads_state && ! detail::is_byte_sequence<T>::value,
!D::reads_state && !detail::is_byte_sequence<T>::value,
error
>::type
apply_sequence(D& self, T& xs) {
......@@ -314,7 +314,7 @@ public:
// Optimized loading for contiguous byte sequences.
template <class D, class T>
static typename std::enable_if<
! D::reads_state && detail::is_byte_sequence<T>::value,
!D::reads_state && detail::is_byte_sequence<T>::value,
error
>::type
apply_sequence(D& self, T& xs) {
......@@ -328,8 +328,8 @@ public:
template <class T>
typename std::enable_if<
detail::is_iterable<T>::value
&& ! detail::has_serialize<T>::value
&& ! detail::is_inspectable<Derived, T>::value,
&& !detail::has_serialize<T>::value
&& !detail::is_inspectable<Derived, T>::value,
error
>::type
apply(T& xs) {
......@@ -378,7 +378,7 @@ public:
template <class T>
typename std::enable_if<
! std::is_empty<T>::value
!std::is_empty<T>::value
&& detail::has_serialize<T>::value,
error
>::type
......@@ -472,14 +472,14 @@ public:
template <class T, class... Ts>
typename std::enable_if<
! meta::is_annotation<T>::value
&& ! is_allowed_unsafe_message_type<T>::value,
!meta::is_annotation<T>::value
&& !is_allowed_unsafe_message_type<T>::value,
error
>::type
operator()(T&& x, Ts&&... xs) {
static_assert(Derived::reads_state
|| (! std::is_rvalue_reference<T&&>::value
&& ! std::is_const<
|| (!std::is_rvalue_reference<T&&>::value
&& !std::is_const<
typename std::remove_reference<T>::type
>::value),
"a loading inspector requires mutable lvalue references");
......@@ -505,7 +505,7 @@ private:
}
template <class D, class T, class U, class F>
static typename std::enable_if<! D::reads_state, error>::type
static typename std::enable_if<!D::reads_state, error>::type
convert_apply(D& self, T& x, U& storage, F assign) {
auto e = self.apply(storage);
if (e)
......
......@@ -56,7 +56,7 @@ public:
}
inline behavior& back() {
CAF_ASSERT(! empty());
CAF_ASSERT(!empty());
return elements_.back();
}
......
......@@ -76,7 +76,7 @@ private:
template <class T>
void delegate(T& x) {
auto rp = self_->make_response_promise();
if (! rp.pending()) {
if (!rp.pending()) {
CAF_LOG_DEBUG("suppress response message: invalid response promise");
return;
}
......
......@@ -34,7 +34,7 @@ public:
}
template <class T>
typename std::enable_if<! std::is_base_of<memory_managed, T>::value>::type
typename std::enable_if<!std::is_base_of<memory_managed, T>::value>::type
operator()(T* ptr) const {
delete ptr;
}
......
......@@ -28,7 +28,7 @@
#include <cassert>
// GCC hack
#if defined(CAF_GCC) && ! defined(_GLIBCXX_USE_SCHED_YIELD)
#if defined(CAF_GCC) && !defined(_GLIBCXX_USE_SCHED_YIELD)
#include <time.h>
namespace std {
namespace this_thread {
......@@ -45,7 +45,7 @@ inline void yield() noexcept {
#endif
// another GCC hack
#if defined(CAF_GCC) && ! defined(_GLIBCXX_USE_NANOSLEEP)
#if defined(CAF_GCC) && !defined(_GLIBCXX_USE_NANOSLEEP)
#include <time.h>
namespace std {
namespace this_thread {
......
......@@ -118,12 +118,12 @@ public:
}
void push_back(const_reference what) {
CAF_ASSERT(! full());
CAF_ASSERT(!full());
data_[size_++] = what;
}
void pop_back() {
CAF_ASSERT(! empty());
CAF_ASSERT(!empty());
--size_;
}
......@@ -194,22 +194,22 @@ public:
}
reference front() {
CAF_ASSERT(! empty());
CAF_ASSERT(!empty());
return data_[0];
}
const_reference front() const {
CAF_ASSERT(! empty());
CAF_ASSERT(!empty());
return data_[0];
}
reference back() {
CAF_ASSERT(! empty());
CAF_ASSERT(!empty());
return data_[size_ - 1];
}
const_reference back() const {
CAF_ASSERT(! empty());
CAF_ASSERT(!empty());
return data_[size_ - 1];
}
......
......@@ -127,7 +127,7 @@ public:
embedded_storage new_embedded_storage() override {
// allocate cache on-the-fly
if (! cache_) {
if (!cache_) {
cache_.reset(new storage, false); // starts with ref count of 1
CAF_ASSERT(cache_->unique());
}
......@@ -177,7 +177,7 @@ private:
template <class T>
static inline memory_cache* get_or_set_cache_map_entry() {
auto mc = get_cache_map_entry(&typeid(T));
if (! mc) {
if (!mc) {
mc = new basic_memory_cache<T>;
add_cache_map_entry(&typeid(T), mc);
}
......
......@@ -59,15 +59,15 @@ struct is_response_promise<delegated<Ts...>> : std::true_type { };
template <class T>
struct optional_message_visitor_enable_tpl {
static constexpr bool value =
! is_one_of<
!is_one_of<
typename std::remove_const<T>::type,
none_t,
unit_t,
skip_t,
optional<skip_t>
>::value
&& ! is_message_id_wrapper<T>::value
&& ! is_response_promise<T>::value;
&& !is_message_id_wrapper<T>::value
&& !is_response_promise<T>::value;
};
class optional_message_visitor : public static_visitor<optional<message>> {
......
......@@ -32,9 +32,9 @@ namespace detail {
/// performs an epsilon comparison.
template <class T, typename U>
typename std::enable_if<
! std::is_floating_point<T>::value
&& ! std::is_floating_point<U>::value
&& ! (std::is_same<T, U>::value && std::is_empty<T>::value),
!std::is_floating_point<T>::value
&& !std::is_floating_point<U>::value
&& !(std::is_same<T, U>::value && std::is_empty<T>::value),
bool
>::type
safe_equal(const T& lhs, const U& rhs) {
......
......@@ -72,7 +72,7 @@ public:
CAF_ASSERT(new_element != nullptr);
pointer e = stack_.load();
for (;;) {
if (! e) {
if (!e) {
// if tail is nullptr, the queue has been closed
delete_(new_element);
return enqueue_result::queue_closed;
......@@ -95,19 +95,19 @@ public:
return true;
auto ptr = stack_.load();
CAF_ASSERT(ptr != nullptr);
return ! is_dummy(ptr);
return !is_dummy(ptr);
}
/// Queries whether this queue is empty.
/// @warning Call only from the reader (owner).
bool empty() {
CAF_ASSERT(! closed());
return cache_.empty() && ! head_ && is_dummy(stack_.load());
CAF_ASSERT(!closed());
return cache_.empty() && !head_ && is_dummy(stack_.load());
}
/// Queries whether this has been closed.
bool closed() {
return ! stack_.load();
return !stack_.load();
}
/// Queries whether this has been marked as blocked, i.e.,
......@@ -142,7 +142,7 @@ public:
template <class F>
void close(const F& f) {
clear_cached_elements(f);
if (! blocked() && fetch_new_data(nullptr))
if (!blocked() && fetch_new_data(nullptr))
clear_cached_elements(f);
cache_.clear(f);
}
......@@ -152,7 +152,7 @@ public:
}
~single_reader_queue() {
if (! closed())
if (!closed())
close();
}
......@@ -203,8 +203,8 @@ public:
template <class Mutex, class CondVar>
void synchronized_await(Mutex& mtx, CondVar& cv) {
CAF_ASSERT(! closed());
if (! can_fetch_more() && try_block()) {
CAF_ASSERT(!closed());
if (!can_fetch_more() && try_block()) {
std::unique_lock<Mutex> guard(mtx);
while (blocked())
cv.wait(guard);
......@@ -213,14 +213,14 @@ public:
template <class Mutex, class CondVar, class TimePoint>
bool synchronized_await(Mutex& mtx, CondVar& cv, const TimePoint& timeout) {
CAF_ASSERT(! closed());
if (! can_fetch_more() && try_block()) {
CAF_ASSERT(!closed());
if (!can_fetch_more() && try_block()) {
std::unique_lock<Mutex> guard(mtx);
while (blocked()) {
if (cv.wait_until(guard, timeout) == std::cv_status::timeout) {
// if we're unable to set the queue from blocked to empty,
// than there's a new element in the list
return ! try_unblock();
return !try_unblock();
}
}
}
......@@ -238,7 +238,7 @@ private:
// atomically sets stack_ back and enqueues all elements to the cache
bool fetch_new_data(pointer end_ptr) {
CAF_ASSERT(! end_ptr || end_ptr == stack_empty_dummy());
CAF_ASSERT(!end_ptr || end_ptr == stack_empty_dummy());
pointer e = stack_.load();
// must not be called on a closed queue
CAF_ASSERT(e != nullptr);
......@@ -253,11 +253,11 @@ private:
CAF_ASSERT(e != reader_blocked_dummy());
if (is_dummy(e)) {
// only use-case for this is closing a queue
CAF_ASSERT(! end_ptr);
CAF_ASSERT(!end_ptr);
return false;
}
while (e) {
CAF_ASSERT(! is_dummy(e));
CAF_ASSERT(!is_dummy(e));
auto next = e->next;
e->next = head_;
head_ = e;
......
......@@ -49,7 +49,7 @@ typename std::conditional<
T&&
>::type
spawn_fwd(typename std::remove_reference<T>::type&& arg) noexcept {
static_assert(! std::is_lvalue_reference<T>::value,
static_assert(!std::is_lvalue_reference<T>::value,
"silently converting an lvalue to an rvalue");
return static_cast<T&&>(arg);
}
......
......@@ -107,7 +107,7 @@ public:
const std::vector<actor>& workers,
mailbox_element_ptr& ptr,
execution_unit* host) {
if (! ptr->sender)
if (!ptr->sender)
return;
actor_msg_vec xs;
xs.reserve(workers.size());
......
......@@ -112,7 +112,7 @@ private:
template <class T>
enable_if_t<
is_inspectable<stringification_inspector, T>::value
&& ! has_to_string<T>::value>
&& !has_to_string<T>::value>
consume(T& x) {
inspect(*this, x);
}
......@@ -133,8 +133,8 @@ private:
template <class T>
enable_if_t<is_iterable<T>::value
&& ! is_inspectable<stringification_inspector, T>::value
&& ! has_to_string<T>::value>
&& !is_inspectable<stringification_inspector, T>::value
&& !has_to_string<T>::value>
consume(T& xs) {
result_ += '[';
for (auto& x : xs) {
......@@ -177,11 +177,11 @@ private:
/// Fallback printing `<unprintable>`.
template <class T>
enable_if_t<
! is_iterable<T>::value
&& ! std::is_pointer<T>::value
&& ! is_inspectable<stringification_inspector, T>::value
&& ! std::is_arithmetic<T>::value
&& ! has_to_string<T>::value>
!is_iterable<T>::value
&& !std::is_pointer<T>::value
&& !is_inspectable<stringification_inspector, T>::value
&& !std::is_arithmetic<T>::value
&& !has_to_string<T>::value>
consume(T&) {
result_ += "<unprintable>";
}
......@@ -204,7 +204,7 @@ private:
template <class T, class... Ts>
void traverse(meta::omittable_if_empty_t, T& x, Ts&&... xs) {
if (! x.empty()) {
if (!x.empty()) {
sep();
consume(x);
}
......@@ -231,7 +231,7 @@ private:
}
template <class T, class... Ts>
enable_if_t<! meta::is_annotation<T>::value> traverse(T&& x, Ts&&... xs) {
enable_if_t<!meta::is_annotation<T>::value> traverse(T&& x, Ts&&... xs) {
sep();
consume(deconst(x));
traverse(std::forward<Ts>(xs)...);
......
......@@ -744,7 +744,7 @@ struct tl_filter_not<type_list<T...>, Pred> {
using type =
typename tl_filter_impl<
type_list<T...>,
! Pred<T>::value...
!Pred<T>::value...
>::type;
};
......@@ -758,7 +758,7 @@ struct tl_filter_type<type_list<T...>, Type> {
using type =
typename tl_filter_impl<
type_list<T...>,
! std::is_same<T, Type>::value...
!std::is_same<T, Type>::value...
>::type;
};
......@@ -772,7 +772,7 @@ struct tl_filter_not_type<type_list<T...>, Type> {
using type =
typename tl_filter_impl<
type_list<T...>,
(! std::is_same<T, Type>::value)...
(!std::is_same<T, Type>::value)...
>::type;
};
......
......@@ -55,7 +55,7 @@ private:
std::declval<T&>()));
public:
static constexpr bool value = ! std::is_same<result_type, std::false_type>::value;
static constexpr bool value = !std::is_same<result_type, std::false_type>::value;
};
template <class T>
......@@ -434,7 +434,7 @@ class has_static_type_name {
private:
template <class U,
class = typename std::enable_if<
! std::is_member_pointer<decltype(&U::static_type_name)>::value
!std::is_member_pointer<decltype(&U::static_type_name)>::value
>::type>
static std::true_type sfinae(int);
......
......@@ -175,7 +175,7 @@ struct deduce_output_type_impl {
Signatures,
input_is<InputTypes>::template eval
>::type;
static_assert(! std::is_same<signature, none_t>::value,
static_assert(!std::is_same<signature, none_t>::value,
"typed actor does not support given input");
using type = typename signature::output_types;
// generates the appropriate `delegated<...>` type from given signatures
......
......@@ -211,12 +211,12 @@ std::string to_string(const error& x);
/// @relates error
inline bool operator==(const error& x, none_t) {
return ! x;
return !x;
}
/// @relates error
inline bool operator==(none_t, const error& x) {
return ! x;
return !x;
}
/// @relates error
......@@ -244,13 +244,13 @@ inline bool operator!=(none_t, const error& x) {
/// @relates error
template <class E, class = enable_if_has_make_error_t<E>>
bool operator!=(const error& x, E y) {
return ! (x == y);
return !(x == y);
}
/// @relates error
template <class E, class = enable_if_has_make_error_t<E>>
bool operator!=(E x, const error& y) {
return ! (x == y);
return !(x == y);
}
} // namespace caf
......
......@@ -84,7 +84,7 @@ int exec_main(F fun, int argc, char** argv,
// pass config to the actor system
actor_system system{cfg};
if (cfg.slave_mode) {
if (! cfg.slave_mode_fun) {
if (!cfg.slave_mode_fun) {
std::cerr << "cannot run slave mode, I/O module not loaded" << std::endl;
return 1;
}
......
......@@ -96,7 +96,7 @@ public:
expected& operator=(const expected& other) noexcept(nothrow_copy) {
if (engaged_ && other.engaged_)
value_ = other.value_;
else if (! engaged_ && ! other.engaged_)
else if (!engaged_ && !other.engaged_)
error_ = other.error_;
else {
destroy();
......@@ -108,7 +108,7 @@ public:
expected& operator=(expected&& other) noexcept(nothrow_move) {
if (engaged_ && other.engaged_)
value_ = std::move(other.value_);
else if (! engaged_ && ! other.engaged_)
else if (!engaged_ && !other.engaged_)
error_ = std::move(other.error_);
else {
destroy();
......@@ -147,7 +147,7 @@ public:
}
expected& operator=(caf::error e) noexcept {
if (! engaged_)
if (!engaged_)
error_ = std::move(e);
else {
destroy();
......@@ -182,7 +182,7 @@ public:
/// @copydoc cerror
caf::error& error() noexcept {
CAF_ASSERT(! engaged_);
CAF_ASSERT(!engaged_);
return error_;
}
......@@ -224,13 +224,13 @@ public:
/// Returns the contained error.
/// @pre `engaged() == false`.
const caf::error& cerror() const noexcept {
CAF_ASSERT(! engaged_);
CAF_ASSERT(!engaged_);
return error_;
}
/// @copydoc cerror
const caf::error& error() const noexcept {
CAF_ASSERT(! engaged_);
CAF_ASSERT(!engaged_);
return error_;
}
......@@ -270,7 +270,7 @@ private:
template <class T>
auto operator==(const expected<T>& x, const expected<T>& y)
-> decltype(*x == *y) {
return x && y ? *x == *y : (! x && ! y ? x.error() == y.error() : false);
return x && y ? *x == *y : (!x && !y ? x.error() == y.error() : false);
}
/// @relates expected
......@@ -313,43 +313,43 @@ enable_if_has_make_error_t<E, bool> operator==(E x, const expected<T>& y) {
template <class T>
auto operator!=(const expected<T>& x, const expected<T>& y)
-> decltype(*x == *y) {
return ! (x == y);
return !(x == y);
}
/// @relates expected
template <class T, class U>
auto operator!=(const expected<T>& x, const U& y) -> decltype(*x == y) {
return ! (x == y);
return !(x == y);
}
/// @relates expected
template <class T, class U>
auto operator!=(const T& x, const expected<U>& y) -> decltype(x == *y) {
return ! (x == y);
return !(x == y);
}
/// @relates expected
template <class T>
bool operator!=(const expected<T>& x, const error& y) {
return ! (x == y);
return !(x == y);
}
/// @relates expected
template <class T>
bool operator!=(const error& x, const expected<T>& y) {
return ! (x == y);
return !(x == y);
}
/// @relates expected
template <class T, class E>
enable_if_has_make_error_t<E, bool> operator!=(const expected<T>& x, E y) {
return ! (x == y);
return !(x == y);
}
/// @relates expected
template <class T, class E>
enable_if_has_make_error_t<E, bool> operator!=(E x, const expected<T>& y) {
return ! (x == y);
return !(x == y);
}
/// The pattern `expected<void>` shall be used for functions that may generate
......@@ -391,7 +391,7 @@ public:
}
explicit operator bool() const {
return ! error_;
return !error_;
}
const caf::error& error() const {
......@@ -422,7 +422,7 @@ auto to_string(const expected<T>& x) -> decltype(to_string(*x)) {
/// @experimental
#define CAF_EXP_THROW(var, expr) \
auto CAF_UNIFYN(tmp_var_) = expr; \
if (! CAF_UNIFYN(tmp_var_)) \
if (!CAF_UNIFYN(tmp_var_)) \
CAF_RAISE_ERROR(to_string(CAF_UNIFYN(tmp_var_).error())); \
auto& var = *CAF_UNIFYN(tmp_var_)
/// @endcond
......
......@@ -148,14 +148,14 @@ public:
}
~function_view() {
if (! impl_.unsafe())
if (!impl_.unsafe())
self_.~scoped_actor();
}
function_view(function_view&& x)
: timeout(x.timeout),
impl_(std::move(x.impl_)) {
if (! impl_.unsafe()) {
if (!impl_.unsafe()) {
new (&self_) scoped_actor(impl_.home_system()); //(std::move(x.self_));
x.self_.~scoped_actor();
}
......@@ -197,16 +197,16 @@ public:
}
void assign(type x) {
if (impl_.unsafe() && ! x.unsafe())
if (impl_.unsafe() && !x.unsafe())
new_self(x);
if (! impl_.unsafe() && x.unsafe())
if (!impl_.unsafe() && x.unsafe())
self_.~scoped_actor();
impl_.swap(x);
}
/// Checks whether this function view has an actor assigned to it.
explicit operator bool() const {
return ! impl_.unsafe();
return !impl_.unsafe();
}
duration timeout;
......@@ -223,7 +223,7 @@ private:
}
void new_self(const Actor& x) {
if (! x.unsafe())
if (!x.unsafe())
new (&self_) scoped_actor(x->home_system());
}
......@@ -234,7 +234,7 @@ private:
/// @relates function_view
template <class T>
bool operator==(const function_view<T>& x, std::nullptr_t) {
return ! x;
return !x;
}
/// @relates function_view
......@@ -246,13 +246,13 @@ bool operator==(std::nullptr_t x, const function_view<T>& y) {
/// @relates function_view
template <class T>
bool operator!=(const function_view<T>& x, std::nullptr_t y) {
return ! (x == y);
return !(x == y);
}
/// @relates function_view
template <class T>
bool operator!=(std::nullptr_t x, const function_view<T>& y) {
return ! (y == x);
return !(y == x);
}
/// Creates a new function view for `x`.
......
......@@ -74,7 +74,7 @@ public:
}
inline bool operator!() const noexcept {
return ! ptr_;
return !ptr_;
}
static intptr_t compare(const abstract_group* lhs, const abstract_group* rhs);
......@@ -112,14 +112,14 @@ public:
template <class... Ts>
void eq_impl(message_id mid, strong_actor_ptr sender,
execution_unit* ctx, Ts&&... xs) const {
CAF_ASSERT(! mid.is_request());
CAF_ASSERT(!mid.is_request());
if (ptr_)
ptr_->enqueue(std::move(sender), mid,
make_message(std::forward<Ts>(xs)...), ctx);
}
inline bool subscribe(strong_actor_ptr who) const {
if (! ptr_)
if (!ptr_)
return false;
return ptr_->subscribe(std::move(who));
}
......@@ -157,7 +157,7 @@ template <>
struct hash<caf::group> {
inline size_t operator()(const caf::group& x) const {
// groups are singleton objects, the address is thus the best possible hash
return ! x ? 0 : reinterpret_cast<size_t>(x.get());
return !x ? 0 : reinterpret_cast<size_t>(x.get());
}
};
} // namespace std
......
......@@ -77,7 +77,7 @@ public:
private:
void advance() {
x_ = xs_->next();
if (! x_)
if (!x_)
xs_ = nullptr;
}
......
......@@ -122,7 +122,7 @@ public:
}
bool operator!() const noexcept {
return ! ptr_;
return !ptr_;
}
explicit operator bool() const noexcept {
......@@ -166,13 +166,13 @@ private:
/// @relates intrusive_ptr
template <class T>
bool operator==(const intrusive_ptr<T>& x, std::nullptr_t) {
return ! x;
return !x;
}
/// @relates intrusive_ptr
template <class T>
bool operator==(std::nullptr_t, const intrusive_ptr<T>& x) {
return ! x;
return !x;
}
/// @relates intrusive_ptr
......
......@@ -245,7 +245,7 @@ public:
typename detail::make_response_promise_helper<Ts...>::type
make_response_promise() {
auto& ptr = current_element_;
if (! ptr)
if (!ptr)
return {};
auto& mid = ptr->mid;
if (mid.is_answered())
......
......@@ -90,7 +90,7 @@ public:
template <class T>
line_builder& operator<<(const T& x) {
if (! str_.empty())
if (!str_.empty())
str_ += " ";
std::stringstream ss;
ss << x;
......@@ -103,7 +103,7 @@ public:
line_builder& operator<<(const arg_wrapper<T>& x) {
if (behind_arg_)
str_ += ", ";
else if (! str_.empty())
else if (!str_.empty())
str_ += " ";
str_ += x.name;
str_ += " = ";
......
......@@ -160,7 +160,7 @@ make_mailbox_element(strong_actor_ptr sender, message_id id,
/// @relates mailbox_element
template <class T, class... Ts>
typename std::enable_if<
! std::is_same<typename std::decay<T>::type, message>::value
!std::is_same<typename std::decay<T>::type, message>::value
|| (sizeof...(Ts) > 0),
mailbox_element_ptr
>::type
......
......@@ -60,7 +60,7 @@ struct is_serializable_or_whitelisted {
/// @relates message
template <class T, class... Ts>
typename std::enable_if<
! std::is_same<message, typename std::decay<T>::type>::value
!std::is_same<message, typename std::decay<T>::type>::value
|| (sizeof...(Ts) > 0),
message
>::type
......
......@@ -129,11 +129,11 @@ public:
>::type;
/*
static_assert(! std::is_same<pattern, detail::type_list<exit_msg>>::value,
static_assert(!std::is_same<pattern, detail::type_list<exit_msg>>::value,
"exit_msg not allowed in message handlers, "
"did you mean to use set_exit_handler()?");
static_assert(! std::is_same<pattern, detail::type_list<down_msg>>::value,
static_assert(!std::is_same<pattern, detail::type_list<down_msg>>::value,
"down_msg not allowed in message handlers, "
"did you mean to use set_down_handler()?");
*/
......@@ -163,7 +163,7 @@ public:
type_erased_tuple& xs) override {
detail::meta_elements<pattern> ms;
// check if try_match() reports success
if (! detail::try_match(xs, ms.arr.data(), ms.arr.size()))
if (!detail::try_match(xs, ms.arr.data(), ms.arr.size()))
return match_case::no_match;
typename detail::il_indices<decayed_arg_types>::type indices;
lfinvoker<std::is_same<result_type, void>::value, F> fun{fun_};
......@@ -191,7 +191,7 @@ inline bool operator<(const match_case_info& x, const match_case_info& y) {
template <class F>
typename std::enable_if<
! std::is_base_of<match_case, F>::value,
!std::is_base_of<match_case, F>::value,
std::tuple<trivial_match_case<F>>
>::type
to_match_case_tuple(F fun) {
......@@ -224,7 +224,7 @@ typename std::enable_if<
std::is_base_of<match_case, T>::value || std::is_base_of<match_case, U>::value
>::type
operator,(T, U) {
static_assert(! std::is_same<T, T>::value,
static_assert(!std::is_same<T, T>::value,
"this syntax is not supported -> you probably did "
"something like 'return (...)' instead of 'return {...}'");
}
......
......@@ -302,7 +302,7 @@ public:
/// @cond PRIVATE
/// @pre `! empty()`
/// @pre `!empty()`
type_erased_tuple& content() {
CAF_ASSERT(vals_);
return *vals_;
......
......@@ -79,7 +79,7 @@ public:
template <class... Ts>
void assign(Ts... xs) {
static_assert(sizeof...(Ts) > 0, "assign without arguments called");
static_assert(! detail::disjunction<may_have_timeout<
static_assert(!detail::disjunction<may_have_timeout<
typename std::decay<Ts>::type>::value...
>::value, "Timeouts are only allowed in behaviors");
impl_ = detail::make_behavior(xs...);
......@@ -112,7 +112,7 @@ public:
// using a behavior is safe here, because we "cast"
// it back to a message_handler when appropriate
behavior tmp{std::forward<Ts>(xs)...};
if (! tmp) {
if (!tmp) {
return *this;
}
if (impl_)
......
......@@ -89,7 +89,7 @@ public:
}
inline bool is_request() const {
return valid() && ! is_response();
return valid() && !is_response();
}
inline message_id response_id() const {
......
......@@ -66,7 +66,7 @@ public:
template <class T0, class T1, class... Ts>
typename std::enable_if<
! std::is_same<keep_behavior_t, typename std::decay<T0>::type>::value
!std::is_same<keep_behavior_t, typename std::decay<T0>::type>::value
>::type
become(T0&& x0, T1&& x1, Ts&&... xs) {
behavior_type bhvr{std::forward<T0>(x0),
......
......@@ -64,7 +64,7 @@ public:
typename detail::implicit_conversions<
typename std::decay<Ts>::type
>::type...>;
static_assert(! statically_typed<Subtype>() || statically_typed<Dest>(),
static_assert(!statically_typed<Subtype>() || statically_typed<Dest>(),
"statically typed actors can only send() to other "
"statically typed actors; use anon_send() or request() when "
"communicating with dynamically typed actors");
......@@ -118,7 +118,7 @@ public:
typename detail::implicit_conversions<
typename std::decay<Ts>::type
>::type...>;
static_assert(! statically_typed<Subtype>() || statically_typed<Dest>(),
static_assert(!statically_typed<Subtype>() || statically_typed<Dest>(),
"statically typed actors are only allowed to send() to other "
"statically typed actors; use anon_send() or request() when "
"communicating with dynamically typed actors");
......
......@@ -58,7 +58,7 @@ public:
/// Links this actor to `x`.
void link_to(const actor_addr& x) {
auto ptr = actor_cast<strong_actor_ptr>(x);
if (! ptr || ptr->get() == this)
if (!ptr || ptr->get() == this)
return;
link_impl(establish_link_op, ptr->get());
}
......@@ -67,7 +67,7 @@ public:
template <class ActorHandle>
void link_to(const ActorHandle& x) {
auto ptr = actor_cast<abstract_actor*>(x);
if (! ptr || ptr == this)
if (!ptr || ptr == this)
return;
link_impl(establish_link_op, ptr);
}
......@@ -75,7 +75,7 @@ public:
/// Unlinks this actor from `x`.
void unlink_from(const actor_addr& x) {
auto ptr = actor_cast<strong_actor_ptr>(x);
if (! ptr || ptr->get() == this)
if (!ptr || ptr->get() == this)
return;
link_impl(remove_link_op, ptr->get());
}
......@@ -84,7 +84,7 @@ public:
template <class ActorHandle>
void unlink_from(const ActorHandle& x) {
auto ptr = actor_cast<abstract_actor*>(x);
if (! ptr || ptr == this)
if (!ptr || ptr == this)
return;
link_impl(remove_link_op, ptr);
}
......
......@@ -145,9 +145,9 @@ public:
data tmp;
// write changes to tmp back to x at scope exit
auto sg = detail::make_scope_guard([&] {
if (! tmp.valid())
if (!tmp.valid())
x.data_.reset();
else if (! x || ! x.data_->unique())
else if (!x || !x.data_->unique())
x.data_ = make_counted<data>(tmp);
else
*x.data_ = tmp;
......@@ -164,12 +164,12 @@ private:
/// @relates node_id
inline bool operator==(const node_id& x, none_t) {
return ! x;
return !x;
}
/// @relates node_id
inline bool operator==(none_t, const node_id& x) {
return ! x;
return !x;
}
/// @relates node_id
......@@ -187,7 +187,7 @@ inline bool operator==(const node_id& lhs, const node_id& rhs) {
}
inline bool operator!=(const node_id& lhs, const node_id& rhs) {
return ! (lhs == rhs);
return !(lhs == rhs);
}
inline bool operator<(const node_id& lhs, const node_id& rhs) {
......
......@@ -98,7 +98,7 @@ class optional {
/// Checks whether this object does not contain a value.
bool operator!() const {
return ! m_valid;
return !m_valid;
}
/// Returns the value.
......@@ -152,7 +152,7 @@ class optional {
template <class V>
void cr(V&& x) {
CAF_ASSERT(! m_valid);
CAF_ASSERT(!m_valid);
m_valid = true;
new (&m_value) T(std::forward<V>(x));
}
......@@ -189,7 +189,7 @@ class optional<T&> {
}
bool operator!() const {
return ! m_value;
return !m_value;
}
T& operator*() {
......@@ -254,7 +254,7 @@ class optional<void> {
}
bool operator!() const {
return ! m_value;
return !m_value;
}
private:
......@@ -308,31 +308,31 @@ auto to_string(const optional<T>& x) -> decltype(to_string(*x)) {
template <class T>
bool operator==(const optional<T>& lhs, const optional<T>& rhs) {
return static_cast<bool>(lhs) == static_cast<bool>(rhs)
&& (! lhs || *lhs == *rhs);
&& (!lhs || *lhs == *rhs);
}
/// @relates optional
template <class T>
bool operator!=(const optional<T>& lhs, const optional<T>& rhs) {
return ! (lhs == rhs);
return !(lhs == rhs);
}
/// @relates optional
template <class T>
bool operator<(const optional<T>& lhs, const optional<T>& rhs) {
return static_cast<bool>(rhs) && (! lhs || *lhs < *rhs);
return static_cast<bool>(rhs) && (!lhs || *lhs < *rhs);
}
/// @relates optional
template <class T>
bool operator<=(const optional<T>& lhs, const optional<T>& rhs) {
return ! (rhs < lhs);
return !(rhs < lhs);
}
/// @relates optional
template <class T>
bool operator>=(const optional<T>& lhs, const optional<T>& rhs) {
return ! (lhs < rhs);
return !(lhs < rhs);
}
/// @relates optional
......@@ -346,13 +346,13 @@ bool operator>(const optional<T>& lhs, const optional<T>& rhs) {
/// @relates optional
template <class T>
bool operator==(const optional<T>& lhs, none_t) {
return ! lhs;
return !lhs;
}
/// @relates optional
template <class T>
bool operator==(none_t, const optional<T>& rhs) {
return ! rhs;
return !rhs;
}
/// @relates optional
......@@ -382,7 +382,7 @@ bool operator<(none_t, const optional<T>& rhs) {
/// @relates optional
template <class T>
bool operator<=(const optional<T>& lhs, none_t) {
return ! lhs;
return !lhs;
}
/// @relates optional
......@@ -432,19 +432,19 @@ bool operator==(const T& lhs, const optional<T>& rhs) {
/// @relates optional
template <class T>
bool operator!=(const optional<T>& lhs, const T& rhs) {
return ! lhs || ! (*lhs == rhs);
return !lhs || !(*lhs == rhs);
}
/// @relates optional
template <class T>
bool operator!=(const T& lhs, const optional<T>& rhs) {
return ! rhs || ! (lhs == *rhs);
return !rhs || !(lhs == *rhs);
}
/// @relates optional
template <class T>
bool operator<(const optional<T>& lhs, const T& rhs) {
return ! lhs || *lhs < rhs;
return !lhs || *lhs < rhs;
}
/// @relates optional
......@@ -456,13 +456,13 @@ bool operator<(const T& lhs, const optional<T>& rhs) {
/// @relates optional
template <class T>
bool operator<=(const optional<T>& lhs, const T& rhs) {
return ! lhs || ! (rhs < *lhs);
return !lhs || !(rhs < *lhs);
}
/// @relates optional
template <class T>
bool operator<=(const T& lhs, const optional<T>& rhs) {
return rhs && ! (rhs < lhs);
return rhs && !(rhs < lhs);
}
/// @relates optional
......@@ -474,19 +474,19 @@ bool operator>(const optional<T>& lhs, const T& rhs) {
/// @relates optional
template <class T>
bool operator>(const T& lhs, const optional<T>& rhs) {
return ! rhs || *rhs < lhs;
return !rhs || *rhs < lhs;
}
/// @relates optional
template <class T>
bool operator>=(const optional<T>& lhs, const T& rhs) {
return lhs && ! (*lhs < rhs);
return lhs && !(*lhs < rhs);
}
/// @relates optional
template <class T>
bool operator>=(const T& lhs, const optional<T>& rhs) {
return ! rhs || ! (lhs < *rhs);
return !rhs || !(lhs < *rhs);
}
} // namespace caf
......
......@@ -91,7 +91,7 @@ public:
resumable* dequeue(Worker* self) {
auto& parent_data = d(self->parent());
std::unique_lock<std::mutex> guard(parent_data.lock);
parent_data.cv.wait(guard, [&] { return ! parent_data.queue.empty(); });
parent_data.cv.wait(guard, [&] { return !parent_data.queue.empty(); });
resumable* job = parent_data.queue.front();
parent_data.queue.pop_front();
return job;
......
......@@ -47,11 +47,11 @@ struct typed_mpi<detail::type_list<Is...>,
static_assert(sizeof...(Ls) > 0, "template parameter pack Ls empty");
using input_types = detail::type_list<Is...>;
using output_types = detail::type_list<Ls...>;
static_assert(! detail::tl_exists<
static_assert(!detail::tl_exists<
input_types,
is_illegal_message_element
>::value
&& ! detail::tl_exists<
&& !detail::tl_exists<
output_types,
is_illegal_message_element
>::value,
......
......@@ -46,7 +46,7 @@ public:
/// Satisfies the promise by sending a non-error response message.
template <class T, class... Ts>
typename std::enable_if<
(sizeof...(Ts) > 0) || ! std::is_convertible<T, error>::value,
(sizeof...(Ts) > 0) || !std::is_convertible<T, error>::value,
response_promise
>::type
deliver(T&&x, Ts&&... xs) {
......@@ -62,7 +62,7 @@ public:
/// Queries whether this promise is a valid promise that is not satisfied yet.
inline bool pending() const {
return ! stages_.empty() || source_;
return !stages_.empty() || source_;
}
/// @cond PRIVATE
......
......@@ -320,13 +320,13 @@ public:
/// Returns whether `true` if the behavior stack is not empty or
/// if outstanding responses exist, `false` otherwise.
inline bool has_behavior() const {
return ! bhvr_stack_.empty()
|| ! awaited_responses_.empty()
|| ! multiplexed_responses_.empty();
return !bhvr_stack_.empty()
|| !awaited_responses_.empty()
|| !multiplexed_responses_.empty();
}
inline behavior& current_behavior() {
return ! awaited_responses_.empty() ? awaited_responses_.front().second
return !awaited_responses_.empty() ? awaited_responses_.front().second
: bhvr_stack_.back();
}
......
......@@ -105,7 +105,7 @@ protected:
sh.ref(); // make sure reference count is high enough
}
CAF_LOG_DEBUG("enqueue shutdown_helper into each worker");
while (! alive_workers.empty()) {
while (!alive_workers.empty()) {
(*alive_workers.begin())->external_enqueue(&sh);
// since jobs can be stolen, we cannot assume that we have
// actually shut down the worker we've enqueued sh to
......
......@@ -177,7 +177,7 @@ public:
void init(actor_system_config& cfg) override {
super::init(cfg);
file_.open(cfg.scheduler_profiling_output_file);
if (! file_)
if (!file_)
std::cerr << "[WARNING] could not open file \""
<< cfg.scheduler_profiling_output_file
<< "\" (no profiler output will be generated)"
......
......@@ -43,7 +43,7 @@ void send_as(const Source& src, const Dest& dest, Ts&&... xs) {
typename detail::implicit_conversions<
typename std::decay<Ts>::type
>::type...>;
static_assert(! statically_typed<Source>() || statically_typed<Dest>(),
static_assert(!statically_typed<Source>() || statically_typed<Dest>(),
"statically typed actors can only send() to other "
"statically typed actors; use anon_send() or request() when "
"communicating with dynamically typed actors");
......
......@@ -120,7 +120,7 @@ constexpr bool has_lazy_init_flag(spawn_options opts) {
/// @cond PRIVATE
constexpr bool is_unbound(spawn_options opts) {
return ! has_monitor_flag(opts) && ! has_link_flag(opts);
return !has_monitor_flag(opts) && !has_link_flag(opts);
}
constexpr spawn_options make_unbound(spawn_options opts) {
......
......@@ -102,7 +102,7 @@ private:
}
template <class T>
typename std::enable_if<! std::is_constructible<State, T>::value>::type
typename std::enable_if<!std::is_constructible<State, T>::value>::type
cr_state(T) {
new (&state_) State();
}
......@@ -123,7 +123,7 @@ private:
}
template <class U>
typename std::enable_if<! detail::has_name<U>::value, const char*>::type
typename std::enable_if<!detail::has_name<U>::value, const char*>::type
get_name(const U&) const {
return Base::name();
}
......
......@@ -48,7 +48,7 @@ void split(Container& result, const std::string& str, const Delim& delims,
while ((pos = str.find_first_of(delims, prev)) != std::string::npos) {
if (pos > prev) {
auto substr = str.substr(prev, pos - prev);
if (! substr.empty() || keep_all) {
if (!substr.empty() || keep_all) {
result.push_back(std::move(substr));
}
}
......
......@@ -154,7 +154,7 @@ public:
return false;
detail::meta_elements<detail::type_list<Ts...>> xs;
for (size_t i = 0; i < xs.arr.size(); ++i)
if (! detail::match_element(xs.arr[i], *this, i))
if (!detail::match_element(xs.arr[i], *this, i))
return false;
return true;
}
......@@ -172,7 +172,7 @@ private:
template <class F, class R, class... Ts>
optional<R> apply(F& fun, detail::type_list<R>,
detail::type_list<Ts...> tk) {
if (! match_elements<Ts...>())
if (!match_elements<Ts...>())
return none;
detail::pseudo_tuple<typename std::decay<Ts>::type...> xs{*this};
return detail::apply_args(fun, detail::get_indices(tk), xs);
......@@ -181,7 +181,7 @@ private:
template <class F, class... Ts>
optional<void> apply(F& fun, detail::type_list<void>,
detail::type_list<Ts...> tk) {
if (! match_elements<Ts...>())
if (!match_elements<Ts...>())
return none;
detail::pseudo_tuple<typename std::decay<Ts>::type...> xs{*this};
detail::apply_args(fun, detail::get_indices(tk), xs);
......
......@@ -212,7 +212,7 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
/// Queries whether this object was constructed using
/// `unsafe_actor_handle_init` or is in moved-from state.
bool unsafe() const {
return ! ptr_;
return !ptr_;
}
/// @cond PRIVATE
......@@ -284,7 +284,7 @@ bool operator==(const typed_actor<Xs...>& x,
template <class... Xs, class... Ys>
bool operator!=(const typed_actor<Xs...>& x,
const typed_actor<Ys...>& y) noexcept {
return ! (x == y);
return !(x == y);
}
/// Returns a new actor that implements the composition `f.g(x) = f(g(x))`.
......
......@@ -70,7 +70,7 @@ public:
void initialize() override {
this->is_initialized(true);
auto bhvr = make_behavior();
CAF_LOG_DEBUG_IF(! bhvr, "make_behavior() did not return a behavior:"
CAF_LOG_DEBUG_IF(!bhvr, "make_behavior() did not return a behavior:"
<< CAF_ARG(this->has_behavior()));
if (bhvr) {
// make_behavior() did return a behavior instead of using become()
......
......@@ -53,7 +53,7 @@ public:
/// Satisfies the promise by sending a non-error response message.
template <class U, class... Us>
typename std::enable_if<
(sizeof...(Us) > 0) || ! std::is_convertible<U, error>::value,
(sizeof...(Us) > 0) || !std::is_convertible<U, error>::value,
typed_response_promise
>::type
deliver(U&& x, Us&&... xs) {
......
......@@ -59,7 +59,7 @@ struct variant_move_helper {
template <class T, class U,
bool Enable = std::is_integral<T>::value
&& std::is_integral<U>::value
&& ! std::is_same<T, bool>::value>
&& !std::is_same<T, bool>::value>
struct is_equal_int_type {
static constexpr bool value = sizeof(T) == sizeof(U)
&& std::is_signed<T>::value
......@@ -89,7 +89,7 @@ public:
static constexpr int max_type_id = sizeof...(Ts) - 1;
static_assert(! detail::tl_exists<types, std::is_reference>::value,
static_assert(!detail::tl_exists<types, std::is_reference>::value,
"Cannot create a variant of references");
variant& operator=(const variant& other) {
......
......@@ -128,7 +128,7 @@ public:
}
bool operator!() const noexcept {
return ! ptr_;
return !ptr_;
}
explicit operator bool() const noexcept {
......@@ -149,7 +149,7 @@ public:
/// Tries to upgrade this weak reference to a strong reference.
intrusive_ptr<T> lock() const noexcept {
if (! ptr_ || ! intrusive_ptr_upgrade_weak(ptr_))
if (!ptr_ || !intrusive_ptr_upgrade_weak(ptr_))
return nullptr;
// reference count already increased by intrusive_ptr_upgrade_weak
return {ptr_, false};
......@@ -159,7 +159,7 @@ public:
/// Returns a pointer with increased strong reference count
/// on success, `nullptr` otherwise.
pointer get_locked() const noexcept {
if (! ptr_ || ! intrusive_ptr_upgrade_weak(ptr_))
if (!ptr_ || !intrusive_ptr_upgrade_weak(ptr_))
return nullptr;
return ptr_;
}
......
......@@ -244,7 +244,7 @@ void printer_loop(blocking_actor* self) {
return nullptr;
};
auto flush = [&](actor_data* what, bool forced) {
if (! what)
if (!what)
return;
auto& line = what->current_line;
if (line.empty() || (line.back() != '\n' && !forced))
......@@ -356,7 +356,7 @@ void abstract_coordinator::cleanup_and_release(resumable* ptr) {
auto dptr = static_cast<scheduled_actor*>(ptr);
dummy_unit dummy{dptr};
dptr->cleanup(make_error(exit_reason::user_shutdown), &dummy);
while (! dummy.resumables.empty()) {
while (!dummy.resumables.empty()) {
auto sub = dummy.resumables.back();
dummy.resumables.pop_back();
switch (sub->subtype()) {
......
......@@ -96,7 +96,7 @@ actor actor::splice_impl(std::initializer_list<actor> xs) {
actor_system* sys = nullptr;
std::vector<strong_actor_ptr> tmp;
for (auto& x : xs) {
if (! sys)
if (!sys)
sys = &(x->home_system());
tmp.push_back(actor_cast<strong_actor_ptr>(x));
}
......
......@@ -44,9 +44,9 @@ actor_addr::actor_addr(actor_control_block* ptr, bool add_ref)
intptr_t actor_addr::compare(const actor_control_block* lhs,
const actor_control_block* rhs) {
// invalid actors are always "less" than valid actors
if (! lhs)
if (!lhs)
return rhs ? -1 : 0;
if (! rhs)
if (!rhs)
return 1;
// check for identity
if (lhs == rhs)
......
......@@ -53,7 +53,7 @@ void actor_companion::enqueue(strong_actor_ptr src, message_id mid,
}
void actor_companion::launch(execution_unit*, bool, bool hide) {
is_registered(! hide);
is_registered(!hide);
}
void actor_companion::on_exit() {
......
......@@ -83,7 +83,7 @@ bool operator==(const abstract_actor* x, const strong_actor_ptr& y) {
error load_actor(strong_actor_ptr& storage, execution_unit* ctx,
actor_id aid, const node_id& nid) {
if (! ctx)
if (!ctx)
return sec::no_context;
auto& sys = ctx->system();
if (sys.node() == nid) {
......@@ -93,7 +93,7 @@ error load_actor(strong_actor_ptr& storage, execution_unit* ctx,
return none;
}
auto prp = ctx->proxy_registry_ptr();
if (! prp)
if (!prp)
return sec::no_proxy_registry;
// deal with (proxies for) remote actors
storage = prp->get_or_put(nid, aid);
......@@ -102,7 +102,7 @@ error load_actor(strong_actor_ptr& storage, execution_unit* ctx,
error save_actor(strong_actor_ptr& storage, execution_unit* ctx,
actor_id aid, const node_id& nid) {
if (! ctx)
if (!ctx)
return sec::no_context;
auto& sys = ctx->system();
// register locally running actors to be able to deserialize them later
......
......@@ -56,7 +56,7 @@ actor_ostream& actor_ostream::flush() {
}
void actor_ostream::redirect(abstract_actor* self, std::string fn, int flags) {
if (! self)
if (!self)
return;
auto pr = self->home_system().scheduler().printer();
pr->enqueue(make_mailbox_element(nullptr, message_id::make(), {},
......@@ -74,7 +74,7 @@ void actor_ostream::redirect_all(actor_system& sys, std::string fn, int flags) {
}
void actor_ostream::init(abstract_actor* self) {
if (! self->get_flag(abstract_actor::has_used_aout_flag))
if (!self->get_flag(abstract_actor::has_used_aout_flag))
self->set_flag(true, abstract_actor::has_used_aout_flag);
}
......
......@@ -54,7 +54,7 @@ namespace {
void broadcast_dispatch(actor_system&, actor_pool::uplock&,
const actor_pool::actor_vec& vec,
mailbox_element_ptr& ptr, execution_unit* host) {
CAF_ASSERT(! vec.empty());
CAF_ASSERT(!vec.empty());
auto msg = ptr->move_content_to_message();
for (auto& worker : vec)
worker->enqueue(ptr->sender, ptr->mid, msg, host);
......
......@@ -67,11 +67,11 @@ strong_actor_ptr actor_registry::get(actor_id key) const {
void actor_registry::put(actor_id key, strong_actor_ptr val) {
CAF_LOG_TRACE(CAF_ARG(key));
if (! val)
if (!val)
return;
{ // lifetime scope of guard
exclusive_guard guard(instances_mtx_);
if (! entries_.emplace(key, val).second)
if (!entries_.emplace(key, val).second)
return;
}
// attach functor without lock
......
......@@ -112,7 +112,7 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) {
[=](subscribe_atom, const std::string& key) {
auto subscriber = actor_cast<strong_actor_ptr>(self->current_sender());
CAF_LOG_TRACE(CAF_ARG(key) << CAF_ARG(subscriber));
if (! subscriber)
if (!subscriber)
return;
self->state.data[key].second.insert(subscriber);
auto& subscribers = self->state.subscribers;
......@@ -127,7 +127,7 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) {
// unsubscribe from a key
[=](unsubscribe_atom, const std::string& key) {
auto subscriber = actor_cast<strong_actor_ptr>(self->current_sender());
if (! subscriber)
if (!subscriber)
return;
CAF_LOG_TRACE(CAF_ARG(key) << CAF_ARG(subscriber));
if (key == wildcard) {
......@@ -203,7 +203,7 @@ actor_system::actor_system(actor_system_config& cfg)
using profiled_share = scheduler::profiled_coordinator<policy::work_sharing>;
using profiled_steal = scheduler::profiled_coordinator<policy::work_stealing>;
// set scheduler only if not explicitly loaded by user
if (! sched) {
if (!sched) {
enum sched_conf {
stealing = 0x0001,
sharing = 0x0002,
......@@ -304,7 +304,7 @@ const uniform_type_info_map& actor_system::types() const {
}
std::string actor_system::render(const error& x) const {
if (! x)
if (!x)
return to_string(x);
auto& xs = config().error_renderers;
auto i = xs.find(x.category());
......@@ -322,7 +322,7 @@ bool actor_system::has_middleman() const {
}
io::middleman& actor_system::middleman() {
if (! middleman_)
if (!middleman_)
CAF_RAISE_ERROR("cannot access middleman: module not loaded");
return *middleman_;
}
......@@ -332,7 +332,7 @@ bool actor_system::has_opencl_manager() const {
}
opencl::manager& actor_system::opencl_manager() const {
if (! opencl_manager_)
if (!opencl_manager_)
CAF_RAISE_ERROR("cannot access opencl manager: module not loaded");
return *opencl_manager_;
}
......@@ -384,7 +384,7 @@ actor_system::dyn_spawn_impl(const std::string& name, message& args,
return sec::unknown_type;
actor_config cfg{ctx ? ctx : &dummy_execution_unit_};
auto res = i->second(cfg, args);
if (! res.first)
if (!res.first)
return sec::cannot_spawn_actor_from_arguments;
if (check_interface && !assignable(res.second, *expected_ifs))
return sec::unexpected_actor_messaging_interface;
......
......@@ -187,7 +187,7 @@ actor_system_config& actor_system_config::parse(int argc, char** argv,
if (argc > 1)
args = message_builder(argv + 1, argv + argc).move_to_message();
// set default config file name if not set by user
if (! ini_file_cstr)
if (!ini_file_cstr)
ini_file_cstr = "caf-application.ini";
std::string config_file_name;
// CLI file name has priority over default file name
......@@ -239,7 +239,7 @@ actor_system_config& actor_system_config::parse(message& args,
using std::cout;
using std::endl;
args_remainder = std::move(res.remainder);
if (! res.error.empty()) {
if (!res.error.empty()) {
cli_helptext_printed = true;
std::cerr << res.error << endl;
return *this;
......
......@@ -59,7 +59,7 @@ void adapter::enqueue(mailbox_element_ptr x, execution_unit* context) {
merger = merger_;
fail_state = fail_state_;
});
if (! decorated) {
if (!decorated) {
bounce(x, fail_state);
return;
}
......
......@@ -117,7 +117,7 @@ optional<message> behavior_impl::invoke(message& xs) {
maybe_message_visitor f;
// the following const-cast is safe, because invoke() is aware of
// copy-on-write and does not modify x if it's shared
if (! xs.empty())
if (!xs.empty())
invoke(f, *const_cast<message_data*>(xs.cvals().get()));
else
invoke_empty(f);
......@@ -134,7 +134,7 @@ match_case::result behavior_impl::invoke(detail::invoke_result_visitor& f,
message& xs) {
// the following const-cast is safe, because invoke() is aware of
// copy-on-write and does not modify x if it's shared
if (! xs.empty())
if (!xs.empty())
return invoke(f, *const_cast<message_data*>(xs.cvals().get()));
return invoke_empty(f);
}
......
......@@ -27,13 +27,13 @@ namespace caf {
namespace detail {
void behavior_stack::pop_back() {
CAF_ASSERT(! elements_.empty());
CAF_ASSERT(!elements_.empty());
erased_elements_.push_back(std::move(elements_.back()));
elements_.pop_back();
}
void behavior_stack::clear() {
if (! elements_.empty()) {
if (!elements_.empty()) {
if (erased_elements_.empty()) {
elements_.swap(erased_elements_);
} else {
......
......@@ -62,7 +62,7 @@ void blocking_actor::enqueue(mailbox_element_ptr ptr, execution_unit*) {
auto mid = ptr->mid;
auto src = ptr->sender;
// returns false if mailbox has been closed
if (! mailbox().synchronized_enqueue(mtx_, cv_, ptr.release())) {
if (!mailbox().synchronized_enqueue(mtx_, cv_, ptr.release())) {
if (mid.is_request()) {
detail::sync_request_bouncer srb{exit_reason()};
srb(src, mid);
......@@ -77,7 +77,7 @@ const char* blocking_actor::name() const {
void blocking_actor::launch(execution_unit*, bool, bool hide) {
CAF_LOG_TRACE(CAF_ARG(hide));
CAF_ASSERT(is_blocking());
is_registered(! hide);
is_registered(!hide);
home_system().inc_detached_threads();
std::thread([](strong_actor_ptr ptr) {
// actor lives in its own thread
......@@ -181,7 +181,7 @@ public:
public:
iterator advance_impl(iterator i) {
while (i != e_) {
if (! i->marked) {
if (!i->marked) {
i->marked = true;
return i;
}
......@@ -220,7 +220,7 @@ public:
}
bool await_value(bool reset_timeout) override {
if (! rel_tout_.valid()) {
if (!rel_tout_.valid()) {
self_->await_data();
return true;
}
......@@ -259,7 +259,7 @@ public:
bool at_end() override {
if (ptr_->at_end()) {
if (! fallback_)
if (!fallback_)
return true;
ptr_ = fallback_;
fallback_ = nullptr;
......@@ -303,17 +303,17 @@ void blocking_actor::receive_impl(receive_cond& rcc,
// read incoming messages until we have a match or a timeout
for (;;) {
// check loop pre-condition
if (! rcc.pre())
if (!rcc.pre())
return;
// mailbox sequence is infinite, but at_end triggers the
// transition from seq1 to seq2 if we iterated our cache
if (seq.at_end())
CAF_RAISE_ERROR("reached the end of an infinite sequence");
// reset the timeout each iteration
if (! seq.await_value(true)) {
if (!seq.await_value(true)) {
// short-circuit "loop body"
bhvr.nested.handle_timeout();
if (! rcc.post())
if (!rcc.post())
return;
continue;
}
......@@ -364,23 +364,23 @@ void blocking_actor::receive_impl(receive_cond& rcc,
seq.advance();
if (seq.at_end())
CAF_RAISE_ERROR("reached the end of an infinite sequence");
if (! seq.await_value(false)) {
if (!seq.await_value(false)) {
timed_out = true;
}
}
} while (skipped && ! timed_out);
} while (skipped && !timed_out);
if (timed_out)
bhvr.nested.handle_timeout();
else
seq.erase_and_advance();
// check loop post condition
if (! rcc.post())
if (!rcc.post())
return;
}
}
void blocking_actor::await_data() {
if (! has_next_message())
if (!has_next_message())
mailbox().synchronized_await(mtx_, cv_);
}
......@@ -404,7 +404,7 @@ size_t blocking_actor::attach_functor(const actor_addr& x) {
size_t blocking_actor::attach_functor(const strong_actor_ptr& ptr) {
using wait_for_atom = atom_constant<atom("waitFor")>;
if (! ptr)
if (!ptr)
return 0;
actor self{this};
ptr->get()->attach_functor([=](const error&) {
......
......@@ -78,7 +78,7 @@ const char* config_option::type_name_visitor::operator()(atom_value) const {
}
bool config_option::assign_config_value(size_t& x, int64_t& y) {
if (y < 0 || ! unsigned_assign_in_range(x, y))
if (y < 0 || !unsigned_assign_in_range(x, y))
return false;
x = static_cast<size_t>(y);
return true;
......
......@@ -61,7 +61,7 @@ error::error(const error& x) : data_(x ? new data(*x.data_) : nullptr) {
error& error::operator=(const error& x) {
if (x) {
if (! data_)
if (!data_)
data_ = new data(*x.data_);
else
*data_ = *x.data_;
......@@ -164,7 +164,7 @@ error error::apply(inspect_fun f) {
}
std::string to_string(const error& x) {
if (! x)
if (!x)
return "none";
return deep_to_string(meta::type_name("error"), x.code(), x.category(),
meta::omittable_if_empty(), x.context());
......
......@@ -34,7 +34,7 @@ void event_based_actor::initialize() {
CAF_LOG_TRACE("subtype =" << logger::render_type_name(typeid(*this)).c_str());
is_initialized(true);
auto bhvr = make_behavior();
CAF_LOG_DEBUG_IF(! bhvr, "make_behavior() did not return a behavior:"
CAF_LOG_DEBUG_IF(!bhvr, "make_behavior() did not return a behavior:"
<< CAF_ARG(has_behavior()));
if (bhvr) {
// make_behavior() did return a behavior instead of using become()
......
......@@ -33,7 +33,7 @@ forwarding_actor_proxy::forwarding_actor_proxy(actor_config& cfg, actor mgr)
}
forwarding_actor_proxy::~forwarding_actor_proxy() {
if (! manager_.unsafe())
if (!manager_.unsafe())
anon_send(manager_, make_message(delete_atom::value, node(), id()));
}
......@@ -54,7 +54,7 @@ void forwarding_actor_proxy::forward_msg(strong_actor_ptr sender,
<< CAF_ARG(mid) << CAF_ARG(msg));
forwarding_stack tmp;
shared_lock<detail::shared_spinlock> guard_(manager_mtx_);
if (! manager_.unsafe())
if (!manager_.unsafe())
manager_->enqueue(nullptr, invalid_message_id,
make_message(forward_atom::value, std::move(sender),
fwd ? *fwd : tmp,
......
......@@ -203,7 +203,7 @@ std::vector<iface_info> get_mac_addresses() {
size_t iterations = 0;
do {
addresses.reset((IP_ADAPTER_ADDRESSES*)malloc(addresses_len));
if (! addresses) {
if (!addresses) {
perror("Memory allocation failed for IP_ADAPTER_ADDRESSES struct");
exit(1);
}
......
......@@ -31,7 +31,7 @@ constexpr char uuid_format[] = "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF";
namespace {
inline void erase_trailing_newline(std::string& str) {
while (! str.empty() && (*str.rbegin()) == '\n') {
while (!str.empty() && (*str.rbegin()) == '\n') {
str.resize(str.size() - 1);
}
}
......@@ -93,7 +93,7 @@ struct columns_iterator : std::iterator<std::forward_iterator_tag,
}
columns_iterator& operator++() {
string line;
if (! std::getline(*fs, line)) {
if (!std::getline(*fs, line)) {
fs = nullptr;
} else {
split(cols, line, is_any_of(" "), token_compress_on);
......
......@@ -58,7 +58,7 @@ intptr_t group::compare(const group& other) const noexcept {
error inspect(serializer& f, group& x) {
std::string mod_name;
auto ptr = x.get();
if (! ptr)
if (!ptr)
return f(mod_name);
mod_name = ptr->module().name();
auto e = f(mod_name);
......@@ -72,11 +72,11 @@ error inspect(deserializer& f, group& x) {
x = invalid_group;
return none;
}
if (! f.context())
if (!f.context())
return sec::no_context;
auto& sys = f.context()->system();
auto mod = sys.groups().get_module(module_name);
if (! mod)
if (!mod)
return sec::no_such_group_module;
return mod->load(f, x);
}
......
......@@ -77,7 +77,7 @@ public:
std::pair<bool, size_t> add_subscriber(strong_actor_ptr who) {
CAF_LOG_TRACE(CAF_ARG(who));
if (! who)
if (!who)
return {false, subscribers_.size()};
exclusive_guard guard(mtx_);
auto res = subscribers_.emplace(std::move(who)).second;
......@@ -354,7 +354,7 @@ public:
if (e)
return e;
CAF_LOG_DEBUG(CAF_ARG(identifier) << CAF_ARG(broker_ptr));
if (! broker_ptr) {
if (!broker_ptr) {
storage = invalid_group;
return none;
}
......
......@@ -60,7 +60,7 @@ void local_actor::on_destroy() {
// alternatively, we would have to use a reference-counted,
// heap-allocated logger
CAF_SET_LOGGER_SYS(nullptr);
if (! is_cleaned_up()) {
if (!is_cleaned_up()) {
on_exit();
cleanup(exit_reason::unreachable, nullptr);
monitorable_actor::on_destroy();
......@@ -69,14 +69,14 @@ void local_actor::on_destroy() {
void local_actor::request_response_timeout(const duration& d, message_id mid) {
CAF_LOG_TRACE(CAF_ARG(d) << CAF_ARG(mid));
if (! d.valid())
if (!d.valid())
return;
system().scheduler().delayed_send(d, ctrl(), ctrl(), mid.response_id(),
make_message(sec::request_timeout));
}
void local_actor::monitor(abstract_actor* ptr) {
if (! ptr)
if (!ptr)
return;
ptr->attach(default_attachable::make_monitor(ptr->address(), address()));
}
......@@ -84,7 +84,7 @@ void local_actor::monitor(abstract_actor* ptr) {
void local_actor::demonitor(const actor_addr& whom) {
CAF_LOG_TRACE(CAF_ARG(whom));
auto ptr = actor_cast<strong_actor_ptr>(whom);
if (! ptr)
if (!ptr)
return;
default_attachable::observe_token tk{address(), default_attachable::monitor};
ptr->get()->detach(tk);
......@@ -101,7 +101,7 @@ message_id local_actor::new_request_id(message_priority mp) {
}
mailbox_element_ptr local_actor::next_message() {
if (! is_priority_aware())
if (!is_priority_aware())
return mailbox_element_ptr{mailbox().try_pop()};
// we partition the mailbox into four segments in this case:
// <-------- ! was_skipped --------> | <-------- was_skipped -------->
......@@ -111,7 +111,7 @@ mailbox_element_ptr local_actor::next_message() {
auto e = cache.separator();
// read elements from mailbox if we don't have a high
// priority message or if cache is empty
if (i == e || ! i->is_high_priority()) {
if (i == e || !i->is_high_priority()) {
// insert points for high priority
auto hp_pos = i;
// read whole mailbox at once
......@@ -119,7 +119,7 @@ mailbox_element_ptr local_actor::next_message() {
while (tmp) {
cache.insert(tmp->is_high_priority() ? hp_pos : e, tmp);
// adjust high priority insert point on first low prio element insert
if (hp_pos == e && ! tmp->is_high_priority())
if (hp_pos == e && !tmp->is_high_priority())
--hp_pos;
tmp = mailbox().try_pop();
}
......@@ -132,7 +132,7 @@ mailbox_element_ptr local_actor::next_message() {
}
bool local_actor::has_next_message() {
if (! is_priority_aware())
if (!is_priority_aware())
return mailbox_.can_fetch_more();
auto& mbox = mailbox();
auto& cache = mbox.cache();
......@@ -142,7 +142,7 @@ bool local_actor::has_next_message() {
void local_actor::push_to_cache(mailbox_element_ptr ptr) {
CAF_ASSERT(ptr != nullptr);
CAF_LOG_TRACE(CAF_ARG(*ptr));
if (! is_priority_aware() || ! ptr->is_high_priority()) {
if (!is_priority_aware() || !ptr->is_high_priority()) {
mailbox().cache().insert(mailbox().cache().end(), ptr.release());
return;
}
......@@ -161,7 +161,7 @@ void local_actor::send_exit(const actor_addr& whom, error reason) {
}
void local_actor::send_exit(const strong_actor_ptr& dest, error reason) {
if (! dest)
if (!dest)
return;
dest->get()->eq_impl(message_id::make(), nullptr, context(),
exit_msg{address(), std::move(reason)});
......@@ -185,7 +185,7 @@ void local_actor::initialize() {
bool local_actor::cleanup(error&& fail_state, execution_unit* host) {
CAF_LOG_TRACE(CAF_ARG(fail_state));
if (! mailbox_.closed()) {
if (!mailbox_.closed()) {
detail::sync_request_bouncer f{fail_state};
mailbox_.close(f);
}
......
......@@ -137,7 +137,7 @@ logger::line_builder::line_builder() : behind_arg_(false) {
}
logger::line_builder& logger::line_builder::operator<<(const std::string& str) {
if (! str_.empty())
if (!str_.empty())
str_ += " ";
str_ += str;
behind_arg_ = false;
......@@ -145,7 +145,7 @@ logger::line_builder& logger::line_builder::operator<<(const std::string& str) {
}
logger::line_builder& logger::line_builder::operator<<(const char* str) {
if (! str_.empty())
if (!str_.empty())
str_ += " ";
str_ += str;
behind_arg_ = false;
......
......@@ -62,7 +62,7 @@ void make_cache_map() {
cache_map& get_cache_map() {
pthread_once(&s_key_once, make_cache_map);
auto cache = reinterpret_cast<cache_map*>(pthread_getspecific(s_key));
if (! cache) {
if (!cache) {
cache = new cache_map;
pthread_setspecific(s_key, cache);
// insert default types
......@@ -81,7 +81,7 @@ thread_local std::unique_ptr<cache_map> s_key;
} // namespace <anonymous>
cache_map& get_cache_map() {
if (! s_key) {
if (!s_key) {
s_key = std::unique_ptr<cache_map>(new cache_map);
// insert default types
std::unique_ptr<memory_cache> tmp(new basic_memory_cache<mailbox_element>);
......
......@@ -45,8 +45,8 @@ merged_tuple::merged_tuple(data_type xs, mapping_type ys)
: data_(std::move(xs)),
type_token_(0xFFFFFFFF),
mapping_(std::move(ys)) {
CAF_ASSERT(! data_.empty());
CAF_ASSERT(! mapping_.empty());
CAF_ASSERT(!data_.empty());
CAF_ASSERT(!mapping_.empty());
// calculate type token
for (size_t i = 0; i < mapping_.size(); ++i) {
type_token_ <<= 6;
......
......@@ -165,7 +165,7 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
return s[0] == "help"
|| std::find_if(s.begin() + 1, s.end(), has_short_help) != s.end();
};
if (! no_help && std::none_of(xs.begin(), xs.end(), pred)) {
if (!no_help && std::none_of(xs.begin(), xs.end(), pred)) {
xs.push_back(cli_arg{"help,h,?", "print this text"});
}
std::map<std::string, cli_arg*> shorts;
......@@ -245,7 +245,7 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
// this short opt expects two arguments
if (arg.size() > 2) {
// this short opt comes with a value (no space), e.g., -x2
if (! i->second->fun(arg.substr(2))) {
if (!i->second->fun(arg.substr(2))) {
error = "invalid value for " + i->second->name + ": " + arg;
return skip();
}
......@@ -268,7 +268,7 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
error = "missing argument to " + arg;
return skip();
}
if (! j->second->fun(arg.substr(eq_pos + 1))) {
if (!j->second->fun(arg.substr(eq_pos + 1))) {
error = "invalid value for " + j->second->name + ": " + arg;
return skip();
}
......@@ -290,14 +290,14 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
}
auto i = shorts.find(arg1.substr(0, 2));
if (i != shorts.end()) {
if (! i->second->fun || arg1.size() > 2) {
if (!i->second->fun || arg1.size() > 2) {
// this short opt either expects no argument or comes with a value
// (no space), e.g., -x2, so we have to parse it with the
// one-argument form above
return skip();
}
CAF_ASSERT(arg1.size() == 2);
if (! i->second->fun(arg2)) {
if (!i->second->fun(arg2)) {
error = "invalid value for option " + i->second->name + ": " + arg2;
return skip();
}
......@@ -383,7 +383,7 @@ message message::concat_impl(std::initializer_list<data_ptr> xs) {
}
error inspect(serializer& sink, message& msg) {
if (! sink.context())
if (!sink.context())
return sec::no_context;
// build type name
uint16_t zero = 0;
......@@ -396,7 +396,7 @@ error inspect(serializer& sink, message& msg) {
for (size_t i = 0; i < n; ++i) {
auto rtti = msg.cvals()->type(i);
auto ptr = types.portable_name(rtti);
if (! ptr) {
if (!ptr) {
std::cerr << "[ERROR]: cannot serialize message because a type was "
"not added to the types list, typeid name: "
<< (rtti.second ? rtti.second->name() : "-not-available-")
......@@ -421,7 +421,7 @@ error inspect(serializer& sink, message& msg) {
}
error inspect(deserializer& source, message& msg) {
if (! source.context())
if (!source.context())
return sec::no_context;
uint16_t zero;
std::string tname;
......@@ -451,7 +451,7 @@ error inspect(deserializer& source, message& msg) {
auto n = next(i);
tmp.assign(i, n);
auto ptr = types.make_value(tmp);
if (! ptr)
if (!ptr)
return make_error(sec::unknown_type, tmp);
err = ptr->load(source);
if (err)
......
......@@ -87,7 +87,7 @@ detail::dynamic_message_data* message_builder::data() {
// detach if needed, i.e., assume further non-const
// operations on data_ can cause race conditions if
// someone else holds a reference to data_
if (! data_->unique()) {
if (!data_->unique()) {
auto tmp = static_cast<detail::dynamic_message_data*>(data_.get())->copy();
data_.reset(tmp.release(), false);
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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