Skip to content

Commit

Permalink
Deprecate tracing API
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Aug 5, 2019
1 parent c117256 commit 147fd1a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
- Deprecated: [[#358](https://github.com/ethereum/evmc/pull/358)]
The usage of `evmc/helpers.hpp` has been deprecated. Use `evmc/evmc.hpp`
which provides the same features.
- Deprecated: [[#376](https://github.com/ethereum/evmc/pull/376)]
The tracing API has been deprecated as there have been some design flaws discovered.
New API is expected to be introduced in future.
- Fixed:
[[#261](https://github.com/ethereum/evmc/issues/261),
[#263](https://github.com/ethereum/evmc/pull/263)]
Expand Down
17 changes: 2 additions & 15 deletions examples/example_vm/example_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
/// The example VM instance struct extending the evmc_instance.
struct example_vm
{
struct evmc_instance instance; ///< The base struct.
int verbose; ///< The verbosity level.
evmc_trace_callback trace_callback; ///< The trace callback.
struct evmc_tracer_context* tracer_context; ///< The tracer context.
struct evmc_instance instance; ///< The base struct.
int verbose; ///< The verbosity level.
};

/// The implementation of the evmc_instance::destroy() method.
Expand Down Expand Up @@ -169,16 +167,6 @@ static struct evmc_result execute(struct evmc_instance* instance,
return ret;
}

/// The implementation of the optional evmc_instance::set_tracer() method.
static void set_tracer(struct evmc_instance* instance,
evmc_trace_callback callback,
struct evmc_tracer_context* context)
{
struct example_vm* vm = (struct example_vm*)instance;
vm->trace_callback = callback;
vm->tracer_context = context;
}


/// @cond internal
#if !defined(PROJECT_VERSION)
Expand All @@ -197,7 +185,6 @@ struct evmc_instance* evmc_create_example_vm()
.execute = execute,
.get_capabilities = get_capabilities,
.set_option = set_option,
.set_tracer = set_tracer,
};
struct example_vm* vm = calloc(1, sizeof(struct example_vm));
struct evmc_instance* interface = &vm->instance;
Expand Down
5 changes: 5 additions & 0 deletions include/evmc/evmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,12 @@ struct evmc_instance
* Optional pointer to function setting the EVM instruction tracer.
*
* If the EVM does not support this feature the pointer can be NULL.
*
* @deprecated
* The tracing API from EVMC 6 has been deprecated as there have been some
* design flaws discovered. New API is expected to be introduced in future.
*/
EVMC_DEPRECATED
evmc_set_tracer_fn set_tracer;

/**
Expand Down
4 changes: 4 additions & 0 deletions include/evmc/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,16 @@ static inline enum evmc_set_option_result evmc_set_option(struct evmc_instance*
*
* @see evmc_set_tracer_fn
*/
EVMC_DEPRECATED
static inline void evmc_set_tracer(struct evmc_instance* instance,
evmc_trace_callback callback,
struct evmc_tracer_context* context)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
if (instance->set_tracer)
instance->set_tracer(instance, callback, context);
#pragma GCC diagnostic pop
}

/**
Expand Down
2 changes: 2 additions & 0 deletions test/vmtester/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <array>
#include <cstring>

#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

namespace
{
// NOTE: this is to avoid compiler optimisations when reading the buffer
Expand Down

0 comments on commit 147fd1a

Please sign in to comment.