summaryrefslogtreecommitdiff
path: root/src/ast-parser-lexer-shared.h
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2017-02-23 16:19:52 -0800
committerGitHub <noreply@github.com>2017-02-23 16:19:52 -0800
commite20131dac9bd01799ce4397cdf7e67f40001356d (patch)
tree9ae94b119bbe04e8047468fff74a165028fcb4a5 /src/ast-parser-lexer-shared.h
parentadaf0c5b86925975ca2a7048b3057da6414722cc (diff)
downloadwabt-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/ast-parser-lexer-shared.h')
-rw-r--r--src/ast-parser-lexer-shared.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ast-parser-lexer-shared.h b/src/ast-parser-lexer-shared.h
index f66e19e6..0b759556 100644
--- a/src/ast-parser-lexer-shared.h
+++ b/src/ast-parser-lexer-shared.h
@@ -48,7 +48,7 @@ typedef struct WabtTextList {
typedef struct WabtOptionalExport {
WabtExport export_;
- WabtBool has_export;
+ bool has_export;
} WabtOptionalExport;
typedef struct WabtExportedFunc {
@@ -65,14 +65,14 @@ typedef struct WabtExportedTable {
WabtTable table;
WabtElemSegment elem_segment;
WabtOptionalExport export_;
- WabtBool has_elem_segment;
+ bool has_elem_segment;
} WabtExportedTable;
typedef struct WabtExportedMemory {
WabtMemory memory;
WabtDataSegment data_segment;
WabtOptionalExport export_;
- WabtBool has_data_segment;
+ bool has_data_segment;
} WabtExportedMemory;
typedef enum WabtFuncFieldType {
@@ -150,6 +150,10 @@ typedef struct WabtAstParser {
WabtScript script;
WabtSourceErrorHandler* error_handler;
int errors;
+ /* Cached pointers to reallocated parser buffers, so they don't leak. */
+ int16_t* yyssa;
+ YYSTYPE* yyvsa;
+ YYLTYPE* yylsa;
} WabtAstParser;
WABT_EXTERN_C_BEGIN