Commit 6c921adf authored by Dominik Charousset's avatar Dominik Charousset

Fix maybe-uninitialized warnings

parent b2f9a1c9
...@@ -198,7 +198,7 @@ public: ...@@ -198,7 +198,7 @@ public:
lhs = static_cast<underlying>(rhs); lhs = static_cast<underlying>(rhs);
} }
} assign; } assign;
underlying tmp; underlying tmp = 0;
return convert_apply(dref(), x, tmp, assign); return convert_apply(dref(), x, tmp, assign);
} }
...@@ -221,7 +221,7 @@ public: ...@@ -221,7 +221,7 @@ public:
lhs = rhs ? 1 : 0; lhs = rhs ? 1 : 0;
} }
} assign; } assign;
uint8_t tmp; uint8_t tmp = 0;
return convert_apply(dref(), x, tmp, assign); return convert_apply(dref(), x, tmp, assign);
} }
...@@ -288,7 +288,7 @@ public: ...@@ -288,7 +288,7 @@ public:
xs.clear(); xs.clear();
auto insert_iter = std::inserter(xs, xs.end()); auto insert_iter = std::inserter(xs, xs.end());
for (size_t i = 0; i < num_elements; ++i) { for (size_t i = 0; i < num_elements; ++i) {
typename std::remove_const<typename T::value_type>::type x; typename std::remove_const<typename T::value_type>::type x = {};
auto err = apply(x); auto err = apply(x);
if (err) if (err)
return err; return err;
...@@ -445,7 +445,7 @@ public: ...@@ -445,7 +445,7 @@ public:
lhs = rhs.count(); lhs = rhs.count();
} }
} assign; } assign;
Rep tmp; Rep tmp = 0;
return convert_apply(dref(), x, tmp, assign); return convert_apply(dref(), x, tmp, assign);
} }
......
...@@ -237,7 +237,7 @@ struct binary_serialization_policy { ...@@ -237,7 +237,7 @@ struct binary_serialization_policy {
binary_serializer f{&context, buf}; binary_serializer f{&context, buf};
f(x); f(x);
binary_deserializer g{&context, buf}; binary_deserializer g{&context, buf};
T y; auto y = T{};
g(y); g(y);
CAF_CHECK_EQUAL(x, y); CAF_CHECK_EQUAL(x, y);
return detail::safe_equal(x, y); return detail::safe_equal(x, y);
...@@ -252,5 +252,4 @@ CAF_TEST(binary_serialization_inspectors) { ...@@ -252,5 +252,4 @@ CAF_TEST(binary_serialization_inspectors) {
scoped_execution_unit context; scoped_execution_unit context;
binary_serialization_policy p{context}; binary_serialization_policy p{context};
test_impl(p); test_impl(p);
} }
...@@ -179,7 +179,7 @@ struct fixture { ...@@ -179,7 +179,7 @@ struct fixture {
// serializes `x` and then deserializes and returns the serialized value // serializes `x` and then deserializes and returns the serialized value
template <class T> template <class T>
T roundtrip(T x) { T roundtrip(T x) {
T result; auto result = T{};
deserialize(serialize(x), result); deserialize(serialize(x), result);
return result; return result;
} }
...@@ -288,7 +288,7 @@ CAF_TEST(timestamp_values) { ...@@ -288,7 +288,7 @@ CAF_TEST(timestamp_values) {
CAF_TEST(enum_classes) { CAF_TEST(enum_classes) {
auto buf = serialize(te); auto buf = serialize(te);
test_enum x; auto x = static_cast<test_enum>(0);
deserialize(buf, x); deserialize(buf, x);
CAF_CHECK_EQUAL(te, x); CAF_CHECK_EQUAL(te, x);
} }
...@@ -374,7 +374,7 @@ CAF_TEST(messages) { ...@@ -374,7 +374,7 @@ CAF_TEST(messages) {
CAF_TEST(multiple_messages) { CAF_TEST(multiple_messages) {
auto m = make_message(rs, te); auto m = make_message(rs, te);
auto buf = serialize(te, m, msg); auto buf = serialize(te, m, msg);
test_enum t; auto t = static_cast<test_enum>(0);
message m1; message m1;
message m2; message m2;
deserialize(buf, t, m1, m2); deserialize(buf, t, m1, m2);
......
...@@ -120,7 +120,7 @@ peer::behavior_type peer_fun(peer::broker_pointer self, connection_handle hdl, ...@@ -120,7 +120,7 @@ peer::behavior_type peer_fun(peer::broker_pointer self, connection_handle hdl,
}, },
[=](const new_data_msg& msg) { [=](const new_data_msg& msg) {
CAF_MESSAGE("received new_data_msg"); CAF_MESSAGE("received new_data_msg");
atom_value x; atom_value x = static_cast<atom_value>(0);
int y; int y;
binary_deserializer source{self->system(), msg.buf}; binary_deserializer source{self->system(), msg.buf};
auto e = source(x, y); auto e = source(x, y);
......
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