From e344efefb739196f0e75b86ee0e23388c02459ba Mon Sep 17 00:00:00 2001 From: anonimal Date: Wed, 20 Feb 2019 04:11:33 +0000 Subject: [PATCH 1/6] currency_core: resolve build warnings (-Wlogical-not-parentheses) --- src/currency_core/blockchain_storage.cpp | 2 +- src/currency_core/currency_format_utils.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index dfe9c6a4..13d7d90c 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -3544,7 +3544,7 @@ bool blockchain_storage::check_tx_inputs(const transaction& tx, const crypto::ha if (!m_is_in_checkpoint_zone) { CHECK_AND_ASSERT_MES(tx.signatures.size() == sig_index, false, "tx signatures count differs from inputs"); - if (!get_tx_flags(tx)&TX_FLAG_SIGNATURE_MODE_SEPARATE) + if (!(get_tx_flags(tx) & TX_FLAG_SIGNATURE_MODE_SEPARATE)) { bool r = validate_attachment_info(tx.extra, tx.attachment, false); CHECK_AND_ASSERT_MES(r, false, "Failed to validate attachments in tx " << tx_prefix_hash << ": incorrect extra_attachment_info in tx.extra"); diff --git a/src/currency_core/currency_format_utils.cpp b/src/currency_core/currency_format_utils.cpp index 673092ca..ad612fe8 100644 --- a/src/currency_core/currency_format_utils.cpp +++ b/src/currency_core/currency_format_utils.cpp @@ -1109,7 +1109,7 @@ namespace currency att_count++; } } - if (!flags&TX_FLAG_SIGNATURE_MODE_SEPARATE) + if (!(flags & TX_FLAG_SIGNATURE_MODE_SEPARATE)) { //take hash from attachment and put into extra if (tx.attachment.size()) @@ -2374,7 +2374,7 @@ namespace currency //--------------------------------------------------------------- bool is_pos_block(const block& b) { - if (!b.flags&CURRENCY_BLOCK_FLAG_POS_BLOCK) + if (!(b.flags & CURRENCY_BLOCK_FLAG_POS_BLOCK)) return false; return is_pos_block(b.miner_tx); } From 17373549c08008ec2de5fc572044a4dad0832c2c Mon Sep 17 00:00:00 2001 From: anonimal Date: Wed, 20 Feb 2019 07:19:02 +0000 Subject: [PATCH 2/6] zano: resolve build warnings (-Wdelete-non-virtual-dtor) --- src/currency_core/bc_attachments_service_manager.h | 2 ++ src/simplewallet/simplewallet.h | 2 +- src/wallet/core_default_rpc_proxy.h | 2 +- src/wallet/core_rpc_proxy.h | 2 ++ src/wallet/wallet2.h | 4 +++- tests/core_tests/test_core_proxy.h | 2 ++ 6 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/currency_core/bc_attachments_service_manager.h b/src/currency_core/bc_attachments_service_manager.h index 8f95d699..bd4f2640 100644 --- a/src/currency_core/bc_attachments_service_manager.h +++ b/src/currency_core/bc_attachments_service_manager.h @@ -12,6 +12,8 @@ namespace currency { struct i_bc_service { + virtual ~i_bc_service() = default; + virtual std::string get_id() = 0; virtual bool init(const std::string& config_folder, const boost::program_options::variables_map& vm) = 0; virtual bool deinit() = 0; diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h index 2b138841..70fa3f85 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -22,7 +22,7 @@ namespace currency /************************************************************************/ /* */ /************************************************************************/ - class simple_wallet : public tools::i_wallet2_callback, + class simple_wallet final : public tools::i_wallet2_callback, public std::enable_shared_from_this { public: diff --git a/src/wallet/core_default_rpc_proxy.h b/src/wallet/core_default_rpc_proxy.h index 6ac1b111..ec43ab5f 100644 --- a/src/wallet/core_default_rpc_proxy.h +++ b/src/wallet/core_default_rpc_proxy.h @@ -16,7 +16,7 @@ namespace tools { - class default_http_core_proxy: public i_core_proxy + class default_http_core_proxy final : public i_core_proxy { public: diff --git a/src/wallet/core_rpc_proxy.h b/src/wallet/core_rpc_proxy.h index 71a06eff..9ea481f2 100644 --- a/src/wallet/core_rpc_proxy.h +++ b/src/wallet/core_rpc_proxy.h @@ -16,6 +16,8 @@ namespace tools */ struct i_core_proxy { + virtual ~i_core_proxy() = default; + virtual bool set_connection_addr(const std::string& url){ return false; } virtual bool call_COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES(const currency::COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES::request& rqt, currency::COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES::response& rsp){ return false; } virtual bool call_COMMAND_RPC_GET_BLOCKS_FAST(const currency::COMMAND_RPC_GET_BLOCKS_FAST::request& rqt, currency::COMMAND_RPC_GET_BLOCKS_FAST::response& rsp){ return false; } diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 819fde3f..66440855 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -68,6 +68,8 @@ namespace tools class i_wallet2_callback { public: + virtual ~i_wallet2_callback() = default; + virtual void on_new_block(uint64_t /*height*/, const currency::block& /*block*/) {} virtual void on_transfer2(const wallet_rpc::wallet_transfer_info& wti, uint64_t balance, uint64_t unlocked_balance, uint64_t total_mined) {} virtual void on_pos_block_found(const currency::block& /*block*/) {} @@ -1204,4 +1206,4 @@ namespace tools #undef LOG_DEFAULT_CHANNEL #define LOG_DEFAULT_CHANNEL "wallet" -ENABLE_CHANNEL_BY_DEFAULT("wallet"); \ No newline at end of file +ENABLE_CHANNEL_BY_DEFAULT("wallet"); diff --git a/tests/core_tests/test_core_proxy.h b/tests/core_tests/test_core_proxy.h index eaad9e51..83694ecd 100644 --- a/tests/core_tests/test_core_proxy.h +++ b/tests/core_tests/test_core_proxy.h @@ -12,6 +12,8 @@ class test_core_listener { public: + virtual ~test_core_listener() = default; + virtual void before_tx_pushed_to_core(const currency::transaction& tx, const currency::blobdata& blob, currency::core& c, bool invalid_tx = false) {} // invalid_tx is true when processing a tx, marked as invalid in a test virtual void before_block_pushed_to_core(const currency::block& block, const currency::blobdata& blob, currency::core& c) {} }; From 5ac0b225cfdbc8881f86df054f68fc037b65a24e Mon Sep 17 00:00:00 2001 From: anonimal Date: Wed, 20 Feb 2019 07:21:48 +0000 Subject: [PATCH 3/6] core_fast_rpc_proxy: resolve build warning (-Winconsistent-missing-override) --- src/gui/qt-daemon/application/core_fast_rpc_proxy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/qt-daemon/application/core_fast_rpc_proxy.h b/src/gui/qt-daemon/application/core_fast_rpc_proxy.h index 39f371e1..ca189240 100644 --- a/src/gui/qt-daemon/application/core_fast_rpc_proxy.h +++ b/src/gui/qt-daemon/application/core_fast_rpc_proxy.h @@ -124,7 +124,7 @@ namespace tools return m_rpc.on_get_current_core_tx_expiration_median(req, res, m_cntxt_stub); } //------------------------------------------------------------------------------------------------------------------------------ - bool call_COMMAND_RPC_GET_POOL_INFO(const currency::COMMAND_RPC_GET_POOL_INFO::request& req, currency::COMMAND_RPC_GET_POOL_INFO::response& res) + bool call_COMMAND_RPC_GET_POOL_INFO(const currency::COMMAND_RPC_GET_POOL_INFO::request& req, currency::COMMAND_RPC_GET_POOL_INFO::response& res) override { return m_rpc.on_get_pool_info(req, res, m_cntxt_stub); } From eec9c9e45c3daf8a9f1aa2145ebb6a221f65c47a Mon Sep 17 00:00:00 2001 From: anonimal Date: Wed, 20 Feb 2019 07:30:44 +0000 Subject: [PATCH 4/6] unit_tests: resolve epee build warning (-Wunused-lambda-capture) The local variable is not required to be captured for this impl. --- tests/unit_tests/epee_levin_protocol_handler_async.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit_tests/epee_levin_protocol_handler_async.cpp b/tests/unit_tests/epee_levin_protocol_handler_async.cpp index 996451a8..b256b12c 100644 --- a/tests/unit_tests/epee_levin_protocol_handler_async.cpp +++ b/tests/unit_tests/epee_levin_protocol_handler_async.cpp @@ -264,7 +264,7 @@ TEST_F(positive_test_connection_to_levin_protocol_handler_calls, handler_initial TEST_F(positive_test_connection_to_levin_protocol_handler_calls, concurent_handler_initialization_and_destruction_is_correct) { const size_t connection_count = 10000; - auto create_and_destroy_connections = [this, connection_count]() + auto create_and_destroy_connections = [this]() { std::vector connections(connection_count); for (size_t i = 0; i < connection_count; ++i) From f91bce9a9167c6db73289462cae99ad03f82c512 Mon Sep 17 00:00:00 2001 From: anonimal Date: Wed, 20 Feb 2019 07:33:26 +0000 Subject: [PATCH 5/6] core_tests: resolve build warning (-Wbackslash-newline-escape) --- tests/core_tests/pos_validation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/core_tests/pos_validation.cpp b/tests/core_tests/pos_validation.cpp index 9c45addf..a137fc8f 100644 --- a/tests/core_tests/pos_validation.cpp +++ b/tests/core_tests/pos_validation.cpp @@ -989,7 +989,7 @@ bool pos_altblocks_validation::generate(std::vector& events) c // || \- (2a)- #3a#- | <- alt chain // |+--------------+ \ | \ PoS block 2a uses stake already spent in main chain (okay) // +---------------|-------+ \ PoS block 3a uses stake already spent in current alt chain (fail) - // | \ \ + // | \ \ // | \ ...... (2br)- (3b)- #4b# <- alt chain // | | // +-----------------------+ PoS block 3b uses as stake an output, created in current alt chain (2a) From 86f93e3b939271051728d62abdde0ef5a771f6a7 Mon Sep 17 00:00:00 2001 From: anonimal Date: Wed, 20 Feb 2019 07:45:41 +0000 Subject: [PATCH 6/6] simplewallet: resolve build warning (-Wunused-lambda-capture) --- src/simplewallet/simplewallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 845c2ec2..b885ea86 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -1401,7 +1401,7 @@ int main(int argc, char* argv[]) bool r = wrpc.init(vm); CHECK_AND_ASSERT_MES(r, 1, "Failed to initialize wallet rpc server"); - tools::signal_handler::install([&wrpc, &wal] { + tools::signal_handler::install([&wrpc/*, &wal*/ /* TODO(unassigned): use? */] { wrpc.send_stop_signal(); }); LOG_PRINT_L0("Starting wallet rpc server");