diff options
author | Ben Smith <binjimin@gmail.com> | 2017-02-23 16:19:52 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-23 16:19:52 -0800 |
commit | e20131dac9bd01799ce4397cdf7e67f40001356d (patch) | |
tree | 9ae94b119bbe04e8047468fff74a165028fcb4a5 /src/binary-reader.h | |
parent | adaf0c5b86925975ca2a7048b3057da6414722cc (diff) | |
download | wabt-e20131dac9bd01799ce4397cdf7e67f40001356d.tar.gz wabt-e20131dac9bd01799ce4397cdf7e67f40001356d.tar.bz2 wabt-e20131dac9bd01799ce4397cdf7e67f40001356d.zip |
Switch C files to CC files (#309)
Mostly this involves adding additional casts. Though there are a few
more substantial changes:
* The default method for relocating parser stacks no longer works
because Bison assumes that C++ values can't be memcpy'd. Ours can, but
there's no easy way to make the generated code do the right thing, so
we do it manually
* Removed all uses of WabtBool and replaced with bool
* Renamed all uses of export and mutable -> export_ and mutable_
* Casting an invalid value to an enum triggers ubsan, so we have to be a
little more careful about when we do it (see binary-reader.c:read_sections())
* It's illegal to forward-declare enums, so we just #include instead.
* Designated initializers are not allowed in g++, so we have to switch
them to lazily initialized structures instead. Pretty horrible, so it
will be nice to have a better solution for C++.
Diffstat (limited to 'src/binary-reader.h')
-rw-r--r-- | src/binary-reader.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/binary-reader.h b/src/binary-reader.h index 5f13ebe5..6e4b929f 100644 --- a/src/binary-reader.h +++ b/src/binary-reader.h @@ -24,11 +24,11 @@ #include "common.h" #define WABT_READ_BINARY_OPTIONS_DEFAULT \ - { NULL, WABT_FALSE } + { NULL, false } typedef struct WabtReadBinaryOptions { struct WabtStream* log_stream; - WabtBool read_debug_names; + bool read_debug_names; } WabtReadBinaryOptions; typedef struct WabtBinaryReaderContext { @@ -94,7 +94,7 @@ typedef struct WabtBinaryReader { WabtResult (*on_import_global)(uint32_t import_index, uint32_t global_index, WabtType type, - WabtBool mutable_, + bool mutable_, void* user_data); WabtResult (*end_import_section)(WabtBinaryReaderContext* ctx); @@ -133,7 +133,7 @@ typedef struct WabtBinaryReader { WabtResult (*on_global_count)(uint32_t count, void* user_data); WabtResult (*begin_global)(uint32_t index, WabtType type, - WabtBool mutable_, + bool mutable_, void* user_data); WabtResult (*begin_global_init_expr)(uint32_t index, void* user_data); WabtResult (*end_global_init_expr)(uint32_t index, void* user_data); |