Commit 01b82717 authored by Dominik Charousset's avatar Dominik Charousset

Fix build on GCC and fix warnings

parent e07934c8
......@@ -114,7 +114,7 @@ public:
template <size_t... Is>
bool invoke_impl(detail::invoke_result_visitor& f, message& msg,
std::index_sequence<Is...>) {
auto dispatch = [&](auto& fun) {
[[maybe_unused]] auto dispatch = [&](auto& fun) {
using fun_type = std::decay_t<decltype(fun)>;
using trait = get_callable_trait_t<fun_type>;
auto arg_types = to_type_id_list<typename trait::decayed_arg_types>();
......
......@@ -35,7 +35,7 @@ void profiled_send(Self* self, SelfHandle&& src, const Handle& dst,
template <class Self, class SelfHandle, class Handle, class... Ts>
void profiled_send(Self* self, SelfHandle&& src, const Handle& dst,
actor_clock& clock, actor_clock::time_point timeout,
message_id msg_id, Ts&&... xs) {
[[maybe_unused]] message_id msg_id, Ts&&... xs) {
if (dst) {
if constexpr (std::is_same<Handle, group>::value) {
clock.schedule_message(timeout, dst, std::forward<SelfHandle>(src),
......
......@@ -61,8 +61,7 @@ template <class T, class Inspector, class Obj>
class has_static_apply {
private:
template <class U>
static auto sfinae(Inspector* f, Obj* x)
-> decltype(U::apply(*f, *x), std::true_type());
static auto sfinae(Inspector* f, Obj* x) -> decltype(U::apply(*f, *x));
template <class U>
static auto sfinae(...) -> std::false_type;
......@@ -70,7 +69,8 @@ private:
using sfinae_type = decltype(sfinae<T>(nullptr, nullptr));
public:
static constexpr bool value = sfinae_type::value;
static constexpr bool value
= !std::is_same<sfinae_type, std::false_type>::value;
};
template <class T, class Inspector, class Obj>
......
......@@ -8,7 +8,9 @@
namespace caf {
class CAF_CORE_EXPORT [[deprecated]] memory_managed {
class [[deprecated]] memory_managed;
class CAF_CORE_EXPORT memory_managed {
public:
virtual void request_deletion(bool decremented_rc) const noexcept;
......
......@@ -19,4 +19,5 @@ struct type_name_t : annotation {
[[deprecated]] type_name_t constexpr type_name(const char* cstr) {
return {cstr};
}
} // namespace caf::meta
......@@ -66,7 +66,7 @@ constexpr size_t max_value = static_cast<size_t>(std::numeric_limits<T>::max());
bool binary_serializer::begin_field(string_view, span<const type_id_t> types,
size_t index) {
CAF_ASSERT(index >= 0 && index < types.size());
CAF_ASSERT(index < types.size());
if (types.size() < max_value<int8_t>) {
return value(static_cast<int8_t>(index));
} else if (types.size() < max_value<int16_t>) {
......@@ -91,7 +91,7 @@ T compress_index(bool is_present, size_t value) {
bool binary_serializer::begin_field(string_view, bool is_present,
span<const type_id_t> types, size_t index) {
CAF_ASSERT(!is_present || (index >= 0 && index < types.size()));
CAF_ASSERT(!is_present || index < types.size());
if (types.size() < max_value<int8_t>) {
return value(compress_index<int8_t>(is_present, index));
} else if (types.size() < max_value<int16_t>) {
......
......@@ -17,7 +17,7 @@ using namespace std::string_literals;
namespace {
using typed_adder_actor
= typed_actor<reacts_to<add_atom, int>, replies_to<get_atom>::with<int>>;
= typed_actor<result<void>(add_atom, int), result<int>(get_atom)>;
struct counter {
int value = 0;
......@@ -49,9 +49,9 @@ typed_adder(typed_adder_actor::stateful_pointer<counter> self) {
};
}
class typed_adder_class : public typed_adder_actor::stateful_base<counter> {
class typed_adder_class : public typed_adder_actor::stateful_impl<counter> {
public:
using super = typed_adder_actor::stateful_base<counter>;
using super = typed_adder_actor::stateful_impl<counter>;
typed_adder_class(actor_config& cfg) : super(cfg) {
// nop
......@@ -185,7 +185,7 @@ CAF_TEST(typed actors can use typed_actor_pointer as self pointer) {
[=](get_atom) { return value; });
}
};
using actor_type = typed_adder_actor::stateful_base<state_type>;
using actor_type = typed_adder_actor::stateful_impl<state_type>;
auto testee = sys.spawn<actor_type>(10);
auto& state = deref<actor_type>(testee).state;
CAF_CHECK(state.self == &deref<actor_type>(testee));
......
......@@ -280,9 +280,9 @@ types shown below to grant access to derived types.
+------------------------+---------------------------------------------------------------+
| ``pointer`` | A pointer of type ``base*``. |
+------------------------+---------------------------------------------------------------+
| ``stateful_base<T>`` | See stateful-actor_. |
| ``stateful_impl<T>`` | See stateful-actor_. |
+------------------------+---------------------------------------------------------------+
| ``stateful_pointer<T>``| A pointer of type ``stateful_base<T>*``. |
| ``stateful_pointer<T>``| A pointer of type ``stateful_impl<T>*``. |
+------------------------+---------------------------------------------------------------+
| ``extend<Ts...>`` | Extend this typed actor with ``Ts...``. |
+------------------------+---------------------------------------------------------------+
......
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