mirror of https://github.com/status-im/evmc.git
commit
ca2933cbed
|
@ -0,0 +1,44 @@
|
|||
Checks: >
|
||||
bugprone-*,
|
||||
cert-*,
|
||||
-cert-err58-cpp,
|
||||
clang-analyzer-*,
|
||||
cppcoreguidelines-*,
|
||||
-cppcoreguidelines-avoid-c-arrays,
|
||||
-cppcoreguidelines-avoid-magic-numbers,
|
||||
-cppcoreguidelines-non-private-member-variables-in-classes,
|
||||
-cppcoreguidelines-owning-memory,
|
||||
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||
-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||
-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
-cppcoreguidelines-pro-type-static-cast-downcast,
|
||||
-cppcoreguidelines-pro-type-vararg,
|
||||
-cppcoreguidelines-special-member-functions,
|
||||
google-global-names-in-headers,
|
||||
google-runtime-int,
|
||||
hicpp-*,
|
||||
-hicpp-avoid-c-arrays,
|
||||
-hicpp-braces-around-statements,
|
||||
-hicpp-no-array-decay,
|
||||
-hicpp-no-malloc,
|
||||
-hicpp-signed-bitwise,
|
||||
-hicpp-special-member-functions,
|
||||
-hicpp-uppercase-literal-suffix,
|
||||
-hicpp-vararg,
|
||||
misc-*,
|
||||
-misc-non-private-member-variables-in-classes,
|
||||
modernize-*,
|
||||
-modernize-avoid-c-arrays,
|
||||
-modernize-use-trailing-return-type,
|
||||
performance-*,
|
||||
portability-*,
|
||||
readability-*,
|
||||
-readability-braces-around-statements,
|
||||
-readability-else-after-return,
|
||||
-readability-magic-numbers,
|
||||
-readability-named-parameter,
|
||||
-readability-uppercase-literal-suffix,
|
||||
|
||||
WarningsAsErrors: '*'
|
||||
FormatStyle: file
|
|
@ -47,13 +47,13 @@ static evmc_result not_implemented()
|
|||
return result;
|
||||
}
|
||||
|
||||
static evmc_result execute(evmc_vm* /*unused*/,
|
||||
const evmc_host_interface* /*unused*/,
|
||||
evmc_host_context* /*unused*/,
|
||||
static evmc_result execute(evmc_vm*,
|
||||
const evmc_host_interface*,
|
||||
evmc_host_context*,
|
||||
enum evmc_revision rev,
|
||||
const evmc_message* msg,
|
||||
const uint8_t*,
|
||||
size_t)
|
||||
const uint8_t* /*code*/,
|
||||
size_t /*code_size*/)
|
||||
{
|
||||
// The EIP-1352 (https://eips.ethereum.org/EIPS/eip-1352) defines
|
||||
// the range 0 - 0xffff (2 bytes) of addresses reserved for precompiled contracts.
|
||||
|
@ -75,11 +75,7 @@ static evmc_result execute(evmc_vm* /*unused*/,
|
|||
switch (id)
|
||||
{
|
||||
case 0x0001: // ECDSARECOVER
|
||||
return not_implemented();
|
||||
|
||||
case 0x0002: // SHA256
|
||||
return not_implemented();
|
||||
|
||||
case 0x0003: // RIPEMD160
|
||||
return not_implemented();
|
||||
|
||||
|
@ -87,20 +83,8 @@ static evmc_result execute(evmc_vm* /*unused*/,
|
|||
return execute_identity(msg);
|
||||
|
||||
case 0x0005: // EXPMOD
|
||||
if (rev < EVMC_BYZANTIUM)
|
||||
return execute_empty(msg);
|
||||
return not_implemented();
|
||||
|
||||
case 0x0006: // SNARKV
|
||||
if (rev < EVMC_BYZANTIUM)
|
||||
return execute_empty(msg);
|
||||
return not_implemented();
|
||||
|
||||
case 0x0007: // BNADD
|
||||
if (rev < EVMC_BYZANTIUM)
|
||||
return execute_empty(msg);
|
||||
return not_implemented();
|
||||
|
||||
case 0x0008: // BNMUL
|
||||
if (rev < EVMC_BYZANTIUM)
|
||||
return execute_empty(msg);
|
||||
|
|
|
@ -294,7 +294,7 @@ public:
|
|||
/// Destructor responsible for automatically releasing attached resources.
|
||||
~result() noexcept
|
||||
{
|
||||
if (release)
|
||||
if (release != nullptr)
|
||||
release(this);
|
||||
}
|
||||
|
||||
|
@ -534,7 +534,7 @@ public:
|
|||
/// Destructor responsible for automatically destroying the VM instance.
|
||||
~VM() noexcept
|
||||
{
|
||||
if (m_instance)
|
||||
if (m_instance != nullptr)
|
||||
m_instance->destroy(m_instance);
|
||||
}
|
||||
|
||||
|
|
|
@ -329,7 +329,7 @@ TEST(cpp, vm_set_option)
|
|||
TEST(cpp, vm_set_option_in_constructor)
|
||||
{
|
||||
static int num_calls = 0;
|
||||
const auto set_option_method = [](evmc_vm* /*unused*/, const char* name, const char* value) {
|
||||
const auto set_option_method = [](evmc_vm*, const char* name, const char* value) {
|
||||
++num_calls;
|
||||
EXPECT_STREQ(name, "o");
|
||||
EXPECT_EQ(value, std::to_string(num_calls));
|
||||
|
|
|
@ -118,12 +118,12 @@ const std::string loader::option_name_causing_unknown_error{"raise_unknown"};
|
|||
|
||||
static evmc_vm* create_aaa()
|
||||
{
|
||||
return (evmc_vm*)0xaaa;
|
||||
return reinterpret_cast<evmc_vm*>(0xaaa);
|
||||
}
|
||||
|
||||
static evmc_vm* create_eee_bbb()
|
||||
{
|
||||
return (evmc_vm*)0xeeebbb;
|
||||
return reinterpret_cast<evmc_vm*>(0xeeebbb);
|
||||
}
|
||||
|
||||
static evmc_vm* create_failure()
|
||||
|
|
|
@ -85,7 +85,7 @@ TEST_F(evmc_vm_test, execute_call)
|
|||
|
||||
EXPECT_TRUE(evmc::is_zero(result.create_address));
|
||||
|
||||
if (result.release)
|
||||
if (result.release != nullptr)
|
||||
result.release(&result);
|
||||
|
||||
example_host_destroy_context(context);
|
||||
|
@ -122,7 +122,7 @@ TEST_F(evmc_vm_test, execute_create)
|
|||
// The VM will never provide the create address.
|
||||
EXPECT_TRUE(evmc::is_zero(result.create_address));
|
||||
|
||||
if (result.release)
|
||||
if (result.release != nullptr)
|
||||
result.release(&result);
|
||||
|
||||
example_host_destroy_context(context);
|
||||
|
@ -130,7 +130,7 @@ TEST_F(evmc_vm_test, execute_create)
|
|||
|
||||
TEST_F(evmc_vm_test, set_option_unknown_name)
|
||||
{
|
||||
if (vm->set_option)
|
||||
if (vm->set_option != nullptr)
|
||||
{
|
||||
evmc_set_option_result r = vm->set_option(vm, "unknown_option_csk9twq", "v");
|
||||
EXPECT_EQ(r, EVMC_SET_OPTION_INVALID_NAME);
|
||||
|
@ -141,7 +141,7 @@ TEST_F(evmc_vm_test, set_option_unknown_name)
|
|||
|
||||
TEST_F(evmc_vm_test, set_option_empty_value)
|
||||
{
|
||||
if (vm->set_option)
|
||||
if (vm->set_option != nullptr)
|
||||
{
|
||||
evmc_set_option_result r = vm->set_option(vm, "unknown_option_csk9twq", nullptr);
|
||||
EXPECT_EQ(r, EVMC_SET_OPTION_INVALID_NAME);
|
||||
|
@ -206,7 +206,7 @@ TEST_F(evmc_vm_test, precompile_test)
|
|||
read_buffer(result.output_data, result.output_size);
|
||||
}
|
||||
|
||||
if (result.release)
|
||||
if (result.release != nullptr)
|
||||
result.release(&result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ int main(int argc, char* argv[])
|
|||
if (ec != EVMC_LOADER_SUCCESS)
|
||||
{
|
||||
const auto error = evmc_last_error_msg();
|
||||
if (error)
|
||||
if (error != nullptr)
|
||||
std::cerr << error << "\n";
|
||||
else
|
||||
std::cerr << "Loading error " << ec << "\n";
|
||||
|
|
Loading…
Reference in New Issue