Fix for styleCheck:usages

This commit is contained in:
jangko 2022-04-07 21:14:49 +07:00
parent 4b504ac784
commit c0e7772f52
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
3 changed files with 6 additions and 4 deletions

View File

@ -15,6 +15,8 @@ proc test(name: string, lang: string = "cpp") =
mkDir "build"
--run
switch("out", ("./build/" & name))
switch("styleCheck", "usages")
switch("styleCheck", "error")
setCommand lang, "tests/" & name & ".nim"
task test_debug, "Run all tests - test implementation":

View File

@ -55,11 +55,11 @@ proc copyCode*(ctx: HostContext, address: var evmc_address, codeOffset: int = 0)
let size = ctx.getCodeSize(address)
if size - codeOffset > 0:
result = newSeq[byte](size - codeOffset)
let read = ctx.host.copy_code(ctx.context, address, code_offset.csize_t, result[0].addr, result.len.csize_t).int
let read = ctx.host.copy_code(ctx.context, address, codeOffset.csize_t, result[0].addr, result.len.csize_t).int
doAssert(read == result.len)
proc copyCode*(ctx: HostContext, address: var evmc_address, codeOffset: int, output: ptr byte, output_len: int): int =
ctx.host.copy_code(ctx.context, address, code_offset.csize_t, output, output_len.csize_t).int
ctx.host.copy_code(ctx.context, address, codeOffset.csize_t, output, output_len.csize_t).int
proc selfdestruct*(ctx: HostContext, address, beneficiary: var evmc_address) =
ctx.host.selfdestruct(ctx.context, address, beneficiary)

View File

@ -18,10 +18,10 @@ import stew/byteutils
{.compile: "evmc_c/example_host.cpp".}
{.compile: "evmc_c/example_vm.cpp".}
{.passL: "-lstdc++"}
{.passl: "-lstdc++"}
when defined(posix):
{.passC: "-std=c++14".}
{.passc: "-std=c++14".}
# The original EVMC C/C++ `example_host_create_context` test code wants struct
# `evmc_tx_context` passed by value, and `(tx_context: evmc_tx_context)` looks