From f92f1cf92c7d217a94903d3edf672f16a27426f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 13 Aug 2018 21:01:54 +0200 Subject: [PATCH 1/2] Circle CI: Store generated docs --- circle.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 2a8fd41..051180e 100644 --- a/circle.yml +++ b/circle.yml @@ -54,13 +54,16 @@ jobs: - run: name: "Test documentation" command: | - doxygen Doxyfile > doxygen.log 2> doxygen.warnings + cat Doxyfile | sed 's/HTML_OUTPUT = ./HTML_OUTPUT = ..\/docs/' | doxygen - > doxygen.log 2> doxygen.warnings if [ -s doxygen.warnings ]; then printf '\n\nDoxygen warnings:\n\n' cat doxygen.warnings exit 1 fi cat doxygen.log + - store_artifacts: + path: ~/docs + destination: docs upload-docs: docker: From 488bd5ad9dfcc8f8a0baf932cfe93e2a18cd9a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 13 Aug 2018 18:42:20 +0200 Subject: [PATCH 2/2] Move Result Optional Storage functions to helpers.h --- include/evmc/evmc.h | 34 ---------------------------- include/evmc/helpers.h | 49 +++++++++++++++++++++++++++++++++++++++++ test/vmtester/tests.cpp | 4 +++- 3 files changed, 52 insertions(+), 35 deletions(-) diff --git a/include/evmc/evmc.h b/include/evmc/evmc.h index c6ef635..dadcbfd 100644 --- a/include/evmc/evmc.h +++ b/include/evmc/evmc.h @@ -393,40 +393,6 @@ struct evmc_result }; -/** - * The union representing evmc_result "optional data". - * - * The evmc_result struct contains 24 bytes of optional data that can be - * reused by the object creator if the object does not contain - * evmc_result::create_address. - * - * An EVM implementation MAY use this memory to keep additional data - * when returning result from ::evmc_execute_fn. - * The host application MAY use this memory to keep additional data - * when returning result of performed calls from ::evmc_call_fn. - * - * @see evmc_get_optional_data(), evmc_get_const_optional_data(). - */ -union evmc_result_optional_data -{ - uint8_t bytes[24]; /**< 24 bytes of optional data. */ - void* pointer; /**< Optional pointer. */ -}; - -/** Provides read-write access to evmc_result "optional data". */ -static inline union evmc_result_optional_data* evmc_get_optional_data(struct evmc_result* result) -{ - return (union evmc_result_optional_data*)&result->create_address; -} - -/** Provides read-only access to evmc_result "optional data". */ -static inline const union evmc_result_optional_data* evmc_get_const_optional_data( - const struct evmc_result* result) -{ - return (const union evmc_result_optional_data*)&result->create_address; -} - - /** * Check account existence callback function * diff --git a/include/evmc/helpers.h b/include/evmc/helpers.h index 66c7907..321da2c 100644 --- a/include/evmc/helpers.h +++ b/include/evmc/helpers.h @@ -51,4 +51,53 @@ static inline void evmc_release_result(struct evmc_result* result) result->release(result); } + +/** + * Helpers for optional storage of evmc_result. + * + * In some contexts (i.e. evmc_result::create_address is unused) objects of + * type evmc_result contains a memory storage that MAY be used by the object + * owner. This group defines helper types and functions for accessing + * the optional storage. + * + * @defgroup result_optional_storage Result Optional Storage + * @{ + */ + +/** + * The union representing evmc_result "optional storage". + * + * The evmc_result struct contains 24 bytes of optional storage that can be + * reused by the object creator if the object does not contain + * evmc_result::create_address. + * + * A VM implementation MAY use this memory to keep additional data + * when returning result from evmc_execute_fn(). + * The host application MAY use this memory to keep additional data + * when returning result of performed calls from evmc_call_fn(). + * + * @see evmc_get_optional_storage(), evmc_get_const_optional_storage(). + */ +union evmc_result_optional_storage +{ + uint8_t bytes[24]; /**< 24 bytes of optional storage. */ + void* pointer; /**< Optional pointer. */ +}; + +/** Provides read-write access to evmc_result "optional storage". */ +static inline union evmc_result_optional_storage* evmc_get_optional_storage( + struct evmc_result* result) +{ + return (union evmc_result_optional_storage*)&result->create_address; +} + +/** Provides read-only access to evmc_result "optional storage". */ +static inline const union evmc_result_optional_storage* evmc_get_const_optional_storage( + const struct evmc_result* result) +{ + return (const union evmc_result_optional_storage*)&result->create_address; +} + +/** @} */ + /** @} */ diff --git a/test/vmtester/tests.cpp b/test/vmtester/tests.cpp index 178afc2..1009249 100644 --- a/test/vmtester/tests.cpp +++ b/test/vmtester/tests.cpp @@ -4,6 +4,8 @@ #include "vmtester.hpp" +#include + #include // Compile time checks: @@ -22,7 +24,7 @@ static_assert(sizeof(evmc_revision) == sizeof(int), "Enum `evmc_revision` is not static constexpr size_t optionalDataSize = sizeof(evmc_result) - offsetof(evmc_result, create_address); -static_assert(optionalDataSize == sizeof(evmc_result_optional_data), ""); +static_assert(optionalDataSize == sizeof(evmc_result_optional_storage), ""); TEST_F(evmc_vm_test, abi_version_match) {