From ff148307848751e635ce3b3ff9afa88cf102eadf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 15 May 2019 12:04:29 +0200 Subject: [PATCH] Do not shadow variable names --- .../example_precompiles_vm.cpp | 2 +- include/evmc/evmc.hpp | 2 +- test/vmtester/vmtester.cpp | 30 ++++++++++--------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/examples/example_precompiles_vm/example_precompiles_vm.cpp b/examples/example_precompiles_vm/example_precompiles_vm.cpp index 0008b5a..e5d3b52 100644 --- a/examples/example_precompiles_vm/example_precompiles_vm.cpp +++ b/examples/example_precompiles_vm/example_precompiles_vm.cpp @@ -28,7 +28,7 @@ static evmc_result execute_identity(const evmc_message* msg) result.status_code = EVMC_SUCCESS; result.output_data = data; result.output_size = msg->input_size; - result.release = [](const evmc_result* result) { delete[] result->output_data; }; + result.release = [](const evmc_result* r) { delete[] r->output_data; }; result.gas_left = gas_left; return result; } diff --git a/include/evmc/evmc.hpp b/include/evmc/evmc.hpp index 2210bae..fc1f738 100644 --- a/include/evmc/evmc.hpp +++ b/include/evmc/evmc.hpp @@ -179,7 +179,7 @@ class HostContext : public HostInterface public: /// Implicit converting constructor from evmc_context. - HostContext(evmc_context* context) noexcept : context{context} {} // NOLINT + HostContext(evmc_context* ctx) noexcept : context{ctx} {} // NOLINT bool account_exists(const evmc_address& address) noexcept final { diff --git a/test/vmtester/vmtester.cpp b/test/vmtester/vmtester.cpp index 8249808..c9a41e6 100644 --- a/test/vmtester/vmtester.cpp +++ b/test/vmtester/vmtester.cpp @@ -31,18 +31,20 @@ evmc_instance* get_vm_instance() class cli_parser { public: - const char* const app_name = nullptr; - const char* const app_version = nullptr; + const char* const application_name = nullptr; + const char* const application_version = nullptr; - std::vector args_names; - std::vector args; + std::vector arguments_names; + std::vector arguments; cli_parser(const char* app_name, const char* app_version, std::vector args_names) noexcept - : app_name{app_name}, app_version{app_version}, args_names{std::move(args_names)} + : application_name{app_name}, + application_version{app_version}, + arguments_names{std::move(args_names)} { - args.reserve(this->args_names.size()); + arguments.reserve(this->arguments_names.size()); } /// Parses the command line arguments. @@ -67,12 +69,12 @@ public: if (x == 0) // Argument. { ++num_args; - if (num_args > args_names.size()) + if (num_args > arguments_names.size()) { err << "Unexpected argument \"" << arg << "\"\n"; return -1; } - args.emplace_back(std::move(arg)); + arguments.emplace_back(std::move(arg)); continue; } else if (x <= 2) @@ -95,12 +97,12 @@ public: return -1; } - out << app_name << " " << app_version << "\n"; + out << application_name << " " << application_version << "\n"; if (help) { out << "Usage: " << argv[0]; - for (const auto& name : args_names) + for (const auto& name : arguments_names) out << " " << name; out << "\n"; return 0; @@ -109,10 +111,10 @@ public: if (version) return 0; - if (num_args < args_names.size()) + if (num_args < arguments_names.size()) { - for (auto i = num_args; i < args_names.size(); ++i) - err << "The " << args_names[i] << " argument is required.\n"; + for (auto i = num_args; i < arguments_names.size(); ++i) + err << "The " << arguments_names[i] << " argument is required.\n"; err << "Run with --help for more information.\n"; return -1; } @@ -133,7 +135,7 @@ int main(int argc, char* argv[]) if (error_code <= 0) return error_code; - const auto& evmc_module = cli.args[0]; + const auto& evmc_module = cli.arguments[0]; std::cout << "Testing " << evmc_module << "\n"; evmc_loader_error_code ec; create_fn = evmc_load(evmc_module.c_str(), &ec);