EVM-C: Build examples without #pragma warning suppressions

This commit is contained in:
Paweł Bylica 2016-08-23 21:10:11 +02:00
parent 81edf123db
commit e0ff4b350e
3 changed files with 10 additions and 10 deletions

View File

@ -1,3 +1,5 @@
add_compile_options("-Wno-extra") # Override -Wextra, I don't know better option.
add_library(example-vm STATIC EXCLUDE_FROM_ALL examplevm.c)
target_include_directories(example-vm PRIVATE ../include)

View File

@ -1,11 +1,8 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include "evm.h"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wunused-parameter"
struct evm_uint256 balance(struct evm_env* env, struct evm_hash160 address)
{
@ -86,8 +83,8 @@ int main(int argc, char *argv[]) {
if (result.gas_left & EVM_EXCEPTION) {
printf(" EVM eception\n");
}
printf(" Gas used: " PRId64 "\n", gas - result.gas_left);
printf(" Gas left: " PRId64 "\n", result.gas_left);
printf(" Gas used: %ld\n", gas - result.gas_left);
printf(" Gas left: %ld\n", result.gas_left);
printf(" Output size: %zd\n", result.output_size);
printf(" Output: ");

View File

@ -3,9 +3,6 @@
#include <stdbool.h>
#include "evm.h"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wunused-parameter"
struct evm_instance {
evm_query_fn query_fn;
evm_update_fn update_fn;
@ -70,7 +67,11 @@ static void evm_release_result(struct evm_result const* result)
EXPORT struct evm_fn_table examplevm_get_fn_table()
{
struct evm_fn_table ftab = {evm_create, evm_destroy, evm_execute,
evm_release_result, 0, 0, 0};
struct evm_fn_table ftab;
memset(&ftab, 0, sizeof(struct evm_result));
ftab.create = evm_create;
ftab.destroy = evm_destroy;
ftab.execute = evm_execute;
ftab.release_result = evm_release_result;
return ftab;
}