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

Fix build on GCC and fix warnings

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