From 16cd06db1cd2b8dada165c009de0d4d5c5b8474a Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Tue, 27 Sep 2022 16:28:08 -0500 Subject: [PATCH 1/3] GH-229 Remove #pragma to ignore strict-aliasing warning from chain_plugin. Also removed pragma to ignore unused-variable from config.hpp. All other changes were to address the removal the ignore unused-variable. --- libraries/chain/apply_context.cpp | 1 - libraries/chain/controller.cpp | 3 ++- libraries/chain/eosio_contract.cpp | 4 +--- libraries/chain/fork_database.cpp | 2 -- libraries/chain/include/eosio/chain/config.hpp | 2 -- libraries/chain/webassembly/softfloat.cpp | 1 - plugins/chain_plugin/chain_plugin.cpp | 5 ----- plugins/net_plugin/net_plugin.cpp | 6 +++--- plugins/trace_api_plugin/store_provider.cpp | 2 +- .../trace_api_plugin/test/test_extraction.cpp | 10 +--------- .../trace_api_plugin/test/test_trace_file.cpp | 1 - plugins/trace_api_plugin/trace_api_plugin.cpp | 1 - .../txn_test_gen_plugin/txn_test_gen_plugin.cpp | 1 - programs/cleos/main.cpp | 4 +--- programs/eosio-launcher/main.cpp | 2 -- unittests/abi_tests.cpp | 3 +-- unittests/api_tests.cpp | 2 +- unittests/auth_tests.cpp | 2 +- unittests/bootseq_tests.cpp | 2 +- unittests/deep_mind_tests.cpp | 2 +- unittests/delay_tests.cpp | 2 -- unittests/snapshot_tests.cpp | 2 +- unittests/wasm_config_tests.cpp | 2 +- unittests/wasm_tests.cpp | 16 ++++++++-------- 24 files changed, 24 insertions(+), 54 deletions(-) diff --git a/libraries/chain/apply_context.cpp b/libraries/chain/apply_context.cpp index 4a9611458c..577b6f7c7c 100644 --- a/libraries/chain/apply_context.cpp +++ b/libraries/chain/apply_context.cpp @@ -56,7 +56,6 @@ void apply_context::exec_one() digest_type act_digest; - const auto& cfg = control.get_global_properties().configuration; const account_metadata_object* receiver_account = nullptr; auto handle_exception = [&](const auto& e) diff --git a/libraries/chain/controller.cpp b/libraries/chain/controller.cpp index 3e1c3c746b..948ac77036 100644 --- a/libraries/chain/controller.cpp +++ b/libraries/chain/controller.cpp @@ -1066,11 +1066,12 @@ struct controller_impl { active_permission.id, active_producers_authority, genesis.initial_timestamp ); - const auto& minority_permission = authorization.create_permission( config::producers_account_name, + authorization.create_permission( config::producers_account_name, config::minority_producers_permission_name, majority_permission.id, active_producers_authority, genesis.initial_timestamp ); + } // The returned scoped_exit should not exceed the lifetime of the pending which existed when make_block_restore_point was called. diff --git a/libraries/chain/eosio_contract.cpp b/libraries/chain/eosio_contract.cpp index d1245ad32f..e3a185e1c3 100644 --- a/libraries/chain/eosio_contract.cpp +++ b/libraries/chain/eosio_contract.cpp @@ -93,7 +93,7 @@ void apply_eosio_newaccount(apply_context& context) { "Cannot create account named ${name}, as that name is already taken", ("name", create.name)); - const auto& new_account = db.create([&](auto& a) { + db.create([&](auto& a) { a.name = create.name; a.creation_date = context.control.pending_block_time(); }); @@ -127,8 +127,6 @@ void apply_eosio_newaccount(apply_context& context) { } FC_CAPTURE_AND_RETHROW( (create) ) } void apply_eosio_setcode(apply_context& context) { - const auto& cfg = context.control.get_global_properties().configuration; - auto& db = context.db; auto act = context.get_action().data_as(); context.require_authorization(act.account); diff --git a/libraries/chain/fork_database.cpp b/libraries/chain/fork_database.cpp index e14975cb37..05af8746be 100644 --- a/libraries/chain/fork_database.cpp +++ b/libraries/chain/fork_database.cpp @@ -283,8 +283,6 @@ namespace eosio { namespace chain { } block_header_state_ptr fork_database::get_block_header( const block_id_type& id )const { - const auto& by_id_idx = my->index.get(); - if( my->root->id == id ) { return my->root; } diff --git a/libraries/chain/include/eosio/chain/config.hpp b/libraries/chain/include/eosio/chain/config.hpp index bcdfe2b341..9c45aaf849 100644 --- a/libraries/chain/include/eosio/chain/config.hpp +++ b/libraries/chain/include/eosio/chain/config.hpp @@ -3,8 +3,6 @@ #include #include -#pragma GCC diagnostic ignored "-Wunused-variable" - namespace eosio { namespace chain { namespace config { typedef __uint128_t uint128_t; diff --git a/libraries/chain/webassembly/softfloat.cpp b/libraries/chain/webassembly/softfloat.cpp index a5610e8280..75de7240ec 100644 --- a/libraries/chain/webassembly/softfloat.cpp +++ b/libraries/chain/webassembly/softfloat.cpp @@ -276,7 +276,6 @@ namespace eosio { namespace chain { namespace webassembly { float64_t ret; int e = a.v >> 52 & 0x7FF; float64_t y; - double de = 1/DBL_EPSILON; if ( a.v == 0x8000000000000000) { return af; } diff --git a/plugins/chain_plugin/chain_plugin.cpp b/plugins/chain_plugin/chain_plugin.cpp index a4e3d6d37f..1e70f94bc7 100644 --- a/plugins/chain_plugin/chain_plugin.cpp +++ b/plugins/chain_plugin/chain_plugin.cpp @@ -554,8 +554,6 @@ protocol_feature_set initialize_protocol_features( const fc::path& p, bool popul } auto output_protocol_feature = [&p]( const builtin_protocol_feature& f, const digest_type& feature_digest ) { - static constexpr int max_tries = 10; - string filename( "BUILTIN-" ); filename += builtin_protocol_feature_codename( f.get_codename() ); filename += ".json"; @@ -1678,8 +1676,6 @@ string get_table_type( const abi_def& abi, const name& table_name ) { read_only::get_table_rows_result read_only::get_table_rows( const read_only::get_table_rows_params& p )const { const abi_def abi = eosio::chain_apis::get_abi( db, p.code ); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstrict-aliasing" bool primary = false; auto table_with_index = get_table_index_name( p, primary ); if( primary ) { @@ -1739,7 +1735,6 @@ read_only::get_table_rows_result read_only::get_table_rows( const read_only::get } EOS_ASSERT(false, chain::contract_table_query_exception, "Unsupported secondary index type: ${t}", ("t", p.key_type)); } -#pragma GCC diagnostic pop } read_only::get_table_by_scope_result read_only::get_table_by_scope( const read_only::get_table_by_scope_params& p )const { diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index 5a262716bd..d04c5646b6 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -416,6 +416,8 @@ namespace eosio { * If there is a change to network protocol or behavior, increment net version to identify * the need for compatibility hooks */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-variable" constexpr uint16_t proto_base = 0; constexpr uint16_t proto_explicit_sync = 1; // version at time of eosio 1.0 constexpr uint16_t proto_block_id_notify = 2; // reserved. feature was removed. next net_version should be 3 @@ -424,6 +426,7 @@ namespace eosio { constexpr uint16_t proto_dup_goaway_resolution = 5; // eosio 2.1: support peer address based duplicate connection resolution constexpr uint16_t proto_dup_node_id_goaway = 6; // eosio 2.1: support peer node_id based duplicate connection resolution constexpr uint16_t proto_leap_initial = 7; // leap client, needed because none of the 2.1 versions are supported +#pragma GCC diagnostic pop constexpr uint16_t net_version_max = proto_leap_initial; @@ -2672,7 +2675,6 @@ namespace eosio { const unsigned long trx_in_progress_sz = this->trx_in_progress_size.load(); auto ds = pending_message_buffer.create_datastream(); - const auto buff_size_start = pending_message_buffer.bytes_to_read(); unsigned_int which{}; fc::raw::unpack( ds, which ); shared_ptr ptr = std::make_shared(); @@ -3348,7 +3350,6 @@ namespace eosio { // called from application thread void net_plugin_impl::on_accepted_block(const block_state_ptr& bs) { update_chain_info(); - controller& cc = chain_plug->chain(); dispatcher->strand.post( [this, bs]() { fc_dlog( logger, "signaled accepted_block, blk num = ${num}, id = ${id}", ("num", bs->block_num)("id", bs->id) ); @@ -3475,7 +3476,6 @@ namespace eosio { bool connection::populate_handshake( handshake_message& hello ) { namespace sc = std::chrono; hello.network_version = net_version_base + net_version; - const auto prev_head_id = hello.head_id; uint32_t lib, head; std::tie( lib, std::ignore, head, hello.last_irreversible_block_id, std::ignore, hello.head_id ) = my_impl->get_chain_info(); diff --git a/plugins/trace_api_plugin/store_provider.cpp b/plugins/trace_api_plugin/store_provider.cpp index f87f79b006..3c0b14b009 100644 --- a/plugins/trace_api_plugin/store_provider.cpp +++ b/plugins/trace_api_plugin/store_provider.cpp @@ -74,7 +74,7 @@ namespace eosio::trace_api { get_block_t store_provider::get_block(uint32_t block_height, const yield_function& yield) { std::optional trace_offset; bool irreversible = false; - uint64_t offset = scan_metadata_log_from(block_height, 0, [&block_height, &trace_offset, &irreversible](const metadata_log_entry& e) -> bool { + scan_metadata_log_from(block_height, 0, [&block_height, &trace_offset, &irreversible](const metadata_log_entry& e) -> bool { if (std::holds_alternative(e)) { const auto& block = std::get(e); if (block.number == block_height) { diff --git a/plugins/trace_api_plugin/test/test_extraction.cpp b/plugins/trace_api_plugin/test/test_extraction.cpp index 004371b72b..e49576d9b1 100644 --- a/plugins/trace_api_plugin/test/test_extraction.cpp +++ b/plugins/trace_api_plugin/test/test_extraction.cpp @@ -122,9 +122,7 @@ struct extraction_test_fixture { } void append_trx_ids(const block_trxs_entry& tt){ - for (const auto& id : tt.ids) { - fixture.id_log[tt.block_num] = tt.ids; - } + fixture.id_log[tt.block_num] = tt.ids; } extraction_test_fixture& fixture; @@ -175,8 +173,6 @@ BOOST_AUTO_TEST_SUITE(block_extraction) { chain::packed_transaction(ptrx1) } ); signal_accepted_block( bsp1 ); - const uint32_t expected_lib = 0; - const std::vector expected_action_traces { { { @@ -269,8 +265,6 @@ BOOST_AUTO_TEST_SUITE(block_extraction) { chain::packed_transaction(ptrx1), chain::packed_transaction(ptrx2), chain::packed_transaction(ptrx3) } ); signal_accepted_block( bsp1 ); - const uint32_t expected_lib = 0; - const std::vector expected_action_trace1 { { { @@ -383,8 +377,6 @@ BOOST_AUTO_TEST_SUITE(block_extraction) { chain::packed_transaction(transfer_trx) } ); signal_accepted_block( bsp1 ); - const uint32_t expected_lib = 0; - const std::vector expected_action_trace { { { diff --git a/plugins/trace_api_plugin/test/test_trace_file.cpp b/plugins/trace_api_plugin/test/test_trace_file.cpp index 322c2d54bc..2278435ee5 100644 --- a/plugins/trace_api_plugin/test/test_trace_file.cpp +++ b/plugins/trace_api_plugin/test/test_trace_file.cpp @@ -498,7 +498,6 @@ BOOST_AUTO_TEST_SUITE(slice_tests) const auto be1_size = data.size(); BOOST_REQUIRE_EQUAL(header_size + be1_size, slice.tellp()); BOOST_REQUIRE_EQUAL(bfs::file_size(fp), slice.tellp()); - uint64_t index_file_size = bfs::file_size(fp); slice.close(); found = sd.find_or_create_index_slice(1, open_state::read, slice); diff --git a/plugins/trace_api_plugin/trace_api_plugin.cpp b/plugins/trace_api_plugin/trace_api_plugin.cpp index 87c3dea18f..ff25356f0f 100644 --- a/plugins/trace_api_plugin/trace_api_plugin.cpp +++ b/plugins/trace_api_plugin/trace_api_plugin.cpp @@ -360,7 +360,6 @@ struct trace_api_plugin_impl { :common(common) {} static void set_program_options(appbase::options_description& cli, appbase::options_description& cfg) { - auto cfg_options = cfg.add_options(); } void plugin_initialize(const appbase::variables_map& options) { diff --git a/plugins/txn_test_gen_plugin/txn_test_gen_plugin.cpp b/plugins/txn_test_gen_plugin/txn_test_gen_plugin.cpp index 679de33bc4..590f21339c 100644 --- a/plugins/txn_test_gen_plugin/txn_test_gen_plugin.cpp +++ b/plugins/txn_test_gen_plugin/txn_test_gen_plugin.cpp @@ -291,7 +291,6 @@ struct txn_test_gen_plugin_impl { running = true; - controller& cc = app().get_plugin().chain(); auto abi_serializer_max_time = app().get_plugin().get_abi_serializer_max_time(); abi_serializer eosio_token_serializer{fc::json::from_string(contracts::eosio_token_abi().data()).as(), abi_serializer::create_yield_function( abi_serializer_max_time )}; //create the actions here diff --git a/programs/cleos/main.cpp b/programs/cleos/main.cpp index 9f41194956..38a686fc17 100644 --- a/programs/cleos/main.cpp +++ b/programs/cleos/main.cpp @@ -3122,7 +3122,7 @@ int main( int argc, char** argv ) { // ->required(); contractSubcommand->add_option("wasm-file", wasmPath, localized("The file containing the contract WASM relative to contract-dir")); // ->check(CLI::ExistingFile); - auto abi = contractSubcommand->add_option("abi-file,-a,--abi", abiPath, localized("The ABI for the contract relative to contract-dir")); + contractSubcommand->add_option("abi-file,-a,--abi", abiPath, localized("The ABI for the contract relative to contract-dir")); // ->check(CLI::ExistingFile); contractSubcommand->add_flag( "-c,--clear", contract_clear, localized("Remove contract on an account")); contractSubcommand->add_flag( "--suppress-duplicate-check", suppress_duplicate_check, localized("Don't check for duplicate")); @@ -3818,13 +3818,11 @@ int main( int argc, char** argv ) { const auto& approvals_object = rows2[0].get_object(); for( const auto& ra : approvals_object["requested_approvals"].get_array() ) { - const auto& ra_obj = ra.get_object(); auto pl = ra["level"].as(); all_approvals.emplace( pl, std::make_pair(ra["time"].as(), approval_status::unapproved) ); } for( const auto& pa : approvals_object["provided_approvals"].get_array() ) { - const auto& pa_obj = pa.get_object(); auto pl = pa["level"].as(); auto res = all_approvals.emplace( pl, std::make_pair(pa["time"].as(), approval_status::approved) ); provided_approvers[pl.actor].second.push_back( res.first ); diff --git a/programs/eosio-launcher/main.cpp b/programs/eosio-launcher/main.cpp index 9b865698e0..581f2debc9 100644 --- a/programs/eosio-launcher/main.cpp +++ b/programs/eosio-launcher/main.cpp @@ -362,7 +362,6 @@ string producer_names::producer_name(unsigned int producer_number, bool shared_p } prod_name[total_chars] = '\0'; - const auto original_producer_number = producer_number; for (int current_char_loc = total_chars - 1; current_char_loc >= 0; --current_char_loc) { const unsigned int slot_value = static_cast(producer_number % valid_char_range); producer_number /= valid_char_range; @@ -1866,7 +1865,6 @@ launcher_def::ignite() { string script("bash " + start_script); bp::child c(script); try { - boost::system::error_code ec; cerr << "waiting for script completion\n"; c.wait(); } catch (bfs::filesystem_error &ex) { diff --git a/unittests/abi_tests.cpp b/unittests/abi_tests.cpp index 4bda2e9fde..c1b044cc2a 100644 --- a/unittests/abi_tests.cpp +++ b/unittests/abi_tests.cpp @@ -2054,8 +2054,7 @@ BOOST_AUTO_TEST_CASE(abi_account_name_in_eosio_abi) } )====="; - auto abi = eosio_contract_abi(fc::json::from_string(repeat_abi).as()); - auto is_type_exception = [](fc::assert_exception const & e) -> bool { return e.to_detail_string().find("abi.types.size") != std::string::npos; }; + eosio_contract_abi(fc::json::from_string(repeat_abi).as()); } FC_LOG_AND_RETHROW() } diff --git a/unittests/api_tests.cpp b/unittests/api_tests.cpp index 856f8bd897..103b26d455 100644 --- a/unittests/api_tests.cpp +++ b/unittests/api_tests.cpp @@ -333,7 +333,7 @@ BOOST_FIXTURE_TEST_CASE(action_receipt_tests, TESTER) { try { != result->action_traces[0].receipt->auth_sequence.end() ); auto base_global_sequence_num = result->action_traces[0].receipt->global_sequence; auto base_system_recv_seq_num = result->action_traces[0].receipt->recv_sequence; - auto base_system_auth_seq_num = result->action_traces[0].receipt->auth_sequence[config::system_account_name]; + result->action_traces[0].receipt->auth_sequence[config::system_account_name]; auto base_system_code_seq_num = result->action_traces[0].receipt->code_sequence.value; auto base_system_abi_seq_num = result->action_traces[0].receipt->abi_sequence.value; diff --git a/unittests/auth_tests.cpp b/unittests/auth_tests.cpp index f6fa7658a4..1e5baf66ff 100644 --- a/unittests/auth_tests.cpp +++ b/unittests/auth_tests.cpp @@ -341,7 +341,7 @@ BOOST_AUTO_TEST_CASE( any_auth ) { try { const auto spending_priv_key = chain.get_private_key(name("alice"), "spending"); const auto spending_pub_key = spending_priv_key.get_public_key(); - const auto bob_spending_priv_key = chain.get_private_key(name("bob"), "spending"); + //const auto bob_spending_priv_key = chain.get_private_key(name("bob"), "spending"); const auto bob_spending_pub_key = spending_priv_key.get_public_key(); chain.set_authority(name("alice"), name("spending"), spending_pub_key, name("active")); diff --git a/unittests/bootseq_tests.cpp b/unittests/bootseq_tests.cpp index 3ae069c030..6a61a6ad0e 100644 --- a/unittests/bootseq_tests.cpp +++ b/unittests/bootseq_tests.cpp @@ -325,7 +325,7 @@ BOOST_FIXTURE_TEST_CASE( bootseq_test, bootseq_tester ) { claim_rewards("runnerup1"_n); BOOST_TEST(get_balance("runnerup1"_n).get_amount() > 0); - const auto first_june_2018 = fc::seconds(1527811200); // 2018-06-01 + //const auto first_june_2018 = fc::seconds(1527811200); // 2018-06-01 const auto first_june_2028 = fc::seconds(1843430400); // 2028-06-01 // Ensure that now is yet 10 years after 2018-06-01 yet BOOST_REQUIRE(control->head_block_time().time_since_epoch() < first_june_2028); diff --git a/unittests/deep_mind_tests.cpp b/unittests/deep_mind_tests.cpp index 0d2acb3cab..8a0cc33833 100644 --- a/unittests/deep_mind_tests.cpp +++ b/unittests/deep_mind_tests.cpp @@ -328,7 +328,7 @@ void merge(const std::string& input_filename, const std::string& pattern_filenam for(std::ptrdiff_t i = 0; i < std::min(line_end - line_iter, pattern_end - pattern_iter); ++i) { tab.emplace_back(); - for(std::ptrdiff_t j = 0, j_end; j < i; ++j) + for(std::ptrdiff_t j = 0; j < i; ++j) { tab[i].push_back(add_point(i, j)); if(tab[i][j].unmodified >= resync_threshold) diff --git a/unittests/delay_tests.cpp b/unittests/delay_tests.cpp index a73873d4c1..2e3d62128e 100644 --- a/unittests/delay_tests.cpp +++ b/unittests/delay_tests.cpp @@ -1621,8 +1621,6 @@ BOOST_AUTO_TEST_CASE( link_delay_link_change_heirarchy_test ) { try { BOOST_AUTO_TEST_CASE( mindelay_test ) { try { TESTER chain; - const auto& tester_account = "tester"_n; - chain.produce_blocks(); chain.create_account("eosio.token"_n); chain.produce_blocks(10); diff --git a/unittests/snapshot_tests.cpp b/unittests/snapshot_tests.cpp index 4c847687db..d2d2a7f0d1 100644 --- a/unittests/snapshot_tests.cpp +++ b/unittests/snapshot_tests.cpp @@ -23,7 +23,7 @@ chainbase::bfs::path get_parent_path(chainbase::bfs::path blocks_dir, int ordina blocks_dir = blocks_dir.parent_path(); leaf_dir = blocks_dir.filename(); try { - auto ordinal_for_config = boost::lexical_cast(leaf_dir.generic_string()); + boost::lexical_cast(leaf_dir.generic_string()); blocks_dir = blocks_dir.parent_path(); } catch(const boost::bad_lexical_cast& ) { diff --git a/unittests/wasm_config_tests.cpp b/unittests/wasm_config_tests.cpp index 5bdaae4c4f..4993e0f697 100644 --- a/unittests/wasm_config_tests.cpp +++ b/unittests/wasm_config_tests.cpp @@ -158,7 +158,7 @@ static const char many_exports_wast[] = R"=====( (func (export "apply") (param i64 i64 i64)) ) )====="; -static const char one_export[] = "(export \"fn${N}\" (func 0))"; +//static const char one_export[] = "(export \"fn${N}\" (func 0))"; static const char many_elem_wast[] = R"=====( (module diff --git a/unittests/wasm_tests.cpp b/unittests/wasm_tests.cpp index d1078baaea..21cd75d8cc 100644 --- a/unittests/wasm_tests.cpp +++ b/unittests/wasm_tests.cpp @@ -239,7 +239,7 @@ BOOST_FIXTURE_TEST_CASE( f32_tests, TESTER ) try { push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); - const auto& receipt = get_transaction_receipt(trx.id()); + get_transaction_receipt(trx.id()); } } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( f32_test_bitwise, TESTER ) try { @@ -262,7 +262,7 @@ BOOST_FIXTURE_TEST_CASE( f32_test_bitwise, TESTER ) try { push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); - const auto& receipt = get_transaction_receipt(trx.id()); + get_transaction_receipt(trx.id()); } } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( f32_test_cmp, TESTER ) try { @@ -285,7 +285,7 @@ BOOST_FIXTURE_TEST_CASE( f32_test_cmp, TESTER ) try { push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); - const auto& receipt = get_transaction_receipt(trx.id()); + get_transaction_receipt(trx.id()); } } FC_LOG_AND_RETHROW() @@ -310,7 +310,7 @@ BOOST_FIXTURE_TEST_CASE( f64_tests, TESTER ) try { push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); - const auto& receipt = get_transaction_receipt(trx.id()); + get_transaction_receipt(trx.id()); } } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( f64_test_bitwise, TESTER ) try { @@ -333,7 +333,7 @@ BOOST_FIXTURE_TEST_CASE( f64_test_bitwise, TESTER ) try { push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); - const auto& receipt = get_transaction_receipt(trx.id()); + get_transaction_receipt(trx.id()); } } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE( f64_test_cmp, TESTER ) try { @@ -356,7 +356,7 @@ BOOST_FIXTURE_TEST_CASE( f64_test_cmp, TESTER ) try { push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); - const auto& receipt = get_transaction_receipt(trx.id()); + get_transaction_receipt(trx.id()); } } FC_LOG_AND_RETHROW() @@ -382,7 +382,7 @@ BOOST_FIXTURE_TEST_CASE( f32_f64_conversion_tests, tester ) try { push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); - const auto& receipt = get_transaction_receipt(trx.id()); + get_transaction_receipt(trx.id()); } } FC_LOG_AND_RETHROW() @@ -413,7 +413,7 @@ BOOST_FIXTURE_TEST_CASE( f32_f64_overflow_tests, tester ) try { push_transaction(trx); produce_blocks(1); BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id())); - const auto& receipt = get_transaction_receipt(trx.id()); + get_transaction_receipt(trx.id()); return true; } catch (eosio::chain::wasm_execution_error &) { return false; From 62e5800b6795c496b7932c980bbbe81bd7dac8c1 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Tue, 27 Sep 2022 16:55:51 -0500 Subject: [PATCH 2/3] GH-229 Fix GCC strict-alias warning --- plugins/chain_plugin/chain_plugin.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/chain_plugin/chain_plugin.cpp b/plugins/chain_plugin/chain_plugin.cpp index 1e70f94bc7..cf9f4e7bde 100644 --- a/plugins/chain_plugin/chain_plugin.cpp +++ b/plugins/chain_plugin/chain_plugin.cpp @@ -1708,18 +1708,22 @@ read_only::get_table_rows_result read_only::get_table_rows( const read_only::get } else if (p.key_type == chain_apis::float64) { return get_table_rows_by_seckey(p, abi, [](double v)->float64_t { - float64_t f = *(float64_t *)&v; + float64_t f; + double_to_float64(v, f); return f; }); } else if (p.key_type == chain_apis::float128) { if ( p.encode_type == chain_apis::hex) { return get_table_rows_by_seckey(p, abi, [](uint128_t v)->float128_t{ - return *reinterpret_cast(&v); + float128_t f; + uint128_to_float128(v, f); + return f; }); } return get_table_rows_by_seckey(p, abi, [](double v)->float128_t{ - float64_t f = *(float64_t *)&v; + float64_t f; + double_to_float64(v, f); float128_t f128; f64_to_f128M(f, &f128); return f128; From 78d04774d8d5877b15f2413e1c5681ee7892cff5 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Tue, 27 Sep 2022 18:27:14 -0500 Subject: [PATCH 3/3] GH-229 Remove commented out code --- unittests/auth_tests.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/unittests/auth_tests.cpp b/unittests/auth_tests.cpp index 1e5baf66ff..d6572f3094 100644 --- a/unittests/auth_tests.cpp +++ b/unittests/auth_tests.cpp @@ -341,7 +341,6 @@ BOOST_AUTO_TEST_CASE( any_auth ) { try { const auto spending_priv_key = chain.get_private_key(name("alice"), "spending"); const auto spending_pub_key = spending_priv_key.get_public_key(); - //const auto bob_spending_priv_key = chain.get_private_key(name("bob"), "spending"); const auto bob_spending_pub_key = spending_priv_key.get_public_key(); chain.set_authority(name("alice"), name("spending"), spending_pub_key, name("active"));