Fix our warnings (#1942)

* Mac warnings

* MSVC warnings

* Re-enable websocket tests
This commit is contained in:
Wesley Shillingford 2019-04-30 16:55:13 +01:00 committed by GitHub
commit 797dfe811a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 21 additions and 47 deletions

View file

@ -1730,7 +1730,7 @@ TEST (node, no_voting)
auto & node0 (*system.nodes[0]);
nano::node_config node_config (24001, system.logging);
node_config.enable_voting = false;
auto & node1 = *system.add_node (node_config);
system.add_node (node_config);
auto wallet0 (system.wallet (0));
auto wallet1 (system.wallet (1));

View file

@ -96,7 +96,7 @@ TEST (websocket, confirmation)
ack_ready = false;
std::atomic<bool> confirmation_event_received{ false };
ASSERT_FALSE (node1->websocket_server->any_subscribers (nano::websocket::topic::confirmation));
std::thread client_thread ([&system, &confirmation_event_received]() {
std::thread client_thread ([&confirmation_event_received]() {
// This will expect two results: the acknowledgement of the subscription
// and then the block confirmation message
auto response = websocket_test_call ("::1", "24078",
@ -142,7 +142,7 @@ TEST (websocket, confirmation)
ack_ready = false;
std::atomic<bool> unsubscribe_ack_received{ false };
std::thread client_thread_2 ([&system, &unsubscribe_ack_received]() {
std::thread client_thread_2 ([&unsubscribe_ack_received]() {
auto response = websocket_test_call ("::1", "24078",
R"json({"action": "subscribe", "topic": "confirmation", "ack": true})json", true, true);
ASSERT_TRUE (response);
@ -207,7 +207,7 @@ TEST (websocket, confirmation_options)
ack_ready = false;
std::atomic<bool> client_thread_finished{ false };
ASSERT_FALSE (node1->websocket_server->any_subscribers (nano::websocket::topic::confirmation));
std::thread client_thread ([&system, &client_thread_finished]() {
std::thread client_thread ([&client_thread_finished]() {
// Subscribe initially with a specific invalid account
auto response = websocket_test_call ("::1", "24078",
R"json({"action": "subscribe", "topic": "confirmation", "ack": "true", "options": {"accounts": ["xrb_invalid"]}})json", true, true, 1s);
@ -246,7 +246,7 @@ TEST (websocket, confirmation_options)
ack_ready = false;
std::atomic<bool> client_thread_2_finished{ false };
std::thread client_thread_2 ([&system, &client_thread_2_finished]() {
std::thread client_thread_2 ([&client_thread_2_finished]() {
// Re-subscribe with options for all local wallet accounts
auto response = websocket_test_call ("::1", "24078",
R"json({"action": "subscribe", "topic": "confirmation", "ack": "true", "options": {"all_local_accounts": "true"}})json", true, true);
@ -289,7 +289,7 @@ TEST (websocket, confirmation_options)
ack_ready = false;
std::atomic<bool> client_thread_3_finished{ false };
std::thread client_thread_3 ([&system, &client_thread_3_finished]() {
std::thread client_thread_3 ([&client_thread_3_finished]() {
auto response = websocket_test_call ("::1", "24078",
R"json({"action": "subscribe", "topic": "confirmation", "ack": "true", "options": {"all_local_accounts": "true"}})json", true, true, 1s);
@ -339,7 +339,7 @@ TEST (websocket, vote)
ack_ready = false;
std::atomic<bool> client_thread_finished{ false };
ASSERT_FALSE (node1->websocket_server->any_subscribers (nano::websocket::topic::vote));
std::thread client_thread ([&system, &client_thread_finished]() {
std::thread client_thread ([&client_thread_finished]() {
// This will expect two results: the acknowledgement of the subscription
// and then the vote message
auto response = websocket_test_call ("::1", "24078",
@ -403,7 +403,7 @@ TEST (websocket, vote_options)
ack_ready = false;
std::atomic<bool> client_thread_finished{ false };
ASSERT_FALSE (node1->websocket_server->any_subscribers (nano::websocket::topic::vote));
std::thread client_thread ([&system, &client_thread_finished]() {
std::thread client_thread ([&client_thread_finished]() {
std::ostringstream data;
data << R"json({"action": "subscribe", "topic": "vote", "ack": true, "options": {"representatives": [")json"
<< nano::test_genesis_key.pub.to_account ()
@ -452,7 +452,7 @@ TEST (websocket, vote_options)
std::atomic<bool> client_thread_2_finished{ false };
ASSERT_FALSE (node1->websocket_server->any_subscribers (nano::websocket::topic::vote));
std::thread client_thread_2 ([&system, &client_thread_2_finished]() {
std::thread client_thread_2 ([&client_thread_2_finished]() {
auto response = websocket_test_call ("::1", "24078",
R"json({"action": "subscribe", "topic": "vote", "ack": true, "options": {"representatives": ["xrb_invalid"]}})json", true, true, 1s);

View file

@ -602,7 +602,8 @@ bool nano::uint128_union::decode_dec (std::string const & text, nano::uint128_t
if (!error)
{
auto base10 = boost::multiprecision::cpp_int (10);
auto pow10 = boost::multiprecision::pow (base10, (scale_length - decimal_text.length () - 1));
release_assert ((scale_length - decimal_text.length () - 1) <= std::numeric_limits<unsigned>::max ());
auto pow10 = boost::multiprecision::pow (base10, static_cast<unsigned> (scale_length - decimal_text.length () - 1));
auto decimal_part_num = decimal_part.number ();
auto integer_part_scaled = integer_part.number () * scale;
auto decimal_part_mult_pow = decimal_part_num * pow10;

View file

@ -42,7 +42,7 @@ opencl (opencl_a)
boost::thread::attributes attrs;
nano::thread_attributes::set (attrs);
auto count (network_constants.is_test_network () ? 1 : std::min (max_threads_a, std::max (1u, boost::thread::hardware_concurrency ())));
for (auto i (0); i < count; ++i)
for (auto i (0u); i < count; ++i)
{
auto thread (boost::thread (attrs, [this, i]() {
nano::thread_role::set (nano::thread_role::name::work);

View file

@ -22,8 +22,8 @@ size_t constexpr nano::frontier_req_client::size_frontier;
nano::socket::socket (std::shared_ptr<nano::node> node_a) :
socket_m (node_a->io_ctx),
async_start_time (std::numeric_limits<uint64_t>::max ()),
last_action_time (0),
async_start_time (std::numeric_limits<uint64_t>::max ()),
node (node_a)
{
}

View file

@ -6,7 +6,7 @@
#include <nano/node/logging.hpp>
boost::shared_ptr<boost::log::sinks::synchronous_sink<boost::log::sinks::text_file_backend>> nano::logging::file_sink;
std::atomic_flag nano::logging::logging_already_added{ ATOMIC_FLAG_INIT };
std::atomic_flag nano::logging::logging_already_added ATOMIC_FLAG_INIT;
void nano::logging::init (boost::filesystem::path const & application_path_a)
{

View file

@ -1797,7 +1797,7 @@ void nano::node::unchecked_cleanup ()
{
nano::unchecked_key key (i->first);
nano::unchecked_info info (i->second);
if ((now - info.modified) > config.unchecked_cutoff_time.count ())
if ((now - info.modified) > static_cast<uint64_t> (config.unchecked_cutoff_time.count ()))
{
cleaning_list.push_back (key);
}

View file

@ -352,13 +352,13 @@ nano::error nano::node_config::deserialize_json (bool & upgraded_a, nano::jsonco
auto block_processor_batch_max_time_l (json.get<unsigned long> ("block_processor_batch_max_time"));
block_processor_batch_max_time = std::chrono::milliseconds (block_processor_batch_max_time_l);
unsigned long unchecked_cutoff_time_l (unchecked_cutoff_time.count ());
auto unchecked_cutoff_time_l = static_cast<unsigned long> (unchecked_cutoff_time.count ());
json.get ("unchecked_cutoff_time", unchecked_cutoff_time_l);
unchecked_cutoff_time = std::chrono::seconds (unchecked_cutoff_time_l);
unsigned long tcp_client_timeout_l (tcp_client_timeout.count ());
auto tcp_client_timeout_l = static_cast<unsigned long> (tcp_client_timeout.count ());
json.get ("tcp_client_timeout", tcp_client_timeout_l);
tcp_client_timeout = std::chrono::seconds (tcp_client_timeout_l);
unsigned long tcp_server_timeout_l (tcp_server_timeout.count ());
auto tcp_server_timeout_l = static_cast<unsigned long> (tcp_server_timeout.count ());
json.get ("tcp_server_timeout", tcp_server_timeout_l);
tcp_server_timeout = std::chrono::seconds (tcp_server_timeout_l);

View file

@ -5,8 +5,8 @@
std::chrono::seconds constexpr nano::transport::udp_channels::syn_cookie_cutoff;
nano::transport::channel_udp::channel_udp (nano::transport::udp_channels & channels_a, nano::endpoint const & endpoint_a, unsigned network_version_a) :
endpoint (endpoint_a),
network_version (network_version_a),
endpoint (endpoint_a),
channels (channels_a)
{
assert (endpoint_a.address ().is_v6 ());

View file

@ -5,8 +5,8 @@
#include <nano/node/websocket.hpp>
nano::websocket::confirmation_options::confirmation_options (boost::property_tree::ptree const & options_a, nano::node & node_a) :
all_local_accounts (options_a.get<bool> ("all_local_accounts", false)),
node (node_a)
node (node_a),
all_local_accounts (options_a.get<bool> ("all_local_accounts", false))
{
auto accounts_l (options_a.get_child_optional ("accounts"));
if (accounts_l)

View file

@ -1849,7 +1849,6 @@ TEST (rpc, keepalive)
TEST (rpc, payment_init)
{
nano::system system (24000, 1);
nano::node_init init1;
auto node1 (system.nodes[0]);
nano::keypair wallet_id;
auto wallet (node1->wallets.create (wallet_id.pub));
@ -1877,7 +1876,6 @@ TEST (rpc, payment_init)
TEST (rpc, payment_begin_end)
{
nano::system system (24000, 1);
nano::node_init init1;
auto node1 (system.nodes[0]);
nano::keypair wallet_id;
auto wallet (node1->wallets.create (wallet_id.pub));
@ -1943,7 +1941,6 @@ TEST (rpc, payment_begin_end)
TEST (rpc, payment_end_nonempty)
{
nano::system system (24000, 1);
nano::node_init init1;
auto node1 (system.nodes[0]);
system.wallet (0)->insert_adhoc (nano::test_genesis_key.prv);
auto transaction (node1->wallets.tx_begin ());
@ -1973,7 +1970,6 @@ TEST (rpc, payment_end_nonempty)
TEST (rpc, payment_zero_balance)
{
nano::system system (24000, 1);
nano::node_init init1;
auto node1 (system.nodes[0]);
system.wallet (0)->insert_adhoc (nano::test_genesis_key.prv);
auto transaction (node1->wallets.tx_begin ());
@ -2005,7 +2001,6 @@ TEST (rpc, payment_zero_balance)
TEST (rpc, payment_begin_reuse)
{
nano::system system (24000, 1);
nano::node_init init1;
auto node1 (system.nodes[0]);
nano::keypair wallet_id;
auto wallet (node1->wallets.create (wallet_id.pub));
@ -2061,7 +2056,6 @@ TEST (rpc, payment_begin_reuse)
TEST (rpc, payment_begin_locked)
{
nano::system system (24000, 1);
nano::node_init init1;
auto node1 (system.nodes[0]);
nano::keypair wallet_id;
auto wallet (node1->wallets.create (wallet_id.pub));
@ -2094,7 +2088,6 @@ TEST (rpc, payment_begin_locked)
TEST (rpc, payment_wait)
{
nano::system system (24000, 1);
nano::node_init init1;
auto node1 (system.nodes[0]);
nano::keypair key;
system.wallet (0)->insert_adhoc (nano::test_genesis_key.prv);
@ -2385,7 +2378,6 @@ TEST (rpc, search_pending)
TEST (rpc, version)
{
nano::system system (24000, 1);
nano::node_init init1;
auto node1 (system.nodes[0]);
nano::keypair key;
system.wallet (0)->insert_adhoc (nano::test_genesis_key.prv);
@ -2439,7 +2431,6 @@ TEST (rpc, version)
TEST (rpc, work_generate)
{
nano::system system (24000, 1);
nano::node_init init1;
auto node1 (system.nodes[0]);
nano::keypair key;
system.wallet (0)->insert_adhoc (nano::test_genesis_key.prv);
@ -2471,7 +2462,6 @@ TEST (rpc, work_generate)
TEST (rpc, work_generate_difficulty)
{
nano::system system (24000, 1);
nano::node_init init1;
auto node1 (system.nodes[0]);
enable_ipc_transport_tcp (node1->config.ipc_config.transport_tcp);
nano::node_rpc_config node_rpc_config;
@ -2530,7 +2520,6 @@ TEST (rpc, work_generate_difficulty)
TEST (rpc, work_cancel)
{
nano::system system (24000, 1);
nano::node_init init1;
auto & node1 (*system.nodes[0]);
nano::keypair key;
system.wallet (0)->insert_adhoc (nano::test_genesis_key.prv);
@ -2567,7 +2556,6 @@ TEST (rpc, work_cancel)
TEST (rpc, work_peer_bad)
{
nano::system system (24000, 2);
nano::node_init init1;
auto & node1 (*system.nodes[0]);
auto & node2 (*system.nodes[1]);
nano::keypair key;
@ -2596,7 +2584,6 @@ TEST (rpc, work_peer_bad)
TEST (rpc, work_peer_one)
{
nano::system system (24000, 2);
nano::node_init init1;
auto & node1 (*system.nodes[0]);
auto & node2 (*system.nodes[1]);
nano::keypair key;
@ -2628,7 +2615,6 @@ TEST (rpc, work_peer_many)
nano::system system2 (24001, 1);
nano::system system3 (24002, 1);
nano::system system4 (24003, 1);
nano::node_init init1;
auto & node1 (*system1.nodes[0]);
auto & node2 (*system2.nodes[0]);
auto & node3 (*system3.nodes[0]);
@ -2680,7 +2666,6 @@ TEST (rpc, work_peer_many)
TEST (rpc, block_count)
{
nano::system system (24000, 1);
nano::node_init init1;
auto & node1 (*system.nodes[0]);
enable_ipc_transport_tcp (node1.config.ipc_config.transport_tcp);
nano::node_rpc_config node_rpc_config;
@ -2705,7 +2690,6 @@ TEST (rpc, block_count)
TEST (rpc, frontier_count)
{
nano::system system (24000, 1);
nano::node_init init1;
auto & node1 (*system.nodes[0]);
enable_ipc_transport_tcp (node1.config.ipc_config.transport_tcp);
nano::node_rpc_config node_rpc_config;
@ -2729,7 +2713,6 @@ TEST (rpc, frontier_count)
TEST (rpc, account_count)
{
nano::system system (24000, 1);
nano::node_init init1;
auto & node1 (*system.nodes[0]);
enable_ipc_transport_tcp (node1.config.ipc_config.transport_tcp);
nano::node_rpc_config node_rpc_config;
@ -2753,7 +2736,6 @@ TEST (rpc, account_count)
TEST (rpc, available_supply)
{
nano::system system (24000, 1);
nano::node_init init1;
auto & node1 (*system.nodes[0]);
enable_ipc_transport_tcp (node1.config.ipc_config.transport_tcp);
nano::node_rpc_config node_rpc_config;
@ -2797,7 +2779,6 @@ TEST (rpc, available_supply)
TEST (rpc, mrai_to_raw)
{
nano::system system (24000, 1);
nano::node_init init1;
auto & node1 (*system.nodes[0]);
enable_ipc_transport_tcp (node1.config.ipc_config.transport_tcp);
nano::node_rpc_config node_rpc_config;
@ -2822,7 +2803,6 @@ TEST (rpc, mrai_to_raw)
TEST (rpc, mrai_from_raw)
{
nano::system system (24000, 1);
nano::node_init init1;
auto & node1 (*system.nodes[0]);
enable_ipc_transport_tcp (node1.config.ipc_config.transport_tcp);
nano::node_rpc_config node_rpc_config;
@ -2847,7 +2827,6 @@ TEST (rpc, mrai_from_raw)
TEST (rpc, krai_to_raw)
{
nano::system system (24000, 1);
nano::node_init init1;
auto & node1 (*system.nodes[0]);
enable_ipc_transport_tcp (node1.config.ipc_config.transport_tcp);
nano::node_rpc_config node_rpc_config;
@ -2872,7 +2851,6 @@ TEST (rpc, krai_to_raw)
TEST (rpc, krai_from_raw)
{
nano::system system (24000, 1);
nano::node_init init1;
auto & node1 (*system.nodes[0]);
enable_ipc_transport_tcp (node1.config.ipc_config.transport_tcp);
nano::node_rpc_config node_rpc_config;
@ -2897,7 +2875,6 @@ TEST (rpc, krai_from_raw)
TEST (rpc, nano_to_raw)
{
nano::system system (24000, 1);
nano::node_init init1;
auto & node1 (*system.nodes[0]);
enable_ipc_transport_tcp (node1.config.ipc_config.transport_tcp);
nano::node_rpc_config node_rpc_config;
@ -2922,7 +2899,6 @@ TEST (rpc, nano_to_raw)
TEST (rpc, nano_from_raw)
{
nano::system system (24000, 1);
nano::node_init init1;
auto & node1 (*system.nodes[0]);
enable_ipc_transport_tcp (node1.config.ipc_config.transport_tcp);
nano::node_rpc_config node_rpc_config;
@ -3209,7 +3185,6 @@ TEST (rpc, work_validate)
{
nano::network_params params;
nano::system system (24000, 1);
nano::node_init init1;
auto & node1 (*system.nodes[0]);
nano::keypair key;
system.wallet (0)->insert_adhoc (nano::test_genesis_key.prv);
@ -4549,7 +4524,6 @@ TEST (rpc, blocks_info_subtype)
TEST (rpc, work_peers_all)
{
nano::system system (24000, 1);
nano::node_init init1;
auto & node1 (*system.nodes[0]);
system.wallet (0)->insert_adhoc (nano::test_genesis_key.prv);
enable_ipc_transport_tcp (node1.config.ipc_config.transport_tcp);

View file

@ -362,7 +362,6 @@ TEST (broadcast, sqrt_broadcast_simulate)
TEST (peer_container, random_set)
{
auto loopback (boost::asio::ip::address_v6::loopback ());
nano::system system (24000, 1);
auto old (std::chrono::steady_clock::now ());
auto current (std::chrono::steady_clock::now ());