diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/binary-reader-linker.cc | 2 | ||||
-rw-r--r-- | src/binary-reader-objdump.cc | 2 | ||||
-rw-r--r-- | src/binary-reader.h | 11 | ||||
-rw-r--r-- | src/binary-writer-spec.h | 5 | ||||
-rw-r--r-- | src/binary-writer.h | 11 | ||||
-rw-r--r-- | src/prebuilt/wast-parser-gen.cc | 2 | ||||
-rw-r--r-- | src/tools/wasm-interp.cc | 3 | ||||
-rw-r--r-- | src/tools/wasm-opcodecnt.cc | 4 | ||||
-rw-r--r-- | src/tools/wasm2wast.cc | 2 | ||||
-rw-r--r-- | src/tools/wast2wasm.cc | 6 | ||||
-rw-r--r-- | src/wast-parser.y | 2 |
11 files changed, 20 insertions, 30 deletions
diff --git a/src/binary-reader-linker.cc b/src/binary-reader-linker.cc index add37f61..d825ac18 100644 --- a/src/binary-reader-linker.cc +++ b/src/binary-reader-linker.cc @@ -284,7 +284,7 @@ Result BinaryReaderLinker::OnFunctionName(Index index, StringSlice name) { Result read_binary_linker(LinkerInputBinary* input_info, LinkOptions* options) { BinaryReaderLinker reader(input_info); - ReadBinaryOptions read_options = WABT_READ_BINARY_OPTIONS_DEFAULT; + ReadBinaryOptions read_options; read_options.read_debug_names = true; read_options.log_stream = options->log_stream; return read_binary(input_info->data, input_info->size, &reader, diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc index f80248ba..0209e699 100644 --- a/src/binary-reader-objdump.cc +++ b/src/binary-reader-objdump.cc @@ -887,7 +887,7 @@ Result read_binary_objdump(const uint8_t* data, size_t size, ObjdumpOptions* options, ObjdumpState* state) { - ReadBinaryOptions read_options = WABT_READ_BINARY_OPTIONS_DEFAULT; + ReadBinaryOptions read_options; read_options.read_debug_names = true; read_options.log_stream = options->log_stream; diff --git a/src/binary-reader.h b/src/binary-reader.h index 2c72f6d8..30a680dd 100644 --- a/src/binary-reader.h +++ b/src/binary-reader.h @@ -24,16 +24,17 @@ #include "common.h" #include "opcode.h" -#define WABT_READ_BINARY_OPTIONS_DEFAULT \ - { nullptr, false } - namespace wabt { class Stream; struct ReadBinaryOptions { - Stream* log_stream; - bool read_debug_names; + ReadBinaryOptions() = default; + ReadBinaryOptions(Stream* log_stream, bool read_debug_names) + : log_stream(log_stream), read_debug_names(read_debug_names) {} + + Stream* log_stream = nullptr; + bool read_debug_names = false; }; class BinaryReaderDelegate { diff --git a/src/binary-writer-spec.h b/src/binary-writer-spec.h index 3266342e..d30de7db 100644 --- a/src/binary-writer-spec.h +++ b/src/binary-writer-spec.h @@ -23,11 +23,8 @@ namespace wabt { -#define WABT_WRITE_BINARY_SPEC_OPTIONS_DEFAULT \ - { nullptr, WABT_WRITE_BINARY_OPTIONS_DEFAULT } - struct WriteBinarySpecOptions { - const char* json_filename; + const char* json_filename = nullptr; WriteBinaryOptions write_binary_options; }; diff --git a/src/binary-writer.h b/src/binary-writer.h index e94b5819..7c1a3731 100644 --- a/src/binary-writer.h +++ b/src/binary-writer.h @@ -27,14 +27,11 @@ class Writer; struct Module; struct Script; -#define WABT_WRITE_BINARY_OPTIONS_DEFAULT \ - { nullptr, true, false, false } - struct WriteBinaryOptions { - Stream* log_stream; - bool canonicalize_lebs; - bool relocatable; - bool write_debug_names; + Stream* log_stream = nullptr; + bool canonicalize_lebs = true; + bool relocatable = false; + bool write_debug_names = false; }; Result write_binary_module(Writer*, const Module*, const WriteBinaryOptions*); diff --git a/src/prebuilt/wast-parser-gen.cc b/src/prebuilt/wast-parser-gen.cc index 3cccb50f..aa3055f1 100644 --- a/src/prebuilt/wast-parser-gen.cc +++ b/src/prebuilt/wast-parser-gen.cc @@ -4147,7 +4147,7 @@ yyreduce: } else { assert((yyvsp[0].script_module)->type == ScriptModule::Type::Binary); (yyval.module) = new Module(); - ReadBinaryOptions options = WABT_READ_BINARY_OPTIONS_DEFAULT; + ReadBinaryOptions options; BinaryErrorHandlerModule error_handler(&(yyvsp[0].script_module)->binary.loc, lexer, parser); read_binary_ir((yyvsp[0].script_module)->binary.data, (yyvsp[0].script_module)->binary.size, &options, &error_handler, (yyval.module)); diff --git a/src/tools/wasm-interp.cc b/src/tools/wasm-interp.cc index 2ef89804..6f1cbc23 100644 --- a/src/tools/wasm-interp.cc +++ b/src/tools/wasm-interp.cc @@ -43,8 +43,7 @@ static const char* s_trap_strings[] = {FOREACH_INTERPRETER_RESULT(V)}; static int s_verbose; static const char* s_infile; -static ReadBinaryOptions s_read_binary_options = - WABT_READ_BINARY_OPTIONS_DEFAULT; +static ReadBinaryOptions s_read_binary_options; static Thread::Options s_thread_options; static bool s_trace; static bool s_spec; diff --git a/src/tools/wasm-opcodecnt.cc b/src/tools/wasm-opcodecnt.cc index 3571871e..bbc4aa7b 100644 --- a/src/tools/wasm-opcodecnt.cc +++ b/src/tools/wasm-opcodecnt.cc @@ -37,9 +37,7 @@ static const char* s_outfile; static size_t s_cutoff = 0; static const char* s_separator = ": "; -static ReadBinaryOptions s_read_binary_options = - WABT_READ_BINARY_OPTIONS_DEFAULT; - +static ReadBinaryOptions s_read_binary_options; static std::unique_ptr<FileStream> s_log_stream; static const char s_description[] = diff --git a/src/tools/wasm2wast.cc b/src/tools/wasm2wast.cc index 45ce4bcd..53cf38a4 100644 --- a/src/tools/wasm2wast.cc +++ b/src/tools/wasm2wast.cc @@ -35,7 +35,7 @@ using namespace wabt; static int s_verbose; static const char* s_infile; static const char* s_outfile; -static ReadBinaryOptions s_read_binary_options = {nullptr, true}; +static ReadBinaryOptions s_read_binary_options(nullptr, true); static WriteWatOptions s_write_wat_options; static bool s_generate_names; static std::unique_ptr<FileStream> s_log_stream; diff --git a/src/tools/wast2wasm.cc b/src/tools/wast2wasm.cc index 4bfc2e7c..5ff77df2 100644 --- a/src/tools/wast2wasm.cc +++ b/src/tools/wast2wasm.cc @@ -41,10 +41,8 @@ static const char* s_infile; static const char* s_outfile; static bool s_dump_module; static int s_verbose; -static WriteBinaryOptions s_write_binary_options = - WABT_WRITE_BINARY_OPTIONS_DEFAULT; -static WriteBinarySpecOptions s_write_binary_spec_options = - WABT_WRITE_BINARY_SPEC_OPTIONS_DEFAULT; +static WriteBinaryOptions s_write_binary_options; +static WriteBinarySpecOptions s_write_binary_spec_options; static bool s_spec; static bool s_validate = true; static WastParseOptions s_parse_options; diff --git a/src/wast-parser.y b/src/wast-parser.y index ca25e893..a5dabd42 100644 --- a/src/wast-parser.y +++ b/src/wast-parser.y @@ -1353,7 +1353,7 @@ module : } else { assert($1->type == ScriptModule::Type::Binary); $$ = new Module(); - ReadBinaryOptions options = WABT_READ_BINARY_OPTIONS_DEFAULT; + ReadBinaryOptions options; BinaryErrorHandlerModule error_handler(&$1->binary.loc, lexer, parser); read_binary_ir($1->binary.data, $1->binary.size, &options, &error_handler, $$); |