summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2017-02-27 18:09:36 -0800
committerGitHub <noreply@github.com>2017-02-27 18:09:36 -0800
commitf94275a6cf1f9ef990ec47d97a1174765790d56c (patch)
tree75d3b317855052872901e699af42f307d9c8ae58 /src
parent86ee5244e68cc2320f1e8bde02aefe255d334430 (diff)
downloadwabt-f94275a6cf1f9ef990ec47d97a1174765790d56c.tar.gz
wabt-f94275a6cf1f9ef990ec47d97a1174765790d56c.tar.bz2
wabt-f94275a6cf1f9ef990ec47d97a1174765790d56c.zip
Require C++-style casts, disallow C-style casts (#320)
Diffstat (limited to 'src')
-rw-r--r--src/apply-names.cc42
-rw-r--r--src/array.h2
-rw-r--r--src/ast-lexer.cc594
-rw-r--r--src/ast-parser-lexer-shared.cc4
-rw-r--r--src/ast-parser-lexer-shared.h2
-rw-r--r--src/ast-parser.y26
-rw-r--r--src/ast-writer.cc6
-rw-r--r--src/ast.cc29
-rw-r--r--src/ast.h16
-rw-r--r--src/binary-reader-ast.cc158
-rw-r--r--src/binary-reader-interpreter.cc149
-rw-r--r--src/binary-reader-linker.cc32
-rw-r--r--src/binary-reader-objdump.cc83
-rw-r--r--src/binary-reader-opcnt.cc17
-rw-r--r--src/binary-reader.cc169
-rw-r--r--src/binary-writer-spec.cc4
-rw-r--r--src/binary-writer.cc11
-rw-r--r--src/binding-hash.cc4
-rw-r--r--src/common.cc13
-rw-r--r--src/common.h12
-rw-r--r--src/generate-names.cc8
-rw-r--r--src/interpreter.cc133
-rw-r--r--src/interpreter.h4
-rw-r--r--src/literal.cc32
-rw-r--r--src/option-parser.cc2
-rw-r--r--src/prebuilt/ast-lexer-gen.cc1018
-rw-r--r--src/prebuilt/ast-parser-gen.cc940
-rw-r--r--src/prebuilt/ast-parser-gen.h4
-rw-r--r--src/resolve-names.cc35
-rw-r--r--src/stream.cc6
-rw-r--r--src/tools/wasm-interp.cc34
-rw-r--r--src/tools/wasm-link.cc7
-rw-r--r--src/tools/wasmdump.cc2
-rw-r--r--src/tools/wasmopcodecnt.cc6
-rw-r--r--src/type-checker.cc6
-rw-r--r--src/validator.cc4
-rw-r--r--src/vector.cc15
-rw-r--r--src/vector.h96
-rw-r--r--src/writer.cc18
39 files changed, 1906 insertions, 1837 deletions
diff --git a/src/apply-names.cc b/src/apply-names.cc
index c78beb64..43867e0a 100644
--- a/src/apply-names.cc
+++ b/src/apply-names.cc
@@ -59,7 +59,7 @@ static WabtLabel* find_label_by_var(Context* ctx, WabtVar* var) {
}
return nullptr;
} else {
- if (var->index < 0 || (size_t)var->index >= ctx->labels.size)
+ if (var->index < 0 || static_cast<size_t>(var->index) >= ctx->labels.size)
return nullptr;
return ctx->labels.data[ctx->labels.size - 1 - var->index];
}
@@ -121,19 +121,19 @@ static WabtResult use_name_for_param_and_local_var(Context* ctx,
WabtVar* var) {
int local_index = wabt_get_local_index_by_var(func, var);
if (local_index < 0 ||
- (size_t)local_index >= wabt_get_num_params_and_locals(func))
+ static_cast<size_t>(local_index) >= wabt_get_num_params_and_locals(func))
return WABT_ERROR;
uint32_t num_params = wabt_get_num_params(func);
WabtStringSlice* name;
- if ((uint32_t)local_index < num_params) {
+ if (static_cast<uint32_t>(local_index) < num_params) {
/* param */
- assert((size_t)local_index < ctx->param_index_to_name.size);
+ assert(static_cast<size_t>(local_index) < ctx->param_index_to_name.size);
name = &ctx->param_index_to_name.data[local_index];
} else {
/* local */
local_index -= num_params;
- assert((size_t)local_index < ctx->local_index_to_name.size);
+ assert(static_cast<size_t>(local_index) < ctx->local_index_to_name.size);
name = &ctx->local_index_to_name.data[local_index];
}
@@ -151,45 +151,45 @@ static WabtResult use_name_for_param_and_local_var(Context* ctx,
}
static WabtResult begin_block_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
push_label(ctx, &expr->block.label);
return WABT_OK;
}
static WabtResult end_block_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
pop_label(ctx);
return WABT_OK;
}
static WabtResult begin_loop_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
push_label(ctx, &expr->loop.label);
return WABT_OK;
}
static WabtResult end_loop_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
pop_label(ctx);
return WABT_OK;
}
static WabtResult on_br_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtLabel* label = find_label_by_var(ctx, &expr->br.var);
use_name_for_var(label, &expr->br.var);
return WABT_OK;
}
static WabtResult on_br_if_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtLabel* label = find_label_by_var(ctx, &expr->br_if.var);
use_name_for_var(label, &expr->br_if.var);
return WABT_OK;
}
static WabtResult on_br_table_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
size_t i;
WabtVarVector* targets = &expr->br_table.targets;
for (i = 0; i < targets->size; ++i) {
@@ -204,58 +204,58 @@ static WabtResult on_br_table_expr(WabtExpr* expr, void* user_data) {
}
static WabtResult on_call_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(use_name_for_func_var(ctx->module, &expr->call.var));
return WABT_OK;
}
static WabtResult on_call_indirect_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(
use_name_for_func_type_var(ctx->module, &expr->call_indirect.var));
return WABT_OK;
}
static WabtResult on_get_global_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(use_name_for_global_var(ctx->module, &expr->get_global.var));
return WABT_OK;
}
static WabtResult on_get_local_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(use_name_for_param_and_local_var(ctx, ctx->current_func,
&expr->get_local.var));
return WABT_OK;
}
static WabtResult begin_if_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
push_label(ctx, &expr->if_.true_.label);
return WABT_OK;
}
static WabtResult end_if_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
pop_label(ctx);
return WABT_OK;
}
static WabtResult on_set_global_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(use_name_for_global_var(ctx->module, &expr->set_global.var));
return WABT_OK;
}
static WabtResult on_set_local_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(use_name_for_param_and_local_var(ctx, ctx->current_func,
&expr->set_local.var));
return WABT_OK;
}
static WabtResult on_tee_local_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(use_name_for_param_and_local_var(ctx, ctx->current_func,
&expr->tee_local.var));
return WABT_OK;
diff --git a/src/array.h b/src/array.h
index 766ff22d..21c30182 100644
--- a/src/array.h
+++ b/src/array.h
@@ -39,7 +39,7 @@
} \
void wabt_new_##name##_array(type##Array* array, size_t size) { \
array->size = size; \
- array->data = (type*)wabt_alloc_zero(size * sizeof(type)); \
+ array->data = static_cast<type*>(wabt_alloc_zero(size * sizeof(type))); \
}
#define WABT_DESTROY_ARRAY_AND_ELEMENTS(v, name) \
diff --git a/src/ast-lexer.cc b/src/ast-lexer.cc
index 3ded34d7..933e1b2c 100644
--- a/src/ast-lexer.cc
+++ b/src/ast-lexer.cc
@@ -98,7 +98,7 @@ static WabtResult fill(WabtLocation* loc,
if (lexer->eof)
return WABT_ERROR;
size_t free = lexer->token - lexer->buffer;
- assert((size_t)(lexer->cursor - lexer->buffer) >= free);
+ assert(static_cast<size_t>(lexer->cursor - lexer->buffer) >= free);
/* our buffer is too small, need to realloc */
if (free < need) {
char* old_buffer = lexer->buffer;
@@ -113,7 +113,8 @@ static WabtResult fill(WabtLocation* loc,
/* TODO(binji): could just alloc instead, because we know we'll need to
* memmove below */
- char* new_buffer = (char*)wabt_realloc(lexer->buffer, new_buffer_size);
+ char* new_buffer =
+ static_cast<char*>(wabt_realloc(lexer->buffer, new_buffer_size));
if (!new_buffer) {
wabt_ast_parser_error(loc, lexer, parser,
"unable to reallocate lexer buffer.");
@@ -148,7 +149,8 @@ static WabtResult fill(WabtLocation* loc,
size_t bytes_left = lexer->source.buffer.size - offset;
if (read_size > bytes_left)
read_size = bytes_left;
- memcpy(lexer->buffer, (char*)lexer->source.buffer.data + offset,
+ memcpy(lexer->buffer,
+ static_cast<const char*>(lexer->source.buffer.data) + offset,
read_size);
lexer->source.buffer.read_offset += read_size;
lexer->limit += read_size;
@@ -178,297 +180,305 @@ int wabt_ast_lexer_lex(WABT_AST_PARSER_STYPE* lval,
for (;;) {
lexer->token = lexer->cursor;
- /*!re2c
- re2c:condprefix = YYCOND_;
- re2c:condenumprefix = YYCOND_;
- re2c:define:YYCTYPE = "unsigned char";
- re2c:define:YYCURSOR = lexer->cursor;
- re2c:define:YYMARKER = lexer->marker;
- re2c:define:YYLIMIT = lexer->limit;
- re2c:define:YYFILL = "FILL";
- re2c:define:YYGETCONDITION = "cond";
- re2c:define:YYGETCONDITION:naked = 1;
- re2c:define:YYSETCONDITION = "BEGIN";
-
- space = [ \t];
- digit = [0-9];
- digits = [0-9]+;
- hexdigit = [0-9a-fA-F];
- letter = [a-zA-Z];
- symbol = [+\-*\/\\\^~=<>!?@#$%&|:`.];
- tick = "'";
- escape = [nt\\'"];
- character = [^"\\\x00-\x1f\x7f] | "\\" escape | "\\" hexdigit hexdigit;
- sign = [+-];
- num = digit+;
- hexnum = "0x" hexdigit+;
- nat = num | hexnum;
- int = sign nat;
- float0 = sign? num "." digit*;
- float1 = sign? num ("." digit*)? [eE] sign? num;
- hexfloat = sign? "0x" hexdigit+ "."? hexdigit* "p" sign? digit+;
- infinity = sign? ("inf" | "infinity");
- nan = sign? "nan" | sign? "nan:0x" hexdigit+;
- float = float0 | float1;
- text = '"' character* '"';
- atom = (letter | digit | "_" | tick | symbol)+;
- name = "$" atom;
- EOF = "\x00";
-
- <i> "(" { RETURN(LPAR); }
- <i> ")" { RETURN(RPAR); }
- <i> nat { LITERAL(INT); RETURN(NAT); }
- <i> int { LITERAL(INT); RETURN(INT); }
- <i> float { LITERAL(FLOAT); RETURN(FLOAT); }
- <i> hexfloat { LITERAL(HEXFLOAT); RETURN(FLOAT); }
- <i> infinity { LITERAL(INFINITY); RETURN(FLOAT); }
- <i> nan { LITERAL(NAN); RETURN(FLOAT); }
- <i> text { TEXT; RETURN(TEXT); }
- <i> '"' => BAD_TEXT { continue; }
- <BAD_TEXT> character { continue; }
- <BAD_TEXT> "\n" => i { ERROR("newline in string"); NEWLINE; continue; }
- <BAD_TEXT> "\\". { ERROR("bad escape \"%.*s\"", (int)yyleng, yytext);
- continue; }
- <BAD_TEXT> '"' => i { TEXT; RETURN(TEXT); }
- <BAD_TEXT> EOF { ERROR("unexpected EOF"); RETURN(EOF); }
- <BAD_TEXT> [^] { ERROR("illegal character in string"); continue; }
- <i> "i32" { TYPE(I32); RETURN(VALUE_TYPE); }
- <i> "i64" { TYPE(I64); RETURN(VALUE_TYPE); }
- <i> "f32" { TYPE(F32); RETURN(VALUE_TYPE); }
- <i> "f64" { TYPE(F64); RETURN(VALUE_TYPE); }
- <i> "anyfunc" { RETURN(ANYFUNC); }
- <i> "mut" { RETURN(MUT); }
- <i> "nop" { RETURN(NOP); }
- <i> "block" { RETURN(BLOCK); }
- <i> "if" { RETURN(IF); }
- <i> "if_else" { RETURN(IF); }
- <i> "then" { RETURN(THEN); }
- <i> "else" { RETURN(ELSE); }
- <i> "loop" { RETURN(LOOP); }
- <i> "br" { RETURN(BR); }
- <i> "br_if" { RETURN(BR_IF); }
- <i> "br_table" { RETURN(BR_TABLE); }
- <i> "call" { RETURN(CALL); }
- <i> "call_import" { RETURN(CALL_IMPORT); }
- <i> "call_indirect" { RETURN(CALL_INDIRECT); }
- <i> "drop" { RETURN(DROP); }
- <i> "end" { RETURN(END); }
- <i> "return" { RETURN(RETURN); }
- <i> "get_local" { RETURN(GET_LOCAL); }
- <i> "set_local" { RETURN(SET_LOCAL); }
- <i> "tee_local" { RETURN(TEE_LOCAL); }
- <i> "get_global" { RETURN(GET_GLOBAL); }
- <i> "set_global" { RETURN(SET_GLOBAL); }
- <i> "i32.load" { OPCODE(I32_LOAD); RETURN(LOAD); }
- <i> "i64.load" { OPCODE(I64_LOAD); RETURN(LOAD); }
- <i> "f32.load" { OPCODE(F32_LOAD); RETURN(LOAD); }
- <i> "f64.load" { OPCODE(F64_LOAD); RETURN(LOAD); }
- <i> "i32.store" { OPCODE(I32_STORE); RETURN(STORE); }
- <i> "i64.store" { OPCODE(I64_STORE); RETURN(STORE); }
- <i> "f32.store" { OPCODE(F32_STORE); RETURN(STORE); }
- <i> "f64.store" { OPCODE(F64_STORE); RETURN(STORE); }
- <i> "i32.load8_s" { OPCODE(I32_LOAD8_S); RETURN(LOAD); }
- <i> "i64.load8_s" { OPCODE(I64_LOAD8_S); RETURN(LOAD); }
- <i> "i32.load8_u" { OPCODE(I32_LOAD8_U); RETURN(LOAD); }
- <i> "i64.load8_u" { OPCODE(I64_LOAD8_U); RETURN(LOAD); }
- <i> "i32.load16_s" { OPCODE(I32_LOAD16_S); RETURN(LOAD); }
- <i> "i64.load16_s" { OPCODE(I64_LOAD16_S); RETURN(LOAD); }
- <i> "i32.load16_u" { OPCODE(I32_LOAD16_U); RETURN(LOAD); }
- <i> "i64.load16_u" { OPCODE(I64_LOAD16_U); RETURN(LOAD); }
- <i> "i64.load32_s" { OPCODE(I64_LOAD32_S); RETURN(LOAD); }
- <i> "i64.load32_u" { OPCODE(I64_LOAD32_U); RETURN(LOAD); }
- <i> "i32.store8" { OPCODE(I32_STORE8); RETURN(STORE); }
- <i> "i64.store8" { OPCODE(I64_STORE8); RETURN(STORE); }
- <i> "i32.store16" { OPCODE(I32_STORE16); RETURN(STORE); }
- <i> "i64.store16" { OPCODE(I64_STORE16); RETURN(STORE); }
- <i> "i64.store32" { OPCODE(I64_STORE32); RETURN(STORE); }
- <i> "offset=" nat { TEXT_AT(7); RETURN(OFFSET_EQ_NAT); }
- <i> "align=" nat { TEXT_AT(6); RETURN(ALIGN_EQ_NAT); }
- <i> "i32.const" { TYPE(I32); RETURN(CONST); }
- <i> "i64.const" { TYPE(I64); RETURN(CONST); }
- <i> "f32.const" { TYPE(F32); RETURN(CONST); }
- <i> "f64.const" { TYPE(F64); RETURN(CONST); }
- <i> "i32.eqz" { OPCODE(I32_EQZ); RETURN(CONVERT); }
- <i> "i64.eqz" { OPCODE(I64_EQZ); RETURN(CONVERT); }
- <i> "i32.clz" { OPCODE(I32_CLZ); RETURN(UNARY); }
- <i> "i64.clz" { OPCODE(I64_CLZ); RETURN(UNARY); }
- <i> "i32.ctz" { OPCODE(I32_CTZ); RETURN(UNARY); }
- <i> "i64.ctz" { OPCODE(I64_CTZ); RETURN(UNARY); }
- <i> "i32.popcnt" { OPCODE(I32_POPCNT); RETURN(UNARY); }
- <i> "i64.popcnt" { OPCODE(I64_POPCNT); RETURN(UNARY); }
- <i> "f32.neg" { OPCODE(F32_NEG); RETURN(UNARY); }
- <i> "f64.neg" { OPCODE(F64_NEG); RETURN(UNARY); }
- <i> "f32.abs" { OPCODE(F32_ABS); RETURN(UNARY); }
- <i> "f64.abs" { OPCODE(F64_ABS); RETURN(UNARY); }
- <i> "f32.sqrt" { OPCODE(F32_SQRT); RETURN(UNARY); }
- <i> "f64.sqrt" { OPCODE(F64_SQRT); RETURN(UNARY); }
- <i> "f32.ceil" { OPCODE(F32_CEIL); RETURN(UNARY); }
- <i> "f64.ceil" { OPCODE(F64_CEIL); RETURN(UNARY); }
- <i> "f32.floor" { OPCODE(F32_FLOOR); RETURN(UNARY); }
- <i> "f64.floor" { OPCODE(F64_FLOOR); RETURN(UNARY); }
- <i> "f32.trunc" { OPCODE(F32_TRUNC); RETURN(UNARY); }
- <i> "f64.trunc" { OPCODE(F64_TRUNC); RETURN(UNARY); }
- <i> "f32.nearest" { OPCODE(F32_NEAREST); RETURN(UNARY); }
- <i> "f64.nearest" { OPCODE(F64_NEAREST); RETURN(UNARY); }
- <i> "i32.add" { OPCODE(I32_ADD); RETURN(BINARY); }
- <i> "i64.add" { OPCODE(I64_ADD); RETURN(BINARY); }
- <i> "i32.sub" { OPCODE(I32_SUB); RETURN(BINARY); }
- <i> "i64.sub" { OPCODE(I64_SUB); RETURN(BINARY); }
- <i> "i32.mul" { OPCODE(I32_MUL); RETURN(BINARY); }
- <i> "i64.mul" { OPCODE(I64_MUL); RETURN(BINARY); }
- <i> "i32.div_s" { OPCODE(I32_DIV_S); RETURN(BINARY); }
- <i> "i64.div_s" { OPCODE(I64_DIV_S); RETURN(BINARY); }
- <i> "i32.div_u" { OPCODE(I32_DIV_U); RETURN(BINARY); }
- <i> "i64.div_u" { OPCODE(I64_DIV_U); RETURN(BINARY); }
- <i> "i32.rem_s" { OPCODE(I32_REM_S); RETURN(BINARY); }
- <i> "i64.rem_s" { OPCODE(I64_REM_S); RETURN(BINARY); }
- <i> "i32.rem_u" { OPCODE(I32_REM_U); RETURN(BINARY); }
- <i> "i64.rem_u" { OPCODE(I64_REM_U); RETURN(BINARY); }
- <i> "i32.and" { OPCODE(I32_AND); RETURN(BINARY); }
- <i> "i64.and" { OPCODE(I64_AND); RETURN(BINARY); }
- <i> "i32.or" { OPCODE(I32_OR); RETURN(BINARY); }
- <i> "i64.or" { OPCODE(I64_OR); RETURN(BINARY); }
- <i> "i32.xor" { OPCODE(I32_XOR); RETURN(BINARY); }
- <i> "i64.xor" { OPCODE(I64_XOR); RETURN(BINARY); }
- <i> "i32.shl" { OPCODE(I32_SHL); RETURN(BINARY); }
- <i> "i64.shl" { OPCODE(I64_SHL); RETURN(BINARY); }
- <i> "i32.shr_s" { OPCODE(I32_SHR_S); RETURN(BINARY); }
- <i> "i64.shr_s" { OPCODE(I64_SHR_S); RETURN(BINARY); }
- <i> "i32.shr_u" { OPCODE(I32_SHR_U); RETURN(BINARY); }
- <i> "i64.shr_u" { OPCODE(I64_SHR_U); RETURN(BINARY); }
- <i> "i32.rotl" { OPCODE(I32_ROTL); RETURN(BINARY); }
- <i> "i64.rotl" { OPCODE(I64_ROTL); RETURN(BINARY); }
- <i> "i32.rotr" { OPCODE(I32_ROTR); RETURN(BINARY); }
- <i> "i64.rotr" { OPCODE(I64_ROTR); RETURN(BINARY); }
- <i> "f32.add" { OPCODE(F32_ADD); RETURN(BINARY); }
- <i> "f64.add" { OPCODE(F64_ADD); RETURN(BINARY); }
- <i> "f32.sub" { OPCODE(F32_SUB); RETURN(BINARY); }
- <i> "f64.sub" { OPCODE(F64_SUB); RETURN(BINARY); }
- <i> "f32.mul" { OPCODE(F32_MUL); RETURN(BINARY); }
- <i> "f64.mul" { OPCODE(F64_MUL); RETURN(BINARY); }
- <i> "f32.div" { OPCODE(F32_DIV); RETURN(BINARY); }
- <i> "f64.div" { OPCODE(F64_DIV); RETURN(BINARY); }
- <i> "f32.min" { OPCODE(F32_MIN); RETURN(BINARY); }
- <i> "f64.min" { OPCODE(F64_MIN); RETURN(BINARY); }
- <i> "f32.max" { OPCODE(F32_MAX); RETURN(BINARY); }
- <i> "f64.max" { OPCODE(F64_MAX); RETURN(BINARY); }
- <i> "f32.copysign" { OPCODE(F32_COPYSIGN); RETURN(BINARY); }
- <i> "f64.copysign" { OPCODE(F64_COPYSIGN); RETURN(BINARY); }
- <i> "i32.eq" { OPCODE(I32_EQ); RETURN(COMPARE); }
- <i> "i64.eq" { OPCODE(I64_EQ); RETURN(COMPARE); }
- <i> "i32.ne" { OPCODE(I32_NE); RETURN(COMPARE); }
- <i> "i64.ne" { OPCODE(I64_NE); RETURN(COMPARE); }
- <i> "i32.lt_s" { OPCODE(I32_LT_S); RETURN(COMPARE); }
- <i> "i64.lt_s" { OPCODE(I64_LT_S); RETURN(COMPARE); }
- <i> "i32.lt_u" { OPCODE(I32_LT_U); RETURN(COMPARE); }
- <i> "i64.lt_u" { OPCODE(I64_LT_U); RETURN(COMPARE); }
- <i> "i32.le_s" { OPCODE(I32_LE_S); RETURN(COMPARE); }
- <i> "i64.le_s" { OPCODE(I64_LE_S); RETURN(COMPARE); }
- <i> "i32.le_u" { OPCODE(I32_LE_U); RETURN(COMPARE); }
- <i> "i64.le_u" { OPCODE(I64_LE_U); RETURN(COMPARE); }
- <i> "i32.gt_s" { OPCODE(I32_GT_S); RETURN(COMPARE); }
- <i> "i64.gt_s" { OPCODE(I64_GT_S); RETURN(COMPARE); }
- <i> "i32.gt_u" { OPCODE(I32_GT_U); RETURN(COMPARE); }
- <i> "i64.gt_u" { OPCODE(I64_GT_U); RETURN(COMPARE); }
- <i> "i32.ge_s" { OPCODE(I32_GE_S); RETURN(COMPARE); }
- <i> "i64.ge_s" { OPCODE(I64_GE_S); RETURN(COMPARE); }
- <i> "i32.ge_u" { OPCODE(I32_GE_U); RETURN(COMPARE); }
- <i> "i64.ge_u" { OPCODE(I64_GE_U); RETURN(COMPARE); }
- <i> "f32.eq" { OPCODE(F32_EQ); RETURN(COMPARE); }
- <i> "f64.eq" { OPCODE(F64_EQ); RETURN(COMPARE); }
- <i> "f32.ne" { OPCODE(F32_NE); RETURN(COMPARE); }
- <i> "f64.ne" { OPCODE(F64_NE); RETURN(COMPARE); }
- <i> "f32.lt" { OPCODE(F32_LT); RETURN(COMPARE); }
- <i> "f64.lt" { OPCODE(F64_LT); RETURN(COMPARE); }
- <i> "f32.le" { OPCODE(F32_LE); RETURN(COMPARE); }
- <i> "f64.le" { OPCODE(F64_LE); RETURN(COMPARE); }
- <i> "f32.gt" { OPCODE(F32_GT); RETURN(COMPARE); }
- <i> "f64.gt" { OPCODE(F64_GT); RETURN(COMPARE); }
- <i> "f32.ge" { OPCODE(F32_GE); RETURN(COMPARE); }
- <i> "f64.ge" { OPCODE(F64_GE); RETURN(COMPARE); }
- <i> "i64.extend_s/i32" { OPCODE(I64_EXTEND_S_I32); RETURN(CONVERT); }
- <i> "i64.extend_u/i32" { OPCODE(I64_EXTEND_U_I32); RETURN(CONVERT); }
- <i> "i32.wrap/i64" { OPCODE(I32_WRAP_I64); RETURN(CONVERT); }
- <i> "i32.trunc_s/f32" { OPCODE(I32_TRUNC_S_F32); RETURN(CONVERT); }
- <i> "i64.trunc_s/f32" { OPCODE(I64_TRUNC_S_F32); RETURN(CONVERT); }
- <i> "i32.trunc_s/f64" { OPCODE(I32_TRUNC_S_F64); RETURN(CONVERT); }
- <i> "i64.trunc_s/f64" { OPCODE(I64_TRUNC_S_F64); RETURN(CONVERT); }
- <i> "i32.trunc_u/f32" { OPCODE(I32_TRUNC_U_F32); RETURN(CONVERT); }
- <i> "i64.trunc_u/f32" { OPCODE(I64_TRUNC_U_F32); RETURN(CONVERT); }
- <i> "i32.trunc_u/f64" { OPCODE(I32_TRUNC_U_F64); RETURN(CONVERT); }
- <i> "i64.trunc_u/f64" { OPCODE(I64_TRUNC_U_F64); RETURN(CONVERT); }
- <i> "f32.convert_s/i32" { OPCODE(F32_CONVERT_S_I32); RETURN(CONVERT); }
- <i> "f64.convert_s/i32" { OPCODE(F64_CONVERT_S_I32); RETURN(CONVERT); }
- <i> "f32.convert_s/i64" { OPCODE(F32_CONVERT_S_I64); RETURN(CONVERT); }
- <i> "f64.convert_s/i64" { OPCODE(F64_CONVERT_S_I64); RETURN(CONVERT); }
- <i> "f32.convert_u/i32" { OPCODE(F32_CONVERT_U_I32); RETURN(CONVERT); }
- <i> "f64.convert_u/i32" { OPCODE(F64_CONVERT_U_I32); RETURN(CONVERT); }
- <i> "f32.convert_u/i64" { OPCODE(F32_CONVERT_U_I64); RETURN(CONVERT); }
- <i> "f64.convert_u/i64" { OPCODE(F64_CONVERT_U_I64); RETURN(CONVERT); }
- <i> "f64.promote/f32" { OPCODE(F64_PROMOTE_F32); RETURN(CONVERT); }
- <i> "f32.demote/f64" { OPCODE(F32_DEMOTE_F64); RETURN(CONVERT); }
- <i> "f32.reinterpret/i32" { OPCODE(F32_REINTERPRET_I32); RETURN(CONVERT); }
- <i> "i32.reinterpret/f32" { OPCODE(I32_REINTERPRET_F32); RETURN(CONVERT); }
- <i> "f64.reinterpret/i64" { OPCODE(F64_REINTERPRET_I64); RETURN(CONVERT); }
- <i> "i64.reinterpret/f64" { OPCODE(I64_REINTERPRET_F64); RETURN(CONVERT); }
- <i> "select" { RETURN(SELECT); }
- <i> "unreachable" { RETURN(UNREACHABLE); }
- <i> "current_memory" { RETURN(CURRENT_MEMORY); }
- <i> "grow_memory" { RETURN(GROW_MEMORY); }
- <i> "type" { RETURN(TYPE); }
- <i> "func" { RETURN(FUNC); }
- <i> "param" { RETURN(PARAM); }
- <i> "result" { RETURN(RESULT); }
- <i> "local" { RETURN(LOCAL); }
- <i> "global" { RETURN(GLOBAL); }
- <i> "module" { RETURN(MODULE); }
- <i> "table" { RETURN(TABLE); }
- <i> "memory" { RETURN(MEMORY); }
- <i> "start" { RETURN(START); }
- <i> "elem" { RETURN(ELEM); }
- <i> "data" { RETURN(DATA); }
- <i> "offset" { RETURN(OFFSET); }
- <i> "import" { RETURN(IMPORT); }
- <i> "export" { RETURN(EXPORT); }
- <i> "register" { RETURN(REGISTER); }
- <i> "invoke" { RETURN(INVOKE); }
- <i> "get" { RETURN(GET); }
- <i> "assert_malformed" { RETURN(ASSERT_MALFORMED); }
- <i> "assert_invalid" { RETURN(ASSERT_INVALID); }
- <i> "assert_unlinkable" { RETURN(ASSERT_UNLINKABLE); }
- <i> "assert_return" { RETURN(ASSERT_RETURN); }
- <i> "assert_return_nan" { RETURN(ASSERT_RETURN_NAN); }
- <i> "assert_trap" { RETURN(ASSERT_TRAP); }
- <i> "assert_exhaustion" { RETURN(ASSERT_EXHAUSTION); }
- <i> "input" { RETURN(INPUT); }
- <i> "output" { RETURN(OUTPUT); }
- <i> name { TEXT; RETURN(VAR); }
-
- <i> ";;" => LINE_COMMENT { continue; }
- <LINE_COMMENT> "\n" => i { NEWLINE; continue; }
- <LINE_COMMENT> [^\n]* { continue; }
- <i> "(;" => BLOCK_COMMENT { COMMENT_NESTING = 1; continue; }
- <BLOCK_COMMENT> "(;" { COMMENT_NESTING++; continue; }
- <BLOCK_COMMENT> ";)" { if (--COMMENT_NESTING == 0)
- BEGIN(YYCOND_INIT);
- continue; }
- <BLOCK_COMMENT> "\n" { NEWLINE; continue; }
- <BLOCK_COMMENT> EOF { ERROR("unexpected EOF"); RETURN(EOF); }
- <BLOCK_COMMENT> [^] { continue; }
- <i> "\n" { NEWLINE; continue; }
- <i> [ \t\r]+ { continue; }
- <i> atom { ERROR("unexpected token \"%.*s\"",
- (int)yyleng, yytext);
- continue; }
- <*> EOF { RETURN(EOF); }
- <*> [^] { ERROR("unexpected char"); continue; }
- */
+ /*!re2c
+ re2c:condprefix = YYCOND_;
+ re2c:condenumprefix = YYCOND_;
+ re2c:define:YYCTYPE = "unsigned char";
+ re2c:define:YYCURSOR = lexer->cursor;
+ re2c:define:YYMARKER = lexer->marker;
+ re2c:define:YYLIMIT = lexer->limit;
+ re2c:define:YYFILL = "FILL";
+ re2c:define:YYGETCONDITION = "cond";
+ re2c:define:YYGETCONDITION:naked = 1;
+ re2c:define:YYSETCONDITION = "BEGIN";
+
+ space = [ \t];
+ digit = [0-9];
+ digits = [0-9]+;
+ hexdigit = [0-9a-fA-F];
+ letter = [a-zA-Z];
+ symbol = [+\-*\/\\\^~=<>!?@#$%&|:`.];
+ tick = "'";
+ escape = [nt\\'"];
+ character = [^"\\\x00-\x1f\x7f] | "\\" escape | "\\" hexdigit hexdigit;
+ sign = [+-];
+ num = digit+;
+ hexnum = "0x" hexdigit+;
+ nat = num | hexnum;
+ int = sign nat;
+ float0 = sign? num "." digit*;
+ float1 = sign? num ("." digit*)? [eE] sign? num;
+ hexfloat = sign? "0x" hexdigit+ "."? hexdigit* "p" sign? digit+;
+ infinity = sign? ("inf" | "infinity");
+ nan = sign? "nan" | sign? "nan:0x" hexdigit+;
+ float = float0 | float1;
+ text = '"' character* '"';
+ atom = (letter | digit | "_" | tick | symbol)+;
+ name = "$" atom;
+ EOF = "\x00";
+
+ <i> "(" { RETURN(LPAR); }
+ <i> ")" { RETURN(RPAR); }
+ <i> nat { LITERAL(INT); RETURN(NAT); }
+ <i> int { LITERAL(INT); RETURN(INT); }
+ <i> float { LITERAL(FLOAT); RETURN(FLOAT); }
+ <i> hexfloat { LITERAL(HEXFLOAT); RETURN(FLOAT); }
+ <i> infinity { LITERAL(INFINITY); RETURN(FLOAT); }
+ <i> nan { LITERAL(NAN); RETURN(FLOAT); }
+ <i> text { TEXT; RETURN(TEXT); }
+ <i> '"' => BAD_TEXT { continue; }
+ <BAD_TEXT> character { continue; }
+ <BAD_TEXT> "\n" => i { ERROR("newline in string"); NEWLINE; continue;
+ }
+ <BAD_TEXT> "\\". { ERROR("bad escape \"%.*s\"",
+ static_cast<int>(yyleng), yytext);
+ continue; }
+ <BAD_TEXT> '"' => i { TEXT; RETURN(TEXT); }
+ <BAD_TEXT> EOF { ERROR("unexpected EOF"); RETURN(EOF); }
+ <BAD_TEXT> [^] { ERROR("illegal character in string");
+ continue; }
+ <i> "i32" { TYPE(I32); RETURN(VALUE_TYPE); }
+ <i> "i64" { TYPE(I64); RETURN(VALUE_TYPE); }
+ <i> "f32" { TYPE(F32); RETURN(VALUE_TYPE); }
+ <i> "f64" { TYPE(F64); RETURN(VALUE_TYPE); }
+ <i> "anyfunc" { RETURN(ANYFUNC); }
+ <i> "mut" { RETURN(MUT); }
+ <i> "nop" { RETURN(NOP); }
+ <i> "block" { RETURN(BLOCK); }
+ <i> "if" { RETURN(IF); }
+ <i> "if_else" { RETURN(IF); }
+ <i> "then" { RETURN(THEN); }
+ <i> "else" { RETURN(ELSE); }
+ <i> "loop" { RETURN(LOOP); }
+ <i> "br" { RETURN(BR); }
+ <i> "br_if" { RETURN(BR_IF); }
+ <i> "br_table" { RETURN(BR_TABLE); }
+ <i> "call" { RETURN(CALL); }
+ <i> "call_import" { RETURN(CALL_IMPORT); }
+ <i> "call_indirect" { RETURN(CALL_INDIRECT); }
+ <i> "drop" { RETURN(DROP); }
+ <i> "end" { RETURN(END); }
+ <i> "return" { RETURN(RETURN); }
+ <i> "get_local" { RETURN(GET_LOCAL); }
+ <i> "set_local" { RETURN(SET_LOCAL); }
+ <i> "tee_local" { RETURN(TEE_LOCAL); }
+ <i> "get_global" { RETURN(GET_GLOBAL); }
+ <i> "set_global" { RETURN(SET_GLOBAL); }
+ <i> "i32.load" { OPCODE(I32_LOAD); RETURN(LOAD); }
+ <i> "i64.load" { OPCODE(I64_LOAD); RETURN(LOAD); }
+ <i> "f32.load" { OPCODE(F32_LOAD); RETURN(LOAD); }
+ <i> "f64.load" { OPCODE(F64_LOAD); RETURN(LOAD); }
+ <i> "i32.store" { OPCODE(I32_STORE); RETURN(STORE); }
+ <i> "i64.store" { OPCODE(I64_STORE); RETURN(STORE); }
+ <i> "f32.store" { OPCODE(F32_STORE); RETURN(STORE); }
+ <i> "f64.store" { OPCODE(F64_STORE); RETURN(STORE); }
+ <i> "i32.load8_s" { OPCODE(I32_LOAD8_S); RETURN(LOAD); }
+ <i> "i64.load8_s" { OPCODE(I64_LOAD8_S); RETURN(LOAD); }
+ <i> "i32.load8_u" { OPCODE(I32_LOAD8_U); RETURN(LOAD); }
+ <i> "i64.load8_u" { OPCODE(I64_LOAD8_U); RETURN(LOAD); }
+ <i> "i32.load16_s" { OPCODE(I32_LOAD16_S); RETURN(LOAD); }
+ <i> "i64.load16_s" { OPCODE(I64_LOAD16_S); RETURN(LOAD); }
+ <i> "i32.load16_u" { OPCODE(I32_LOAD16_U); RETURN(LOAD); }
+ <i> "i64.load16_u" { OPCODE(I64_LOAD16_U); RETURN(LOAD); }
+ <i> "i64.load32_s" { OPCODE(I64_LOAD32_S); RETURN(LOAD); }
+ <i> "i64.load32_u" { OPCODE(I64_LOAD32_U); RETURN(LOAD); }
+ <i> "i32.store8" { OPCODE(I32_STORE8); RETURN(STORE); }
+ <i> "i64.store8" { OPCODE(I64_STORE8); RETURN(STORE); }
+ <i> "i32.store16" { OPCODE(I32_STORE16); RETURN(STORE); }
+ <i> "i64.store16" { OPCODE(I64_STORE16); RETURN(STORE); }
+ <i> "i64.store32" { OPCODE(I64_STORE32); RETURN(STORE); }
+ <i> "offset=" nat { TEXT_AT(7); RETURN(OFFSET_EQ_NAT); }
+ <i> "align=" nat { TEXT_AT(6); RETURN(ALIGN_EQ_NAT); }
+ <i> "i32.const" { TYPE(I32); RETURN(CONST); }
+ <i> "i64.const" { TYPE(I64); RETURN(CONST); }
+ <i> "f32.const" { TYPE(F32); RETURN(CONST); }
+ <i> "f64.const" { TYPE(F64); RETURN(CONST); }
+ <i> "i32.eqz" { OPCODE(I32_EQZ); RETURN(CONVERT); }
+ <i> "i64.eqz" { OPCODE(I64_EQZ); RETURN(CONVERT); }
+ <i> "i32.clz" { OPCODE(I32_CLZ); RETURN(UNARY); }
+ <i> "i64.clz" { OPCODE(I64_CLZ); RETURN(UNARY); }
+ <i> "i32.ctz" { OPCODE(I32_CTZ); RETURN(UNARY); }
+ <i> "i64.ctz" { OPCODE(I64_CTZ); RETURN(UNARY); }
+ <i> "i32.popcnt" { OPCODE(I32_POPCNT); RETURN(UNARY); }
+ <i> "i64.popcnt" { OPCODE(I64_POPCNT); RETURN(UNARY); }
+ <i> "f32.neg" { OPCODE(F32_NEG); RETURN(UNARY); }
+ <i> "f64.neg" { OPCODE(F64_NEG); RETURN(UNARY); }
+ <i> "f32.abs" { OPCODE(F32_ABS); RETURN(UNARY); }
+ <i> "f64.abs" { OPCODE(F64_ABS); RETURN(UNARY); }
+ <i> "f32.sqrt" { OPCODE(F32_SQRT); RETURN(UNARY); }
+ <i> "f64.sqrt" { OPCODE(F64_SQRT); RETURN(UNARY); }
+ <i> "f32.ceil" { OPCODE(F32_CEIL); RETURN(UNARY); }
+ <i> "f64.ceil" { OPCODE(F64_CEIL); RETURN(UNARY); }
+ <i> "f32.floor" { OPCODE(F32_FLOOR); RETURN(UNARY); }
+ <i> "f64.floor" { OPCODE(F64_FLOOR); RETURN(UNARY); }
+ <i> "f32.trunc" { OPCODE(F32_TRUNC); RETURN(UNARY); }
+ <i> "f64.trunc" { OPCODE(F64_TRUNC); RETURN(UNARY); }
+ <i> "f32.nearest" { OPCODE(F32_NEAREST); RETURN(UNARY); }
+ <i> "f64.nearest" { OPCODE(F64_NEAREST); RETURN(UNARY); }
+ <i> "i32.add" { OPCODE(I32_ADD); RETURN(BINARY); }
+ <i> "i64.add" { OPCODE(I64_ADD); RETURN(BINARY); }
+ <i> "i32.sub" { OPCODE(I32_SUB); RETURN(BINARY); }
+ <i> "i64.sub" { OPCODE(I64_SUB); RETURN(BINARY); }
+ <i> "i32.mul" { OPCODE(I32_MUL); RETURN(BINARY); }
+ <i> "i64.mul" { OPCODE(I64_MUL); RETURN(BINARY); }
+ <i> "i32.div_s" { OPCODE(I32_DIV_S); RETURN(BINARY); }
+ <i> "i64.div_s" { OPCODE(I64_DIV_S); RETURN(BINARY); }
+ <i> "i32.div_u" { OPCODE(I32_DIV_U); RETURN(BINARY); }
+ <i> "i64.div_u" { OPCODE(I64_DIV_U); RETURN(BINARY); }
+ <i> "i32.rem_s" { OPCODE(I32_REM_S); RETURN(BINARY); }
+ <i> "i64.rem_s" { OPCODE(I64_REM_S); RETURN(BINARY); }
+ <i> "i32.rem_u" { OPCODE(I32_REM_U); RETURN(BINARY); }
+ <i> "i64.rem_u" { OPCODE(I64_REM_U); RETURN(BINARY); }
+ <i> "i32.and" { OPCODE(I32_AND); RETURN(BINARY); }
+ <i> "i64.and" { OPCODE(I64_AND); RETURN(BINARY); }
+ <i> "i32.or" { OPCODE(I32_OR); RETURN(BINARY); }
+ <i> "i64.or" { OPCODE(I64_OR); RETURN(BINARY); }
+ <i> "i32.xor" { OPCODE(I32_XOR); RETURN(BINARY); }
+ <i> "i64.xor" { OPCODE(I64_XOR); RETURN(BINARY); }
+ <i> "i32.shl" { OPCODE(I32_SHL); RETURN(BINARY); }
+ <i> "i64.shl" { OPCODE(I64_SHL); RETURN(BINARY); }
+ <i> "i32.shr_s" { OPCODE(I32_SHR_S); RETURN(BINARY); }
+ <i> "i64.shr_s" { OPCODE(I64_SHR_S); RETURN(BINARY); }
+ <i> "i32.shr_u" { OPCODE(I32_SHR_U); RETURN(BINARY); }
+ <i> "i64.shr_u" { OPCODE(I64_SHR_U); RETURN(BINARY); }
+ <i> "i32.rotl" { OPCODE(I32_ROTL); RETURN(BINARY); }
+ <i> "i64.rotl" { OPCODE(I64_ROTL); RETURN(BINARY); }
+ <i> "i32.rotr" { OPCODE(I32_ROTR); RETURN(BINARY); }
+ <i> "i64.rotr" { OPCODE(I64_ROTR); RETURN(BINARY); }
+ <i> "f32.add" { OPCODE(F32_ADD); RETURN(BINARY); }
+ <i> "f64.add" { OPCODE(F64_ADD); RETURN(BINARY); }
+ <i> "f32.sub" { OPCODE(F32_SUB); RETURN(BINARY); }
+ <i> "f64.sub" { OPCODE(F64_SUB); RETURN(BINARY); }
+ <i> "f32.mul" { OPCODE(F32_MUL); RETURN(BINARY); }
+ <i> "f64.mul" { OPCODE(F64_MUL); RETURN(BINARY); }
+ <i> "f32.div" { OPCODE(F32_DIV); RETURN(BINARY); }
+ <i> "f64.div" { OPCODE(F64_DIV); RETURN(BINARY); }
+ <i> "f32.min" { OPCODE(F32_MIN); RETURN(BINARY); }
+ <i> "f64.min" { OPCODE(F64_MIN); RETURN(BINARY); }
+ <i> "f32.max" { OPCODE(F32_MAX); RETURN(BINARY); }
+ <i> "f64.max" { OPCODE(F64_MAX); RETURN(BINARY); }
+ <i> "f32.copysign" { OPCODE(F32_COPYSIGN); RETURN(BINARY); }
+ <i> "f64.copysign" { OPCODE(F64_COPYSIGN); RETURN(BINARY); }
+ <i> "i32.eq" { OPCODE(I32_EQ); RETURN(COMPARE); }
+ <i> "i64.eq" { OPCODE(I64_EQ); RETURN(COMPARE); }
+ <i> "i32.ne" { OPCODE(I32_NE); RETURN(COMPARE); }
+ <i> "i64.ne" { OPCODE(I64_NE); RETURN(COMPARE); }
+ <i> "i32.lt_s" { OPCODE(I32_LT_S); RETURN(COMPARE); }
+ <i> "i64.lt_s" { OPCODE(I64_LT_S); RETURN(COMPARE); }
+ <i> "i32.lt_u" { OPCODE(I32_LT_U); RETURN(COMPARE); }
+ <i> "i64.lt_u" { OPCODE(I64_LT_U); RETURN(COMPARE); }
+ <i> "i32.le_s" { OPCODE(I32_LE_S); RETURN(COMPARE); }
+ <i> "i64.le_s" { OPCODE(I64_LE_S); RETURN(COMPARE); }
+ <i> "i32.le_u" { OPCODE(I32_LE_U); RETURN(COMPARE); }
+ <i> "i64.le_u" { OPCODE(I64_LE_U); RETURN(COMPARE); }
+ <i> "i32.gt_s" { OPCODE(I32_GT_S); RETURN(COMPARE); }
+ <i> "i64.gt_s" { OPCODE(I64_GT_S); RETURN(COMPARE); }
+ <i> "i32.gt_u" { OPCODE(I32_GT_U); RETURN(COMPARE); }
+ <i> "i64.gt_u" { OPCODE(I64_GT_U); RETURN(COMPARE); }
+ <i> "i32.ge_s" { OPCODE(I32_GE_S); RETURN(COMPARE); }
+ <i> "i64.ge_s" { OPCODE(I64_GE_S); RETURN(COMPARE); }
+ <i> "i32.ge_u" { OPCODE(I32_GE_U); RETURN(COMPARE); }
+ <i> "i64.ge_u" { OPCODE(I64_GE_U); RETURN(COMPARE); }
+ <i> "f32.eq" { OPCODE(F32_EQ); RETURN(COMPARE); }
+ <i> "f64.eq" { OPCODE(F64_EQ); RETURN(COMPARE); }
+ <i> "f32.ne" { OPCODE(F32_NE); RETURN(COMPARE); }
+ <i> "f64.ne" { OPCODE(F64_NE); RETURN(COMPARE); }
+ <i> "f32.lt" { OPCODE(F32_LT); RETURN(COMPARE); }
+ <i> "f64.lt" { OPCODE(F64_LT); RETURN(COMPARE); }
+ <i> "f32.le" { OPCODE(F32_LE); RETURN(COMPARE); }
+ <i> "f64.le" { OPCODE(F64_LE); RETURN(COMPARE); }
+ <i> "f32.gt" { OPCODE(F32_GT); RETURN(COMPARE); }
+ <i> "f64.gt" { OPCODE(F64_GT); RETURN(COMPARE); }
+ <i> "f32.ge" { OPCODE(F32_GE); RETURN(COMPARE); }
+ <i> "f64.ge" { OPCODE(F64_GE); RETURN(COMPARE); }
+ <i> "i64.extend_s/i32" { OPCODE(I64_EXTEND_S_I32); RETURN(CONVERT); }
+ <i> "i64.extend_u/i32" { OPCODE(I64_EXTEND_U_I32); RETURN(CONVERT); }
+ <i> "i32.wrap/i64" { OPCODE(I32_WRAP_I64); RETURN(CONVERT); }
+ <i> "i32.trunc_s/f32" { OPCODE(I32_TRUNC_S_F32); RETURN(CONVERT); }
+ <i> "i64.trunc_s/f32" { OPCODE(I64_TRUNC_S_F32); RETURN(CONVERT); }
+ <i> "i32.trunc_s/f64" { OPCODE(I32_TRUNC_S_F64); RETURN(CONVERT); }
+ <i> "i64.trunc_s/f64" { OPCODE(I64_TRUNC_S_F64); RETURN(CONVERT); }
+ <i> "i32.trunc_u/f32" { OPCODE(I32_TRUNC_U_F32); RETURN(CONVERT); }
+ <i> "i64.trunc_u/f32" { OPCODE(I64_TRUNC_U_F32); RETURN(CONVERT); }
+ <i> "i32.trunc_u/f64" { OPCODE(I32_TRUNC_U_F64); RETURN(CONVERT); }
+ <i> "i64.trunc_u/f64" { OPCODE(I64_TRUNC_U_F64); RETURN(CONVERT); }
+ <i> "f32.convert_s/i32" { OPCODE(F32_CONVERT_S_I32); RETURN(CONVERT); }
+ <i> "f64.convert_s/i32" { OPCODE(F64_CONVERT_S_I32); RETURN(CONVERT); }
+ <i> "f32.convert_s/i64" { OPCODE(F32_CONVERT_S_I64); RETURN(CONVERT); }
+ <i> "f64.convert_s/i64" { OPCODE(F64_CONVERT_S_I64); RETURN(CONVERT); }
+ <i> "f32.convert_u/i32" { OPCODE(F32_CONVERT_U_I32); RETURN(CONVERT); }
+ <i> "f64.convert_u/i32" { OPCODE(F64_CONVERT_U_I32); RETURN(CONVERT); }
+ <i> "f32.convert_u/i64" { OPCODE(F32_CONVERT_U_I64); RETURN(CONVERT); }
+ <i> "f64.convert_u/i64" { OPCODE(F64_CONVERT_U_I64); RETURN(CONVERT); }
+ <i> "f64.promote/f32" { OPCODE(F64_PROMOTE_F32); RETURN(CONVERT); }
+ <i> "f32.demote/f64" { OPCODE(F32_DEMOTE_F64); RETURN(CONVERT); }
+ <i> "f32.reinterpret/i32" { OPCODE(F32_REINTERPRET_I32); RETURN(CONVERT);
+ }
+ <i> "i32.reinterpret/f32" { OPCODE(I32_REINTERPRET_F32); RETURN(CONVERT);
+ }
+ <i> "f64.reinterpret/i64" { OPCODE(F64_REINTERPRET_I64); RETURN(CONVERT);
+ }
+ <i> "i64.reinterpret/f64" { OPCODE(I64_REINTERPRET_F64); RETURN(CONVERT);
+ }
+ <i> "select" { RETURN(SELECT); }
+ <i> "unreachable" { RETURN(UNREACHABLE); }
+ <i> "current_memory" { RETURN(CURRENT_MEMORY); }
+ <i> "grow_memory" { RETURN(GROW_MEMORY); }
+ <i> "type" { RETURN(TYPE); }
+ <i> "func" { RETURN(FUNC); }
+ <i> "param" { RETURN(PARAM); }
+ <i> "result" { RETURN(RESULT); }
+ <i> "local" { RETURN(LOCAL); }
+ <i> "global" { RETURN(GLOBAL); }
+ <i> "module" { RETURN(MODULE); }
+ <i> "table" { RETURN(TABLE); }
+ <i> "memory" { RETURN(MEMORY); }
+ <i> "start" { RETURN(START); }
+ <i> "elem" { RETURN(ELEM); }
+ <i> "data" { RETURN(DATA); }
+ <i> "offset" { RETURN(OFFSET); }
+ <i> "import" { RETURN(IMPORT); }
+ <i> "export" { RETURN(EXPORT); }
+ <i> "register" { RETURN(REGISTER); }
+ <i> "invoke" { RETURN(INVOKE); }
+ <i> "get" { RETURN(GET); }
+ <i> "assert_malformed" { RETURN(ASSERT_MALFORMED); }
+ <i> "assert_invalid" { RETURN(ASSERT_INVALID); }
+ <i> "assert_unlinkable" { RETURN(ASSERT_UNLINKABLE); }
+ <i> "assert_return" { RETURN(ASSERT_RETURN); }
+ <i> "assert_return_nan" { RETURN(ASSERT_RETURN_NAN); }
+ <i> "assert_trap" { RETURN(ASSERT_TRAP); }
+ <i> "assert_exhaustion" { RETURN(ASSERT_EXHAUSTION); }
+ <i> "input" { RETURN(INPUT); }
+ <i> "output" { RETURN(OUTPUT); }
+ <i> name { TEXT; RETURN(VAR); }
+
+ <i> ";;" => LINE_COMMENT { continue; }
+ <LINE_COMMENT> "\n" => i { NEWLINE; continue; }
+ <LINE_COMMENT> [^\n]* { continue; }
+ <i> "(;" => BLOCK_COMMENT { COMMENT_NESTING = 1; continue; }
+ <BLOCK_COMMENT> "(;" { COMMENT_NESTING++; continue; }
+ <BLOCK_COMMENT> ";)" { if (--COMMENT_NESTING == 0)
+ BEGIN(YYCOND_INIT);
+ continue; }
+ <BLOCK_COMMENT> "\n" { NEWLINE; continue; }
+ <BLOCK_COMMENT> EOF { ERROR("unexpected EOF"); RETURN(EOF); }
+ <BLOCK_COMMENT> [^] { continue; }
+ <i> "\n" { NEWLINE; continue; }
+ <i> [ \t\r]+ { continue; }
+ <i> atom { ERROR("unexpected token \"%.*s\"",
+ static_cast<int>(yyleng), yytext);
+ continue; }
+ <*> EOF { RETURN(EOF); }
+ <*> [^] { ERROR("unexpected char"); continue; }
+ */
}
}
static WabtAstLexer* wabt_new_lexer(WabtAstLexerSourceType type,
const char* filename) {
- WabtAstLexer* lexer = (WabtAstLexer*)wabt_alloc_zero(sizeof(WabtAstLexer));
+ WabtAstLexer* lexer =
+ static_cast<WabtAstLexer*>(wabt_alloc_zero(sizeof(WabtAstLexer)));
lexer->line = 1;
lexer->filename = filename;
lexer->source.type = type;
@@ -609,7 +619,8 @@ static WabtResult scan_forward_for_line_offset(
size_t* out_line_offset) {
assert(line <= find_line);
if (lexer->source.type == WABT_LEXER_SOURCE_TYPE_BUFFER) {
- const char* source_buffer = (const char*)lexer->source.buffer.data;
+ const char* source_buffer =
+ static_cast<const char*>(lexer->source.buffer.data);
const char* buffer_start = source_buffer + line_start_offset;
const char* buffer_end = source_buffer + lexer->source.buffer.size;
return scan_forward_for_line_offset_in_buffer(
@@ -733,7 +744,8 @@ WabtResult wabt_ast_lexer_get_source_line(WabtAstLexer* lexer,
}
if (lexer->source.type == WABT_LEXER_SOURCE_TYPE_BUFFER) {
- char* buffer_read_start = (char*)lexer->source.buffer.data + read_start;
+ const char* buffer_read_start =
+ static_cast<const char*>(lexer->source.buffer.data) + read_start;
memcpy(write_start, buffer_read_start, read_length);
} else {
assert(lexer->source.type == WABT_LEXER_SOURCE_TYPE_FILE);
diff --git a/src/ast-parser-lexer-shared.cc b/src/ast-parser-lexer-shared.cc
index b7e7ffa9..24936e93 100644
--- a/src/ast-parser-lexer-shared.cc
+++ b/src/ast-parser-lexer-shared.cc
@@ -43,7 +43,7 @@ void wabt_ast_format_error(WabtSourceErrorHandler* error_handler,
char* buffer = fixed_buf;
size_t len = wabt_vsnprintf(fixed_buf, sizeof(fixed_buf), format, args);
if (len + 1 > sizeof(fixed_buf)) {
- buffer = (char*)alloca(len + 1);
+ buffer = static_cast<char*>(alloca(len + 1));
len = wabt_vsnprintf(buffer, len + 1, format, args_copy);
}
@@ -52,7 +52,7 @@ void wabt_ast_format_error(WabtSourceErrorHandler* error_handler,
int source_line_column_offset = 0;
size_t source_line_max_length = error_handler->source_line_max_length;
if (loc && lexer) {
- source_line = (char*)alloca(source_line_max_length + 1);
+ source_line = static_cast<char*>(alloca(source_line_max_length + 1));
WabtResult result = wabt_ast_lexer_get_source_line(
lexer, loc, source_line_max_length, source_line, &source_line_length,
&source_line_column_offset);
diff --git a/src/ast-parser-lexer-shared.h b/src/ast-parser-lexer-shared.h
index 1d599c5d..8ad3a82c 100644
--- a/src/ast-parser-lexer-shared.h
+++ b/src/ast-parser-lexer-shared.h
@@ -28,7 +28,7 @@
#define YYSTYPE WABT_AST_PARSER_STYPE
#define YYLTYPE WABT_AST_PARSER_LTYPE
-#define WABT_INVALID_LINE_OFFSET ((size_t)~0)
+#define WABT_INVALID_LINE_OFFSET (static_cast<size_t>(~0))
struct WabtExprList {
WabtExpr* first;
diff --git a/src/ast-parser.y b/src/ast-parser.y
index d5f55e91..521bb2fa 100644
--- a/src/ast-parser.y
+++ b/src/ast-parser.y
@@ -31,11 +31,12 @@
#define RELOCATE_STACK(type, array, stack_base, old_byte_size, new_size) \
do { \
if ((stack_base) == (array)) { \
- (stack_base) = (type*)wabt_alloc((new_size) * sizeof(*(stack_base))); \
+ (stack_base) = \
+ static_cast<type*>(wabt_alloc((new_size) * sizeof(*(stack_base)))); \
memcpy((stack_base), (array), old_byte_size); \
} else { \
- (stack_base) = (type*)wabt_realloc((stack_base), \
- (new_size) * sizeof(*(stack_base))); \
+ (stack_base) = static_cast<type*>( \
+ wabt_realloc((stack_base), (new_size) * sizeof(*(stack_base)))); \
} \
/* Cache the pointer in the parser struct to be free'd later. */ \
parser->array = (stack_base); \
@@ -146,27 +147,28 @@ static WabtExprList join_exprs2(WabtLocation* loc, WabtExprList* expr1,
WabtExpr* expr2);
static WabtFuncField* new_func_field(void) {
- return (WabtFuncField*)wabt_alloc_zero(sizeof(WabtFuncField));
+ return static_cast<WabtFuncField*>(wabt_alloc_zero(sizeof(WabtFuncField)));
}
static WabtFunc* new_func(void) {
- return (WabtFunc*)wabt_alloc_zero(sizeof(WabtFunc));
+ return static_cast<WabtFunc*>(wabt_alloc_zero(sizeof(WabtFunc)));
}
static WabtCommand* new_command(void) {
- return (WabtCommand*)wabt_alloc_zero(sizeof(WabtCommand));
+ return static_cast<WabtCommand*>(wabt_alloc_zero(sizeof(WabtCommand)));
}
static WabtModule* new_module(void) {
- return (WabtModule*)wabt_alloc_zero(sizeof(WabtModule));
+ return static_cast<WabtModule*>(wabt_alloc_zero(sizeof(WabtModule)));
}
static WabtImport* new_import(void) {
- return (WabtImport*)wabt_alloc_zero(sizeof(WabtImport));
+ return static_cast<WabtImport*>(wabt_alloc_zero(sizeof(WabtImport)));
}
static WabtTextListNode* new_text_list_node(void) {
- return (WabtTextListNode*)wabt_alloc_zero(sizeof(WabtTextListNode));
+ return static_cast<WabtTextListNode*>(
+ wabt_alloc_zero(sizeof(WabtTextListNode)));
}
static WabtResult parse_const(WabtType type, WabtLiteralType literal_type,
@@ -333,7 +335,7 @@ quoted_text :
void* data;
size_t size;
dup_text_list(&text_list, &data, &size);
- $$.start = (const char*)data;
+ $$.start = static_cast<const char*>(data);
$$.length = size;
}
;
@@ -571,7 +573,7 @@ plain_instr :
"invalid literal \"" PRIstringslice "\"",
WABT_PRINTF_STRING_SLICE_ARG($2.text));
}
- wabt_free((char*)$2.text.start);
+ wabt_free(const_cast<char*>($2.text.start));
}
| UNARY {
$$ = wabt_new_unary_expr();
@@ -1440,7 +1442,7 @@ const :
"invalid literal \"" PRIstringslice "\"",
WABT_PRINTF_STRING_SLICE_ARG($3.text));
}
- wabt_free((char*)$3.text.start);
+ wabt_free(const_cast<char*>($3.text.start));
}
;
const_list :
diff --git a/src/ast-writer.cc b/src/ast-writer.cc
index 84296a40..3d92d7ef 100644
--- a/src/ast-writer.cc
+++ b/src/ast-writer.cc
@@ -203,7 +203,7 @@ static void write_string_slice_or_index(Context* ctx,
}
static void write_quoted_data(Context* ctx, const void* data, size_t length) {
- const uint8_t* u8_data = (const uint8_t*)data;
+ const uint8_t* u8_data = static_cast<const uint8_t*>(data);
static const char s_hexdigits[] = "0123456789abcdef";
write_next_char(ctx);
write_putc(ctx, '\"');
@@ -310,13 +310,13 @@ static void write_const(Context* ctx, const WabtConst* const_) {
switch (const_->type) {
case WABT_TYPE_I32:
write_puts_space(ctx, wabt_get_opcode_name(WABT_OPCODE_I32_CONST));
- writef(ctx, "%d", (int32_t)const_->u32);
+ writef(ctx, "%d", static_cast<int32_t>(const_->u32));
write_newline(ctx, NO_FORCE_NEWLINE);
break;
case WABT_TYPE_I64:
write_puts_space(ctx, wabt_get_opcode_name(WABT_OPCODE_I64_CONST));
- writef(ctx, "%" PRId64, (int64_t)const_->u64);
+ writef(ctx, "%" PRId64, static_cast<int64_t>(const_->u64));
write_newline(ctx, NO_FORCE_NEWLINE);
break;
diff --git a/src/ast.cc b/src/ast.cc
index 887dfdf3..450199dd 100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -22,7 +22,7 @@
int wabt_get_index_from_var(const WabtBindingHash* hash, const WabtVar* var) {
if (var->type == WABT_VAR_TYPE_NAME)
return wabt_find_binding_index_by_name(hash, &var->name);
- return (int)var->index;
+ return static_cast<int>(var->index);
}
WabtExportPtr wabt_get_export_by_name(const WabtModule* module,
@@ -56,7 +56,7 @@ int wabt_get_func_type_index_by_var(const WabtModule* module,
int wabt_get_local_index_by_var(const WabtFunc* func, const WabtVar* var) {
if (var->type == WABT_VAR_TYPE_INDEX)
- return (int)var->index;
+ return static_cast<int>(var->index);
int result =
wabt_find_binding_index_by_name(&func->param_bindings, &var->name);
@@ -77,7 +77,7 @@ int wabt_get_module_index_by_var(const WabtScript* script, const WabtVar* var) {
WabtFuncPtr wabt_get_func_by_var(const WabtModule* module, const WabtVar* var) {
int index = wabt_get_index_from_var(&module->func_bindings, var);
- if (index < 0 || (size_t)index >= module->funcs.size)
+ if (index < 0 || static_cast<size_t>(index) >= module->funcs.size)
return nullptr;
return module->funcs.data[index];
}
@@ -85,7 +85,7 @@ WabtFuncPtr wabt_get_func_by_var(const WabtModule* module, const WabtVar* var) {
WabtGlobalPtr wabt_get_global_by_var(const WabtModule* module,
const WabtVar* var) {
int index = wabt_get_index_from_var(&module->global_bindings, var);
- if (index < 0 || (size_t)index >= module->globals.size)
+ if (index < 0 || static_cast<size_t>(index) >= module->globals.size)
return nullptr;
return module->globals.data[index];
}
@@ -93,7 +93,7 @@ WabtGlobalPtr wabt_get_global_by_var(const WabtModule* module,
WabtTablePtr wabt_get_table_by_var(const WabtModule* module,
const WabtVar* var) {
int index = wabt_get_index_from_var(&module->table_bindings, var);
- if (index < 0 || (size_t)index >= module->tables.size)
+ if (index < 0 || static_cast<size_t>(index) >= module->tables.size)
return nullptr;
return module->tables.data[index];
}
@@ -101,7 +101,7 @@ WabtTablePtr wabt_get_table_by_var(const WabtModule* module,
WabtMemoryPtr wabt_get_memory_by_var(const WabtModule* module,
const WabtVar* var) {
int index = wabt_get_index_from_var(&module->memory_bindings, var);
- if (index < 0 || (size_t)index >= module->memories.size)
+ if (index < 0 || static_cast<size_t>(index) >= module->memories.size)
return nullptr;
return module->memories.data[index];
}
@@ -109,7 +109,7 @@ WabtMemoryPtr wabt_get_memory_by_var(const WabtModule* module,
WabtFuncTypePtr wabt_get_func_type_by_var(const WabtModule* module,
const WabtVar* var) {
int index = wabt_get_index_from_var(&module->func_type_bindings, var);
- if (index < 0 || (size_t)index >= module->func_types.size)
+ if (index < 0 || static_cast<size_t>(index) >= module->func_types.size)
return nullptr;
return module->func_types.data[index];
}
@@ -145,7 +145,7 @@ WabtModule* wabt_get_first_module(const WabtScript* script) {
WabtModule* wabt_get_module_by_var(const WabtScript* script,
const WabtVar* var) {
int index = wabt_get_index_from_var(&script->module_bindings, var);
- if (index < 0 || (size_t)index >= script->commands.size)
+ if (index < 0 || static_cast<size_t>(index) >= script->commands.size)
return nullptr;
WabtCommand* command = &script->commands.data[index];
assert(command->type == WABT_COMMAND_TYPE_MODULE);
@@ -200,7 +200,7 @@ void wabt_find_duplicate_bindings(const WabtBindingHash* bindings,
WabtModuleField* wabt_append_module_field(WabtModule* module) {
WabtModuleField* result =
- (WabtModuleField*)wabt_alloc_zero(sizeof(WabtModuleField));
+ static_cast<WabtModuleField*>(wabt_alloc_zero(sizeof(WabtModuleField)));
if (!module->first_field)
module->first_field = result;
else if (module->last_field)
@@ -251,11 +251,12 @@ WabtFuncType* wabt_append_implicit_func_type(WabtLocation* loc,
V(WABT_EXPR_TYPE_SELECT, select) \
V(WABT_EXPR_TYPE_UNREACHABLE, unreachable)
-#define DEFINE_NEW_EXPR(type_, name) \
- WabtExpr* wabt_new_##name##_expr(void) { \
- WabtExpr* result = (WabtExpr*)wabt_alloc_zero(sizeof(WabtExpr)); \
- result->type = type_; \
- return result; \
+#define DEFINE_NEW_EXPR(type_, name) \
+ WabtExpr* wabt_new_##name##_expr(void) { \
+ WabtExpr* result = \
+ static_cast<WabtExpr*>(wabt_alloc_zero(sizeof(WabtExpr))); \
+ result->type = type_; \
+ return result; \
}
FOREACH_EXPR_TYPE(DEFINE_NEW_EXPR)
#undef DEFINE_NEW_EXPR
diff --git a/src/ast.h b/src/ast.h
index 88fbb450..08fef16e 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -511,16 +511,16 @@ void wabt_find_duplicate_bindings(const WabtBindingHash*,
static WABT_INLINE bool
wabt_decl_has_func_type(const WabtFuncDeclaration* decl) {
- return (bool)((decl->flags & WABT_FUNC_DECLARATION_FLAG_HAS_FUNC_TYPE) != 0);
+ return static_cast<bool>(
+ (decl->flags & WABT_FUNC_DECLARATION_FLAG_HAS_FUNC_TYPE) != 0);
}
static WABT_INLINE bool
wabt_signatures_are_equal(const WabtFuncSignature* sig1,
const WabtFuncSignature* sig2) {
- return (bool)(wabt_type_vectors_are_equal(&sig1->param_types,
- &sig2->param_types) &&
- wabt_type_vectors_are_equal(&sig1->result_types,
- &sig2->result_types));
+ return static_cast<bool>(
+ wabt_type_vectors_are_equal(&sig1->param_types, &sig2->param_types) &&
+ wabt_type_vectors_are_equal(&sig1->result_types, &sig2->result_types));
}
static WABT_INLINE size_t wabt_get_num_params(const WabtFunc* func) {
@@ -541,19 +541,19 @@ static WABT_INLINE size_t wabt_get_num_params_and_locals(const WabtFunc* func) {
static WABT_INLINE WabtType wabt_get_param_type(const WabtFunc* func,
int index) {
- assert((size_t)index < func->decl.sig.param_types.size);
+ assert(static_cast<size_t>(index) < func->decl.sig.param_types.size);
return func->decl.sig.param_types.data[index];
}
static WABT_INLINE WabtType wabt_get_local_type(const WabtFunc* func,
int index) {
- assert((size_t)index < wabt_get_num_locals(func));
+ assert(static_cast<size_t>(index) < wabt_get_num_locals(func));
return func->local_types.data[index];
}
static WABT_INLINE WabtType wabt_get_result_type(const WabtFunc* func,
int index) {
- assert((size_t)index < func->decl.sig.result_types.size);
+ assert(static_cast<size_t>(index) < func->decl.sig.result_types.size);
return func->decl.sig.result_types.data[index];
}
diff --git a/src/binary-reader-ast.cc b/src/binary-reader-ast.cc
index d22c1f3f..c159bfc5 100644
--- a/src/binary-reader-ast.cc
+++ b/src/binary-reader-ast.cc
@@ -130,12 +130,12 @@ static void handle_error(Context* ctx, uint32_t offset, const char* message) {
static void on_error(WabtBinaryReaderContext* reader_context,
const char* message) {
- Context* ctx = (Context*)reader_context->user_data;
+ Context* ctx = static_cast<Context*>(reader_context->user_data);
handle_error(ctx, reader_context->offset, message);
}
static WabtResult on_signature_count(uint32_t count, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
wabt_reserve_func_type_ptrs(&ctx->module->func_types, count);
return WABT_OK;
}
@@ -146,7 +146,7 @@ static WabtResult on_signature(uint32_t index,
uint32_t result_count,
WabtType* result_types,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtModuleField* field = wabt_append_module_field(ctx->module);
field->type = WABT_MODULE_FIELD_TYPE_FUNC_TYPE;
@@ -171,7 +171,7 @@ static WabtResult on_signature(uint32_t index,
}
static WabtResult on_import_count(uint32_t count, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
wabt_reserve_import_ptrs(&ctx->module->imports, count);
return WABT_OK;
}
@@ -180,7 +180,7 @@ static WabtResult on_import(uint32_t index,
WabtStringSlice module_name,
WabtStringSlice field_name,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(index < ctx->module->imports.capacity);
WabtModuleField* field = wabt_append_module_field(ctx->module);
@@ -200,7 +200,7 @@ static WabtResult on_import_func(uint32_t import_index,
uint32_t func_index,
uint32_t sig_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(import_index == ctx->module->imports.size - 1);
assert(sig_index < ctx->module->func_types.size);
WabtImport* import = ctx->module->imports.data[import_index];
@@ -223,7 +223,7 @@ static WabtResult on_import_table(uint32_t import_index,
WabtType elem_type,
const WabtLimits* elem_limits,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(import_index == ctx->module->imports.size - 1);
WabtImport* import = ctx->module->imports.data[import_index];
import->kind = WABT_EXTERNAL_KIND_TABLE;
@@ -239,7 +239,7 @@ static WabtResult on_import_memory(uint32_t import_index,
uint32_t memory_index,
const WabtLimits* page_limits,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(import_index == ctx->module->imports.size - 1);
WabtImport* import = ctx->module->imports.data[import_index];
import->kind = WABT_EXTERNAL_KIND_MEMORY;
@@ -256,7 +256,7 @@ static WabtResult on_import_global(uint32_t import_index,
WabtType type,
bool mutable_,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(import_index == ctx->module->imports.size - 1);
WabtImport* import = ctx->module->imports.data[import_index];
import->kind = WABT_EXTERNAL_KIND_GLOBAL;
@@ -271,7 +271,7 @@ static WabtResult on_import_global(uint32_t import_index,
static WabtResult on_function_signatures_count(uint32_t count,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
wabt_reserve_func_ptrs(&ctx->module->funcs,
ctx->module->num_func_imports + count);
return WABT_OK;
@@ -280,7 +280,7 @@ static WabtResult on_function_signatures_count(uint32_t count,
static WabtResult on_function_signature(uint32_t index,
uint32_t sig_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(index < ctx->module->funcs.capacity);
assert(sig_index < ctx->module->func_types.size);
@@ -301,7 +301,7 @@ static WabtResult on_function_signature(uint32_t index,
}
static WabtResult on_table_count(uint32_t count, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
wabt_reserve_table_ptrs(&ctx->module->tables,
ctx->module->num_table_imports + count);
return WABT_OK;
@@ -311,7 +311,7 @@ static WabtResult on_table(uint32_t index,
WabtType elem_type,
const WabtLimits* elem_limits,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(index < ctx->module->tables.capacity);
WabtModuleField* field = wabt_append_module_field(ctx->module);
@@ -327,7 +327,7 @@ static WabtResult on_table(uint32_t index,
}
static WabtResult on_memory_count(uint32_t count, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
wabt_reserve_memory_ptrs(&ctx->module->memories,
ctx->module->num_memory_imports + count);
return WABT_OK;
@@ -336,7 +336,7 @@ static WabtResult on_memory_count(uint32_t count, void* user_data) {
static WabtResult on_memory(uint32_t index,
const WabtLimits* page_limits,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(index < ctx->module->memories.capacity);
WabtModuleField* field = wabt_append_module_field(ctx->module);
@@ -352,7 +352,7 @@ static WabtResult on_memory(uint32_t index,
}
static WabtResult on_global_count(uint32_t count, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
wabt_reserve_global_ptrs(&ctx->module->globals,
ctx->module->num_global_imports + count);
return WABT_OK;
@@ -362,7 +362,7 @@ static WabtResult begin_global(uint32_t index,
WabtType type,
bool mutable_,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(index < ctx->module->globals.capacity);
WabtModuleField* field = wabt_append_module_field(ctx->module);
@@ -379,7 +379,7 @@ static WabtResult begin_global(uint32_t index,
}
static WabtResult begin_global_init_expr(uint32_t index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(index == ctx->module->globals.size - 1);
WabtGlobal* global = ctx->module->globals.data[index];
ctx->current_init_expr = &global->init_expr;
@@ -387,13 +387,13 @@ static WabtResult begin_global_init_expr(uint32_t index, void* user_data) {
}
static WabtResult end_global_init_expr(uint32_t index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
ctx->current_init_expr = nullptr;
return WABT_OK;
}
static WabtResult on_export_count(uint32_t count, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
wabt_reserve_export_ptrs(&ctx->module->exports, count);
return WABT_OK;
}
@@ -403,7 +403,7 @@ static WabtResult on_export(uint32_t index,
uint32_t item_index,
WabtStringSlice name,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtModuleField* field = wabt_append_module_field(ctx->module);
field->type = WABT_MODULE_FIELD_TYPE_EXPORT;
@@ -438,7 +438,7 @@ static WabtResult on_export(uint32_t index,
}
static WabtResult on_start_function(uint32_t func_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtModuleField* field = wabt_append_module_field(ctx->module);
field->type = WABT_MODULE_FIELD_TYPE_START;
@@ -451,15 +451,15 @@ static WabtResult on_start_function(uint32_t func_index, void* user_data) {
}
static WabtResult on_function_bodies_count(uint32_t count, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(ctx->module->num_func_imports + count == ctx->module->funcs.size);
- (void)ctx;
+ WABT_USE(ctx);
return WABT_OK;
}
static WabtResult begin_function_body(WabtBinaryReaderContext* context,
uint32_t index) {
- Context* ctx = (Context*)context->user_data;
+ Context* ctx = static_cast<Context*>(context->user_data);
assert(index < ctx->module->funcs.size);
ctx->current_func = ctx->module->funcs.data[index];
push_label(ctx, WABT_LABEL_TYPE_FUNC, &ctx->current_func->first_expr);
@@ -470,7 +470,7 @@ static WabtResult on_local_decl(uint32_t decl_index,
uint32_t count,
WabtType type,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
size_t old_local_count = ctx->current_func->local_types.size;
size_t new_local_count = old_local_count + count;
wabt_reserve_types(&ctx->current_func->local_types, new_local_count);
@@ -483,7 +483,7 @@ static WabtResult on_local_decl(uint32_t decl_index,
}
static WabtResult on_binary_expr(WabtOpcode opcode, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_binary_expr();
expr->binary.opcode = opcode;
return append_expr(ctx, expr);
@@ -492,7 +492,7 @@ static WabtResult on_binary_expr(WabtOpcode opcode, void* user_data) {
static WabtResult on_block_expr(uint32_t num_types,
WabtType* sig_types,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_block_expr();
WabtTypeVector src;
WABT_ZERO_MEMORY(src);
@@ -505,7 +505,7 @@ static WabtResult on_block_expr(uint32_t num_types,
}
static WabtResult on_br_expr(uint32_t depth, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_br_expr();
expr->br.var.type = WABT_VAR_TYPE_INDEX;
expr->br.var.index = depth;
@@ -513,7 +513,7 @@ static WabtResult on_br_expr(uint32_t depth, void* user_data) {
}
static WabtResult on_br_if_expr(uint32_t depth, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_br_if_expr();
expr->br_if.var.type = WABT_VAR_TYPE_INDEX;
expr->br_if.var.index = depth;
@@ -524,7 +524,7 @@ static WabtResult on_br_table_expr(WabtBinaryReaderContext* context,
uint32_t num_targets,
uint32_t* target_depths,
uint32_t default_target_depth) {
- Context* ctx = (Context*)context->user_data;
+ Context* ctx = static_cast<Context*>(context->user_data);
WabtExpr* expr = wabt_new_br_table_expr();
wabt_reserve_vars(&expr->br_table.targets, num_targets);
expr->br_table.targets.size = num_targets;
@@ -540,7 +540,7 @@ static WabtResult on_br_table_expr(WabtBinaryReaderContext* context,
}
static WabtResult on_call_expr(uint32_t func_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(func_index < ctx->module->funcs.size);
WabtExpr* expr = wabt_new_call_expr();
expr->call.var.type = WABT_VAR_TYPE_INDEX;
@@ -549,7 +549,7 @@ static WabtResult on_call_expr(uint32_t func_index, void* user_data) {
}
static WabtResult on_call_indirect_expr(uint32_t sig_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(sig_index < ctx->module->func_types.size);
WabtExpr* expr = wabt_new_call_indirect_expr();
expr->call_indirect.var.type = WABT_VAR_TYPE_INDEX;
@@ -558,33 +558,33 @@ static WabtResult on_call_indirect_expr(uint32_t sig_index, void* user_data) {
}
static WabtResult on_compare_expr(WabtOpcode opcode, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_compare_expr();
expr->compare.opcode = opcode;
return append_expr(ctx, expr);
}
static WabtResult on_convert_expr(WabtOpcode opcode, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_convert_expr();
expr->convert.opcode = opcode;
return append_expr(ctx, expr);
}
static WabtResult on_current_memory_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_current_memory_expr();
return append_expr(ctx, expr);
}
static WabtResult on_drop_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_drop_expr();
return append_expr(ctx, expr);
}
static WabtResult on_else_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
LabelNode* label;
CHECK_RESULT(top_label(ctx, &label));
if (label->label_type != WABT_LABEL_TYPE_IF) {
@@ -603,12 +603,12 @@ static WabtResult on_else_expr(void* user_data) {
}
static WabtResult on_end_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
return pop_label(ctx);
}
static WabtResult on_f32_const_expr(uint32_t value_bits, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_const_expr();
expr->const_.type = WABT_TYPE_F32;
expr->const_.f32_bits = value_bits;
@@ -616,7 +616,7 @@ static WabtResult on_f32_const_expr(uint32_t value_bits, void* user_data) {
}
static WabtResult on_f64_const_expr(uint64_t value_bits, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_const_expr();
expr->const_.type = WABT_TYPE_F64;
expr->const_.f64_bits = value_bits;
@@ -624,7 +624,7 @@ static WabtResult on_f64_const_expr(uint64_t value_bits, void* user_data) {
}
static WabtResult on_get_global_expr(uint32_t global_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_get_global_expr();
expr->get_global.var.type = WABT_VAR_TYPE_INDEX;
expr->get_global.var.index = global_index;
@@ -632,7 +632,7 @@ static WabtResult on_get_global_expr(uint32_t global_index, void* user_data) {
}
static WabtResult on_get_local_expr(uint32_t local_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_get_local_expr();
expr->get_local.var.type = WABT_VAR_TYPE_INDEX;
expr->get_local.var.index = local_index;
@@ -640,13 +640,13 @@ static WabtResult on_get_local_expr(uint32_t local_index, void* user_data) {
}
static WabtResult on_grow_memory_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_grow_memory_expr();
return append_expr(ctx, expr);
}
static WabtResult on_i32_const_expr(uint32_t value, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_const_expr();
expr->const_.type = WABT_TYPE_I32;
expr->const_.u32 = value;
@@ -654,7 +654,7 @@ static WabtResult on_i32_const_expr(uint32_t value, void* user_data) {
}
static WabtResult on_i64_const_expr(uint64_t value, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_const_expr();
expr->const_.type = WABT_TYPE_I64;
expr->const_.u64 = value;
@@ -664,7 +664,7 @@ static WabtResult on_i64_const_expr(uint64_t value, void* user_data) {
static WabtResult on_if_expr(uint32_t num_types,
WabtType* sig_types,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_if_expr();
WabtTypeVector src;
WABT_ZERO_MEMORY(src);
@@ -680,7 +680,7 @@ static WabtResult on_load_expr(WabtOpcode opcode,
uint32_t alignment_log2,
uint32_t offset,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_load_expr();
expr->load.opcode = opcode;
expr->load.align = 1 << alignment_log2;
@@ -691,7 +691,7 @@ static WabtResult on_load_expr(WabtOpcode opcode,
static WabtResult on_loop_expr(uint32_t num_types,
WabtType* sig_types,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_loop_expr();
WabtTypeVector src;
WABT_ZERO_MEMORY(src);
@@ -704,25 +704,25 @@ static WabtResult on_loop_expr(uint32_t num_types,
}
static WabtResult on_nop_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_nop_expr();
return append_expr(ctx, expr);
}
static WabtResult on_return_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_return_expr();
return append_expr(ctx, expr);
}
static WabtResult on_select_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_select_expr();
return append_expr(ctx, expr);
}
static WabtResult on_set_global_expr(uint32_t global_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_set_global_expr();
expr->set_global.var.type = WABT_VAR_TYPE_INDEX;
expr->set_global.var.index = global_index;
@@ -730,7 +730,7 @@ static WabtResult on_set_global_expr(uint32_t global_index, void* user_data) {
}
static WabtResult on_set_local_expr(uint32_t local_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_set_local_expr();
expr->set_local.var.type = WABT_VAR_TYPE_INDEX;
expr->set_local.var.index = local_index;
@@ -741,7 +741,7 @@ static WabtResult on_store_expr(WabtOpcode opcode,
uint32_t alignment_log2,
uint32_t offset,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_store_expr();
expr->store.opcode = opcode;
expr->store.align = 1 << alignment_log2;
@@ -750,7 +750,7 @@ static WabtResult on_store_expr(WabtOpcode opcode,
}
static WabtResult on_tee_local_expr(uint32_t local_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_tee_local_expr();
expr->tee_local.var.type = WABT_VAR_TYPE_INDEX;
expr->tee_local.var.index = local_index;
@@ -758,27 +758,27 @@ static WabtResult on_tee_local_expr(uint32_t local_index, void* user_data) {
}
static WabtResult on_unary_expr(WabtOpcode opcode, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_unary_expr();
expr->unary.opcode = opcode;
return append_expr(ctx, expr);
}
static WabtResult on_unreachable_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_unreachable_expr();
return append_expr(ctx, expr);
}
static WabtResult end_function_body(uint32_t index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(pop_label(ctx));
ctx->current_func = nullptr;
return WABT_OK;
}
static WabtResult on_elem_segment_count(uint32_t count, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
wabt_reserve_elem_segment_ptrs(&ctx->module->elem_segments,
count);
return WABT_OK;
@@ -787,7 +787,7 @@ static WabtResult on_elem_segment_count(uint32_t count, void* user_data) {
static WabtResult begin_elem_segment(uint32_t index,
uint32_t table_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtModuleField* field = wabt_append_module_field(ctx->module);
field->type = WABT_MODULE_FIELD_TYPE_ELEM_SEGMENT;
@@ -806,7 +806,7 @@ static WabtResult begin_elem_segment(uint32_t index,
static WabtResult begin_elem_segment_init_expr(uint32_t index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(index == ctx->module->elem_segments.size - 1);
WabtElemSegment* segment = ctx->module->elem_segments.data[index];
ctx->current_init_expr = &segment->offset;
@@ -814,7 +814,7 @@ static WabtResult begin_elem_segment_init_expr(uint32_t index,
}
static WabtResult end_elem_segment_init_expr(uint32_t index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
ctx->current_init_expr = nullptr;
return WABT_OK;
}
@@ -823,7 +823,7 @@ static WabtResult on_elem_segment_function_index_count(
WabtBinaryReaderContext* context,
uint32_t index,
uint32_t count) {
- Context* ctx = (Context*)context->user_data;
+ Context* ctx = static_cast<Context*>(context->user_data);
assert(index == ctx->module->elem_segments.size - 1);
WabtElemSegment* segment = ctx->module->elem_segments.data[index];
wabt_reserve_vars(&segment->vars, count);
@@ -833,7 +833,7 @@ static WabtResult on_elem_segment_function_index_count(
static WabtResult on_elem_segment_function_index(uint32_t index,
uint32_t func_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(index == ctx->module->elem_segments.size - 1);
WabtElemSegment* segment = ctx->module->elem_segments.data[index];
WabtVar* var = wabt_append_var(&segment->vars);
@@ -843,7 +843,7 @@ static WabtResult on_elem_segment_function_index(uint32_t index,
}
static WabtResult on_data_segment_count(uint32_t count, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
wabt_reserve_data_segment_ptrs(&ctx->module->data_segments, count);
return WABT_OK;
}
@@ -851,7 +851,7 @@ static WabtResult on_data_segment_count(uint32_t count, void* user_data) {
static WabtResult begin_data_segment(uint32_t index,
uint32_t memory_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtModuleField* field = wabt_append_module_field(ctx->module);
field->type = WABT_MODULE_FIELD_TYPE_DATA_SEGMENT;
@@ -870,7 +870,7 @@ static WabtResult begin_data_segment(uint32_t index,
static WabtResult begin_data_segment_init_expr(uint32_t index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(index == ctx->module->data_segments.size - 1);
WabtDataSegment* segment = ctx->module->data_segments.data[index];
ctx->current_init_expr = &segment->offset;
@@ -878,7 +878,7 @@ static WabtResult begin_data_segment_init_expr(uint32_t index,
}
static WabtResult end_data_segment_init_expr(uint32_t index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
ctx->current_init_expr = nullptr;
return WABT_OK;
}
@@ -887,7 +887,7 @@ static WabtResult on_data_segment_data(uint32_t index,
const void* data,
uint32_t size,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(index == ctx->module->data_segments.size - 1);
WabtDataSegment* segment = ctx->module->data_segments.data[index];
segment->data = wabt_alloc(size);
@@ -897,7 +897,7 @@ static WabtResult on_data_segment_data(uint32_t index,
}
static WabtResult on_function_names_count(uint32_t count, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (count > ctx->module->funcs.size) {
print_error(
ctx, "expected function name count (%u) <= function count (%" PRIzd ")",
@@ -910,7 +910,7 @@ static WabtResult on_function_names_count(uint32_t count, void* user_data) {
static WabtResult on_function_name(uint32_t index,
WabtStringSlice name,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtStringSlice new_name;
dup_name(ctx, &name, &new_name);
@@ -927,7 +927,7 @@ static WabtResult on_function_name(uint32_t index,
static WabtResult on_local_names_count(uint32_t index,
uint32_t count,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtModule* module = ctx->module;
assert(index < module->funcs.size);
WabtFunc* func = module->funcs.data[index];
@@ -943,7 +943,7 @@ static WabtResult on_local_names_count(uint32_t index,
static WabtResult on_init_expr_f32_const_expr(uint32_t index,
uint32_t value,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_const_expr();
expr->const_.type = WABT_TYPE_F32;
expr->const_.f32_bits = value;
@@ -954,7 +954,7 @@ static WabtResult on_init_expr_f32_const_expr(uint32_t index,
static WabtResult on_init_expr_f64_const_expr(uint32_t index,
uint64_t value,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_const_expr();
expr->const_.type = WABT_TYPE_F64;
expr->const_.f64_bits = value;
@@ -965,7 +965,7 @@ static WabtResult on_init_expr_f64_const_expr(uint32_t index,
static WabtResult on_init_expr_get_global_expr(uint32_t index,
uint32_t global_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_get_global_expr();
expr->get_global.var.type = WABT_VAR_TYPE_INDEX;
expr->get_global.var.index = global_index;
@@ -976,7 +976,7 @@ static WabtResult on_init_expr_get_global_expr(uint32_t index,
static WabtResult on_init_expr_i32_const_expr(uint32_t index,
uint32_t value,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_const_expr();
expr->const_.type = WABT_TYPE_I32;
expr->const_.u32 = value;
@@ -987,7 +987,7 @@ static WabtResult on_init_expr_i32_const_expr(uint32_t index,
static WabtResult on_init_expr_i64_const_expr(uint32_t index,
uint64_t value,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExpr* expr = wabt_new_const_expr();
expr->const_.type = WABT_TYPE_I64;
expr->const_.u64 = value;
@@ -999,7 +999,7 @@ static WabtResult on_local_name(uint32_t func_index,
uint32_t local_index,
WabtStringSlice name,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtModule* module = ctx->module;
WabtFunc* func = module->funcs.data[func_index];
uint32_t num_params = wabt_get_num_params(func);
diff --git a/src/binary-reader-interpreter.cc b/src/binary-reader-interpreter.cc
index fbe9fbfd..9c5c40d1 100644
--- a/src/binary-reader-interpreter.cc
+++ b/src/binary-reader-interpreter.cc
@@ -115,7 +115,7 @@ static void WABT_PRINTF_FORMAT(2, 3)
}
static void on_typechecker_error(const char* msg, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_error(ctx, "%s", msg);
}
@@ -237,7 +237,8 @@ static WabtResult emit_drop_keep(Context* ctx, uint32_t drop, uint8_t keep) {
if (drop == 1 && keep == 0) {
CHECK_RESULT(emit_opcode(ctx, WABT_OPCODE_DROP));
} else {
- CHECK_RESULT(emit_opcode(ctx, (WabtOpcode)WABT_OPCODE_DROP_KEEP));
+ CHECK_RESULT(
+ emit_opcode(ctx, static_cast<WabtOpcode>(WABT_OPCODE_DROP_KEEP)));
CHECK_RESULT(emit_i32(ctx, drop));
CHECK_RESULT(emit_i8(ctx, keep));
}
@@ -350,11 +351,11 @@ static WabtResult emit_func_offset(Context* ctx,
}
static void on_error(WabtBinaryReaderContext* ctx, const char* message) {
- handle_error(ctx->offset, message, (Context*)ctx->user_data);
+ handle_error(ctx->offset, message, static_cast<Context*>(ctx->user_data));
}
static WabtResult on_signature_count(uint32_t count, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
wabt_resize_uint32_vector(&ctx->sig_index_mapping, count);
uint32_t i;
for (i = 0; i < count; ++i)
@@ -370,7 +371,7 @@ static WabtResult on_signature(uint32_t index,
uint32_t result_count,
WabtType* result_types,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtInterpreterFuncSignature* sig = get_signature_by_module_index(ctx, index);
wabt_reserve_types(&sig->param_types, param_count);
@@ -384,7 +385,7 @@ static WabtResult on_signature(uint32_t index,
}
static WabtResult on_import_count(uint32_t count, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
wabt_new_interpreter_import_array(&ctx->module->defined.imports, count);
return WABT_OK;
}
@@ -393,7 +394,7 @@ static WabtResult on_import(uint32_t index,
WabtStringSlice module_name,
WabtStringSlice field_name,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(index < ctx->module->defined.imports.size);
WabtInterpreterImport* import = &ctx->module->defined.imports.data[index];
import->module_name = wabt_dup_string_slice(module_name);
@@ -406,7 +407,7 @@ static WabtResult on_import(uint32_t index,
return WABT_ERROR;
}
- assert((size_t)module_index < ctx->env->modules.size);
+ assert(static_cast<size_t>(module_index) < ctx->env->modules.size);
WabtInterpreterModule* module = &ctx->env->modules.data[module_index];
if (module->is_host) {
/* We don't yet know the kind of a host import module, so just assume it
@@ -496,7 +497,7 @@ static WabtResult append_export(Context* ctx,
}
static void on_host_import_print_error(const char* msg, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_error(ctx, "%s", msg);
}
@@ -511,7 +512,7 @@ static WabtResult on_import_func(uint32_t import_index,
uint32_t func_index,
uint32_t sig_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(import_index < ctx->module->defined.imports.size);
WabtInterpreterImport* import =
&ctx->module->defined.imports.data[import_index];
@@ -566,7 +567,7 @@ static WabtResult on_import_table(uint32_t import_index,
WabtType elem_type,
const WabtLimits* elem_limits,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (ctx->module->table_index != WABT_INVALID_INDEX) {
print_error(ctx, "only one table allowed");
return WABT_ERROR;
@@ -609,7 +610,7 @@ static WabtResult on_import_memory(uint32_t import_index,
uint32_t memory_index,
const WabtLimits* page_limits,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (ctx->module->memory_index != WABT_INVALID_INDEX) {
print_error(ctx, "only one memory allowed");
return WABT_ERROR;
@@ -653,7 +654,7 @@ static WabtResult on_import_global(uint32_t import_index,
WabtType type,
bool mutable_,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(import_index < ctx->module->defined.imports.size);
WabtInterpreterImport* import =
&ctx->module->defined.imports.data[import_index];
@@ -688,7 +689,7 @@ static WabtResult on_import_global(uint32_t import_index,
static WabtResult on_function_signatures_count(uint32_t count,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
size_t old_size = ctx->func_index_mapping.size;
wabt_resize_uint32_vector(&ctx->func_index_mapping, old_size + count);
uint32_t i;
@@ -703,7 +704,7 @@ static WabtResult on_function_signatures_count(uint32_t count,
static WabtResult on_function_signature(uint32_t index,
uint32_t sig_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtInterpreterFunc* func = get_func_by_module_index(ctx, index);
func->defined.offset = WABT_INVALID_OFFSET;
func->sig_index = translate_sig_index_to_env(ctx, sig_index);
@@ -714,7 +715,7 @@ static WabtResult on_table(uint32_t index,
WabtType elem_type,
const WabtLimits* elem_limits,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (ctx->module->table_index != WABT_INVALID_INDEX) {
print_error(ctx, "only one table allowed");
return WABT_ERROR;
@@ -730,7 +731,7 @@ static WabtResult on_table(uint32_t index,
static WabtResult on_memory(uint32_t index,
const WabtLimits* page_limits,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (ctx->module->memory_index != WABT_INVALID_INDEX) {
print_error(ctx, "only one memory allowed");
return WABT_ERROR;
@@ -745,7 +746,7 @@ static WabtResult on_memory(uint32_t index,
}
static WabtResult on_global_count(uint32_t count, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
size_t old_size = ctx->global_index_mapping.size;
wabt_resize_uint32_vector(&ctx->global_index_mapping, old_size + count);
uint32_t i;
@@ -760,7 +761,7 @@ static WabtResult begin_global(uint32_t index,
WabtType type,
bool mutable_,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtInterpreterGlobal* global = get_global_by_module_index(ctx, index);
global->typed_value.type = type;
global->mutable_ = mutable_;
@@ -768,7 +769,7 @@ static WabtResult begin_global(uint32_t index,
}
static WabtResult end_global_init_expr(uint32_t index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtInterpreterGlobal* global = get_global_by_module_index(ctx, index);
if (ctx->init_expr_value.type != global->typed_value.type) {
print_error(ctx, "type mismatch in global, expected %s but got %s.",
@@ -783,7 +784,7 @@ static WabtResult end_global_init_expr(uint32_t index, void* user_data) {
static WabtResult on_init_expr_f32_const_expr(uint32_t index,
uint32_t value_bits,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
ctx->init_expr_value.type = WABT_TYPE_F32;
ctx->init_expr_value.value.f32_bits = value_bits;
return WABT_OK;
@@ -792,7 +793,7 @@ static WabtResult on_init_expr_f32_const_expr(uint32_t index,
static WabtResult on_init_expr_f64_const_expr(uint32_t index,
uint64_t value_bits,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
ctx->init_expr_value.type = WABT_TYPE_F64;
ctx->init_expr_value.value.f64_bits = value_bits;
return WABT_OK;
@@ -801,7 +802,7 @@ static WabtResult on_init_expr_f64_const_expr(uint32_t index,
static WabtResult on_init_expr_get_global_expr(uint32_t index,
uint32_t global_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (global_index >= ctx->num_global_imports) {
print_error(ctx,
"initializer expression can only reference an imported global");
@@ -821,7 +822,7 @@ static WabtResult on_init_expr_get_global_expr(uint32_t index,
static WabtResult on_init_expr_i32_const_expr(uint32_t index,
uint32_t value,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
ctx->init_expr_value.type = WABT_TYPE_I32;
ctx->init_expr_value.value.i32 = value;
return WABT_OK;
@@ -830,7 +831,7 @@ static WabtResult on_init_expr_i32_const_expr(uint32_t index,
static WabtResult on_init_expr_i64_const_expr(uint32_t index,
uint64_t value,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
ctx->init_expr_value.type = WABT_TYPE_I64;
ctx->init_expr_value.value.i64 = value;
return WABT_OK;
@@ -841,7 +842,7 @@ static WabtResult on_export(uint32_t index,
uint32_t item_index,
WabtStringSlice name,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
switch (kind) {
case WABT_EXTERNAL_KIND_FUNC:
item_index = translate_func_index_to_env(ctx, item_index);
@@ -873,7 +874,7 @@ static WabtResult on_export(uint32_t index,
}
static WabtResult on_start_function(uint32_t func_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
uint32_t start_func_index = translate_func_index_to_env(ctx, func_index);
WabtInterpreterFunc* start_func =
get_func_by_env_index(ctx, start_func_index);
@@ -892,7 +893,7 @@ static WabtResult on_start_function(uint32_t func_index, void* user_data) {
}
static WabtResult end_elem_segment_init_expr(uint32_t index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (ctx->init_expr_value.type != WABT_TYPE_I32) {
print_error(ctx, "type mismatch in elem segment, expected i32 but got %s",
wabt_get_type_name(ctx->init_expr_value.type));
@@ -905,7 +906,7 @@ static WabtResult end_elem_segment_init_expr(uint32_t index, void* user_data) {
static WabtResult on_elem_segment_function_index_check(uint32_t index,
uint32_t func_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(ctx->module->table_index != WABT_INVALID_INDEX);
WabtInterpreterTable* table =
&ctx->env->tables.data[ctx->module->table_index];
@@ -931,7 +932,7 @@ static WabtResult on_elem_segment_function_index_check(uint32_t index,
static WabtResult on_elem_segment_function_index(uint32_t index,
uint32_t func_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(ctx->module->table_index != WABT_INVALID_INDEX);
WabtInterpreterTable* table =
&ctx->env->tables.data[ctx->module->table_index];
@@ -944,7 +945,7 @@ static WabtResult on_data_segment_data_check(uint32_t index,
const void* src_data,
uint32_t size,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(ctx->module->memory_index != WABT_INVALID_INDEX);
WabtInterpreterMemory* memory =
&ctx->env->memories.data[ctx->module->memory_index];
@@ -954,7 +955,8 @@ static WabtResult on_data_segment_data_check(uint32_t index,
return WABT_ERROR;
}
uint32_t address = ctx->init_expr_value.value.i32;
- uint64_t end_address = (uint64_t)address + (uint64_t)size;
+ uint64_t end_address =
+ static_cast<uint64_t>(address) + static_cast<uint64_t>(size);
if (end_address > memory->byte_size) {
print_error(ctx, "data segment is out of bounds: [%u, %" PRIu64
") >= max value %u",
@@ -968,12 +970,12 @@ static WabtResult on_data_segment_data(uint32_t index,
const void* src_data,
uint32_t size,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
assert(ctx->module->memory_index != WABT_INVALID_INDEX);
WabtInterpreterMemory* memory =
&ctx->env->memories.data[ctx->module->memory_index];
uint32_t address = ctx->init_expr_value.value.i32;
- uint8_t* dst_data = (uint8_t*)memory->data;
+ uint8_t* dst_data = static_cast<uint8_t*>(memory->data);
memcpy(&dst_data[address], src_data, size);
return WABT_OK;
}
@@ -1000,7 +1002,7 @@ static void pop_label(Context* ctx) {
static WabtResult begin_function_body(WabtBinaryReaderContext* context,
uint32_t index) {
- Context* ctx = (Context*)context->user_data;
+ Context* ctx = static_cast<Context*>(context->user_data);
WabtInterpreterFunc* func = get_func_by_module_index(ctx, index);
WabtInterpreterFuncSignature* sig =
get_signature_by_env_index(ctx, func->sig_index);
@@ -1036,7 +1038,7 @@ static WabtResult begin_function_body(WabtBinaryReaderContext* context,
}
static WabtResult end_function_body(uint32_t index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
fixup_top_label(ctx);
uint32_t drop_count, keep_count;
CHECK_RESULT(get_return_drop_keep_count(ctx, &drop_count, &keep_count));
@@ -1049,7 +1051,7 @@ static WabtResult end_function_body(uint32_t index, void* user_data) {
}
static WabtResult on_local_decl_count(uint32_t count, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtInterpreterFunc* func = ctx->current_func;
func->defined.local_decl_count = count;
return WABT_OK;
@@ -1059,7 +1061,7 @@ static WabtResult on_local_decl(uint32_t decl_index,
uint32_t count,
WabtType type,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtInterpreterFunc* func = ctx->current_func;
func->defined.local_count += count;
@@ -1070,7 +1072,7 @@ static WabtResult on_local_decl(uint32_t decl_index,
if (decl_index == func->defined.local_decl_count - 1) {
/* last local declaration, allocate space for all locals. */
- CHECK_RESULT(emit_opcode(ctx, (WabtOpcode)WABT_OPCODE_ALLOCA));
+ CHECK_RESULT(emit_opcode(ctx, static_cast<WabtOpcode>(WABT_OPCODE_ALLOCA)));
CHECK_RESULT(emit_i32(ctx, func->defined.local_count));
}
return WABT_OK;
@@ -1097,14 +1099,14 @@ static WabtResult check_align(Context* ctx,
}
static WabtResult on_unary_expr(WabtOpcode opcode, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(wabt_typechecker_on_unary(&ctx->typechecker, opcode));
CHECK_RESULT(emit_opcode(ctx, opcode));
return WABT_OK;
}
static WabtResult on_binary_expr(WabtOpcode opcode, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(wabt_typechecker_on_binary(&ctx->typechecker, opcode));
CHECK_RESULT(emit_opcode(ctx, opcode));
return WABT_OK;
@@ -1113,7 +1115,7 @@ static WabtResult on_binary_expr(WabtOpcode opcode, void* user_data) {
static WabtResult on_block_expr(uint32_t num_types,
WabtType* sig_types,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtTypeVector sig;
sig.size = num_types;
sig.data = sig_types;
@@ -1125,7 +1127,7 @@ static WabtResult on_block_expr(uint32_t num_types,
static WabtResult on_loop_expr(uint32_t num_types,
WabtType* sig_types,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtTypeVector sig;
sig.size = num_types;
sig.data = sig_types;
@@ -1137,12 +1139,13 @@ static WabtResult on_loop_expr(uint32_t num_types,
static WabtResult on_if_expr(uint32_t num_types,
WabtType* sig_types,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtTypeVector sig;
sig.size = num_types;
sig.data = sig_types;
CHECK_RESULT(wabt_typechecker_on_if(&ctx->typechecker, &sig));
- CHECK_RESULT(emit_opcode(ctx, (WabtOpcode)WABT_OPCODE_BR_UNLESS));
+ CHECK_RESULT(
+ emit_opcode(ctx, static_cast<WabtOpcode>(WABT_OPCODE_BR_UNLESS)));
uint32_t fixup_offset = get_istream_offset(ctx);
CHECK_RESULT(emit_i32(ctx, WABT_INVALID_OFFSET));
push_label(ctx, WABT_INVALID_OFFSET, fixup_offset);
@@ -1150,7 +1153,7 @@ static WabtResult on_if_expr(uint32_t num_types,
}
static WabtResult on_else_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(wabt_typechecker_on_else(&ctx->typechecker));
Label* label = top_label(ctx);
uint32_t fixup_cond_offset = label->fixup_offset;
@@ -1162,7 +1165,7 @@ static WabtResult on_else_expr(void* user_data) {
}
static WabtResult on_end_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtTypeCheckerLabel* label;
CHECK_RESULT(wabt_typechecker_get_label(&ctx->typechecker, 0, &label));
WabtLabelType label_type = label->label_type;
@@ -1177,7 +1180,7 @@ static WabtResult on_end_expr(void* user_data) {
}
static WabtResult on_br_expr(uint32_t depth, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
uint32_t drop_count, keep_count;
CHECK_RESULT(get_br_drop_keep_count(ctx, depth, &drop_count, &keep_count));
CHECK_RESULT(wabt_typechecker_on_br(&ctx->typechecker, depth));
@@ -1186,12 +1189,13 @@ static WabtResult on_br_expr(uint32_t depth, void* user_data) {
}
static WabtResult on_br_if_expr(uint32_t depth, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
uint32_t drop_count, keep_count;
CHECK_RESULT(wabt_typechecker_on_br_if(&ctx->typechecker, depth));
CHECK_RESULT(get_br_drop_keep_count(ctx, depth, &drop_count, &keep_count));
/* flip the br_if so if <cond> is true it can drop values from the stack */
- CHECK_RESULT(emit_opcode(ctx, (WabtOpcode)WABT_OPCODE_BR_UNLESS));
+ CHECK_RESULT(
+ emit_opcode(ctx, static_cast<WabtOpcode>(WABT_OPCODE_BR_UNLESS)));
uint32_t fixup_br_offset = get_istream_offset(ctx);
CHECK_RESULT(emit_i32(ctx, WABT_INVALID_OFFSET));
CHECK_RESULT(emit_br(ctx, depth, drop_count, keep_count));
@@ -1203,7 +1207,7 @@ static WabtResult on_br_table_expr(WabtBinaryReaderContext* context,
uint32_t num_targets,
uint32_t* target_depths,
uint32_t default_target_depth) {
- Context* ctx = (Context*)context->user_data;
+ Context* ctx = static_cast<Context*>(context->user_data);
CHECK_RESULT(wabt_typechecker_begin_br_table(&ctx->typechecker));
CHECK_RESULT(emit_opcode(ctx, WABT_OPCODE_BR_TABLE));
CHECK_RESULT(emit_i32(ctx, num_targets));
@@ -1211,7 +1215,7 @@ static WabtResult on_br_table_expr(WabtBinaryReaderContext* context,
CHECK_RESULT(emit_i32(ctx, WABT_INVALID_OFFSET));
/* not necessary for the interpreter, but it makes it easier to disassemble.
* This opcode specifies how many bytes of data follow. */
- CHECK_RESULT(emit_opcode(ctx, (WabtOpcode)WABT_OPCODE_DATA));
+ CHECK_RESULT(emit_opcode(ctx, static_cast<WabtOpcode>(WABT_OPCODE_DATA)));
CHECK_RESULT(emit_i32(ctx, (num_targets + 1) * WABT_TABLE_ENTRY_SIZE));
CHECK_RESULT(emit_i32_at(ctx, fixup_table_offset, get_istream_offset(ctx)));
@@ -1227,7 +1231,7 @@ static WabtResult on_br_table_expr(WabtBinaryReaderContext* context,
}
static WabtResult on_call_expr(uint32_t func_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtInterpreterFunc* func = get_func_by_module_index(ctx, func_index);
WabtInterpreterFuncSignature* sig =
get_signature_by_env_index(ctx, func->sig_index);
@@ -1235,7 +1239,8 @@ static WabtResult on_call_expr(uint32_t func_index, void* user_data) {
&sig->result_types));
if (func->is_host) {
- CHECK_RESULT(emit_opcode(ctx, (WabtOpcode)WABT_OPCODE_CALL_HOST));
+ CHECK_RESULT(
+ emit_opcode(ctx, static_cast<WabtOpcode>(WABT_OPCODE_CALL_HOST)));
CHECK_RESULT(emit_i32(ctx, translate_func_index_to_env(ctx, func_index)));
} else {
CHECK_RESULT(emit_opcode(ctx, WABT_OPCODE_CALL));
@@ -1246,7 +1251,7 @@ static WabtResult on_call_expr(uint32_t func_index, void* user_data) {
}
static WabtResult on_call_indirect_expr(uint32_t sig_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (ctx->module->table_index == WABT_INVALID_INDEX) {
print_error(ctx, "found call_indirect operator, but no table");
return WABT_ERROR;
@@ -1263,14 +1268,14 @@ static WabtResult on_call_indirect_expr(uint32_t sig_index, void* user_data) {
}
static WabtResult on_drop_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(wabt_typechecker_on_drop(&ctx->typechecker));
CHECK_RESULT(emit_opcode(ctx, WABT_OPCODE_DROP));
return WABT_OK;
}
static WabtResult on_i32_const_expr(uint32_t value, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(wabt_typechecker_on_const(&ctx->typechecker, WABT_TYPE_I32));
CHECK_RESULT(emit_opcode(ctx, WABT_OPCODE_I32_CONST));
CHECK_RESULT(emit_i32(ctx, value));
@@ -1278,7 +1283,7 @@ static WabtResult on_i32_const_expr(uint32_t value, void* user_data) {
}
static WabtResult on_i64_const_expr(uint64_t value, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(wabt_typechecker_on_const(&ctx->typechecker, WABT_TYPE_I64));
CHECK_RESULT(emit_opcode(ctx, WABT_OPCODE_I64_CONST));
CHECK_RESULT(emit_i64(ctx, value));
@@ -1286,7 +1291,7 @@ static WabtResult on_i64_const_expr(uint64_t value, void* user_data) {
}
static WabtResult on_f32_const_expr(uint32_t value_bits, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(wabt_typechecker_on_const(&ctx->typechecker, WABT_TYPE_F32));
CHECK_RESULT(emit_opcode(ctx, WABT_OPCODE_F32_CONST));
CHECK_RESULT(emit_i32(ctx, value_bits));
@@ -1294,7 +1299,7 @@ static WabtResult on_f32_const_expr(uint32_t value_bits, void* user_data) {
}
static WabtResult on_f64_const_expr(uint64_t value_bits, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(wabt_typechecker_on_const(&ctx->typechecker, WABT_TYPE_F64));
CHECK_RESULT(emit_opcode(ctx, WABT_OPCODE_F64_CONST));
CHECK_RESULT(emit_i64(ctx, value_bits));
@@ -1302,7 +1307,7 @@ static WabtResult on_f64_const_expr(uint64_t value_bits, void* user_data) {
}
static WabtResult on_get_global_expr(uint32_t global_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_GLOBAL(ctx, global_index);
WabtType type = get_global_type_by_module_index(ctx, global_index);
CHECK_RESULT(wabt_typechecker_on_get_global(&ctx->typechecker, type));
@@ -1312,7 +1317,7 @@ static WabtResult on_get_global_expr(uint32_t global_index, void* user_data) {
}
static WabtResult on_set_global_expr(uint32_t global_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_GLOBAL(ctx, global_index);
WabtInterpreterGlobal* global = get_global_by_module_index(ctx, global_index);
if (!global->mutable_) {
@@ -1333,7 +1338,7 @@ static uint32_t translate_local_index(Context* ctx, uint32_t local_index) {
}
static WabtResult on_get_local_expr(uint32_t local_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_LOCAL(ctx, local_index);
WabtType type = get_local_type_by_index(ctx->current_func, local_index);
/* Get the translated index before calling wabt_typechecker_on_get_local
@@ -1347,7 +1352,7 @@ static WabtResult on_get_local_expr(uint32_t local_index, void* user_data) {
}
static WabtResult on_set_local_expr(uint32_t local_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_LOCAL(ctx, local_index);
WabtType type = get_local_type_by_index(ctx->current_func, local_index);
CHECK_RESULT(wabt_typechecker_on_set_local(&ctx->typechecker, type));
@@ -1357,7 +1362,7 @@ static WabtResult on_set_local_expr(uint32_t local_index, void* user_data) {
}
static WabtResult on_tee_local_expr(uint32_t local_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_LOCAL(ctx, local_index);
WabtType type = get_local_type_by_index(ctx->current_func, local_index);
CHECK_RESULT(wabt_typechecker_on_tee_local(&ctx->typechecker, type));
@@ -1367,7 +1372,7 @@ static WabtResult on_tee_local_expr(uint32_t local_index, void* user_data) {
}
static WabtResult on_grow_memory_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(check_has_memory(ctx, WABT_OPCODE_GROW_MEMORY));
CHECK_RESULT(wabt_typechecker_on_grow_memory(&ctx->typechecker));
CHECK_RESULT(emit_opcode(ctx, WABT_OPCODE_GROW_MEMORY));
@@ -1379,7 +1384,7 @@ static WabtResult on_load_expr(WabtOpcode opcode,
uint32_t alignment_log2,
uint32_t offset,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(check_has_memory(ctx, opcode));
CHECK_RESULT(
check_align(ctx, alignment_log2, wabt_get_opcode_memory_size(opcode)));
@@ -1394,7 +1399,7 @@ static WabtResult on_store_expr(WabtOpcode opcode,
uint32_t alignment_log2,
uint32_t offset,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(check_has_memory(ctx, opcode));
CHECK_RESULT(
check_align(ctx, alignment_log2, wabt_get_opcode_memory_size(opcode)));
@@ -1406,7 +1411,7 @@ static WabtResult on_store_expr(WabtOpcode opcode,
}
static WabtResult on_current_memory_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(check_has_memory(ctx, WABT_OPCODE_CURRENT_MEMORY));
CHECK_RESULT(wabt_typechecker_on_current_memory(&ctx->typechecker));
CHECK_RESULT(emit_opcode(ctx, WABT_OPCODE_CURRENT_MEMORY));
@@ -1419,7 +1424,7 @@ static WabtResult on_nop_expr(void* user_data) {
}
static WabtResult on_return_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
uint32_t drop_count, keep_count;
CHECK_RESULT(get_return_drop_keep_count(ctx, &drop_count, &keep_count));
CHECK_RESULT(wabt_typechecker_on_return(&ctx->typechecker));
@@ -1429,14 +1434,14 @@ static WabtResult on_return_expr(void* user_data) {
}
static WabtResult on_select_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(wabt_typechecker_on_select(&ctx->typechecker));
CHECK_RESULT(emit_opcode(ctx, WABT_OPCODE_SELECT));
return WABT_OK;
}
static WabtResult on_unreachable_expr(void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
CHECK_RESULT(wabt_typechecker_on_unreachable(&ctx->typechecker));
CHECK_RESULT(emit_opcode(ctx, WABT_OPCODE_UNREACHABLE));
return WABT_OK;
diff --git a/src/binary-reader-linker.cc b/src/binary-reader-linker.cc
index 568bd1eb..4f3e4811 100644
--- a/src/binary-reader-linker.cc
+++ b/src/binary-reader-linker.cc
@@ -34,7 +34,7 @@ static WabtResult on_reloc_count(uint32_t count,
WabtBinarySection section_code,
WabtStringSlice section_name,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtLinkerInputBinary* binary = ctx->binary;
if (section_code == WABT_BINARY_SECTION_CUSTOM) {
WABT_FATAL("relocation for custom sections not yet supported\n");
@@ -56,7 +56,7 @@ static WabtResult on_reloc_count(uint32_t count,
static WabtResult on_reloc(WabtRelocType type,
uint32_t offset,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (offset + RELOC_SIZE > ctx->reloc_section->size) {
WABT_FATAL("invalid relocation offset: %#x\n", offset);
@@ -73,7 +73,7 @@ static WabtResult on_import(uint32_t index,
WabtStringSlice module_name,
WabtStringSlice field_name,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (!wabt_string_slice_eq_cstr(&module_name, WABT_LINK_MODULE_NAME)) {
WABT_FATAL("unsupported import module: " PRIstringslice,
WABT_PRINTF_STRING_SLICE_ARG(module_name));
@@ -86,7 +86,7 @@ static WabtResult on_import_func(uint32_t import_index,
uint32_t global_index,
uint32_t sig_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtFunctionImport* import =
wabt_append_function_import(&ctx->binary->function_imports);
import->name = ctx->import_name;
@@ -101,7 +101,7 @@ static WabtResult on_import_global(uint32_t import_index,
WabtType type,
bool mutable_,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtGlobalImport* import =
wabt_append_global_import(&ctx->binary->global_imports);
import->name = ctx->import_name;
@@ -114,7 +114,7 @@ static WabtResult on_import_global(uint32_t import_index,
static WabtResult begin_section(WabtBinaryReaderContext* ctx,
WabtBinarySection section_code,
uint32_t size) {
- Context* context = (Context*)ctx->user_data;
+ Context* context = static_cast<Context*>(ctx->user_data);
WabtLinkerInputBinary* binary = context->binary;
WabtSection* sec = wabt_append_section(&binary->sections);
context->current_section = sec;
@@ -138,7 +138,7 @@ static WabtResult begin_section(WabtBinaryReaderContext* ctx,
static WabtResult begin_custom_section(WabtBinaryReaderContext* ctx,
uint32_t size,
WabtStringSlice section_name) {
- Context* context = (Context*)ctx->user_data;
+ Context* context = static_cast<Context*>(ctx->user_data);
WabtLinkerInputBinary* binary = context->binary;
WabtSection* sec = context->current_section;
sec->data_custom.name = section_name;
@@ -184,7 +184,7 @@ static WabtResult on_table(uint32_t index,
if (elem_limits->has_max && (elem_limits->max != elem_limits->initial))
WABT_FATAL("Tables with max != initial not supported by wabt-link\n");
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
ctx->binary->table_elem_count = elem_limits->initial;
return WABT_OK;
}
@@ -193,7 +193,7 @@ static WabtResult on_elem_segment_function_index_count(
WabtBinaryReaderContext* ctx,
uint32_t index,
uint32_t count) {
- Context* context = (Context*)ctx->user_data;
+ Context* context = static_cast<Context*>(ctx->user_data);
WabtSection* sec = context->current_section;
/* Modify the payload to include only the actual function indexes */
@@ -206,7 +206,7 @@ static WabtResult on_elem_segment_function_index_count(
static WabtResult on_memory(uint32_t index,
const WabtLimits* page_limits,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtSection* sec = ctx->current_section;
sec->memory_limits = *page_limits;
ctx->binary->memory_page_count = page_limits->initial;
@@ -216,7 +216,7 @@ static WabtResult on_memory(uint32_t index,
static WabtResult begin_data_segment(uint32_t index,
uint32_t memory_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtSection* sec = ctx->current_section;
WabtDataSegment* segment = wabt_append_data_segment(&sec->data_segments);
segment->memory_index = memory_index;
@@ -226,7 +226,7 @@ static WabtResult begin_data_segment(uint32_t index,
static WabtResult on_init_expr_i32_const_expr(uint32_t index,
uint32_t value,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtSection* sec = ctx->current_section;
if (sec->section_code != WABT_BINARY_SECTION_DATA)
return WABT_OK;
@@ -240,11 +240,11 @@ static WabtResult on_data_segment_data(uint32_t index,
const void* src_data,
uint32_t size,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtSection* sec = ctx->current_section;
WabtDataSegment* segment =
&sec->data_segments.data[sec->data_segments.size - 1];
- segment->data = (uint8_t*)src_data;
+ segment->data = static_cast<const uint8_t*>(src_data);
segment->size = size;
return WABT_OK;
}
@@ -254,7 +254,7 @@ static WabtResult on_export(uint32_t index,
uint32_t item_index,
WabtStringSlice name,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
WabtExport* export_ = wabt_append_export(&ctx->binary->exports);
export_->name = name;
export_->kind = kind;
@@ -265,7 +265,7 @@ static WabtResult on_export(uint32_t index,
static WabtResult on_function_name(uint32_t index,
WabtStringSlice name,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
wabt_append_string_slice_value(&ctx->binary->debug_names, &name);
return WABT_OK;
}
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc
index 70bf4ae5..11964494 100644
--- a/src/binary-reader-objdump.cc
+++ b/src/binary-reader-objdump.cc
@@ -69,7 +69,7 @@ static void WABT_PRINTF_FORMAT(2, 3)
static WabtResult begin_section(WabtBinaryReaderContext* ctx,
WabtBinarySection section_code,
uint32_t size) {
- Context* context = (Context*)ctx->user_data;
+ Context* context = static_cast<Context*>(ctx->user_data);
context->section_starts[section_code] = ctx->offset;
const char* name = wabt_get_section_name(section_code);
@@ -112,7 +112,7 @@ static WabtResult begin_section(WabtBinaryReaderContext* ctx,
static WabtResult begin_custom_section(WabtBinaryReaderContext* ctx,
uint32_t size,
WabtStringSlice section_name) {
- Context* context = (Context*)ctx->user_data;
+ Context* context = static_cast<Context*>(ctx->user_data);
print_details(context, " - name: \"" PRIstringslice "\"\n",
WABT_PRINTF_STRING_SLICE_ARG(section_name));
if (context->options->mode == WABT_DUMP_HEADERS) {
@@ -123,7 +123,7 @@ static WabtResult begin_custom_section(WabtBinaryReaderContext* ctx,
}
static WabtResult on_count(uint32_t count, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (ctx->options->mode == WABT_DUMP_HEADERS) {
printf("count: %d\n", count);
}
@@ -131,7 +131,7 @@ static WabtResult on_count(uint32_t count, void* user_data) {
}
static WabtResult begin_module(uint32_t version, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (ctx->options->print_header) {
const char *basename = strrchr(ctx->options->infile, '/');
if (basename)
@@ -164,7 +164,7 @@ static WabtResult begin_module(uint32_t version, void* user_data) {
}
static WabtResult end_module(void *user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (ctx->options->section_name) {
if (!ctx->section_found) {
printf("Section not found: %s\n", ctx->options->section_name);
@@ -176,7 +176,7 @@ static WabtResult end_module(void *user_data) {
}
static WabtResult on_opcode(WabtBinaryReaderContext* ctx, WabtOpcode opcode) {
- Context* context = (Context*)ctx->user_data;
+ Context* context = static_cast<Context*>(ctx->user_data);
if (context->options->debug) {
const char* opcode_name = wabt_get_opcode_name(opcode);
@@ -187,7 +187,7 @@ static WabtResult on_opcode(WabtBinaryReaderContext* ctx, WabtOpcode opcode) {
if (ctx->offset != context->last_opcode_end + 1) {
uint8_t missing_opcode = ctx->data[context->last_opcode_end];
const char* opcode_name =
- wabt_get_opcode_name((WabtOpcode)missing_opcode);
+ wabt_get_opcode_name(static_cast<WabtOpcode>(missing_opcode));
fprintf(stderr, "warning: %#" PRIzx " missing opcode callback at %#" PRIzx
" (%#02x=%s)\n",
ctx->offset, context->last_opcode_end + 1,
@@ -259,14 +259,14 @@ static void log_opcode(Context* ctx,
}
static WabtResult on_opcode_bare(WabtBinaryReaderContext* ctx) {
- Context* context = (Context*)ctx->user_data;
+ Context* context = static_cast<Context*>(ctx->user_data);
log_opcode(context, ctx->data, 0, nullptr);
return WABT_OK;
}
static WabtResult on_opcode_uint32(WabtBinaryReaderContext* ctx,
uint32_t value) {
- Context* context = (Context*)ctx->user_data;
+ Context* context = static_cast<Context*>(ctx->user_data);
size_t immediate_len = ctx->offset - context->current_opcode_offset;
log_opcode(context, ctx->data, immediate_len, "%#x", value);
return WABT_OK;
@@ -275,7 +275,7 @@ static WabtResult on_opcode_uint32(WabtBinaryReaderContext* ctx,
static WabtResult on_opcode_uint32_uint32(WabtBinaryReaderContext* ctx,
uint32_t value,
uint32_t value2) {
- Context* context = (Context*)ctx->user_data;
+ Context* context = static_cast<Context*>(ctx->user_data);
size_t immediate_len = ctx->offset - context->current_opcode_offset;
log_opcode(context, ctx->data, immediate_len, "%lu %lu", value, value2);
return WABT_OK;
@@ -283,7 +283,7 @@ static WabtResult on_opcode_uint32_uint32(WabtBinaryReaderContext* ctx,
static WabtResult on_opcode_uint64(WabtBinaryReaderContext* ctx,
uint64_t value) {
- Context* context = (Context*)ctx->user_data;
+ Context* context = static_cast<Context*>(ctx->user_data);
size_t immediate_len = ctx->offset - context->current_opcode_offset;
log_opcode(context, ctx->data, immediate_len, "%d", value);
return WABT_OK;
@@ -291,7 +291,7 @@ static WabtResult on_opcode_uint64(WabtBinaryReaderContext* ctx,
static WabtResult on_opcode_f32(WabtBinaryReaderContext* ctx,
uint32_t value) {
- Context* context = (Context*)ctx->user_data;
+ Context* context = static_cast<Context*>(ctx->user_data);
size_t immediate_len = ctx->offset - context->current_opcode_offset;
char buffer[WABT_MAX_FLOAT_HEX];
wabt_write_float_hex(buffer, sizeof(buffer), value);
@@ -301,7 +301,7 @@ static WabtResult on_opcode_f32(WabtBinaryReaderContext* ctx,
static WabtResult on_opcode_f64(WabtBinaryReaderContext* ctx,
uint64_t value) {
- Context* context = (Context*)ctx->user_data;
+ Context* context = static_cast<Context*>(ctx->user_data);
size_t immediate_len = ctx->offset - context->current_opcode_offset;
char buffer[WABT_MAX_DOUBLE_HEX];
wabt_write_double_hex(buffer, sizeof(buffer), value);
@@ -313,7 +313,7 @@ WabtResult on_br_table_expr(WabtBinaryReaderContext* ctx,
uint32_t num_targets,
uint32_t* target_depths,
uint32_t default_target_depth) {
- Context* context = (Context*)ctx->user_data;
+ Context* context = static_cast<Context*>(ctx->user_data);
size_t immediate_len = ctx->offset - context->current_opcode_offset;
/* TODO(sbc): Print targets */
log_opcode(context, ctx->data, immediate_len, nullptr);
@@ -321,7 +321,7 @@ WabtResult on_br_table_expr(WabtBinaryReaderContext* ctx,
}
static WabtResult on_end_expr(void* user_data) {
- Context* context = (Context*)user_data;
+ Context* context = static_cast<Context*>(user_data);
context->indent_level--;
assert(context->indent_level >= 0);
log_opcode(context, nullptr, 0, nullptr);
@@ -351,7 +351,7 @@ static const char* wabt_type_name(WabtType type) {
static WabtResult on_opcode_block_sig(WabtBinaryReaderContext* ctx,
uint32_t num_types,
WabtType* sig_types) {
- Context* context = (Context*)ctx->user_data;
+ Context* context = static_cast<Context*>(ctx->user_data);
if (num_types)
log_opcode(context, ctx->data, 1, "%s", wabt_type_name(*sig_types));
else
@@ -366,7 +366,7 @@ static WabtResult on_signature(uint32_t index,
uint32_t result_count,
WabtType* result_types,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (!should_print_details(ctx))
return WABT_OK;
@@ -390,13 +390,14 @@ static WabtResult on_signature(uint32_t index,
static WabtResult on_function_signature(uint32_t index,
uint32_t sig_index,
void* user_data) {
- print_details((Context*)user_data, " - func[%d] sig=%d\n", index, sig_index);
+ print_details(static_cast<Context*>(user_data), " - func[%d] sig=%d\n", index,
+ sig_index);
return WABT_OK;
}
static WabtResult begin_function_body(WabtBinaryReaderContext* context,
uint32_t index) {
- Context* ctx = (Context*)context->user_data;
+ Context* ctx = static_cast<Context*>(context->user_data);
if (ctx->options->mode == WABT_DUMP_DISASSEMBLE) {
if (index < ctx->options->function_names.size)
@@ -415,7 +416,7 @@ static WabtResult on_import(uint32_t index,
WabtStringSlice module_name,
WabtStringSlice field_name,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
ctx->import_module_name = module_name;
ctx->import_field_name = field_name;
return WABT_OK;
@@ -425,7 +426,7 @@ static WabtResult on_import_func(uint32_t import_index,
uint32_t func_index,
uint32_t sig_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_details(ctx,
" - func[%d] sig=%d <- " PRIstringslice "." PRIstringslice "\n",
func_index, sig_index,
@@ -439,7 +440,7 @@ static WabtResult on_import_table(uint32_t import_index,
WabtType elem_type,
const WabtLimits* elem_limits,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_details(
ctx, " - " PRIstringslice "." PRIstringslice
" -> table elem_type=%s init=%" PRId64 " max=%" PRId64 "\n",
@@ -453,7 +454,7 @@ static WabtResult on_import_memory(uint32_t import_index,
uint32_t memory_index,
const WabtLimits* page_limits,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_details(ctx, " - " PRIstringslice "." PRIstringslice " -> memory\n",
WABT_PRINTF_STRING_SLICE_ARG(ctx->import_module_name),
WABT_PRINTF_STRING_SLICE_ARG(ctx->import_field_name));
@@ -465,7 +466,7 @@ static WabtResult on_import_global(uint32_t import_index,
WabtType type,
bool mutable_,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_details(ctx, " - global[%d] %s mutable=%d <- " PRIstringslice
"." PRIstringslice "\n",
global_index, wabt_get_type_name(type), mutable_,
@@ -477,7 +478,7 @@ static WabtResult on_import_global(uint32_t import_index,
static WabtResult on_memory(uint32_t index,
const WabtLimits* page_limits,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_details(ctx, " - memory[%d] pages: initial=%" PRId64, index,
page_limits->initial);
if (page_limits->has_max)
@@ -490,7 +491,7 @@ static WabtResult on_table(uint32_t index,
WabtType elem_type,
const WabtLimits* elem_limits,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_details(ctx, " - table[%d] type=%s initial=%" PRId64, index,
wabt_get_type_name(elem_type), elem_limits->initial);
if (elem_limits->has_max)
@@ -504,7 +505,7 @@ static WabtResult on_export(uint32_t index,
uint32_t item_index,
WabtStringSlice name,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_details(ctx, " - %s[%d] ", wabt_get_kind_name(kind), item_index);
print_details(ctx, PRIstringslice, WABT_PRINTF_STRING_SLICE_ARG(name));
print_details(ctx, "\n");
@@ -514,7 +515,7 @@ static WabtResult on_export(uint32_t index,
static WabtResult on_elem_segment_function_index(uint32_t index,
uint32_t func_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_details(ctx, " - func[%d]\n", func_index);
return WABT_OK;
}
@@ -522,7 +523,7 @@ static WabtResult on_elem_segment_function_index(uint32_t index,
static WabtResult begin_elem_segment(uint32_t index,
uint32_t table_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_details(ctx, " - segment[%d] table=%d\n", index, table_index);
return WABT_OK;
}
@@ -531,7 +532,7 @@ static WabtResult begin_global(uint32_t index,
WabtType type,
bool mutable_,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_details(ctx, " - global[%d] %s mutable=%d", index,
wabt_get_type_name(type), mutable_);
return WABT_OK;
@@ -540,7 +541,7 @@ static WabtResult begin_global(uint32_t index,
static WabtResult on_init_expr_f32_const_expr(uint32_t index,
uint32_t value,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
char buffer[WABT_MAX_FLOAT_HEX];
wabt_write_float_hex(buffer, sizeof(buffer), value);
print_details(ctx, " - init f32=%s\n", buffer);
@@ -550,7 +551,7 @@ static WabtResult on_init_expr_f32_const_expr(uint32_t index,
static WabtResult on_init_expr_f64_const_expr(uint32_t index,
uint64_t value,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
char buffer[WABT_MAX_DOUBLE_HEX];
wabt_write_float_hex(buffer, sizeof(buffer), value);
print_details(ctx, " - init f64=%s\n", buffer);
@@ -560,7 +561,7 @@ static WabtResult on_init_expr_f64_const_expr(uint32_t index,
static WabtResult on_init_expr_get_global_expr(uint32_t index,
uint32_t global_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_details(ctx, " - init global=%d\n", global_index);
return WABT_OK;
}
@@ -568,7 +569,7 @@ static WabtResult on_init_expr_get_global_expr(uint32_t index,
static WabtResult on_init_expr_i32_const_expr(uint32_t index,
uint32_t value,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_details(ctx, " - init i32=%d\n", value);
return WABT_OK;
}
@@ -576,7 +577,7 @@ static WabtResult on_init_expr_i32_const_expr(uint32_t index,
static WabtResult on_init_expr_i64_const_expr(uint32_t index,
uint64_t value,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_details(ctx, " - init i64=%" PRId64 "\n", value);
return WABT_OK;
}
@@ -584,7 +585,7 @@ static WabtResult on_init_expr_i64_const_expr(uint32_t index,
static WabtResult on_function_name(uint32_t index,
WabtStringSlice name,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_details(ctx, " - func[%d] " PRIstringslice "\n", index,
WABT_PRINTF_STRING_SLICE_ARG(name));
if (ctx->options->mode == WABT_DUMP_PREPASS)
@@ -596,7 +597,7 @@ static WabtResult on_local_name(uint32_t func_index,
uint32_t local_index,
WabtStringSlice name,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (name.length) {
print_details(ctx, " - local[%d] " PRIstringslice "\n", local_index,
WABT_PRINTF_STRING_SLICE_ARG(name));
@@ -608,7 +609,7 @@ WabtResult on_reloc_count(uint32_t count,
WabtBinarySection section_code,
WabtStringSlice section_name,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
ctx->reloc_section = section_code;
print_details(ctx, " - section: %s\n", wabt_get_section_name(section_code));
return WABT_OK;
@@ -617,7 +618,7 @@ WabtResult on_reloc_count(uint32_t count,
WabtResult on_reloc(WabtRelocType type,
uint32_t offset,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
uint32_t total_offset = ctx->section_starts[ctx->reloc_section] + offset;
print_details(ctx, " - %-18s offset=%#x (%#x)\n",
wabt_get_reloc_type_name(type), total_offset, offset);
@@ -642,7 +643,7 @@ static void on_error(WabtBinaryReaderContext* ctx, const char* message) {
static WabtResult begin_data_segment(uint32_t index,
uint32_t memory_index,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_details(ctx, " - memory[%d]", memory_index);
return WABT_OK;
}
@@ -651,7 +652,7 @@ static WabtResult on_data_segment_data(uint32_t index,
const void* src_data,
uint32_t size,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (should_print_details(ctx)) {
wabt_write_memory_dump(ctx->out_stream, src_data, size, 0, WABT_PRINT_CHARS,
" - ", nullptr);
diff --git a/src/binary-reader-opcnt.cc b/src/binary-reader-opcnt.cc
index 18b37366..4c0cd5c2 100644
--- a/src/binary-reader-opcnt.cc
+++ b/src/binary-reader-opcnt.cc
@@ -65,7 +65,7 @@ static WabtResult add_int_pair_counter_value(WabtIntPairCounterVector* vec,
static WabtResult on_opcode(WabtBinaryReaderContext* context,
WabtOpcode opcode) {
- Context* ctx = (Context*)context->user_data;
+ Context* ctx = static_cast<Context*>(context->user_data);
WabtIntCounterVector* opcnt_vec = &ctx->opcnt_data->opcode_vec;
while (opcode >= opcnt_vec->size) {
WabtIntCounter Counter;
@@ -78,22 +78,23 @@ static WabtResult on_opcode(WabtBinaryReaderContext* context,
}
static WabtResult on_i32_const_expr(uint32_t value, void* user_data) {
- Context* ctx = (Context*)user_data;
- return add_int_counter_value(&ctx->opcnt_data->i32_const_vec, (int32_t)value);
+ Context* ctx = static_cast<Context*>(user_data);
+ return add_int_counter_value(&ctx->opcnt_data->i32_const_vec,
+ static_cast<int32_t>(value));
}
static WabtResult on_get_local_expr(uint32_t local_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
return add_int_counter_value(&ctx->opcnt_data->get_local_vec, local_index);
}
static WabtResult on_set_local_expr(uint32_t local_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
return add_int_counter_value(&ctx->opcnt_data->set_local_vec, local_index);
}
static WabtResult on_tee_local_expr(uint32_t local_index, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
return add_int_counter_value(&ctx->opcnt_data->tee_local_vec, local_index);
}
@@ -101,7 +102,7 @@ static WabtResult on_load_expr(WabtOpcode opcode,
uint32_t alignment_log2,
uint32_t offset,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (opcode == WABT_OPCODE_I32_LOAD)
return add_int_pair_counter_value(&ctx->opcnt_data->i32_load_vec,
alignment_log2, offset);
@@ -112,7 +113,7 @@ static WabtResult on_store_expr(WabtOpcode opcode,
uint32_t alignment_log2,
uint32_t offset,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
if (opcode == WABT_OPCODE_I32_STORE)
return add_int_pair_counter_value(&ctx->opcnt_data->i32_store_vec,
alignment_log2, offset);
diff --git a/src/binary-reader.cc b/src/binary-reader.cc
index 45f1a4ee..d937a6c4 100644
--- a/src/binary-reader.cc
+++ b/src/binary-reader.cc
@@ -181,7 +181,7 @@ static void in_f64(Context* ctx, uint64_t* out_value, const char* desc) {
#undef IN_SIZE
-#define BYTE_AT(type, i, shift) (((type)p[i] & 0x7f) << (shift))
+#define BYTE_AT(type, i, shift) ((static_cast<type>(p[i]) & 0x7f) << (shift))
#define LEB128_1(type) (BYTE_AT(type, 0, 0))
#define LEB128_2(type) (BYTE_AT(type, 1, 7) | LEB128_1(type))
@@ -195,8 +195,8 @@ static void in_f64(Context* ctx, uint64_t* out_value, const char* desc) {
#define LEB128_10(type) (BYTE_AT(type, 9, 63) | LEB128_9(type))
#define SHIFT_AMOUNT(type, sign_bit) (sizeof(type) * 8 - 1 - (sign_bit))
-#define SIGN_EXTEND(type, value, sign_bit) \
- ((type)((value) << SHIFT_AMOUNT(type, sign_bit)) >> \
+#define SIGN_EXTEND(type, value, sign_bit) \
+ (static_cast<type>((value) << SHIFT_AMOUNT(type, sign_bit)) >> \
SHIFT_AMOUNT(type, sign_bit))
size_t wabt_read_u32_leb128(const uint8_t* p,
@@ -356,9 +356,9 @@ static void in_type(Context* ctx, WabtType* out_value, const char* desc) {
uint32_t type = 0;
in_i32_leb128(ctx, &type, desc);
/* Must be in the vs7 range: [-128, 127). */
- if ((int32_t)type < -128 || (int32_t)type > 127)
+ if (static_cast<int32_t>(type) < -128 || static_cast<int32_t>(type) > 127)
RAISE_ERROR("invalid type: %d", type);
- *out_value = (WabtType)type;
+ *out_value = static_cast<WabtType>(type);
}
static void in_str(Context* ctx, WabtStringSlice* out_str, const char* desc) {
@@ -368,7 +368,7 @@ static void in_str(Context* ctx, WabtStringSlice* out_str, const char* desc) {
if (ctx->offset + str_len > ctx->read_end)
RAISE_ERROR("unable to read string: %s", desc);
- out_str->start = (const char*)ctx->data + ctx->offset;
+ out_str->start = reinterpret_cast<const char*>(ctx->data) + ctx->offset;
out_str->length = str_len;
ctx->offset += str_len;
}
@@ -383,7 +383,7 @@ static void in_bytes(Context* ctx,
if (ctx->offset + data_size > ctx->read_end)
RAISE_ERROR("unable to read data: %s", desc);
- *out_data = (const uint8_t*)ctx->data + ctx->offset;
+ *out_data = static_cast<const uint8_t*>(ctx->data) + ctx->offset;
*out_data_size = data_size;
ctx->offset += data_size;
}
@@ -466,7 +466,7 @@ static void write_indent(LoggingContext* ctx) {
static void logging_on_error(WabtBinaryReaderContext* ctx,
const char* message) {
- LoggingContext* logging_ctx = (LoggingContext*)ctx->user_data;
+ LoggingContext* logging_ctx = static_cast<LoggingContext*>(ctx->user_data);
if (logging_ctx->reader->on_error) {
WabtBinaryReaderContext new_ctx = *ctx;
new_ctx.user_data = logging_ctx->reader->user_data;
@@ -477,48 +477,48 @@ static void logging_on_error(WabtBinaryReaderContext* ctx,
static WabtResult logging_begin_custom_section(WabtBinaryReaderContext* context,
uint32_t size,
WabtStringSlice section_name) {
- LoggingContext* ctx = (LoggingContext*)context->user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(context->user_data);
LOGF("begin_custom_section: '" PRIstringslice "' size=%d\n",
WABT_PRINTF_STRING_SLICE_ARG(section_name), size);
indent(ctx);
FORWARD_CTX(begin_custom_section, size, section_name);
}
-#define LOGGING_BEGIN(name) \
- static WabtResult logging_begin_##name(WabtBinaryReaderContext* context, \
- uint32_t size) { \
- LoggingContext* ctx = (LoggingContext*)context->user_data; \
- LOGF("begin_" #name "\n"); \
- indent(ctx); \
- FORWARD_CTX(begin_##name, size); \
+#define LOGGING_BEGIN(name) \
+ static WabtResult logging_begin_##name(WabtBinaryReaderContext* context, \
+ uint32_t size) { \
+ LoggingContext* ctx = static_cast<LoggingContext*>(context->user_data); \
+ LOGF("begin_" #name "\n"); \
+ indent(ctx); \
+ FORWARD_CTX(begin_##name, size); \
}
-#define LOGGING_END(name) \
- static WabtResult logging_end_##name(WabtBinaryReaderContext* context) { \
- LoggingContext* ctx = (LoggingContext*)context->user_data; \
- dedent(ctx); \
- LOGF("end_" #name "\n"); \
- FORWARD_CTX0(end_##name); \
+#define LOGGING_END(name) \
+ static WabtResult logging_end_##name(WabtBinaryReaderContext* context) { \
+ LoggingContext* ctx = static_cast<LoggingContext*>(context->user_data); \
+ dedent(ctx); \
+ LOGF("end_" #name "\n"); \
+ FORWARD_CTX0(end_##name); \
}
#define LOGGING_UINT32(name) \
static WabtResult logging_##name(uint32_t value, void* user_data) { \
- LoggingContext* ctx = (LoggingContext*)user_data; \
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data); \
LOGF(#name "(%u)\n", value); \
FORWARD(name, value); \
}
-#define LOGGING_UINT32_CTX(name) \
- static WabtResult logging_##name(WabtBinaryReaderContext* context, \
- uint32_t value) { \
- LoggingContext* ctx = (LoggingContext*)context->user_data; \
- LOGF(#name "(%u)\n", value); \
- FORWARD_CTX(name, value); \
+#define LOGGING_UINT32_CTX(name) \
+ static WabtResult logging_##name(WabtBinaryReaderContext* context, \
+ uint32_t value) { \
+ LoggingContext* ctx = static_cast<LoggingContext*>(context->user_data); \
+ LOGF(#name "(%u)\n", value); \
+ FORWARD_CTX(name, value); \
}
#define LOGGING_UINT32_DESC(name, desc) \
static WabtResult logging_##name(uint32_t value, void* user_data) { \
- LoggingContext* ctx = (LoggingContext*)user_data; \
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data); \
LOGF(#name "(" desc ": %u)\n", value); \
FORWARD(name, value); \
}
@@ -526,31 +526,31 @@ static WabtResult logging_begin_custom_section(WabtBinaryReaderContext* context,
#define LOGGING_UINT32_UINT32(name, desc0, desc1) \
static WabtResult logging_##name(uint32_t value0, uint32_t value1, \
void* user_data) { \
- LoggingContext* ctx = (LoggingContext*)user_data; \
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data); \
LOGF(#name "(" desc0 ": %u, " desc1 ": %u)\n", value0, value1); \
FORWARD(name, value0, value1); \
}
-#define LOGGING_UINT32_UINT32_CTX(name, desc0, desc1) \
- static WabtResult logging_##name(WabtBinaryReaderContext* context, \
- uint32_t value0, uint32_t value1) { \
- LoggingContext* ctx = (LoggingContext*)context->user_data; \
- LOGF(#name "(" desc0 ": %u, " desc1 ": %u)\n", value0, value1); \
- FORWARD_CTX(name, value0, value1); \
+#define LOGGING_UINT32_UINT32_CTX(name, desc0, desc1) \
+ static WabtResult logging_##name(WabtBinaryReaderContext* context, \
+ uint32_t value0, uint32_t value1) { \
+ LoggingContext* ctx = static_cast<LoggingContext*>(context->user_data); \
+ LOGF(#name "(" desc0 ": %u, " desc1 ": %u)\n", value0, value1); \
+ FORWARD_CTX(name, value0, value1); \
}
#define LOGGING_OPCODE(name) \
static WabtResult logging_##name(WabtOpcode opcode, void* user_data) { \
- LoggingContext* ctx = (LoggingContext*)user_data; \
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data); \
LOGF(#name "(\"%s\" (%u))\n", wabt_get_opcode_name(opcode), opcode); \
FORWARD(name, opcode); \
}
-#define LOGGING0(name) \
- static WabtResult logging_##name(void* user_data) { \
- LoggingContext* ctx = (LoggingContext*)user_data; \
- LOGF(#name "\n"); \
- FORWARD0(name); \
+#define LOGGING0(name) \
+ static WabtResult logging_##name(void* user_data) { \
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data); \
+ LOGF(#name "\n"); \
+ FORWARD0(name); \
}
LOGGING_UINT32(begin_module)
@@ -646,7 +646,7 @@ static void sprint_limits(char* dst, size_t size, const WabtLimits* limits) {
result = wabt_snprintf(dst, size, "initial: %" PRIu64, limits->initial);
}
WABT_USE(result);
- assert((size_t)result < size);
+ assert(static_cast<size_t>(result) < size);
}
static void log_types(LoggingContext* ctx,
@@ -668,7 +668,7 @@ static WabtResult logging_on_signature(uint32_t index,
uint32_t result_count,
WabtType* result_types,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_signature(index: %u, params: ", index);
log_types(ctx, param_count, param_types);
LOGF_NOINDENT(", results: ");
@@ -682,7 +682,7 @@ static WabtResult logging_on_import(uint32_t index,
WabtStringSlice module_name,
WabtStringSlice field_name,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_import(index: %u, module: \"" PRIstringslice
"\", field: \"" PRIstringslice "\")\n",
index, WABT_PRINTF_STRING_SLICE_ARG(module_name),
@@ -694,7 +694,7 @@ static WabtResult logging_on_import_func(uint32_t import_index,
uint32_t func_index,
uint32_t sig_index,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_import_func(import_index: %u, func_index: %u, sig_index: %u)\n",
import_index, func_index, sig_index);
FORWARD(on_import_func, import_index, func_index, sig_index);
@@ -706,7 +706,7 @@ static WabtResult logging_on_import_table(uint32_t import_index,
WabtType elem_type,
const WabtLimits* elem_limits,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
char buf[100];
sprint_limits(buf, sizeof(buf), elem_limits);
LOGF(
@@ -719,7 +719,7 @@ static WabtResult logging_on_import_memory(uint32_t import_index,
uint32_t memory_index,
const WabtLimits* page_limits,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
char buf[100];
sprint_limits(buf, sizeof(buf), page_limits);
LOGF("on_import_memory(import_index: %u, memory_index: %u, %s)\n",
@@ -732,7 +732,7 @@ static WabtResult logging_on_import_global(uint32_t import_index,
WabtType type,
bool mutable_,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF(
"on_import_global(import_index: %u, global_index: %u, type: %s, mutable: "
"%s)\n",
@@ -745,7 +745,7 @@ static WabtResult logging_on_table(uint32_t index,
WabtType elem_type,
const WabtLimits* elem_limits,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
char buf[100];
sprint_limits(buf, sizeof(buf), elem_limits);
LOGF("on_table(index: %u, elem_type: %s, %s)\n", index,
@@ -756,7 +756,7 @@ static WabtResult logging_on_table(uint32_t index,
static WabtResult logging_on_memory(uint32_t index,
const WabtLimits* page_limits,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
char buf[100];
sprint_limits(buf, sizeof(buf), page_limits);
LOGF("on_memory(index: %u, %s)\n", index, buf);
@@ -767,7 +767,7 @@ static WabtResult logging_begin_global(uint32_t index,
WabtType type,
bool mutable_,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("begin_global(index: %u, type: %s, mutable: %s)\n", index,
wabt_get_type_name(type), mutable_ ? "true" : "false");
FORWARD(begin_global, index, type, mutable_);
@@ -778,7 +778,7 @@ static WabtResult logging_on_export(uint32_t index,
uint32_t item_index,
WabtStringSlice name,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_export(index: %u, kind: %s, item_index: %u, name: \"" PRIstringslice
"\")\n",
index, wabt_get_kind_name(kind), item_index,
@@ -789,7 +789,7 @@ static WabtResult logging_on_export(uint32_t index,
static WabtResult logging_begin_function_body_pass(uint32_t index,
uint32_t pass,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("begin_function_body_pass(index: %u, pass: %u)\n", index, pass);
indent(ctx);
FORWARD(begin_function_body_pass, index, pass);
@@ -799,7 +799,7 @@ static WabtResult logging_on_local_decl(uint32_t decl_index,
uint32_t count,
WabtType type,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_local_decl(index: %u, count: %u, type: %s)\n", decl_index, count,
wabt_get_type_name(type));
FORWARD(on_local_decl, decl_index, count, type);
@@ -808,7 +808,7 @@ static WabtResult logging_on_local_decl(uint32_t decl_index,
static WabtResult logging_on_block_expr(uint32_t num_types,
WabtType* sig_types,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_block_expr(sig: ");
log_types(ctx, num_types, sig_types);
LOGF_NOINDENT(")\n");
@@ -816,13 +816,13 @@ static WabtResult logging_on_block_expr(uint32_t num_types,
}
static WabtResult logging_on_br_expr(uint32_t depth, void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_br_expr(depth: %u)\n", depth);
FORWARD(on_br_expr, depth);
}
static WabtResult logging_on_br_if_expr(uint32_t depth, void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_br_if_expr(depth: %u)\n", depth);
FORWARD(on_br_if_expr, depth);
}
@@ -831,7 +831,7 @@ static WabtResult logging_on_br_table_expr(WabtBinaryReaderContext* context,
uint32_t num_targets,
uint32_t* target_depths,
uint32_t default_target_depth) {
- LoggingContext* ctx = (LoggingContext*)context->user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(context->user_data);
LOGF("on_br_table_expr(num_targets: %u, depths: [", num_targets);
uint32_t i;
for (i = 0; i < num_targets; ++i) {
@@ -846,7 +846,7 @@ static WabtResult logging_on_br_table_expr(WabtBinaryReaderContext* context,
static WabtResult logging_on_f32_const_expr(uint32_t value_bits,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
float value;
memcpy(&value, &value_bits, sizeof(value));
LOGF("on_f32_const_expr(%g (0x04%x))\n", value, value_bits);
@@ -855,7 +855,7 @@ static WabtResult logging_on_f32_const_expr(uint32_t value_bits,
static WabtResult logging_on_f64_const_expr(uint64_t value_bits,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
double value;
memcpy(&value, &value_bits, sizeof(value));
LOGF("on_f64_const_expr(%g (0x08%" PRIx64 "))\n", value, value_bits);
@@ -863,13 +863,13 @@ static WabtResult logging_on_f64_const_expr(uint64_t value_bits,
}
static WabtResult logging_on_i32_const_expr(uint32_t value, void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_i32_const_expr(%u (0x%x))\n", value, value);
FORWARD(on_i32_const_expr, value);
}
static WabtResult logging_on_i64_const_expr(uint64_t value, void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_i64_const_expr(%" PRIu64 " (0x%" PRIx64 "))\n", value, value);
FORWARD(on_i64_const_expr, value);
}
@@ -877,7 +877,7 @@ static WabtResult logging_on_i64_const_expr(uint64_t value, void* user_data) {
static WabtResult logging_on_if_expr(uint32_t num_types,
WabtType* sig_types,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_if_expr(sig: ");
log_types(ctx, num_types, sig_types);
LOGF_NOINDENT(")\n");
@@ -888,7 +888,7 @@ static WabtResult logging_on_load_expr(WabtOpcode opcode,
uint32_t alignment_log2,
uint32_t offset,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_load_expr(opcode: \"%s\" (%u), align log2: %u, offset: %u)\n",
wabt_get_opcode_name(opcode), opcode, alignment_log2, offset);
FORWARD(on_load_expr, opcode, alignment_log2, offset);
@@ -897,7 +897,7 @@ static WabtResult logging_on_load_expr(WabtOpcode opcode,
static WabtResult logging_on_loop_expr(uint32_t num_types,
WabtType* sig_types,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_loop_expr(sig: ");
log_types(ctx, num_types, sig_types);
LOGF_NOINDENT(")\n");
@@ -908,7 +908,7 @@ static WabtResult logging_on_store_expr(WabtOpcode opcode,
uint32_t alignment_log2,
uint32_t offset,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_store_expr(opcode: \"%s\" (%u), align log2: %u, offset: %u)\n",
wabt_get_opcode_name(opcode), opcode, alignment_log2, offset);
FORWARD(on_store_expr, opcode, alignment_log2, offset);
@@ -917,7 +917,7 @@ static WabtResult logging_on_store_expr(WabtOpcode opcode,
static WabtResult logging_end_function_body_pass(uint32_t index,
uint32_t pass,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
dedent(ctx);
LOGF("end_function_body_pass(index: %u, pass: %u)\n", index, pass);
FORWARD(end_function_body_pass, index, pass);
@@ -927,7 +927,7 @@ static WabtResult logging_on_data_segment_data(uint32_t index,
const void* data,
uint32_t size,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_data_segment_data(index:%u, size:%u)\n", index, size);
FORWARD(on_data_segment_data, index, data, size);
}
@@ -935,7 +935,7 @@ static WabtResult logging_on_data_segment_data(uint32_t index,
static WabtResult logging_on_function_name(uint32_t index,
WabtStringSlice name,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_function_name(index: %u, name: \"" PRIstringslice "\")\n", index,
WABT_PRINTF_STRING_SLICE_ARG(name));
FORWARD(on_function_name, index, name);
@@ -945,7 +945,7 @@ static WabtResult logging_on_local_name(uint32_t func_index,
uint32_t local_index,
WabtStringSlice name,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_local_name(func_index: %u, local_index: %u, name: \"" PRIstringslice
"\")\n",
func_index, local_index, WABT_PRINTF_STRING_SLICE_ARG(name));
@@ -955,7 +955,7 @@ static WabtResult logging_on_local_name(uint32_t func_index,
static WabtResult logging_on_init_expr_f32_const_expr(uint32_t index,
uint32_t value_bits,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
float value;
memcpy(&value, &value_bits, sizeof(value));
LOGF("on_init_expr_f32_const_expr(index: %u, value: %g (0x04%x))\n", index,
@@ -966,7 +966,7 @@ static WabtResult logging_on_init_expr_f32_const_expr(uint32_t index,
static WabtResult logging_on_init_expr_f64_const_expr(uint32_t index,
uint64_t value_bits,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
double value;
memcpy(&value, &value_bits, sizeof(value));
LOGF("on_init_expr_f64_const_expr(index: %u value: %g (0x08%" PRIx64 "))\n",
@@ -977,7 +977,7 @@ static WabtResult logging_on_init_expr_f64_const_expr(uint32_t index,
static WabtResult logging_on_init_expr_i32_const_expr(uint32_t index,
uint32_t value,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_init_expr_i32_const_expr(index: %u, value: %u)\n", index, value);
FORWARD(on_init_expr_i32_const_expr, index, value);
}
@@ -985,7 +985,7 @@ static WabtResult logging_on_init_expr_i32_const_expr(uint32_t index,
static WabtResult logging_on_init_expr_i64_const_expr(uint32_t index,
uint64_t value,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_init_expr_i64_const_expr(index: %u, value: %" PRIu64 ")\n", index,
value);
FORWARD(on_init_expr_i64_const_expr, index, value);
@@ -995,7 +995,7 @@ static WabtResult logging_on_reloc_count(uint32_t count,
WabtBinarySection section_code,
WabtStringSlice section_name,
void* user_data) {
- LoggingContext* ctx = (LoggingContext*)user_data;
+ LoggingContext* ctx = static_cast<LoggingContext*>(user_data);
LOGF("on_reloc_count(count: %d, section: %s, section_name: " PRIstringslice
")\n",
count, wabt_get_section_name(section_code),
@@ -1121,7 +1121,7 @@ static void read_function_body(Context* ctx, uint32_t end_offset) {
while (ctx->offset < end_offset) {
uint8_t opcode_u8;
in_u8(ctx, &opcode_u8, "opcode");
- WabtOpcode opcode = (WabtOpcode)opcode_u8;
+ WabtOpcode opcode = static_cast<WabtOpcode>(opcode_u8);
CALLBACK_CTX(on_opcode, opcode);
switch (opcode) {
case WABT_OPCODE_UNREACHABLE:
@@ -1579,13 +1579,13 @@ static void read_custom_section(Context* ctx, uint32_t section_size) {
if (section == WABT_BINARY_SECTION_CUSTOM)
in_str(ctx, &section_name, "section name");
in_u32_leb128(ctx, &num_relocs, "relocation count");
- CALLBACK(on_reloc_count, num_relocs, (WabtBinarySection)section,
- section_name);
+ CALLBACK(on_reloc_count, num_relocs,
+ static_cast<WabtBinarySection>(section), section_name);
for (i = 0; i < num_relocs; ++i) {
uint32_t reloc_type, offset;
in_u32_leb128(ctx, &reloc_type, "relocation type");
in_u32_leb128(ctx, &offset, "offset");
- CALLBACK(on_reloc, (WabtRelocType)reloc_type, offset);
+ CALLBACK(on_reloc, static_cast<WabtRelocType>(reloc_type), offset);
}
CALLBACK_CTX0(end_reloc_section);
} else {
@@ -1802,7 +1802,8 @@ static void read_export_section(Context* ctx, uint32_t section_size) {
break;
}
- CALLBACK(on_export, i, (WabtExternalKind)external_kind, item_index, name);
+ CALLBACK(on_export, i, static_cast<WabtExternalKind>(external_kind),
+ item_index, name);
}
CALLBACK_CTX0(end_export_section);
}
@@ -1923,7 +1924,7 @@ static void read_sections(Context* ctx) {
WABT_NUM_BINARY_SECTIONS - 1);
}
- WabtBinarySection section = (WabtBinarySection)section_code;
+ WabtBinarySection section = static_cast<WabtBinarySection>(section_code);
if (ctx->read_end > ctx->data_size)
RAISE_ERROR("invalid section size: extends past end");
@@ -2127,7 +2128,7 @@ WabtResult wabt_read_binary(const void* data,
WABT_ZERO_MEMORY(context);
/* all the macros assume a Context* named ctx */
Context* ctx = &context;
- ctx->data = (const uint8_t*)data;
+ ctx->data = static_cast<const uint8_t*>(data);
ctx->data_size = ctx->read_end = size;
ctx->reader = options->log_stream ? &logging_reader : reader;
ctx->options = options;
diff --git a/src/binary-writer-spec.cc b/src/binary-writer-spec.cc
index c6b91e10..d3696d97 100644
--- a/src/binary-writer-spec.cc
+++ b/src/binary-writer-spec.cc
@@ -96,7 +96,7 @@ static WabtStringSlice get_basename(const char* s) {
static char* get_module_filename(Context* ctx) {
size_t buflen = ctx->module_filename_noext.length + 20;
- char* str = (char*)wabt_alloc(buflen);
+ char* str = static_cast<char*>(wabt_alloc(buflen));
size_t length =
wabt_snprintf(str, buflen, PRIstringslice ".%" PRIzd ".wasm",
WABT_PRINTF_STRING_SLICE_ARG(ctx->module_filename_noext),
@@ -377,7 +377,7 @@ static void write_commands(Context* ctx, WabtScript* script) {
write_module(ctx, filename, module);
wabt_free(filename);
ctx->num_modules++;
- last_module_index = (int)i;
+ last_module_index = static_cast<int>(i);
break;
}
diff --git a/src/binary-writer.cc b/src/binary-writer.cc
index a0dbb5cc..2117c8e5 100644
--- a/src/binary-writer.cc
+++ b/src/binary-writer.cc
@@ -410,13 +410,14 @@ static void write_expr(Context* ctx,
switch (expr->const_.type) {
case WABT_TYPE_I32: {
wabt_write_opcode(&ctx->stream, WABT_OPCODE_I32_CONST);
- wabt_write_i32_leb128(&ctx->stream, (int32_t)expr->const_.u32,
+ wabt_write_i32_leb128(&ctx->stream,
+ static_cast<int32_t>(expr->const_.u32),
"i32 literal");
break;
}
case WABT_TYPE_I64:
wabt_write_opcode(&ctx->stream, WABT_OPCODE_I64_CONST);
- write_i64_leb128(&ctx->stream, (int64_t)expr->const_.u64,
+ write_i64_leb128(&ctx->stream, static_cast<int64_t>(expr->const_.u64),
"i64 literal");
break;
case WABT_TYPE_F32:
@@ -473,7 +474,8 @@ static void write_expr(Context* ctx,
uint32_t align =
wabt_get_opcode_alignment(expr->load.opcode, expr->load.align);
wabt_write_u8(&ctx->stream, log2_u32(align), "alignment");
- wabt_write_u32_leb128(&ctx->stream, (uint32_t)expr->load.offset,
+ wabt_write_u32_leb128(&ctx->stream,
+ static_cast<uint32_t>(expr->load.offset),
"load offset");
break;
}
@@ -510,7 +512,8 @@ static void write_expr(Context* ctx,
uint32_t align =
wabt_get_opcode_alignment(expr->store.opcode, expr->store.align);
wabt_write_u8(&ctx->stream, log2_u32(align), "alignment");
- wabt_write_u32_leb128(&ctx->stream, (uint32_t)expr->store.offset,
+ wabt_write_u32_leb128(&ctx->stream,
+ static_cast<uint32_t>(expr->store.offset),
"store offset");
break;
}
diff --git a/src/binding-hash.cc b/src/binding-hash.cc
index a7230e93..6e743ad4 100644
--- a/src/binding-hash.cc
+++ b/src/binding-hash.cc
@@ -21,11 +21,11 @@
static size_t hash_name(const WabtStringSlice* name) {
// FNV-1a hash
const uint32_t fnv_prime = 0x01000193;
- const uint8_t* bp = (const uint8_t*)name->start;
+ const uint8_t* bp = reinterpret_cast<const uint8_t*>(name->start);
const uint8_t* be = bp + name->length;
uint32_t hval = 0x811c9dc5;
while (bp < be) {
- hval ^= (uint32_t)*bp++;
+ hval ^= static_cast<uint32_t>(*bp++);
hval *= fnv_prime;
}
return hval;
diff --git a/src/common.cc b/src/common.cc
index cdc40376..f2ab97d7 100644
--- a/src/common.cc
+++ b/src/common.cc
@@ -112,7 +112,7 @@ bool wabt_string_slices_are_equal(const WabtStringSlice* a,
void wabt_destroy_string_slice(WabtStringSlice* str) {
assert(str);
- wabt_free((void*)str->start);
+ wabt_free(const_cast<void*>(static_cast<const void*>(str->start)));
}
WabtResult wabt_read_file(const char* filename,
@@ -157,14 +157,15 @@ static void print_carets(FILE* out,
size_t num_carets,
size_t max_line) {
/* print the caret */
- char* carets = (char*)alloca(max_line);
+ char* carets = static_cast<char*>(alloca(max_line));
memset(carets, '^', max_line);
if (num_carets > max_line - num_spaces)
num_carets = max_line - num_spaces;
/* always print at least one caret */
if (num_carets == 0)
num_carets = 1;
- fprintf(out, "%*s%.*s\n", (int)num_spaces, "", (int)num_carets, carets);
+ fprintf(out, "%*s%.*s\n", static_cast<int>(num_spaces), "",
+ static_cast<int>(num_carets), carets);
}
static void print_source_error(FILE* out,
@@ -213,7 +214,8 @@ void wabt_default_source_error_callback(const WabtLocation* loc,
size_t source_line_length,
size_t source_line_column_offset,
void* user_data) {
- WabtDefaultErrorHandlerInfo* info = (WabtDefaultErrorHandlerInfo*)user_data;
+ WabtDefaultErrorHandlerInfo* info =
+ static_cast<WabtDefaultErrorHandlerInfo*>(user_data);
FILE* out = get_default_error_handler_info_output_file(info);
print_error_header(out, info);
print_source_error(out, loc, error, source_line, source_line_length,
@@ -223,7 +225,8 @@ void wabt_default_source_error_callback(const WabtLocation* loc,
void wabt_default_binary_error_callback(uint32_t offset,
const char* error,
void* user_data) {
- WabtDefaultErrorHandlerInfo* info = (WabtDefaultErrorHandlerInfo*)user_data;
+ WabtDefaultErrorHandlerInfo* info =
+ static_cast<WabtDefaultErrorHandlerInfo*>(user_data);
FILE* out = get_default_error_handler_info_output_file(info);
print_error_header(out, info);
if (offset == WABT_UNKNOWN_OFFSET)
diff --git a/src/common.h b/src/common.h
index e3d7c000..a0eee458 100644
--- a/src/common.h
+++ b/src/common.h
@@ -39,10 +39,10 @@
#define WABT_FATAL(...) fprintf(stderr, __VA_ARGS__), exit(1)
#define WABT_ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-#define WABT_ZERO_MEMORY(var) memset((void*)&(var), 0, sizeof(var))
-#define WABT_USE(x) (void)x
+#define WABT_ZERO_MEMORY(var) memset(static_cast<void*>(&(var)), 0, sizeof(var))
+#define WABT_USE(x) static_cast<void>(x)
-#define WABT_UNKNOWN_OFFSET ((uint32_t)~0)
+#define WABT_UNKNOWN_OFFSET (static_cast<uint32_t>(~0))
#define WABT_PAGE_SIZE 0x10000 /* 64k */
#define WABT_MAX_PAGES 0x10000 /* # of pages that fit in 32-bit address space */
#define WABT_BYTES_TO_PAGES(x) ((x) >> 16)
@@ -50,7 +50,7 @@
(((x) + WABT_PAGE_SIZE - 1) & ~(WABT_PAGE_SIZE - 1))
#define PRIstringslice "%.*s"
-#define WABT_PRINTF_STRING_SLICE_ARG(x) (int)((x).length), (x).start
+#define WABT_PRINTF_STRING_SLICE_ARG(x) static_cast<int>((x).length), (x).start
#define WABT_DEFAULT_SNPRINTF_ALLOCA_BUFSIZE 128
#define WABT_SNPRINTF_ALLOCA(buffer, len, format) \
@@ -63,7 +63,7 @@
size_t len = wabt_vsnprintf(fixed_buf, sizeof(fixed_buf), format, args); \
va_end(args); \
if (len + 1 > sizeof(fixed_buf)) { \
- buffer = (char*)alloca(len + 1); \
+ buffer = static_cast<char*>(alloca(len + 1)); \
len = wabt_vsnprintf(buffer, len + 1, format, args_copy); \
} \
va_end(args_copy)
@@ -425,7 +425,7 @@ static WABT_INLINE char* wabt_strndup(const char* s, size_t len) {
real_len++;
}
- char* new_s = (char*)wabt_alloc(real_len + 1);
+ char* new_s = static_cast<char*>(wabt_alloc(real_len + 1));
memcpy(new_s, s, real_len);
new_s[real_len] = 0;
return new_s;
diff --git a/src/generate-names.cc b/src/generate-names.cc
index 2604adb1..e19bcfd4 100644
--- a/src/generate-names.cc
+++ b/src/generate-names.cc
@@ -43,7 +43,7 @@ static void generate_name(const char* prefix,
WabtStringSlice* str) {
size_t prefix_len = strlen(prefix);
size_t buffer_len = prefix_len + 20; /* add space for the number */
- char* buffer = (char*)alloca(buffer_len);
+ char* buffer = static_cast<char*>(alloca(buffer_len));
int actual_len = wabt_snprintf(buffer, buffer_len, "%s%u", prefix, index);
WabtStringSlice buf;
@@ -93,19 +93,19 @@ static void generate_and_bind_local_names(WabtStringSliceVector* index_to_name,
}
static WabtResult begin_block_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
maybe_generate_name("$B", ctx->label_count++, &expr->block.label);
return WABT_OK;
}
static WabtResult begin_loop_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
maybe_generate_name("$L", ctx->label_count++, &expr->loop.label);
return WABT_OK;
}
static WabtResult begin_if_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
maybe_generate_name("$L", ctx->label_count++, &expr->if_.true_.label);
return WABT_OK;
}
diff --git a/src/interpreter.cc b/src/interpreter.cc
index d539bff3..ac246a5d 100644
--- a/src/interpreter.cc
+++ b/src/interpreter.cc
@@ -149,7 +149,7 @@ void wabt_reset_interpreter_environment_to_mark(
WabtBindingHashEntry* entry =
&env->registered_module_bindings.entries.data[i];
if (!wabt_hash_entry_is_free(entry) &&
- entry->binding.index >= (int)mark.modules_size) {
+ entry->binding.index >= static_cast<int>(mark.modules_size)) {
wabt_remove_binding(&env->registered_module_bindings,
&entry->binding.name);
}
@@ -211,7 +211,7 @@ WabtInterpreterExport* wabt_get_interpreter_export_by_name(
wabt_find_binding_index_by_name(&module->export_bindings, name);
if (field_index < 0)
return nullptr;
- assert((size_t)field_index < module->exports.size);
+ assert(static_cast<size_t>(field_index) < module->exports.size);
return &module->exports.data[field_index];
}
@@ -389,18 +389,18 @@ DEFINE_BITCAST(bitcast_u32_to_f32, uint32_t, float)
DEFINE_BITCAST(bitcast_f64_to_u64, double, uint64_t)
DEFINE_BITCAST(bitcast_u64_to_f64, uint64_t, double)
-#define bitcast_i32_to_u32(x) ((uint32_t)x)
-#define bitcast_i64_to_u64(x) ((uint64_t)x)
+#define bitcast_i32_to_u32(x) (static_cast<uint32_t>(x))
+#define bitcast_i64_to_u64(x) (static_cast<uint64_t>(x))
#define VALUE_TYPE_I32 uint32_t
#define VALUE_TYPE_I64 uint64_t
#define VALUE_TYPE_F32 uint32_t
#define VALUE_TYPE_F64 uint64_t
-#define VALUE_TYPE_SIGNED_MAX_I32 (uint32_t)(0x80000000U)
-#define VALUE_TYPE_UNSIGNED_MAX_I32 (uint32_t)(0xFFFFFFFFU)
-#define VALUE_TYPE_SIGNED_MAX_I64 (uint64_t)(0x8000000000000000ULL)
-#define VALUE_TYPE_UNSIGNED_MAX_I64 (uint64_t)(0xFFFFFFFFFFFFFFFFULL)
+#define VALUE_TYPE_SIGNED_MAX_I32 (0x80000000U)
+#define VALUE_TYPE_UNSIGNED_MAX_I32 (0xFFFFFFFFU)
+#define VALUE_TYPE_SIGNED_MAX_I64 static_cast<uint64_t>(0x8000000000000000ULL)
+#define VALUE_TYPE_UNSIGNED_MAX_I64 static_cast<uint64_t>(0xFFFFFFFFFFFFFFFFULL)
#define FLOAT_TYPE_F32 float
#define FLOAT_TYPE_F64 double
@@ -478,7 +478,7 @@ DEFINE_BITCAST(bitcast_u64_to_f64, uint64_t, double)
do { \
CHECK_STACK(); \
(*thread->value_stack_top++).TYPE_FIELD_NAME_##type = \
- (VALUE_TYPE_##type)(v); \
+ static_cast<VALUE_TYPE_##type>(v); \
} while (0)
#define PUSH_I32(v) PUSH_TYPE(I32, (v))
@@ -517,28 +517,32 @@ DEFINE_BITCAST(bitcast_u64_to_f64, uint64_t, double)
assert(memory_index < env->memories.size); \
WabtInterpreterMemory* var = &env->memories.data[memory_index]
-#define LOAD(type, mem_type) \
- do { \
- GET_MEMORY(memory); \
- uint64_t offset = (uint64_t)POP_I32() + read_u32(&pc); \
- MEM_TYPE_##mem_type value; \
- TRAP_IF(offset + sizeof(value) > memory->byte_size, \
- MEMORY_ACCESS_OUT_OF_BOUNDS); \
- void* src = (void*)((intptr_t)memory->data + (uint32_t)offset); \
- memcpy(&value, src, sizeof(MEM_TYPE_##mem_type)); \
- PUSH_##type((MEM_TYPE_EXTEND_##type##_##mem_type)value); \
+#define LOAD(type, mem_type) \
+ do { \
+ GET_MEMORY(memory); \
+ uint64_t offset = static_cast<uint64_t>(POP_I32()) + read_u32(&pc); \
+ MEM_TYPE_##mem_type value; \
+ TRAP_IF(offset + sizeof(value) > memory->byte_size, \
+ MEMORY_ACCESS_OUT_OF_BOUNDS); \
+ void* src = \
+ reinterpret_cast<void*>(reinterpret_cast<intptr_t>(memory->data) + \
+ static_cast<uint32_t>(offset)); \
+ memcpy(&value, src, sizeof(MEM_TYPE_##mem_type)); \
+ PUSH_##type(static_cast<MEM_TYPE_EXTEND_##type##_##mem_type>(value)); \
} while (0)
-#define STORE(type, mem_type) \
- do { \
- GET_MEMORY(memory); \
- VALUE_TYPE_##type value = POP_##type(); \
- uint64_t offset = (uint64_t)POP_I32() + read_u32(&pc); \
- MEM_TYPE_##mem_type src = (MEM_TYPE_##mem_type)value; \
- TRAP_IF(offset + sizeof(src) > memory->byte_size, \
- MEMORY_ACCESS_OUT_OF_BOUNDS); \
- void* dst = (void*)((intptr_t)memory->data + (uint32_t)offset); \
- memcpy(dst, &src, sizeof(MEM_TYPE_##mem_type)); \
+#define STORE(type, mem_type) \
+ do { \
+ GET_MEMORY(memory); \
+ VALUE_TYPE_##type value = POP_##type(); \
+ uint64_t offset = static_cast<uint64_t>(POP_I32()) + read_u32(&pc); \
+ MEM_TYPE_##mem_type src = static_cast<MEM_TYPE_##mem_type>(value); \
+ TRAP_IF(offset + sizeof(src) > memory->byte_size, \
+ MEMORY_ACCESS_OUT_OF_BOUNDS); \
+ void* dst = \
+ reinterpret_cast<void*>(reinterpret_cast<intptr_t>(memory->data) + \
+ static_cast<uint32_t>(offset)); \
+ memcpy(dst, &src, sizeof(MEM_TYPE_##mem_type)); \
} while (0)
#define BINOP(rtype, type, op) \
@@ -757,8 +761,8 @@ WabtInterpreterResult wabt_call_host(WabtInterpreterThread* thread,
uint32_t num_results = sig->result_types.size;
WabtInterpreterTypedValue* call_result_values =
- (WabtInterpreterTypedValue*)alloca(sizeof(WabtInterpreterTypedValue) *
- num_results);
+ static_cast<WabtInterpreterTypedValue*>(
+ alloca(sizeof(WabtInterpreterTypedValue) * num_results));
WabtResult call_result = func->host.callback(
func, sig, num_args, thread->host_args.data, num_results,
@@ -782,7 +786,7 @@ WabtInterpreterResult wabt_run_interpreter(WabtInterpreterThread* thread,
WabtInterpreterEnvironment* env = thread->env;
- const uint8_t* istream = (const uint8_t*)env->istream.start;
+ const uint8_t* istream = static_cast<const uint8_t*>(env->istream.start);
const uint8_t* pc = &istream[thread->pc];
uint32_t i;
for (i = 0; i < num_instructions; ++i) {
@@ -1027,13 +1031,14 @@ WabtInterpreterResult wabt_run_interpreter(WabtInterpreterThread* thread,
? memory->page_limits.max
: WABT_MAX_PAGES;
PUSH_NEG_1_AND_BREAK_IF(new_page_size > max_page_size);
- PUSH_NEG_1_AND_BREAK_IF((uint64_t)new_page_size * WABT_PAGE_SIZE >
- UINT32_MAX);
+ PUSH_NEG_1_AND_BREAK_IF(
+ static_cast<uint64_t>(new_page_size) * WABT_PAGE_SIZE > UINT32_MAX);
uint32_t new_byte_size = new_page_size * WABT_PAGE_SIZE;
void* new_data = wabt_realloc(memory->data, new_byte_size);
PUSH_NEG_1_AND_BREAK_IF(!new_data);
- memset((void*)((intptr_t)new_data + old_byte_size), 0,
- new_byte_size - old_byte_size);
+ memset(reinterpret_cast<void*>(reinterpret_cast<intptr_t>(new_data) +
+ old_byte_size),
+ 0, new_byte_size - old_byte_size);
memory->data = new_data;
memory->page_limits.initial = new_page_size;
memory->byte_size = new_byte_size;
@@ -1437,7 +1442,7 @@ WabtInterpreterResult wabt_run_interpreter(WabtInterpreterThread* thread,
VALUE_TYPE_F32 value = POP_F32();
TRAP_IF(wabt_is_nan_f32(value), INVALID_CONVERSION_TO_INTEGER);
TRAP_UNLESS(is_in_range_i32_trunc_s_f32(value), INTEGER_OVERFLOW);
- PUSH_I32((int32_t)BITCAST_TO_F32(value));
+ PUSH_I32(static_cast<int32_t>(BITCAST_TO_F32(value)));
break;
}
@@ -1445,7 +1450,7 @@ WabtInterpreterResult wabt_run_interpreter(WabtInterpreterThread* thread,
VALUE_TYPE_F64 value = POP_F64();
TRAP_IF(wabt_is_nan_f64(value), INVALID_CONVERSION_TO_INTEGER);
TRAP_UNLESS(is_in_range_i32_trunc_s_f64(value), INTEGER_OVERFLOW);
- PUSH_I32((int32_t)BITCAST_TO_F64(value));
+ PUSH_I32(static_cast<int32_t>(BITCAST_TO_F64(value)));
break;
}
@@ -1453,7 +1458,7 @@ WabtInterpreterResult wabt_run_interpreter(WabtInterpreterThread* thread,
VALUE_TYPE_F32 value = POP_F32();
TRAP_IF(wabt_is_nan_f32(value), INVALID_CONVERSION_TO_INTEGER);
TRAP_UNLESS(is_in_range_i32_trunc_u_f32(value), INTEGER_OVERFLOW);
- PUSH_I32((uint32_t)BITCAST_TO_F32(value));
+ PUSH_I32(static_cast<uint32_t>(BITCAST_TO_F32(value)));
break;
}
@@ -1461,13 +1466,13 @@ WabtInterpreterResult wabt_run_interpreter(WabtInterpreterThread* thread,
VALUE_TYPE_F64 value = POP_F64();
TRAP_IF(wabt_is_nan_f64(value), INVALID_CONVERSION_TO_INTEGER);
TRAP_UNLESS(is_in_range_i32_trunc_u_f64(value), INTEGER_OVERFLOW);
- PUSH_I32((uint32_t)BITCAST_TO_F64(value));
+ PUSH_I32(static_cast<uint32_t>(BITCAST_TO_F64(value)));
break;
}
case WABT_OPCODE_I32_WRAP_I64: {
VALUE_TYPE_I64 value = POP_I64();
- PUSH_I32((uint32_t)value);
+ PUSH_I32(static_cast<uint32_t>(value));
break;
}
@@ -1475,7 +1480,7 @@ WabtInterpreterResult wabt_run_interpreter(WabtInterpreterThread* thread,
VALUE_TYPE_F32 value = POP_F32();
TRAP_IF(wabt_is_nan_f32(value), INVALID_CONVERSION_TO_INTEGER);
TRAP_UNLESS(is_in_range_i64_trunc_s_f32(value), INTEGER_OVERFLOW);
- PUSH_I64((int64_t)BITCAST_TO_F32(value));
+ PUSH_I64(static_cast<int64_t>(BITCAST_TO_F32(value)));
break;
}
@@ -1483,7 +1488,7 @@ WabtInterpreterResult wabt_run_interpreter(WabtInterpreterThread* thread,
VALUE_TYPE_F64 value = POP_F64();
TRAP_IF(wabt_is_nan_f64(value), INVALID_CONVERSION_TO_INTEGER);
TRAP_UNLESS(is_in_range_i64_trunc_s_f64(value), INTEGER_OVERFLOW);
- PUSH_I64((int64_t)BITCAST_TO_F64(value));
+ PUSH_I64(static_cast<int64_t>(BITCAST_TO_F64(value)));
break;
}
@@ -1491,7 +1496,7 @@ WabtInterpreterResult wabt_run_interpreter(WabtInterpreterThread* thread,
VALUE_TYPE_F32 value = POP_F32();
TRAP_IF(wabt_is_nan_f32(value), INVALID_CONVERSION_TO_INTEGER);
TRAP_UNLESS(is_in_range_i64_trunc_u_f32(value), INTEGER_OVERFLOW);
- PUSH_I64((uint64_t)BITCAST_TO_F32(value));
+ PUSH_I64(static_cast<uint64_t>(BITCAST_TO_F32(value)));
break;
}
@@ -1499,50 +1504,52 @@ WabtInterpreterResult wabt_run_interpreter(WabtInterpreterThread* thread,
VALUE_TYPE_F64 value = POP_F64();
TRAP_IF(wabt_is_nan_f64(value), INVALID_CONVERSION_TO_INTEGER);
TRAP_UNLESS(is_in_range_i64_trunc_u_f64(value), INTEGER_OVERFLOW);
- PUSH_I64((uint64_t)BITCAST_TO_F64(value));
+ PUSH_I64(static_cast<uint64_t>(BITCAST_TO_F64(value)));
break;
}
case WABT_OPCODE_I64_EXTEND_S_I32: {
VALUE_TYPE_I32 value = POP_I32();
- PUSH_I64((int64_t)BITCAST_I32_TO_SIGNED(value));
+ PUSH_I64(static_cast<int64_t>(BITCAST_I32_TO_SIGNED(value)));
break;
}
case WABT_OPCODE_I64_EXTEND_U_I32: {
VALUE_TYPE_I32 value = POP_I32();
- PUSH_I64((uint64_t)value);
+ PUSH_I64(static_cast<uint64_t>(value));
break;
}
case WABT_OPCODE_F32_CONVERT_S_I32: {
VALUE_TYPE_I32 value = POP_I32();
- PUSH_F32(BITCAST_FROM_F32((float)BITCAST_I32_TO_SIGNED(value)));
+ PUSH_F32(
+ BITCAST_FROM_F32(static_cast<float>(BITCAST_I32_TO_SIGNED(value))));
break;
}
case WABT_OPCODE_F32_CONVERT_U_I32: {
VALUE_TYPE_I32 value = POP_I32();
- PUSH_F32(BITCAST_FROM_F32((float)value));
+ PUSH_F32(BITCAST_FROM_F32(static_cast<float>(value)));
break;
}
case WABT_OPCODE_F32_CONVERT_S_I64: {
VALUE_TYPE_I64 value = POP_I64();
- PUSH_F32(BITCAST_FROM_F32((float)BITCAST_I64_TO_SIGNED(value)));
+ PUSH_F32(
+ BITCAST_FROM_F32(static_cast<float>(BITCAST_I64_TO_SIGNED(value))));
break;
}
case WABT_OPCODE_F32_CONVERT_U_I64: {
VALUE_TYPE_I64 value = POP_I64();
- PUSH_F32(BITCAST_FROM_F32((float)value));
+ PUSH_F32(BITCAST_FROM_F32(static_cast<float>(value)));
break;
}
case WABT_OPCODE_F32_DEMOTE_F64: {
VALUE_TYPE_F64 value = POP_F64();
if (WABT_LIKELY(is_in_range_f64_demote_f32(value))) {
- PUSH_F32(BITCAST_FROM_F32((float)BITCAST_TO_F64(value)));
+ PUSH_F32(BITCAST_FROM_F32(static_cast<float>(BITCAST_TO_F64(value))));
} else if (is_in_range_f64_demote_f32_round_to_f32_max(value)) {
PUSH_F32(F32_MAX);
} else if (is_in_range_f64_demote_f32_round_to_neg_f32_max(value)) {
@@ -1567,31 +1574,33 @@ WabtInterpreterResult wabt_run_interpreter(WabtInterpreterThread* thread,
case WABT_OPCODE_F64_CONVERT_S_I32: {
VALUE_TYPE_I32 value = POP_I32();
- PUSH_F64(BITCAST_FROM_F64((double)BITCAST_I32_TO_SIGNED(value)));
+ PUSH_F64(BITCAST_FROM_F64(
+ static_cast<double>(BITCAST_I32_TO_SIGNED(value))));
break;
}
case WABT_OPCODE_F64_CONVERT_U_I32: {
VALUE_TYPE_I32 value = POP_I32();
- PUSH_F64(BITCAST_FROM_F64((double)value));
+ PUSH_F64(BITCAST_FROM_F64(static_cast<double>(value)));
break;
}
case WABT_OPCODE_F64_CONVERT_S_I64: {
VALUE_TYPE_I64 value = POP_I64();
- PUSH_F64(BITCAST_FROM_F64((double)BITCAST_I64_TO_SIGNED(value)));
+ PUSH_F64(BITCAST_FROM_F64(
+ static_cast<double>(BITCAST_I64_TO_SIGNED(value))));
break;
}
case WABT_OPCODE_F64_CONVERT_U_I64: {
VALUE_TYPE_I64 value = POP_I64();
- PUSH_F64(BITCAST_FROM_F64((double)value));
+ PUSH_F64(BITCAST_FROM_F64(static_cast<double>(value)));
break;
}
case WABT_OPCODE_F64_PROMOTE_F32: {
VALUE_TYPE_F32 value = POP_F32();
- PUSH_F64(BITCAST_FROM_F64((double)BITCAST_TO_F32(value)));
+ PUSH_F64(BITCAST_FROM_F64(static_cast<double>(BITCAST_TO_F32(value))));
break;
}
@@ -1683,13 +1692,15 @@ exit_loop:
}
void wabt_trace_pc(WabtInterpreterThread* thread, WabtStream* stream) {
- const uint8_t* istream = (const uint8_t*)thread->env->istream.start;
+ const uint8_t* istream =
+ static_cast<const uint8_t*>(thread->env->istream.start);
const uint8_t* pc = &istream[thread->pc];
size_t value_stack_depth = thread->value_stack_top - thread->value_stack.data;
size_t call_stack_depth = thread->call_stack_top - thread->call_stack.data;
wabt_writef(stream, "#%" PRIzd ". %4" PRIzd ": V:%-3" PRIzd "| ",
- call_stack_depth, pc - (uint8_t*)thread->env->istream.start,
+ call_stack_depth,
+ pc - static_cast<uint8_t*>(thread->env->istream.start),
value_stack_depth);
uint8_t opcode = *pc++;
@@ -2066,10 +2077,10 @@ void wabt_disassemble(WabtInterpreterEnvironment* env,
return;
if (to > env->istream.size)
to = env->istream.size;
- const uint8_t* istream = (const uint8_t*)env->istream.start;
+ const uint8_t* istream = static_cast<const uint8_t*>(env->istream.start);
const uint8_t* pc = &istream[from];
- while ((uint32_t)(pc - istream) < to) {
+ while (static_cast<uint32_t>(pc - istream) < to) {
wabt_writef(stream, "%4" PRIzd "| ", pc - istream);
uint8_t opcode = *pc++;
diff --git a/src/interpreter.h b/src/interpreter.h
index bad6f151..78a28312 100644
--- a/src/interpreter.h
+++ b/src/interpreter.h
@@ -70,8 +70,8 @@ enum WabtInterpreterResult {
#undef V
};
-#define WABT_INVALID_INDEX ((uint32_t)~0)
-#define WABT_INVALID_OFFSET ((uint32_t)~0)
+#define WABT_INVALID_INDEX static_cast<uint32_t>(~0)
+#define WABT_INVALID_OFFSET static_cast<uint32_t>(~0)
#define WABT_TABLE_ENTRY_SIZE (sizeof(uint32_t) * 2 + sizeof(uint8_t))
#define WABT_TABLE_ENTRY_OFFSET_OFFSET 0
#define WABT_TABLE_ENTRY_DROP_OFFSET sizeof(uint32_t)
diff --git a/src/literal.cc b/src/literal.cc
index 2801b042..bfd02de6 100644
--- a/src/literal.cc
+++ b/src/literal.cc
@@ -52,13 +52,13 @@
static const char s_hex_digits[] = "0123456789abcdef";
WabtResult wabt_parse_hexdigit(char c, uint32_t* out) {
- if ((unsigned int)(c - '0') <= 9) {
+ if (static_cast<unsigned int>(c - '0') <= 9) {
*out = c - '0';
return WABT_OK;
- } else if ((unsigned int)(c - 'a') <= 6) {
+ } else if (static_cast<unsigned int>(c - 'a') <= 6) {
*out = 10 + (c - 'a');
return WABT_OK;
- } else if ((unsigned int)(c - 'A') <= 6) {
+ } else if (static_cast<unsigned int>(c - 'A') <= 6) {
*out = 10 + (c - 'A');
return WABT_OK;
}
@@ -130,7 +130,8 @@ WabtResult wabt_parse_int64(const char* s,
uint64_t value = 0;
WabtResult result = wabt_parse_uint64(s, end, &value);
if (has_sign) {
- if (value > (uint64_t)INT64_MAX + 1) /* abs(INT64_MIN) == INT64_MAX + 1 */
+ /* abs(INT64_MIN) == INT64_MAX + 1 */
+ if (value > static_cast<uint64_t>(INT64_MAX) + 1)
return WABT_ERROR;
value = UINT64_MAX - value + 1;
}
@@ -155,14 +156,15 @@ WabtResult wabt_parse_int32(const char* s,
return WABT_ERROR;
if (has_sign) {
- if (value > (uint64_t)INT32_MAX + 1) /* abs(INT32_MIN) == INT32_MAX + 1 */
+ /* abs(INT32_MIN) == INT32_MAX + 1 */
+ if (value > static_cast<uint64_t>(INT32_MAX) + 1)
return WABT_ERROR;
value = UINT32_MAX - value + 1;
} else {
- if (value > (uint64_t)UINT32_MAX)
+ if (value > static_cast<uint64_t>(UINT32_MAX))
return WABT_ERROR;
}
- *out = (uint32_t)value;
+ *out = static_cast<uint32_t>(value);
return WABT_OK;
}
@@ -170,16 +172,16 @@ WabtResult wabt_parse_int32(const char* s,
static uint32_t make_float(bool sign, int exp, uint32_t sig) {
assert(exp >= F32_MIN_EXP && exp <= F32_MAX_EXP);
assert(sig <= F32_SIG_MASK);
- return ((uint32_t)sign << F32_SIGN_SHIFT) |
- ((uint32_t)(exp + F32_EXP_BIAS) << F32_SIG_BITS) | sig;
+ return (static_cast<uint32_t>(sign) << F32_SIGN_SHIFT) |
+ (static_cast<uint32_t>(exp + F32_EXP_BIAS) << F32_SIG_BITS) | sig;
}
static uint32_t shift_float_and_round_to_nearest(uint32_t significand,
int shift) {
assert(shift > 0);
/* round ties to even */
- if (significand & ((uint32_t)1 << shift))
- significand += (uint32_t)1 << (shift - 1);
+ if (significand & (1U << shift))
+ significand += 1U << (shift - 1);
significand >>= shift;
return significand;
}
@@ -506,16 +508,16 @@ void wabt_write_float_hex(char* out, size_t size, uint32_t bits) {
static uint64_t make_double(bool sign, int exp, uint64_t sig) {
assert(exp >= F64_MIN_EXP && exp <= F64_MAX_EXP);
assert(sig <= F64_SIG_MASK);
- return ((uint64_t)sign << F64_SIGN_SHIFT) |
- ((uint64_t)(exp + F64_EXP_BIAS) << F64_SIG_BITS) | sig;
+ return (static_cast<uint64_t>(sign) << F64_SIGN_SHIFT) |
+ (static_cast<uint64_t>(exp + F64_EXP_BIAS) << F64_SIG_BITS) | sig;
}
static uint64_t shift_double_and_round_to_nearest(uint64_t significand,
int shift) {
assert(shift > 0);
/* round ties to even */
- if (significand & ((uint64_t)1 << shift))
- significand += (uint64_t)1 << (shift - 1);
+ if (significand & (static_cast<uint64_t>(1) << shift))
+ significand += static_cast<uint64_t>(1) << (shift - 1);
significand >>= shift;
return significand;
}
diff --git a/src/option-parser.cc b/src/option-parser.cc
index 2afe1d59..db897860 100644
--- a/src/option-parser.cc
+++ b/src/option-parser.cc
@@ -191,7 +191,7 @@ void wabt_print_help(WabtOptionParser* parser, const char* program_name) {
}
size_t buffer_size = longest_name_length + 1;
- char* buffer = (char*)alloca(buffer_size);
+ char* buffer = static_cast<char*>(alloca(buffer_size));
for (i = 0; i < parser->num_options; ++i) {
WabtOption* option = &parser->options[i];
diff --git a/src/prebuilt/ast-lexer-gen.cc b/src/prebuilt/ast-lexer-gen.cc
index 6e8d9b5c..47c8c59a 100644
--- a/src/prebuilt/ast-lexer-gen.cc
+++ b/src/prebuilt/ast-lexer-gen.cc
@@ -100,7 +100,7 @@ static WabtResult fill(WabtLocation* loc,
if (lexer->eof)
return WABT_ERROR;
size_t free = lexer->token - lexer->buffer;
- assert((size_t)(lexer->cursor - lexer->buffer) >= free);
+ assert(static_cast<size_t>(lexer->cursor - lexer->buffer) >= free);
/* our buffer is too small, need to realloc */
if (free < need) {
char* old_buffer = lexer->buffer;
@@ -115,7 +115,8 @@ static WabtResult fill(WabtLocation* loc,
/* TODO(binji): could just alloc instead, because we know we'll need to
* memmove below */
- char* new_buffer = (char*)wabt_realloc(lexer->buffer, new_buffer_size);
+ char* new_buffer =
+ static_cast<char*>(wabt_realloc(lexer->buffer, new_buffer_size));
if (!new_buffer) {
wabt_ast_parser_error(loc, lexer, parser,
"unable to reallocate lexer buffer.");
@@ -150,7 +151,8 @@ static WabtResult fill(WabtLocation* loc,
size_t bytes_left = lexer->source.buffer.size - offset;
if (read_size > bytes_left)
read_size = bytes_left;
- memcpy(lexer->buffer, (char*)lexer->source.buffer.data + offset,
+ memcpy(lexer->buffer,
+ static_cast<const char*>(lexer->source.buffer.data) + offset,
read_size);
lexer->source.buffer.read_offset += read_size;
lexer->limit += read_size;
@@ -180,8 +182,8 @@ int wabt_ast_lexer_lex(WABT_AST_PARSER_STYPE* lval,
for (;;) {
lexer->token = lexer->cursor;
-
-#line 185 "src/prebuilt/ast-lexer-gen.cc"
+
+#line 187 "src/prebuilt/ast-lexer-gen.cc"
{
unsigned char yych;
if (cond < 2) {
@@ -220,32 +222,34 @@ YYCOND_BAD_TEXT:
}
}
++lexer->cursor;
-#line 233 "src/ast-lexer.cc"
+#line 237 "src/ast-lexer.cc"
{ ERROR("unexpected EOF"); RETURN(EOF); }
-#line 226 "src/prebuilt/ast-lexer-gen.cc"
+#line 228 "src/prebuilt/ast-lexer-gen.cc"
yy5:
++lexer->cursor;
yy6:
-#line 234 "src/ast-lexer.cc"
- { ERROR("illegal character in string"); continue; }
-#line 232 "src/prebuilt/ast-lexer-gen.cc"
+#line 238 "src/ast-lexer.cc"
+ { ERROR("illegal character in string");
+ continue; }
+#line 235 "src/prebuilt/ast-lexer-gen.cc"
yy7:
++lexer->cursor;
BEGIN(YYCOND_i);
-#line 229 "src/ast-lexer.cc"
- { ERROR("newline in string"); NEWLINE; continue; }
-#line 238 "src/prebuilt/ast-lexer-gen.cc"
+#line 231 "src/ast-lexer.cc"
+ { ERROR("newline in string"); NEWLINE; continue;
+ }
+#line 242 "src/prebuilt/ast-lexer-gen.cc"
yy9:
++lexer->cursor;
-#line 228 "src/ast-lexer.cc"
+#line 230 "src/ast-lexer.cc"
{ continue; }
-#line 243 "src/prebuilt/ast-lexer-gen.cc"
+#line 247 "src/prebuilt/ast-lexer-gen.cc"
yy11:
++lexer->cursor;
BEGIN(YYCOND_i);
-#line 232 "src/ast-lexer.cc"
+#line 236 "src/ast-lexer.cc"
{ TEXT; RETURN(TEXT); }
-#line 249 "src/prebuilt/ast-lexer-gen.cc"
+#line 253 "src/prebuilt/ast-lexer-gen.cc"
yy13:
yych = *++lexer->cursor;
if (yych <= '@') {
@@ -279,10 +283,11 @@ yy13:
yy14:
++lexer->cursor;
yy15:
-#line 230 "src/ast-lexer.cc"
- { ERROR("bad escape \"%.*s\"", (int)yyleng, yytext);
- continue; }
-#line 286 "src/prebuilt/ast-lexer-gen.cc"
+#line 233 "src/ast-lexer.cc"
+ { ERROR("bad escape \"%.*s\"",
+ static_cast<int>(yyleng), yytext);
+ continue; }
+#line 291 "src/prebuilt/ast-lexer-gen.cc"
yy16:
++lexer->cursor;
if ((yych = *lexer->cursor) <= '@') {
@@ -310,20 +315,20 @@ YYCOND_BLOCK_COMMENT:
}
yy19:
++lexer->cursor;
-#line 456 "src/ast-lexer.cc"
+#line 465 "src/ast-lexer.cc"
{ ERROR("unexpected EOF"); RETURN(EOF); }
-#line 316 "src/prebuilt/ast-lexer-gen.cc"
+#line 321 "src/prebuilt/ast-lexer-gen.cc"
yy21:
++lexer->cursor;
yy22:
-#line 457 "src/ast-lexer.cc"
+#line 466 "src/ast-lexer.cc"
{ continue; }
-#line 322 "src/prebuilt/ast-lexer-gen.cc"
+#line 327 "src/prebuilt/ast-lexer-gen.cc"
yy23:
++lexer->cursor;
-#line 455 "src/ast-lexer.cc"
+#line 464 "src/ast-lexer.cc"
{ NEWLINE; continue; }
-#line 327 "src/prebuilt/ast-lexer-gen.cc"
+#line 332 "src/prebuilt/ast-lexer-gen.cc"
yy25:
yych = *++lexer->cursor;
if (yych == ';') goto yy27;
@@ -334,16 +339,16 @@ yy26:
goto yy22;
yy27:
++lexer->cursor;
-#line 451 "src/ast-lexer.cc"
+#line 460 "src/ast-lexer.cc"
{ COMMENT_NESTING++; continue; }
-#line 340 "src/prebuilt/ast-lexer-gen.cc"
+#line 345 "src/prebuilt/ast-lexer-gen.cc"
yy29:
++lexer->cursor;
-#line 452 "src/ast-lexer.cc"
+#line 461 "src/ast-lexer.cc"
{ if (--COMMENT_NESTING == 0)
- BEGIN(YYCOND_INIT);
- continue; }
-#line 347 "src/prebuilt/ast-lexer-gen.cc"
+ BEGIN(YYCOND_INIT);
+ continue; }
+#line 352 "src/prebuilt/ast-lexer-gen.cc"
/* *********************************** */
YYCOND_LINE_COMMENT:
{
@@ -388,9 +393,9 @@ YYCOND_LINE_COMMENT:
}
goto yy36;
yy33:
-#line 449 "src/ast-lexer.cc"
+#line 458 "src/ast-lexer.cc"
{ continue; }
-#line 394 "src/prebuilt/ast-lexer-gen.cc"
+#line 399 "src/prebuilt/ast-lexer-gen.cc"
yy34:
++lexer->cursor;
if (lexer->limit <= lexer->cursor) FILL(1);
@@ -402,9 +407,9 @@ yy34:
yy36:
++lexer->cursor;
BEGIN(YYCOND_i);
-#line 448 "src/ast-lexer.cc"
+#line 457 "src/ast-lexer.cc"
{ NEWLINE; continue; }
-#line 408 "src/prebuilt/ast-lexer-gen.cc"
+#line 413 "src/prebuilt/ast-lexer-gen.cc"
}
/* *********************************** */
YYCOND_i:
@@ -546,15 +551,15 @@ YYCOND_i:
}
yy40:
++lexer->cursor;
-#line 463 "src/ast-lexer.cc"
+#line 472 "src/ast-lexer.cc"
{ RETURN(EOF); }
-#line 552 "src/prebuilt/ast-lexer-gen.cc"
+#line 557 "src/prebuilt/ast-lexer-gen.cc"
yy42:
++lexer->cursor;
yy43:
-#line 464 "src/ast-lexer.cc"
+#line 473 "src/ast-lexer.cc"
{ ERROR("unexpected char"); continue; }
-#line 558 "src/prebuilt/ast-lexer-gen.cc"
+#line 563 "src/prebuilt/ast-lexer-gen.cc"
yy44:
++lexer->cursor;
if (lexer->limit <= lexer->cursor) FILL(1);
@@ -562,14 +567,14 @@ yy44:
if (yybm[0+yych] & 8) {
goto yy44;
}
-#line 459 "src/ast-lexer.cc"
+#line 468 "src/ast-lexer.cc"
{ continue; }
-#line 568 "src/prebuilt/ast-lexer-gen.cc"
+#line 573 "src/prebuilt/ast-lexer-gen.cc"
yy47:
++lexer->cursor;
-#line 458 "src/ast-lexer.cc"
+#line 467 "src/ast-lexer.cc"
{ NEWLINE; continue; }
-#line 573 "src/prebuilt/ast-lexer-gen.cc"
+#line 578 "src/prebuilt/ast-lexer-gen.cc"
yy49:
++lexer->cursor;
if (lexer->limit <= lexer->cursor) FILL(1);
@@ -579,20 +584,20 @@ yy50:
goto yy49;
}
yy51:
-#line 460 "src/ast-lexer.cc"
+#line 469 "src/ast-lexer.cc"
{ ERROR("unexpected token \"%.*s\"",
- (int)yyleng, yytext);
- continue; }
-#line 587 "src/prebuilt/ast-lexer-gen.cc"
+ static_cast<int>(yyleng), yytext);
+ continue; }
+#line 592 "src/prebuilt/ast-lexer-gen.cc"
yy52:
yych = *(lexer->marker = ++lexer->cursor);
if (yych <= 0x1F) goto yy53;
if (yych != 0x7F) goto yy83;
yy53:
BEGIN(YYCOND_BAD_TEXT);
-#line 227 "src/ast-lexer.cc"
+#line 229 "src/ast-lexer.cc"
{ continue; }
-#line 596 "src/prebuilt/ast-lexer-gen.cc"
+#line 601 "src/prebuilt/ast-lexer-gen.cc"
yy54:
yych = *++lexer->cursor;
if (yych <= ';') {
@@ -632,14 +637,14 @@ yy54:
yy55:
++lexer->cursor;
if ((yych = *lexer->cursor) == ';') goto yy91;
-#line 218 "src/ast-lexer.cc"
+#line 220 "src/ast-lexer.cc"
{ RETURN(LPAR); }
-#line 638 "src/prebuilt/ast-lexer-gen.cc"
+#line 643 "src/prebuilt/ast-lexer-gen.cc"
yy57:
++lexer->cursor;
-#line 219 "src/ast-lexer.cc"
+#line 221 "src/ast-lexer.cc"
{ RETURN(RPAR); }
-#line 643 "src/prebuilt/ast-lexer-gen.cc"
+#line 648 "src/prebuilt/ast-lexer-gen.cc"
yy59:
yych = *++lexer->cursor;
if (yych <= 'h') {
@@ -696,9 +701,9 @@ yy60:
}
}
yy61:
-#line 220 "src/ast-lexer.cc"
+#line 222 "src/ast-lexer.cc"
{ LITERAL(INT); RETURN(NAT); }
-#line 702 "src/prebuilt/ast-lexer-gen.cc"
+#line 707 "src/prebuilt/ast-lexer-gen.cc"
yy62:
++lexer->cursor;
if ((lexer->limit - lexer->cursor) < 3) FILL(3);
@@ -899,9 +904,9 @@ yy84:
goto yy53;
yy85:
++lexer->cursor;
-#line 226 "src/ast-lexer.cc"
+#line 228 "src/ast-lexer.cc"
{ TEXT; RETURN(TEXT); }
-#line 905 "src/prebuilt/ast-lexer-gen.cc"
+#line 910 "src/prebuilt/ast-lexer-gen.cc"
yy87:
++lexer->cursor;
if (lexer->limit <= lexer->cursor) FILL(1);
@@ -964,15 +969,15 @@ yy88:
}
}
yy90:
-#line 445 "src/ast-lexer.cc"
+#line 454 "src/ast-lexer.cc"
{ TEXT; RETURN(VAR); }
-#line 970 "src/prebuilt/ast-lexer-gen.cc"
+#line 975 "src/prebuilt/ast-lexer-gen.cc"
yy91:
++lexer->cursor;
BEGIN(YYCOND_BLOCK_COMMENT);
-#line 450 "src/ast-lexer.cc"
+#line 459 "src/ast-lexer.cc"
{ COMMENT_NESTING = 1; continue; }
-#line 976 "src/prebuilt/ast-lexer-gen.cc"
+#line 981 "src/prebuilt/ast-lexer-gen.cc"
yy93:
++lexer->cursor;
if ((yych = *lexer->cursor) <= 'D') {
@@ -1014,9 +1019,9 @@ yy93:
}
}
yy94:
-#line 221 "src/ast-lexer.cc"
+#line 223 "src/ast-lexer.cc"
{ LITERAL(INT); RETURN(INT); }
-#line 1020 "src/prebuilt/ast-lexer-gen.cc"
+#line 1025 "src/prebuilt/ast-lexer-gen.cc"
yy95:
++lexer->cursor;
if ((lexer->limit - lexer->cursor) < 3) FILL(3);
@@ -1113,9 +1118,9 @@ yy99:
}
}
yy101:
-#line 222 "src/ast-lexer.cc"
+#line 224 "src/ast-lexer.cc"
{ LITERAL(FLOAT); RETURN(FLOAT); }
-#line 1119 "src/prebuilt/ast-lexer-gen.cc"
+#line 1124 "src/prebuilt/ast-lexer-gen.cc"
yy102:
yych = *++lexer->cursor;
if (yych <= ',') {
@@ -1136,9 +1141,9 @@ yy103:
yy104:
++lexer->cursor;
BEGIN(YYCOND_LINE_COMMENT);
-#line 447 "src/ast-lexer.cc"
+#line 456 "src/ast-lexer.cc"
{ continue; }
-#line 1142 "src/prebuilt/ast-lexer-gen.cc"
+#line 1147 "src/prebuilt/ast-lexer-gen.cc"
yy106:
yych = *++lexer->cursor;
if (yych == 'i') goto yy156;
@@ -1190,9 +1195,9 @@ yy110:
}
}
yy111:
-#line 248 "src/ast-lexer.cc"
+#line 253 "src/ast-lexer.cc"
{ RETURN(BR); }
-#line 1196 "src/prebuilt/ast-lexer-gen.cc"
+#line 1201 "src/prebuilt/ast-lexer-gen.cc"
yy112:
yych = *++lexer->cursor;
if (yych == 'l') goto yy161;
@@ -1289,9 +1294,9 @@ yy127:
}
}
yy128:
-#line 243 "src/ast-lexer.cc"
+#line 248 "src/ast-lexer.cc"
{ RETURN(IF); }
-#line 1295 "src/prebuilt/ast-lexer-gen.cc"
+#line 1300 "src/prebuilt/ast-lexer-gen.cc"
yy129:
yych = *++lexer->cursor;
if (yych == 'p') goto yy184;
@@ -1556,9 +1561,9 @@ yy167:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 255 "src/ast-lexer.cc"
+#line 260 "src/ast-lexer.cc"
{ RETURN(END); }
-#line 1562 "src/prebuilt/ast-lexer-gen.cc"
+#line 1567 "src/prebuilt/ast-lexer-gen.cc"
yy169:
yych = *++lexer->cursor;
if (yych == 'o') goto yy235;
@@ -1597,9 +1602,9 @@ yy170:
}
}
yy171:
-#line 237 "src/ast-lexer.cc"
+#line 242 "src/ast-lexer.cc"
{ TYPE(F32); RETURN(VALUE_TYPE); }
-#line 1603 "src/prebuilt/ast-lexer-gen.cc"
+#line 1608 "src/prebuilt/ast-lexer-gen.cc"
yy172:
++lexer->cursor;
if ((yych = *lexer->cursor) <= ':') {
@@ -1634,9 +1639,9 @@ yy172:
}
}
yy173:
-#line 238 "src/ast-lexer.cc"
+#line 243 "src/ast-lexer.cc"
{ TYPE(F64); RETURN(VALUE_TYPE); }
-#line 1640 "src/prebuilt/ast-lexer-gen.cc"
+#line 1645 "src/prebuilt/ast-lexer-gen.cc"
yy174:
yych = *++lexer->cursor;
if (yych == 'c') goto yy238;
@@ -1676,9 +1681,9 @@ yy175:
}
}
yy176:
-#line 435 "src/ast-lexer.cc"
+#line 444 "src/ast-lexer.cc"
{ RETURN(GET); }
-#line 1682 "src/prebuilt/ast-lexer-gen.cc"
+#line 1687 "src/prebuilt/ast-lexer-gen.cc"
yy177:
yych = *++lexer->cursor;
if (yych == 'b') goto yy241;
@@ -1721,9 +1726,9 @@ yy179:
}
}
yy180:
-#line 235 "src/ast-lexer.cc"
+#line 240 "src/ast-lexer.cc"
{ TYPE(I32); RETURN(VALUE_TYPE); }
-#line 1727 "src/prebuilt/ast-lexer-gen.cc"
+#line 1732 "src/prebuilt/ast-lexer-gen.cc"
yy181:
++lexer->cursor;
if ((yych = *lexer->cursor) <= ':') {
@@ -1758,9 +1763,9 @@ yy181:
}
}
yy182:
-#line 236 "src/ast-lexer.cc"
+#line 241 "src/ast-lexer.cc"
{ TYPE(I64); RETURN(VALUE_TYPE); }
-#line 1764 "src/prebuilt/ast-lexer-gen.cc"
+#line 1769 "src/prebuilt/ast-lexer-gen.cc"
yy183:
yych = *++lexer->cursor;
if (yych == 'e') goto yy245;
@@ -1804,9 +1809,9 @@ yy185:
}
}
yy186:
-#line 224 "src/ast-lexer.cc"
+#line 226 "src/ast-lexer.cc"
{ LITERAL(INFINITY); RETURN(FLOAT); }
-#line 1810 "src/prebuilt/ast-lexer-gen.cc"
+#line 1815 "src/prebuilt/ast-lexer-gen.cc"
yy187:
yych = *++lexer->cursor;
if (yych == 'u') goto yy248;
@@ -1836,9 +1841,9 @@ yy193:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 240 "src/ast-lexer.cc"
+#line 245 "src/ast-lexer.cc"
{ RETURN(MUT); }
-#line 1842 "src/prebuilt/ast-lexer-gen.cc"
+#line 1847 "src/prebuilt/ast-lexer-gen.cc"
yy195:
++lexer->cursor;
if ((yych = *lexer->cursor) <= ';') {
@@ -1873,17 +1878,17 @@ yy195:
}
}
yy196:
-#line 225 "src/ast-lexer.cc"
+#line 227 "src/ast-lexer.cc"
{ LITERAL(NAN); RETURN(FLOAT); }
-#line 1879 "src/prebuilt/ast-lexer-gen.cc"
+#line 1884 "src/prebuilt/ast-lexer-gen.cc"
yy197:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 241 "src/ast-lexer.cc"
+#line 246 "src/ast-lexer.cc"
{ RETURN(NOP); }
-#line 1887 "src/prebuilt/ast-lexer-gen.cc"
+#line 1892 "src/prebuilt/ast-lexer-gen.cc"
yy199:
yych = *++lexer->cursor;
if (yych == 's') goto yy256;
@@ -2105,9 +2110,9 @@ yy224:
}
}
yy225:
-#line 251 "src/ast-lexer.cc"
+#line 256 "src/ast-lexer.cc"
{ RETURN(CALL); }
-#line 2111 "src/prebuilt/ast-lexer-gen.cc"
+#line 2116 "src/prebuilt/ast-lexer-gen.cc"
yy226:
yych = *++lexer->cursor;
if (yych == 'e') goto yy285;
@@ -2117,33 +2122,33 @@ yy227:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 429 "src/ast-lexer.cc"
+#line 438 "src/ast-lexer.cc"
{ RETURN(DATA); }
-#line 2123 "src/prebuilt/ast-lexer-gen.cc"
+#line 2128 "src/prebuilt/ast-lexer-gen.cc"
yy229:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 254 "src/ast-lexer.cc"
+#line 259 "src/ast-lexer.cc"
{ RETURN(DROP); }
-#line 2131 "src/prebuilt/ast-lexer-gen.cc"
+#line 2136 "src/prebuilt/ast-lexer-gen.cc"
yy231:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 428 "src/ast-lexer.cc"
+#line 437 "src/ast-lexer.cc"
{ RETURN(ELEM); }
-#line 2139 "src/prebuilt/ast-lexer-gen.cc"
+#line 2144 "src/prebuilt/ast-lexer-gen.cc"
yy233:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 246 "src/ast-lexer.cc"
+#line 251 "src/ast-lexer.cc"
{ RETURN(ELSE); }
-#line 2147 "src/prebuilt/ast-lexer-gen.cc"
+#line 2152 "src/prebuilt/ast-lexer-gen.cc"
yy235:
yych = *++lexer->cursor;
if (yych == 'r') goto yy286;
@@ -2188,9 +2193,9 @@ yy238:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 419 "src/ast-lexer.cc"
+#line 428 "src/ast-lexer.cc"
{ RETURN(FUNC); }
-#line 2194 "src/prebuilt/ast-lexer-gen.cc"
+#line 2199 "src/prebuilt/ast-lexer-gen.cc"
yy240:
yych = *++lexer->cursor;
if (yych == 'g') goto yy312;
@@ -2272,9 +2277,9 @@ yy251:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 247 "src/ast-lexer.cc"
+#line 252 "src/ast-lexer.cc"
{ RETURN(LOOP); }
-#line 2278 "src/prebuilt/ast-lexer-gen.cc"
+#line 2283 "src/prebuilt/ast-lexer-gen.cc"
yy253:
yych = *++lexer->cursor;
if (yych == 'r') goto yy353;
@@ -2337,17 +2342,17 @@ yy267:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 245 "src/ast-lexer.cc"
+#line 250 "src/ast-lexer.cc"
{ RETURN(THEN); }
-#line 2343 "src/prebuilt/ast-lexer-gen.cc"
+#line 2348 "src/prebuilt/ast-lexer-gen.cc"
yy269:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 418 "src/ast-lexer.cc"
+#line 427 "src/ast-lexer.cc"
{ RETURN(TYPE); }
-#line 2351 "src/prebuilt/ast-lexer-gen.cc"
+#line 2356 "src/prebuilt/ast-lexer-gen.cc"
yy271:
yych = *++lexer->cursor;
if (yych == 'a') goto yy371;
@@ -2393,9 +2398,9 @@ yy273:
}
}
yy275:
-#line 223 "src/ast-lexer.cc"
+#line 225 "src/ast-lexer.cc"
{ LITERAL(HEXFLOAT); RETURN(FLOAT); }
-#line 2399 "src/prebuilt/ast-lexer-gen.cc"
+#line 2404 "src/prebuilt/ast-lexer-gen.cc"
yy276:
yych = *++lexer->cursor;
if (yych == '=') goto yy372;
@@ -2413,17 +2418,17 @@ yy279:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 242 "src/ast-lexer.cc"
+#line 247 "src/ast-lexer.cc"
{ RETURN(BLOCK); }
-#line 2419 "src/prebuilt/ast-lexer-gen.cc"
+#line 2424 "src/prebuilt/ast-lexer-gen.cc"
yy281:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 249 "src/ast-lexer.cc"
+#line 254 "src/ast-lexer.cc"
{ RETURN(BR_IF); }
-#line 2427 "src/prebuilt/ast-lexer-gen.cc"
+#line 2432 "src/prebuilt/ast-lexer-gen.cc"
yy283:
yych = *++lexer->cursor;
if (yych == 'b') goto yy375;
@@ -2775,9 +2780,9 @@ yy348:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 443 "src/ast-lexer.cc"
+#line 452 "src/ast-lexer.cc"
{ RETURN(INPUT); }
-#line 2781 "src/prebuilt/ast-lexer-gen.cc"
+#line 2786 "src/prebuilt/ast-lexer-gen.cc"
yy350:
yych = *++lexer->cursor;
if (yych == 'e') goto yy499;
@@ -2787,9 +2792,9 @@ yy351:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 422 "src/ast-lexer.cc"
+#line 431 "src/ast-lexer.cc"
{ RETURN(LOCAL); }
-#line 2793 "src/prebuilt/ast-lexer-gen.cc"
+#line 2798 "src/prebuilt/ast-lexer-gen.cc"
yy353:
yych = *++lexer->cursor;
if (yych == 'y') goto yy501;
@@ -2815,9 +2820,9 @@ yy358:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 420 "src/ast-lexer.cc"
+#line 429 "src/ast-lexer.cc"
{ RETURN(PARAM); }
-#line 2821 "src/prebuilt/ast-lexer-gen.cc"
+#line 2826 "src/prebuilt/ast-lexer-gen.cc"
yy360:
yych = *++lexer->cursor;
if (yych == 't') goto yy510;
@@ -2847,17 +2852,17 @@ yy366:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 427 "src/ast-lexer.cc"
+#line 436 "src/ast-lexer.cc"
{ RETURN(START); }
-#line 2853 "src/prebuilt/ast-lexer-gen.cc"
+#line 2858 "src/prebuilt/ast-lexer-gen.cc"
yy368:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 425 "src/ast-lexer.cc"
+#line 434 "src/ast-lexer.cc"
{ RETURN(TABLE); }
-#line 2861 "src/prebuilt/ast-lexer-gen.cc"
+#line 2866 "src/prebuilt/ast-lexer-gen.cc"
yy370:
yych = *++lexer->cursor;
if (yych == 'o') goto yy519;
@@ -2899,9 +2904,9 @@ yy378:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 432 "src/ast-lexer.cc"
+#line 441 "src/ast-lexer.cc"
{ RETURN(EXPORT); }
-#line 2905 "src/prebuilt/ast-lexer-gen.cc"
+#line 2910 "src/prebuilt/ast-lexer-gen.cc"
yy380:
yych = *++lexer->cursor;
if (yych == 's') goto yy532;
@@ -2932,9 +2937,9 @@ yy386:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 377 "src/ast-lexer.cc"
+#line 382 "src/ast-lexer.cc"
{ OPCODE(F32_EQ); RETURN(COMPARE); }
-#line 2938 "src/prebuilt/ast-lexer-gen.cc"
+#line 2943 "src/prebuilt/ast-lexer-gen.cc"
yy388:
yych = *++lexer->cursor;
if (yych == 'o') goto yy542;
@@ -2944,25 +2949,25 @@ yy389:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 387 "src/ast-lexer.cc"
+#line 392 "src/ast-lexer.cc"
{ OPCODE(F32_GE); RETURN(COMPARE); }
-#line 2950 "src/prebuilt/ast-lexer-gen.cc"
+#line 2955 "src/prebuilt/ast-lexer-gen.cc"
yy391:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 385 "src/ast-lexer.cc"
+#line 390 "src/ast-lexer.cc"
{ OPCODE(F32_GT); RETURN(COMPARE); }
-#line 2958 "src/prebuilt/ast-lexer-gen.cc"
+#line 2963 "src/prebuilt/ast-lexer-gen.cc"
yy393:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 383 "src/ast-lexer.cc"
+#line 388 "src/ast-lexer.cc"
{ OPCODE(F32_LE); RETURN(COMPARE); }
-#line 2966 "src/prebuilt/ast-lexer-gen.cc"
+#line 2971 "src/prebuilt/ast-lexer-gen.cc"
yy395:
yych = *++lexer->cursor;
if (yych == 'a') goto yy543;
@@ -2972,9 +2977,9 @@ yy396:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 381 "src/ast-lexer.cc"
+#line 386 "src/ast-lexer.cc"
{ OPCODE(F32_LT); RETURN(COMPARE); }
-#line 2978 "src/prebuilt/ast-lexer-gen.cc"
+#line 2983 "src/prebuilt/ast-lexer-gen.cc"
yy398:
yych = *++lexer->cursor;
if (yych == 'x') goto yy544;
@@ -3023,9 +3028,9 @@ yy401:
}
}
yy402:
-#line 379 "src/ast-lexer.cc"
+#line 384 "src/ast-lexer.cc"
{ OPCODE(F32_NE); RETURN(COMPARE); }
-#line 3029 "src/prebuilt/ast-lexer-gen.cc"
+#line 3034 "src/prebuilt/ast-lexer-gen.cc"
yy403:
yych = *++lexer->cursor;
if (yych == 'i') goto yy553;
@@ -3072,9 +3077,9 @@ yy413:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 378 "src/ast-lexer.cc"
+#line 383 "src/ast-lexer.cc"
{ OPCODE(F64_EQ); RETURN(COMPARE); }
-#line 3078 "src/prebuilt/ast-lexer-gen.cc"
+#line 3083 "src/prebuilt/ast-lexer-gen.cc"
yy415:
yych = *++lexer->cursor;
if (yych == 'o') goto yy568;
@@ -3084,25 +3089,25 @@ yy416:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 388 "src/ast-lexer.cc"
+#line 393 "src/ast-lexer.cc"
{ OPCODE(F64_GE); RETURN(COMPARE); }
-#line 3090 "src/prebuilt/ast-lexer-gen.cc"
+#line 3095 "src/prebuilt/ast-lexer-gen.cc"
yy418:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 386 "src/ast-lexer.cc"
+#line 391 "src/ast-lexer.cc"
{ OPCODE(F64_GT); RETURN(COMPARE); }
-#line 3098 "src/prebuilt/ast-lexer-gen.cc"
+#line 3103 "src/prebuilt/ast-lexer-gen.cc"
yy420:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 384 "src/ast-lexer.cc"
+#line 389 "src/ast-lexer.cc"
{ OPCODE(F64_LE); RETURN(COMPARE); }
-#line 3106 "src/prebuilt/ast-lexer-gen.cc"
+#line 3111 "src/prebuilt/ast-lexer-gen.cc"
yy422:
yych = *++lexer->cursor;
if (yych == 'a') goto yy569;
@@ -3112,9 +3117,9 @@ yy423:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 382 "src/ast-lexer.cc"
+#line 387 "src/ast-lexer.cc"
{ OPCODE(F64_LT); RETURN(COMPARE); }
-#line 3118 "src/prebuilt/ast-lexer-gen.cc"
+#line 3123 "src/prebuilt/ast-lexer-gen.cc"
yy425:
yych = *++lexer->cursor;
if (yych == 'x') goto yy570;
@@ -3163,9 +3168,9 @@ yy428:
}
}
yy429:
-#line 380 "src/ast-lexer.cc"
+#line 385 "src/ast-lexer.cc"
{ OPCODE(F64_NE); RETURN(COMPARE); }
-#line 3169 "src/prebuilt/ast-lexer-gen.cc"
+#line 3174 "src/prebuilt/ast-lexer-gen.cc"
yy430:
yych = *++lexer->cursor;
if (yych == 'o') goto yy579;
@@ -3203,9 +3208,9 @@ yy438:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 423 "src/ast-lexer.cc"
+#line 432 "src/ast-lexer.cc"
{ RETURN(GLOBAL); }
-#line 3209 "src/prebuilt/ast-lexer-gen.cc"
+#line 3214 "src/prebuilt/ast-lexer-gen.cc"
yy440:
yych = *++lexer->cursor;
if (yych == 'e') goto yy588;
@@ -3269,9 +3274,9 @@ yy447:
}
}
yy448:
-#line 357 "src/ast-lexer.cc"
+#line 362 "src/ast-lexer.cc"
{ OPCODE(I32_EQ); RETURN(COMPARE); }
-#line 3275 "src/prebuilt/ast-lexer-gen.cc"
+#line 3280 "src/prebuilt/ast-lexer-gen.cc"
yy449:
yych = *++lexer->cursor;
if (yych == '_') goto yy601;
@@ -3301,17 +3306,17 @@ yy455:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 359 "src/ast-lexer.cc"
+#line 364 "src/ast-lexer.cc"
{ OPCODE(I32_NE); RETURN(COMPARE); }
-#line 3307 "src/prebuilt/ast-lexer-gen.cc"
+#line 3312 "src/prebuilt/ast-lexer-gen.cc"
yy457:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 329 "src/ast-lexer.cc"
+#line 334 "src/ast-lexer.cc"
{ OPCODE(I32_OR); RETURN(BINARY); }
-#line 3315 "src/prebuilt/ast-lexer-gen.cc"
+#line 3320 "src/prebuilt/ast-lexer-gen.cc"
yy459:
yych = *++lexer->cursor;
if (yych == 'p') goto yy608;
@@ -3409,9 +3414,9 @@ yy474:
}
}
yy475:
-#line 358 "src/ast-lexer.cc"
+#line 363 "src/ast-lexer.cc"
{ OPCODE(I64_EQ); RETURN(COMPARE); }
-#line 3415 "src/prebuilt/ast-lexer-gen.cc"
+#line 3420 "src/prebuilt/ast-lexer-gen.cc"
yy476:
yych = *++lexer->cursor;
if (yych == 't') goto yy634;
@@ -3445,17 +3450,17 @@ yy483:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 360 "src/ast-lexer.cc"
+#line 365 "src/ast-lexer.cc"
{ OPCODE(I64_NE); RETURN(COMPARE); }
-#line 3451 "src/prebuilt/ast-lexer-gen.cc"
+#line 3456 "src/prebuilt/ast-lexer-gen.cc"
yy485:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 330 "src/ast-lexer.cc"
+#line 335 "src/ast-lexer.cc"
{ OPCODE(I64_OR); RETURN(BINARY); }
-#line 3459 "src/prebuilt/ast-lexer-gen.cc"
+#line 3464 "src/prebuilt/ast-lexer-gen.cc"
yy487:
yych = *++lexer->cursor;
if (yych == 'p') goto yy642;
@@ -3499,9 +3504,9 @@ yy496:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 431 "src/ast-lexer.cc"
+#line 440 "src/ast-lexer.cc"
{ RETURN(IMPORT); }
-#line 3505 "src/prebuilt/ast-lexer-gen.cc"
+#line 3510 "src/prebuilt/ast-lexer-gen.cc"
yy498:
yych = *++lexer->cursor;
if (yych == 't') goto yy657;
@@ -3511,25 +3516,25 @@ yy499:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 434 "src/ast-lexer.cc"
+#line 443 "src/ast-lexer.cc"
{ RETURN(INVOKE); }
-#line 3517 "src/prebuilt/ast-lexer-gen.cc"
+#line 3522 "src/prebuilt/ast-lexer-gen.cc"
yy501:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 426 "src/ast-lexer.cc"
+#line 435 "src/ast-lexer.cc"
{ RETURN(MEMORY); }
-#line 3525 "src/prebuilt/ast-lexer-gen.cc"
+#line 3530 "src/prebuilt/ast-lexer-gen.cc"
yy503:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 424 "src/ast-lexer.cc"
+#line 433 "src/ast-lexer.cc"
{ RETURN(MODULE); }
-#line 3533 "src/prebuilt/ast-lexer-gen.cc"
+#line 3538 "src/prebuilt/ast-lexer-gen.cc"
yy505:
yych = *++lexer->cursor;
if (yych <= '@') {
@@ -3576,17 +3581,17 @@ yy506:
}
}
yy507:
-#line 430 "src/ast-lexer.cc"
+#line 439 "src/ast-lexer.cc"
{ RETURN(OFFSET); }
-#line 3582 "src/prebuilt/ast-lexer-gen.cc"
+#line 3587 "src/prebuilt/ast-lexer-gen.cc"
yy508:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 444 "src/ast-lexer.cc"
+#line 453 "src/ast-lexer.cc"
{ RETURN(OUTPUT); }
-#line 3590 "src/prebuilt/ast-lexer-gen.cc"
+#line 3595 "src/prebuilt/ast-lexer-gen.cc"
yy510:
yych = *++lexer->cursor;
if (yych == 'e') goto yy661;
@@ -3596,25 +3601,25 @@ yy511:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 421 "src/ast-lexer.cc"
+#line 430 "src/ast-lexer.cc"
{ RETURN(RESULT); }
-#line 3602 "src/prebuilt/ast-lexer-gen.cc"
+#line 3607 "src/prebuilt/ast-lexer-gen.cc"
yy513:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 256 "src/ast-lexer.cc"
+#line 261 "src/ast-lexer.cc"
{ RETURN(RETURN); }
-#line 3610 "src/prebuilt/ast-lexer-gen.cc"
+#line 3615 "src/prebuilt/ast-lexer-gen.cc"
yy515:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 414 "src/ast-lexer.cc"
+#line 423 "src/ast-lexer.cc"
{ RETURN(SELECT); }
-#line 3618 "src/prebuilt/ast-lexer-gen.cc"
+#line 3623 "src/prebuilt/ast-lexer-gen.cc"
yy517:
yych = *++lexer->cursor;
if (yych == 'o') goto yy662;
@@ -3667,9 +3672,9 @@ yy521:
}
}
yy522:
-#line 286 "src/ast-lexer.cc"
+#line 291 "src/ast-lexer.cc"
{ TEXT_AT(6); RETURN(ALIGN_EQ_NAT); }
-#line 3673 "src/prebuilt/ast-lexer-gen.cc"
+#line 3678 "src/prebuilt/ast-lexer-gen.cc"
yy523:
++lexer->cursor;
if (lexer->limit <= lexer->cursor) FILL(1);
@@ -3718,9 +3723,9 @@ yy525:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 239 "src/ast-lexer.cc"
+#line 244 "src/ast-lexer.cc"
{ RETURN(ANYFUNC); }
-#line 3724 "src/prebuilt/ast-lexer-gen.cc"
+#line 3729 "src/prebuilt/ast-lexer-gen.cc"
yy527:
yych = *++lexer->cursor;
switch (yych) {
@@ -3753,17 +3758,17 @@ yy532:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 301 "src/ast-lexer.cc"
+#line 306 "src/ast-lexer.cc"
{ OPCODE(F32_ABS); RETURN(UNARY); }
-#line 3759 "src/prebuilt/ast-lexer-gen.cc"
+#line 3764 "src/prebuilt/ast-lexer-gen.cc"
yy534:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 343 "src/ast-lexer.cc"
+#line 348 "src/ast-lexer.cc"
{ OPCODE(F32_ADD); RETURN(BINARY); }
-#line 3767 "src/prebuilt/ast-lexer-gen.cc"
+#line 3772 "src/prebuilt/ast-lexer-gen.cc"
yy536:
yych = *++lexer->cursor;
if (yych == 'l') goto yy678;
@@ -3786,9 +3791,9 @@ yy540:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 349 "src/ast-lexer.cc"
+#line 354 "src/ast-lexer.cc"
{ OPCODE(F32_DIV); RETURN(BINARY); }
-#line 3792 "src/prebuilt/ast-lexer-gen.cc"
+#line 3797 "src/prebuilt/ast-lexer-gen.cc"
yy542:
yych = *++lexer->cursor;
if (yych == 'o') goto yy684;
@@ -3802,25 +3807,25 @@ yy544:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 353 "src/ast-lexer.cc"
+#line 358 "src/ast-lexer.cc"
{ OPCODE(F32_MAX); RETURN(BINARY); }
-#line 3808 "src/prebuilt/ast-lexer-gen.cc"
+#line 3813 "src/prebuilt/ast-lexer-gen.cc"
yy546:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 351 "src/ast-lexer.cc"
+#line 356 "src/ast-lexer.cc"
{ OPCODE(F32_MIN); RETURN(BINARY); }
-#line 3816 "src/prebuilt/ast-lexer-gen.cc"
+#line 3821 "src/prebuilt/ast-lexer-gen.cc"
yy548:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 347 "src/ast-lexer.cc"
+#line 352 "src/ast-lexer.cc"
{ OPCODE(F32_MUL); RETURN(BINARY); }
-#line 3824 "src/prebuilt/ast-lexer-gen.cc"
+#line 3829 "src/prebuilt/ast-lexer-gen.cc"
yy550:
yych = *++lexer->cursor;
if (yych == 'r') goto yy687;
@@ -3830,9 +3835,9 @@ yy551:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 299 "src/ast-lexer.cc"
+#line 304 "src/ast-lexer.cc"
{ OPCODE(F32_NEG); RETURN(UNARY); }
-#line 3836 "src/prebuilt/ast-lexer-gen.cc"
+#line 3841 "src/prebuilt/ast-lexer-gen.cc"
yy553:
yych = *++lexer->cursor;
if (yych == 'n') goto yy688;
@@ -3850,9 +3855,9 @@ yy556:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 345 "src/ast-lexer.cc"
+#line 350 "src/ast-lexer.cc"
{ OPCODE(F32_SUB); RETURN(BINARY); }
-#line 3856 "src/prebuilt/ast-lexer-gen.cc"
+#line 3861 "src/prebuilt/ast-lexer-gen.cc"
yy558:
yych = *++lexer->cursor;
if (yych == 'n') goto yy692;
@@ -3862,17 +3867,17 @@ yy559:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 302 "src/ast-lexer.cc"
+#line 307 "src/ast-lexer.cc"
{ OPCODE(F64_ABS); RETURN(UNARY); }
-#line 3868 "src/prebuilt/ast-lexer-gen.cc"
+#line 3873 "src/prebuilt/ast-lexer-gen.cc"
yy561:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 344 "src/ast-lexer.cc"
+#line 349 "src/ast-lexer.cc"
{ OPCODE(F64_ADD); RETURN(BINARY); }
-#line 3876 "src/prebuilt/ast-lexer-gen.cc"
+#line 3881 "src/prebuilt/ast-lexer-gen.cc"
yy563:
yych = *++lexer->cursor;
if (yych == 'l') goto yy693;
@@ -3891,9 +3896,9 @@ yy566:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 350 "src/ast-lexer.cc"
+#line 355 "src/ast-lexer.cc"
{ OPCODE(F64_DIV); RETURN(BINARY); }
-#line 3897 "src/prebuilt/ast-lexer-gen.cc"
+#line 3902 "src/prebuilt/ast-lexer-gen.cc"
yy568:
yych = *++lexer->cursor;
if (yych == 'o') goto yy698;
@@ -3907,25 +3912,25 @@ yy570:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 354 "src/ast-lexer.cc"
+#line 359 "src/ast-lexer.cc"
{ OPCODE(F64_MAX); RETURN(BINARY); }
-#line 3913 "src/prebuilt/ast-lexer-gen.cc"
+#line 3918 "src/prebuilt/ast-lexer-gen.cc"
yy572:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 352 "src/ast-lexer.cc"
+#line 357 "src/ast-lexer.cc"
{ OPCODE(F64_MIN); RETURN(BINARY); }
-#line 3921 "src/prebuilt/ast-lexer-gen.cc"
+#line 3926 "src/prebuilt/ast-lexer-gen.cc"
yy574:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 348 "src/ast-lexer.cc"
+#line 353 "src/ast-lexer.cc"
{ OPCODE(F64_MUL); RETURN(BINARY); }
-#line 3929 "src/prebuilt/ast-lexer-gen.cc"
+#line 3934 "src/prebuilt/ast-lexer-gen.cc"
yy576:
yych = *++lexer->cursor;
if (yych == 'r') goto yy701;
@@ -3935,9 +3940,9 @@ yy577:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 300 "src/ast-lexer.cc"
+#line 305 "src/ast-lexer.cc"
{ OPCODE(F64_NEG); RETURN(UNARY); }
-#line 3941 "src/prebuilt/ast-lexer-gen.cc"
+#line 3946 "src/prebuilt/ast-lexer-gen.cc"
yy579:
yych = *++lexer->cursor;
if (yych == 'm') goto yy702;
@@ -3959,9 +3964,9 @@ yy583:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 346 "src/ast-lexer.cc"
+#line 351 "src/ast-lexer.cc"
{ OPCODE(F64_SUB); RETURN(BINARY); }
-#line 3965 "src/prebuilt/ast-lexer-gen.cc"
+#line 3970 "src/prebuilt/ast-lexer-gen.cc"
yy585:
yych = *++lexer->cursor;
if (yych == 'n') goto yy707;
@@ -3983,25 +3988,25 @@ yy589:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 313 "src/ast-lexer.cc"
+#line 318 "src/ast-lexer.cc"
{ OPCODE(I32_ADD); RETURN(BINARY); }
-#line 3989 "src/prebuilt/ast-lexer-gen.cc"
+#line 3994 "src/prebuilt/ast-lexer-gen.cc"
yy591:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 327 "src/ast-lexer.cc"
+#line 332 "src/ast-lexer.cc"
{ OPCODE(I32_AND); RETURN(BINARY); }
-#line 3997 "src/prebuilt/ast-lexer-gen.cc"
+#line 4002 "src/prebuilt/ast-lexer-gen.cc"
yy593:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 293 "src/ast-lexer.cc"
+#line 298 "src/ast-lexer.cc"
{ OPCODE(I32_CLZ); RETURN(UNARY); }
-#line 4005 "src/prebuilt/ast-lexer-gen.cc"
+#line 4010 "src/prebuilt/ast-lexer-gen.cc"
yy595:
yych = *++lexer->cursor;
if (yych == 's') goto yy711;
@@ -4011,9 +4016,9 @@ yy596:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 295 "src/ast-lexer.cc"
+#line 300 "src/ast-lexer.cc"
{ OPCODE(I32_CTZ); RETURN(UNARY); }
-#line 4017 "src/prebuilt/ast-lexer-gen.cc"
+#line 4022 "src/prebuilt/ast-lexer-gen.cc"
yy598:
yych = *++lexer->cursor;
if (yych == '_') goto yy712;
@@ -4023,9 +4028,9 @@ yy599:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 291 "src/ast-lexer.cc"
+#line 296 "src/ast-lexer.cc"
{ OPCODE(I32_EQZ); RETURN(CONVERT); }
-#line 4029 "src/prebuilt/ast-lexer-gen.cc"
+#line 4034 "src/prebuilt/ast-lexer-gen.cc"
yy601:
yych = *++lexer->cursor;
if (yych == 's') goto yy713;
@@ -4055,9 +4060,9 @@ yy606:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 317 "src/ast-lexer.cc"
+#line 322 "src/ast-lexer.cc"
{ OPCODE(I32_MUL); RETURN(BINARY); }
-#line 4061 "src/prebuilt/ast-lexer-gen.cc"
+#line 4066 "src/prebuilt/ast-lexer-gen.cc"
yy608:
yych = *++lexer->cursor;
if (yych == 'c') goto yy731;
@@ -4080,9 +4085,9 @@ yy612:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 333 "src/ast-lexer.cc"
+#line 338 "src/ast-lexer.cc"
{ OPCODE(I32_SHL); RETURN(BINARY); }
-#line 4086 "src/prebuilt/ast-lexer-gen.cc"
+#line 4091 "src/prebuilt/ast-lexer-gen.cc"
yy614:
yych = *++lexer->cursor;
if (yych == '_') goto yy738;
@@ -4096,9 +4101,9 @@ yy616:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 315 "src/ast-lexer.cc"
+#line 320 "src/ast-lexer.cc"
{ OPCODE(I32_SUB); RETURN(BINARY); }
-#line 4102 "src/prebuilt/ast-lexer-gen.cc"
+#line 4107 "src/prebuilt/ast-lexer-gen.cc"
yy618:
yych = *++lexer->cursor;
if (yych == 'n') goto yy740;
@@ -4112,33 +4117,33 @@ yy620:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 331 "src/ast-lexer.cc"
+#line 336 "src/ast-lexer.cc"
{ OPCODE(I32_XOR); RETURN(BINARY); }
-#line 4118 "src/prebuilt/ast-lexer-gen.cc"
+#line 4123 "src/prebuilt/ast-lexer-gen.cc"
yy622:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 314 "src/ast-lexer.cc"
+#line 319 "src/ast-lexer.cc"
{ OPCODE(I64_ADD); RETURN(BINARY); }
-#line 4126 "src/prebuilt/ast-lexer-gen.cc"
+#line 4131 "src/prebuilt/ast-lexer-gen.cc"
yy624:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 328 "src/ast-lexer.cc"
+#line 333 "src/ast-lexer.cc"
{ OPCODE(I64_AND); RETURN(BINARY); }
-#line 4134 "src/prebuilt/ast-lexer-gen.cc"
+#line 4139 "src/prebuilt/ast-lexer-gen.cc"
yy626:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 294 "src/ast-lexer.cc"
+#line 299 "src/ast-lexer.cc"
{ OPCODE(I64_CLZ); RETURN(UNARY); }
-#line 4142 "src/prebuilt/ast-lexer-gen.cc"
+#line 4147 "src/prebuilt/ast-lexer-gen.cc"
yy628:
yych = *++lexer->cursor;
if (yych == 's') goto yy742;
@@ -4148,9 +4153,9 @@ yy629:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 296 "src/ast-lexer.cc"
+#line 301 "src/ast-lexer.cc"
{ OPCODE(I64_CTZ); RETURN(UNARY); }
-#line 4154 "src/prebuilt/ast-lexer-gen.cc"
+#line 4159 "src/prebuilt/ast-lexer-gen.cc"
yy631:
yych = *++lexer->cursor;
if (yych == '_') goto yy743;
@@ -4160,9 +4165,9 @@ yy632:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 292 "src/ast-lexer.cc"
+#line 297 "src/ast-lexer.cc"
{ OPCODE(I64_EQZ); RETURN(CONVERT); }
-#line 4166 "src/prebuilt/ast-lexer-gen.cc"
+#line 4171 "src/prebuilt/ast-lexer-gen.cc"
yy634:
yych = *++lexer->cursor;
if (yych == 'e') goto yy744;
@@ -4196,9 +4201,9 @@ yy640:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 318 "src/ast-lexer.cc"
+#line 323 "src/ast-lexer.cc"
{ OPCODE(I64_MUL); RETURN(BINARY); }
-#line 4202 "src/prebuilt/ast-lexer-gen.cc"
+#line 4207 "src/prebuilt/ast-lexer-gen.cc"
yy642:
yych = *++lexer->cursor;
if (yych == 'c') goto yy763;
@@ -4221,9 +4226,9 @@ yy646:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 334 "src/ast-lexer.cc"
+#line 339 "src/ast-lexer.cc"
{ OPCODE(I64_SHL); RETURN(BINARY); }
-#line 4227 "src/prebuilt/ast-lexer-gen.cc"
+#line 4232 "src/prebuilt/ast-lexer-gen.cc"
yy648:
yych = *++lexer->cursor;
if (yych == '_') goto yy770;
@@ -4237,9 +4242,9 @@ yy650:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 316 "src/ast-lexer.cc"
+#line 321 "src/ast-lexer.cc"
{ OPCODE(I64_SUB); RETURN(BINARY); }
-#line 4243 "src/prebuilt/ast-lexer-gen.cc"
+#line 4248 "src/prebuilt/ast-lexer-gen.cc"
yy652:
yych = *++lexer->cursor;
if (yych == 'n') goto yy772;
@@ -4249,17 +4254,17 @@ yy653:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 332 "src/ast-lexer.cc"
+#line 337 "src/ast-lexer.cc"
{ OPCODE(I64_XOR); RETURN(BINARY); }
-#line 4255 "src/prebuilt/ast-lexer-gen.cc"
+#line 4260 "src/prebuilt/ast-lexer-gen.cc"
yy655:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 244 "src/ast-lexer.cc"
+#line 249 "src/ast-lexer.cc"
{ RETURN(IF); }
-#line 4263 "src/prebuilt/ast-lexer-gen.cc"
+#line 4268 "src/prebuilt/ast-lexer-gen.cc"
yy657:
yych = *++lexer->cursor;
if (yych == 'y') goto yy773;
@@ -4377,9 +4382,9 @@ yy673:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 250 "src/ast-lexer.cc"
+#line 255 "src/ast-lexer.cc"
{ RETURN(BR_TABLE); }
-#line 4383 "src/prebuilt/ast-lexer-gen.cc"
+#line 4388 "src/prebuilt/ast-lexer-gen.cc"
yy675:
yych = *++lexer->cursor;
if (yych == 'o') goto yy792;
@@ -4397,9 +4402,9 @@ yy678:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 305 "src/ast-lexer.cc"
+#line 310 "src/ast-lexer.cc"
{ OPCODE(F32_CEIL); RETURN(UNARY); }
-#line 4403 "src/prebuilt/ast-lexer-gen.cc"
+#line 4408 "src/prebuilt/ast-lexer-gen.cc"
yy680:
yych = *++lexer->cursor;
if (yych == 't') goto yy795;
@@ -4425,9 +4430,9 @@ yy685:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 264 "src/ast-lexer.cc"
+#line 269 "src/ast-lexer.cc"
{ OPCODE(F32_LOAD); RETURN(LOAD); }
-#line 4431 "src/prebuilt/ast-lexer-gen.cc"
+#line 4436 "src/prebuilt/ast-lexer-gen.cc"
yy687:
yych = *++lexer->cursor;
if (yych == 'e') goto yy802;
@@ -4441,9 +4446,9 @@ yy689:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 303 "src/ast-lexer.cc"
+#line 308 "src/ast-lexer.cc"
{ OPCODE(F32_SQRT); RETURN(UNARY); }
-#line 4447 "src/prebuilt/ast-lexer-gen.cc"
+#line 4452 "src/prebuilt/ast-lexer-gen.cc"
yy691:
yych = *++lexer->cursor;
if (yych == 'e') goto yy804;
@@ -4457,9 +4462,9 @@ yy693:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 306 "src/ast-lexer.cc"
+#line 311 "src/ast-lexer.cc"
{ OPCODE(F64_CEIL); RETURN(UNARY); }
-#line 4463 "src/prebuilt/ast-lexer-gen.cc"
+#line 4468 "src/prebuilt/ast-lexer-gen.cc"
yy695:
yych = *++lexer->cursor;
if (yych == 't') goto yy808;
@@ -4481,9 +4486,9 @@ yy699:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 265 "src/ast-lexer.cc"
+#line 270 "src/ast-lexer.cc"
{ OPCODE(F64_LOAD); RETURN(LOAD); }
-#line 4487 "src/prebuilt/ast-lexer-gen.cc"
+#line 4492 "src/prebuilt/ast-lexer-gen.cc"
yy701:
yych = *++lexer->cursor;
if (yych == 'e') goto yy814;
@@ -4501,9 +4506,9 @@ yy704:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 304 "src/ast-lexer.cc"
+#line 309 "src/ast-lexer.cc"
{ OPCODE(F64_SQRT); RETURN(UNARY); }
-#line 4507 "src/prebuilt/ast-lexer-gen.cc"
+#line 4512 "src/prebuilt/ast-lexer-gen.cc"
yy706:
yych = *++lexer->cursor;
if (yych == 'e') goto yy817;
@@ -4538,49 +4543,49 @@ yy713:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 373 "src/ast-lexer.cc"
+#line 378 "src/ast-lexer.cc"
{ OPCODE(I32_GE_S); RETURN(COMPARE); }
-#line 4544 "src/prebuilt/ast-lexer-gen.cc"
+#line 4549 "src/prebuilt/ast-lexer-gen.cc"
yy715:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 375 "src/ast-lexer.cc"
+#line 380 "src/ast-lexer.cc"
{ OPCODE(I32_GE_U); RETURN(COMPARE); }
-#line 4552 "src/prebuilt/ast-lexer-gen.cc"
+#line 4557 "src/prebuilt/ast-lexer-gen.cc"
yy717:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 369 "src/ast-lexer.cc"
+#line 374 "src/ast-lexer.cc"
{ OPCODE(I32_GT_S); RETURN(COMPARE); }
-#line 4560 "src/prebuilt/ast-lexer-gen.cc"
+#line 4565 "src/prebuilt/ast-lexer-gen.cc"
yy719:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 371 "src/ast-lexer.cc"
+#line 376 "src/ast-lexer.cc"
{ OPCODE(I32_GT_U); RETURN(COMPARE); }
-#line 4568 "src/prebuilt/ast-lexer-gen.cc"
+#line 4573 "src/prebuilt/ast-lexer-gen.cc"
yy721:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 365 "src/ast-lexer.cc"
+#line 370 "src/ast-lexer.cc"
{ OPCODE(I32_LE_S); RETURN(COMPARE); }
-#line 4576 "src/prebuilt/ast-lexer-gen.cc"
+#line 4581 "src/prebuilt/ast-lexer-gen.cc"
yy723:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 367 "src/ast-lexer.cc"
+#line 372 "src/ast-lexer.cc"
{ OPCODE(I32_LE_U); RETURN(COMPARE); }
-#line 4584 "src/prebuilt/ast-lexer-gen.cc"
+#line 4589 "src/prebuilt/ast-lexer-gen.cc"
yy725:
++lexer->cursor;
if ((yych = *lexer->cursor) <= '8') {
@@ -4616,25 +4621,25 @@ yy725:
}
}
yy726:
-#line 262 "src/ast-lexer.cc"
+#line 267 "src/ast-lexer.cc"
{ OPCODE(I32_LOAD); RETURN(LOAD); }
-#line 4622 "src/prebuilt/ast-lexer-gen.cc"
+#line 4627 "src/prebuilt/ast-lexer-gen.cc"
yy727:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 361 "src/ast-lexer.cc"
+#line 366 "src/ast-lexer.cc"
{ OPCODE(I32_LT_S); RETURN(COMPARE); }
-#line 4630 "src/prebuilt/ast-lexer-gen.cc"
+#line 4635 "src/prebuilt/ast-lexer-gen.cc"
yy729:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 363 "src/ast-lexer.cc"
+#line 368 "src/ast-lexer.cc"
{ OPCODE(I32_LT_U); RETURN(COMPARE); }
-#line 4638 "src/prebuilt/ast-lexer-gen.cc"
+#line 4643 "src/prebuilt/ast-lexer-gen.cc"
yy731:
yych = *++lexer->cursor;
if (yych == 'n') goto yy833;
@@ -4653,17 +4658,17 @@ yy734:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 339 "src/ast-lexer.cc"
+#line 344 "src/ast-lexer.cc"
{ OPCODE(I32_ROTL); RETURN(BINARY); }
-#line 4659 "src/prebuilt/ast-lexer-gen.cc"
+#line 4664 "src/prebuilt/ast-lexer-gen.cc"
yy736:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 341 "src/ast-lexer.cc"
+#line 346 "src/ast-lexer.cc"
{ OPCODE(I32_ROTR); RETURN(BINARY); }
-#line 4667 "src/prebuilt/ast-lexer-gen.cc"
+#line 4672 "src/prebuilt/ast-lexer-gen.cc"
yy738:
yych = *++lexer->cursor;
if (yych == 's') goto yy839;
@@ -4699,49 +4704,49 @@ yy745:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 374 "src/ast-lexer.cc"
+#line 379 "src/ast-lexer.cc"
{ OPCODE(I64_GE_S); RETURN(COMPARE); }
-#line 4705 "src/prebuilt/ast-lexer-gen.cc"
+#line 4710 "src/prebuilt/ast-lexer-gen.cc"
yy747:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 376 "src/ast-lexer.cc"
+#line 381 "src/ast-lexer.cc"
{ OPCODE(I64_GE_U); RETURN(COMPARE); }
-#line 4713 "src/prebuilt/ast-lexer-gen.cc"
+#line 4718 "src/prebuilt/ast-lexer-gen.cc"
yy749:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 370 "src/ast-lexer.cc"
+#line 375 "src/ast-lexer.cc"
{ OPCODE(I64_GT_S); RETURN(COMPARE); }
-#line 4721 "src/prebuilt/ast-lexer-gen.cc"
+#line 4726 "src/prebuilt/ast-lexer-gen.cc"
yy751:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 372 "src/ast-lexer.cc"
+#line 377 "src/ast-lexer.cc"
{ OPCODE(I64_GT_U); RETURN(COMPARE); }
-#line 4729 "src/prebuilt/ast-lexer-gen.cc"
+#line 4734 "src/prebuilt/ast-lexer-gen.cc"
yy753:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 366 "src/ast-lexer.cc"
+#line 371 "src/ast-lexer.cc"
{ OPCODE(I64_LE_S); RETURN(COMPARE); }
-#line 4737 "src/prebuilt/ast-lexer-gen.cc"
+#line 4742 "src/prebuilt/ast-lexer-gen.cc"
yy755:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 368 "src/ast-lexer.cc"
+#line 373 "src/ast-lexer.cc"
{ OPCODE(I64_LE_U); RETURN(COMPARE); }
-#line 4745 "src/prebuilt/ast-lexer-gen.cc"
+#line 4750 "src/prebuilt/ast-lexer-gen.cc"
yy757:
++lexer->cursor;
if ((yych = *lexer->cursor) <= '7') {
@@ -4781,25 +4786,25 @@ yy757:
}
}
yy758:
-#line 263 "src/ast-lexer.cc"
+#line 268 "src/ast-lexer.cc"
{ OPCODE(I64_LOAD); RETURN(LOAD); }
-#line 4787 "src/prebuilt/ast-lexer-gen.cc"
+#line 4792 "src/prebuilt/ast-lexer-gen.cc"
yy759:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 362 "src/ast-lexer.cc"
+#line 367 "src/ast-lexer.cc"
{ OPCODE(I64_LT_S); RETURN(COMPARE); }
-#line 4795 "src/prebuilt/ast-lexer-gen.cc"
+#line 4800 "src/prebuilt/ast-lexer-gen.cc"
yy761:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 364 "src/ast-lexer.cc"
+#line 369 "src/ast-lexer.cc"
{ OPCODE(I64_LT_U); RETURN(COMPARE); }
-#line 4803 "src/prebuilt/ast-lexer-gen.cc"
+#line 4808 "src/prebuilt/ast-lexer-gen.cc"
yy763:
yych = *++lexer->cursor;
if (yych == 'n') goto yy857;
@@ -4818,17 +4823,17 @@ yy766:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 340 "src/ast-lexer.cc"
+#line 345 "src/ast-lexer.cc"
{ OPCODE(I64_ROTL); RETURN(BINARY); }
-#line 4824 "src/prebuilt/ast-lexer-gen.cc"
+#line 4829 "src/prebuilt/ast-lexer-gen.cc"
yy768:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 342 "src/ast-lexer.cc"
+#line 347 "src/ast-lexer.cc"
{ OPCODE(I64_ROTR); RETURN(BINARY); }
-#line 4832 "src/prebuilt/ast-lexer-gen.cc"
+#line 4837 "src/prebuilt/ast-lexer-gen.cc"
yy770:
yych = *++lexer->cursor;
if (yych == 's') goto yy863;
@@ -4884,9 +4889,9 @@ yy774:
}
}
yy775:
-#line 285 "src/ast-lexer.cc"
+#line 290 "src/ast-lexer.cc"
{ TEXT_AT(7); RETURN(OFFSET_EQ_NAT); }
-#line 4890 "src/prebuilt/ast-lexer-gen.cc"
+#line 4895 "src/prebuilt/ast-lexer-gen.cc"
yy776:
++lexer->cursor;
if (lexer->limit <= lexer->cursor) FILL(1);
@@ -4935,9 +4940,9 @@ yy778:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 433 "src/ast-lexer.cc"
+#line 442 "src/ast-lexer.cc"
{ RETURN(REGISTER); }
-#line 4941 "src/prebuilt/ast-lexer-gen.cc"
+#line 4946 "src/prebuilt/ast-lexer-gen.cc"
yy780:
yych = *++lexer->cursor;
if (yych == 'a') goto yy871;
@@ -5041,9 +5046,9 @@ yy795:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 289 "src/ast-lexer.cc"
+#line 294 "src/ast-lexer.cc"
{ TYPE(F32); RETURN(CONST); }
-#line 5047 "src/prebuilt/ast-lexer-gen.cc"
+#line 5052 "src/prebuilt/ast-lexer-gen.cc"
yy797:
yych = *++lexer->cursor;
if (yych == 'r') goto yy886;
@@ -5061,9 +5066,9 @@ yy800:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 307 "src/ast-lexer.cc"
+#line 312 "src/ast-lexer.cc"
{ OPCODE(F32_FLOOR); RETURN(UNARY); }
-#line 5067 "src/prebuilt/ast-lexer-gen.cc"
+#line 5072 "src/prebuilt/ast-lexer-gen.cc"
yy802:
yych = *++lexer->cursor;
if (yych == 's') goto yy889;
@@ -5077,25 +5082,25 @@ yy804:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 268 "src/ast-lexer.cc"
+#line 273 "src/ast-lexer.cc"
{ OPCODE(F32_STORE); RETURN(STORE); }
-#line 5083 "src/prebuilt/ast-lexer-gen.cc"
+#line 5088 "src/prebuilt/ast-lexer-gen.cc"
yy806:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 309 "src/ast-lexer.cc"
+#line 314 "src/ast-lexer.cc"
{ OPCODE(F32_TRUNC); RETURN(UNARY); }
-#line 5091 "src/prebuilt/ast-lexer-gen.cc"
+#line 5096 "src/prebuilt/ast-lexer-gen.cc"
yy808:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 290 "src/ast-lexer.cc"
+#line 295 "src/ast-lexer.cc"
{ TYPE(F64); RETURN(CONST); }
-#line 5099 "src/prebuilt/ast-lexer-gen.cc"
+#line 5104 "src/prebuilt/ast-lexer-gen.cc"
yy810:
yych = *++lexer->cursor;
if (yych == 'r') goto yy891;
@@ -5109,9 +5114,9 @@ yy812:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 308 "src/ast-lexer.cc"
+#line 313 "src/ast-lexer.cc"
{ OPCODE(F64_FLOOR); RETURN(UNARY); }
-#line 5115 "src/prebuilt/ast-lexer-gen.cc"
+#line 5120 "src/prebuilt/ast-lexer-gen.cc"
yy814:
yych = *++lexer->cursor;
if (yych == 's') goto yy893;
@@ -5129,17 +5134,17 @@ yy817:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 269 "src/ast-lexer.cc"
+#line 274 "src/ast-lexer.cc"
{ OPCODE(F64_STORE); RETURN(STORE); }
-#line 5135 "src/prebuilt/ast-lexer-gen.cc"
+#line 5140 "src/prebuilt/ast-lexer-gen.cc"
yy819:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 310 "src/ast-lexer.cc"
+#line 315 "src/ast-lexer.cc"
{ OPCODE(F64_TRUNC); RETURN(UNARY); }
-#line 5143 "src/prebuilt/ast-lexer-gen.cc"
+#line 5148 "src/prebuilt/ast-lexer-gen.cc"
yy821:
yych = *++lexer->cursor;
if (yych == 'l') goto yy896;
@@ -5149,9 +5154,9 @@ yy822:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 257 "src/ast-lexer.cc"
+#line 262 "src/ast-lexer.cc"
{ RETURN(GET_LOCAL); }
-#line 5155 "src/prebuilt/ast-lexer-gen.cc"
+#line 5160 "src/prebuilt/ast-lexer-gen.cc"
yy824:
yych = *++lexer->cursor;
if (yych == 'r') goto yy898;
@@ -5161,25 +5166,25 @@ yy825:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 287 "src/ast-lexer.cc"
+#line 292 "src/ast-lexer.cc"
{ TYPE(I32); RETURN(CONST); }
-#line 5167 "src/prebuilt/ast-lexer-gen.cc"
+#line 5172 "src/prebuilt/ast-lexer-gen.cc"
yy827:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 319 "src/ast-lexer.cc"
+#line 324 "src/ast-lexer.cc"
{ OPCODE(I32_DIV_S); RETURN(BINARY); }
-#line 5175 "src/prebuilt/ast-lexer-gen.cc"
+#line 5180 "src/prebuilt/ast-lexer-gen.cc"
yy829:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 321 "src/ast-lexer.cc"
+#line 326 "src/ast-lexer.cc"
{ OPCODE(I32_DIV_U); RETURN(BINARY); }
-#line 5183 "src/prebuilt/ast-lexer-gen.cc"
+#line 5188 "src/prebuilt/ast-lexer-gen.cc"
yy831:
yych = *++lexer->cursor;
if (yych == '6') goto yy899;
@@ -5201,33 +5206,33 @@ yy835:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 323 "src/ast-lexer.cc"
+#line 328 "src/ast-lexer.cc"
{ OPCODE(I32_REM_S); RETURN(BINARY); }
-#line 5207 "src/prebuilt/ast-lexer-gen.cc"
+#line 5212 "src/prebuilt/ast-lexer-gen.cc"
yy837:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 325 "src/ast-lexer.cc"
+#line 330 "src/ast-lexer.cc"
{ OPCODE(I32_REM_U); RETURN(BINARY); }
-#line 5215 "src/prebuilt/ast-lexer-gen.cc"
+#line 5220 "src/prebuilt/ast-lexer-gen.cc"
yy839:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 335 "src/ast-lexer.cc"
+#line 340 "src/ast-lexer.cc"
{ OPCODE(I32_SHR_S); RETURN(BINARY); }
-#line 5223 "src/prebuilt/ast-lexer-gen.cc"
+#line 5228 "src/prebuilt/ast-lexer-gen.cc"
yy841:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 337 "src/ast-lexer.cc"
+#line 342 "src/ast-lexer.cc"
{ OPCODE(I32_SHR_U); RETURN(BINARY); }
-#line 5231 "src/prebuilt/ast-lexer-gen.cc"
+#line 5236 "src/prebuilt/ast-lexer-gen.cc"
yy843:
++lexer->cursor;
if ((yych = *lexer->cursor) <= '8') {
@@ -5263,9 +5268,9 @@ yy843:
}
}
yy844:
-#line 266 "src/ast-lexer.cc"
+#line 271 "src/ast-lexer.cc"
{ OPCODE(I32_STORE); RETURN(STORE); }
-#line 5269 "src/prebuilt/ast-lexer-gen.cc"
+#line 5274 "src/prebuilt/ast-lexer-gen.cc"
yy845:
yych = *++lexer->cursor;
if (yych == '_') goto yy907;
@@ -5279,25 +5284,25 @@ yy847:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 288 "src/ast-lexer.cc"
+#line 293 "src/ast-lexer.cc"
{ TYPE(I64); RETURN(CONST); }
-#line 5285 "src/prebuilt/ast-lexer-gen.cc"
+#line 5290 "src/prebuilt/ast-lexer-gen.cc"
yy849:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 320 "src/ast-lexer.cc"
+#line 325 "src/ast-lexer.cc"
{ OPCODE(I64_DIV_S); RETURN(BINARY); }
-#line 5293 "src/prebuilt/ast-lexer-gen.cc"
+#line 5298 "src/prebuilt/ast-lexer-gen.cc"
yy851:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 322 "src/ast-lexer.cc"
+#line 327 "src/ast-lexer.cc"
{ OPCODE(I64_DIV_U); RETURN(BINARY); }
-#line 5301 "src/prebuilt/ast-lexer-gen.cc"
+#line 5306 "src/prebuilt/ast-lexer-gen.cc"
yy853:
yych = *++lexer->cursor;
if (yych == 'd') goto yy909;
@@ -5327,33 +5332,33 @@ yy859:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 324 "src/ast-lexer.cc"
+#line 329 "src/ast-lexer.cc"
{ OPCODE(I64_REM_S); RETURN(BINARY); }
-#line 5333 "src/prebuilt/ast-lexer-gen.cc"
+#line 5338 "src/prebuilt/ast-lexer-gen.cc"
yy861:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 326 "src/ast-lexer.cc"
+#line 331 "src/ast-lexer.cc"
{ OPCODE(I64_REM_U); RETURN(BINARY); }
-#line 5341 "src/prebuilt/ast-lexer-gen.cc"
+#line 5346 "src/prebuilt/ast-lexer-gen.cc"
yy863:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 336 "src/ast-lexer.cc"
+#line 341 "src/ast-lexer.cc"
{ OPCODE(I64_SHR_S); RETURN(BINARY); }
-#line 5349 "src/prebuilt/ast-lexer-gen.cc"
+#line 5354 "src/prebuilt/ast-lexer-gen.cc"
yy865:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 338 "src/ast-lexer.cc"
+#line 343 "src/ast-lexer.cc"
{ OPCODE(I64_SHR_U); RETURN(BINARY); }
-#line 5357 "src/prebuilt/ast-lexer-gen.cc"
+#line 5362 "src/prebuilt/ast-lexer-gen.cc"
yy867:
++lexer->cursor;
if ((yych = *lexer->cursor) <= '7') {
@@ -5393,9 +5398,9 @@ yy867:
}
}
yy868:
-#line 267 "src/ast-lexer.cc"
+#line 272 "src/ast-lexer.cc"
{ OPCODE(I64_STORE); RETURN(STORE); }
-#line 5399 "src/prebuilt/ast-lexer-gen.cc"
+#line 5404 "src/prebuilt/ast-lexer-gen.cc"
yy869:
yych = *++lexer->cursor;
if (yych == '_') goto yy920;
@@ -5421,17 +5426,17 @@ yy872:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 258 "src/ast-lexer.cc"
+#line 263 "src/ast-lexer.cc"
{ RETURN(SET_LOCAL); }
-#line 5427 "src/prebuilt/ast-lexer-gen.cc"
+#line 5432 "src/prebuilt/ast-lexer-gen.cc"
yy874:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 259 "src/ast-lexer.cc"
+#line 264 "src/ast-lexer.cc"
{ RETURN(TEE_LOCAL); }
-#line 5435 "src/prebuilt/ast-lexer-gen.cc"
+#line 5440 "src/prebuilt/ast-lexer-gen.cc"
yy876:
yych = *++lexer->cursor;
if (yych == 'l') goto yy925;
@@ -5517,9 +5522,9 @@ yy896:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 260 "src/ast-lexer.cc"
+#line 265 "src/ast-lexer.cc"
{ RETURN(GET_GLOBAL); }
-#line 5523 "src/prebuilt/ast-lexer-gen.cc"
+#line 5528 "src/prebuilt/ast-lexer-gen.cc"
yy898:
yych = *++lexer->cursor;
if (yych == 'y') goto yy949;
@@ -5538,9 +5543,9 @@ yy901:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 297 "src/ast-lexer.cc"
+#line 302 "src/ast-lexer.cc"
{ OPCODE(I32_POPCNT); RETURN(UNARY); }
-#line 5544 "src/prebuilt/ast-lexer-gen.cc"
+#line 5549 "src/prebuilt/ast-lexer-gen.cc"
yy903:
yych = *++lexer->cursor;
if (yych == 'r') goto yy956;
@@ -5554,9 +5559,9 @@ yy905:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 280 "src/ast-lexer.cc"
+#line 285 "src/ast-lexer.cc"
{ OPCODE(I32_STORE8); RETURN(STORE); }
-#line 5560 "src/prebuilt/ast-lexer-gen.cc"
+#line 5565 "src/prebuilt/ast-lexer-gen.cc"
yy907:
yych = *++lexer->cursor;
if (yych == 's') goto yy959;
@@ -5588,9 +5593,9 @@ yy913:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 298 "src/ast-lexer.cc"
+#line 303 "src/ast-lexer.cc"
{ OPCODE(I64_POPCNT); RETURN(UNARY); }
-#line 5594 "src/prebuilt/ast-lexer-gen.cc"
+#line 5599 "src/prebuilt/ast-lexer-gen.cc"
yy915:
yych = *++lexer->cursor;
if (yych == 'r') goto yy969;
@@ -5608,9 +5613,9 @@ yy918:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 281 "src/ast-lexer.cc"
+#line 286 "src/ast-lexer.cc"
{ OPCODE(I64_STORE8); RETURN(STORE); }
-#line 5614 "src/prebuilt/ast-lexer-gen.cc"
+#line 5619 "src/prebuilt/ast-lexer-gen.cc"
yy920:
yych = *++lexer->cursor;
if (yych == 's') goto yy974;
@@ -5667,9 +5672,9 @@ yy923:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 261 "src/ast-lexer.cc"
+#line 266 "src/ast-lexer.cc"
{ RETURN(SET_GLOBAL); }
-#line 5673 "src/prebuilt/ast-lexer-gen.cc"
+#line 5678 "src/prebuilt/ast-lexer-gen.cc"
yy925:
yych = *++lexer->cursor;
if (yych == 'e') goto yy976;
@@ -5695,9 +5700,9 @@ yy930:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 441 "src/ast-lexer.cc"
+#line 450 "src/ast-lexer.cc"
{ RETURN(ASSERT_TRAP); }
-#line 5701 "src/prebuilt/ast-lexer-gen.cc"
+#line 5706 "src/prebuilt/ast-lexer-gen.cc"
yy932:
yych = *++lexer->cursor;
if (yych == 'n') goto yy982;
@@ -5707,9 +5712,9 @@ yy933:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 252 "src/ast-lexer.cc"
+#line 257 "src/ast-lexer.cc"
{ RETURN(CALL_IMPORT); }
-#line 5713 "src/prebuilt/ast-lexer-gen.cc"
+#line 5718 "src/prebuilt/ast-lexer-gen.cc"
yy935:
yych = *++lexer->cursor;
if (yych == 'c') goto yy983;
@@ -5735,9 +5740,9 @@ yy940:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 311 "src/ast-lexer.cc"
+#line 316 "src/ast-lexer.cc"
{ OPCODE(F32_NEAREST); RETURN(UNARY); }
-#line 5741 "src/prebuilt/ast-lexer-gen.cc"
+#line 5746 "src/prebuilt/ast-lexer-gen.cc"
yy942:
yych = *++lexer->cursor;
if (yych == 'p') goto yy989;
@@ -5755,9 +5760,9 @@ yy945:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 312 "src/ast-lexer.cc"
+#line 317 "src/ast-lexer.cc"
{ OPCODE(F64_NEAREST); RETURN(UNARY); }
-#line 5761 "src/prebuilt/ast-lexer-gen.cc"
+#line 5766 "src/prebuilt/ast-lexer-gen.cc"
yy947:
yych = *++lexer->cursor;
if (yych == '/') goto yy993;
@@ -5771,9 +5776,9 @@ yy949:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 417 "src/ast-lexer.cc"
+#line 426 "src/ast-lexer.cc"
{ RETURN(GROW_MEMORY); }
-#line 5777 "src/prebuilt/ast-lexer-gen.cc"
+#line 5782 "src/prebuilt/ast-lexer-gen.cc"
yy951:
yych = *++lexer->cursor;
if (yych == 's') goto yy995;
@@ -5784,17 +5789,17 @@ yy952:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 270 "src/ast-lexer.cc"
+#line 275 "src/ast-lexer.cc"
{ OPCODE(I32_LOAD8_S); RETURN(LOAD); }
-#line 5790 "src/prebuilt/ast-lexer-gen.cc"
+#line 5795 "src/prebuilt/ast-lexer-gen.cc"
yy954:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 272 "src/ast-lexer.cc"
+#line 277 "src/ast-lexer.cc"
{ OPCODE(I32_LOAD8_U); RETURN(LOAD); }
-#line 5798 "src/prebuilt/ast-lexer-gen.cc"
+#line 5803 "src/prebuilt/ast-lexer-gen.cc"
yy956:
yych = *++lexer->cursor;
if (yych == 'p') goto yy999;
@@ -5804,9 +5809,9 @@ yy957:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 282 "src/ast-lexer.cc"
+#line 287 "src/ast-lexer.cc"
{ OPCODE(I32_STORE16); RETURN(STORE); }
-#line 5810 "src/prebuilt/ast-lexer-gen.cc"
+#line 5815 "src/prebuilt/ast-lexer-gen.cc"
yy959:
yych = *++lexer->cursor;
if (yych == '/') goto yy1000;
@@ -5839,17 +5844,17 @@ yy965:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 271 "src/ast-lexer.cc"
+#line 276 "src/ast-lexer.cc"
{ OPCODE(I64_LOAD8_S); RETURN(LOAD); }
-#line 5845 "src/prebuilt/ast-lexer-gen.cc"
+#line 5850 "src/prebuilt/ast-lexer-gen.cc"
yy967:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 273 "src/ast-lexer.cc"
+#line 278 "src/ast-lexer.cc"
{ OPCODE(I64_LOAD8_U); RETURN(LOAD); }
-#line 5853 "src/prebuilt/ast-lexer-gen.cc"
+#line 5858 "src/prebuilt/ast-lexer-gen.cc"
yy969:
yych = *++lexer->cursor;
if (yych == 'p') goto yy1014;
@@ -5859,17 +5864,17 @@ yy970:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 283 "src/ast-lexer.cc"
+#line 288 "src/ast-lexer.cc"
{ OPCODE(I64_STORE16); RETURN(STORE); }
-#line 5865 "src/prebuilt/ast-lexer-gen.cc"
+#line 5870 "src/prebuilt/ast-lexer-gen.cc"
yy972:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 284 "src/ast-lexer.cc"
+#line 289 "src/ast-lexer.cc"
{ OPCODE(I64_STORE32); RETURN(STORE); }
-#line 5873 "src/prebuilt/ast-lexer-gen.cc"
+#line 5878 "src/prebuilt/ast-lexer-gen.cc"
yy974:
yych = *++lexer->cursor;
if (yych == '/') goto yy1015;
@@ -5883,9 +5888,9 @@ yy976:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 415 "src/ast-lexer.cc"
+#line 424 "src/ast-lexer.cc"
{ RETURN(UNREACHABLE); }
-#line 5889 "src/prebuilt/ast-lexer-gen.cc"
+#line 5894 "src/prebuilt/ast-lexer-gen.cc"
yy978:
yych = *++lexer->cursor;
if (yych == 's') goto yy1017;
@@ -5924,9 +5929,9 @@ yy986:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 355 "src/ast-lexer.cc"
+#line 360 "src/ast-lexer.cc"
{ OPCODE(F32_COPYSIGN); RETURN(BINARY); }
-#line 5930 "src/prebuilt/ast-lexer-gen.cc"
+#line 5935 "src/prebuilt/ast-lexer-gen.cc"
yy988:
yych = *++lexer->cursor;
if (yych == '6') goto yy1028;
@@ -5945,9 +5950,9 @@ yy991:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 356 "src/ast-lexer.cc"
+#line 361 "src/ast-lexer.cc"
{ OPCODE(F64_COPYSIGN); RETURN(BINARY); }
-#line 5951 "src/prebuilt/ast-lexer-gen.cc"
+#line 5956 "src/prebuilt/ast-lexer-gen.cc"
yy993:
yych = *++lexer->cursor;
if (yych == 'f') goto yy1032;
@@ -5961,17 +5966,17 @@ yy995:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 274 "src/ast-lexer.cc"
+#line 279 "src/ast-lexer.cc"
{ OPCODE(I32_LOAD16_S); RETURN(LOAD); }
-#line 5967 "src/prebuilt/ast-lexer-gen.cc"
+#line 5972 "src/prebuilt/ast-lexer-gen.cc"
yy997:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 276 "src/ast-lexer.cc"
+#line 281 "src/ast-lexer.cc"
{ OPCODE(I32_LOAD16_U); RETURN(LOAD); }
-#line 5975 "src/prebuilt/ast-lexer-gen.cc"
+#line 5980 "src/prebuilt/ast-lexer-gen.cc"
yy999:
yych = *++lexer->cursor;
if (yych == 'r') goto yy1034;
@@ -5989,9 +5994,9 @@ yy1002:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 391 "src/ast-lexer.cc"
+#line 396 "src/ast-lexer.cc"
{ OPCODE(I32_WRAP_I64); RETURN(CONVERT); }
-#line 5995 "src/prebuilt/ast-lexer-gen.cc"
+#line 6000 "src/prebuilt/ast-lexer-gen.cc"
yy1004:
yych = *++lexer->cursor;
if (yych == '/') goto yy1037;
@@ -6005,33 +6010,33 @@ yy1006:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 275 "src/ast-lexer.cc"
+#line 280 "src/ast-lexer.cc"
{ OPCODE(I64_LOAD16_S); RETURN(LOAD); }
-#line 6011 "src/prebuilt/ast-lexer-gen.cc"
+#line 6016 "src/prebuilt/ast-lexer-gen.cc"
yy1008:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 277 "src/ast-lexer.cc"
+#line 282 "src/ast-lexer.cc"
{ OPCODE(I64_LOAD16_U); RETURN(LOAD); }
-#line 6019 "src/prebuilt/ast-lexer-gen.cc"
+#line 6024 "src/prebuilt/ast-lexer-gen.cc"
yy1010:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 278 "src/ast-lexer.cc"
+#line 283 "src/ast-lexer.cc"
{ OPCODE(I64_LOAD32_S); RETURN(LOAD); }
-#line 6027 "src/prebuilt/ast-lexer-gen.cc"
+#line 6032 "src/prebuilt/ast-lexer-gen.cc"
yy1012:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 279 "src/ast-lexer.cc"
+#line 284 "src/ast-lexer.cc"
{ OPCODE(I64_LOAD32_U); RETURN(LOAD); }
-#line 6035 "src/prebuilt/ast-lexer-gen.cc"
+#line 6040 "src/prebuilt/ast-lexer-gen.cc"
yy1014:
yych = *++lexer->cursor;
if (yych == 'r') goto yy1039;
@@ -6091,9 +6096,9 @@ yy1020:
}
}
yy1021:
-#line 439 "src/ast-lexer.cc"
+#line 448 "src/ast-lexer.cc"
{ RETURN(ASSERT_RETURN); }
-#line 6097 "src/prebuilt/ast-lexer-gen.cc"
+#line 6102 "src/prebuilt/ast-lexer-gen.cc"
yy1022:
yych = *++lexer->cursor;
if (yych == 'a') goto yy1047;
@@ -6103,9 +6108,9 @@ yy1023:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 253 "src/ast-lexer.cc"
+#line 258 "src/ast-lexer.cc"
{ RETURN(CALL_INDIRECT); }
-#line 6109 "src/prebuilt/ast-lexer-gen.cc"
+#line 6114 "src/prebuilt/ast-lexer-gen.cc"
yy1025:
yych = *++lexer->cursor;
if (yych == 'y') goto yy1048;
@@ -6187,9 +6192,9 @@ yy1043:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 437 "src/ast-lexer.cc"
+#line 446 "src/ast-lexer.cc"
{ RETURN(ASSERT_INVALID); }
-#line 6193 "src/prebuilt/ast-lexer-gen.cc"
+#line 6198 "src/prebuilt/ast-lexer-gen.cc"
yy1045:
yych = *++lexer->cursor;
if (yych == 'e') goto yy1072;
@@ -6207,9 +6212,9 @@ yy1048:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 416 "src/ast-lexer.cc"
+#line 425 "src/ast-lexer.cc"
{ RETURN(CURRENT_MEMORY); }
-#line 6213 "src/prebuilt/ast-lexer-gen.cc"
+#line 6218 "src/prebuilt/ast-lexer-gen.cc"
yy1050:
yych = *++lexer->cursor;
if (yych == 'i') goto yy1075;
@@ -6223,9 +6228,9 @@ yy1052:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 409 "src/ast-lexer.cc"
+#line 414 "src/ast-lexer.cc"
{ OPCODE(F32_DEMOTE_F64); RETURN(CONVERT); }
-#line 6229 "src/prebuilt/ast-lexer-gen.cc"
+#line 6234 "src/prebuilt/ast-lexer-gen.cc"
yy1054:
yych = *++lexer->cursor;
if (yych == 't') goto yy1077;
@@ -6339,9 +6344,9 @@ yy1080:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 408 "src/ast-lexer.cc"
+#line 413 "src/ast-lexer.cc"
{ OPCODE(F64_PROMOTE_F32); RETURN(CONVERT); }
-#line 6345 "src/prebuilt/ast-lexer-gen.cc"
+#line 6350 "src/prebuilt/ast-lexer-gen.cc"
yy1082:
yych = *++lexer->cursor;
if (yych == '/') goto yy1117;
@@ -6355,33 +6360,33 @@ yy1084:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 392 "src/ast-lexer.cc"
+#line 397 "src/ast-lexer.cc"
{ OPCODE(I32_TRUNC_S_F32); RETURN(CONVERT); }
-#line 6361 "src/prebuilt/ast-lexer-gen.cc"
+#line 6366 "src/prebuilt/ast-lexer-gen.cc"
yy1086:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 394 "src/ast-lexer.cc"
+#line 399 "src/ast-lexer.cc"
{ OPCODE(I32_TRUNC_S_F64); RETURN(CONVERT); }
-#line 6369 "src/prebuilt/ast-lexer-gen.cc"
+#line 6374 "src/prebuilt/ast-lexer-gen.cc"
yy1088:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 396 "src/ast-lexer.cc"
+#line 401 "src/ast-lexer.cc"
{ OPCODE(I32_TRUNC_U_F32); RETURN(CONVERT); }
-#line 6377 "src/prebuilt/ast-lexer-gen.cc"
+#line 6382 "src/prebuilt/ast-lexer-gen.cc"
yy1090:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 398 "src/ast-lexer.cc"
+#line 403 "src/ast-lexer.cc"
{ OPCODE(I32_TRUNC_U_F64); RETURN(CONVERT); }
-#line 6385 "src/prebuilt/ast-lexer-gen.cc"
+#line 6390 "src/prebuilt/ast-lexer-gen.cc"
yy1092:
yych = *++lexer->cursor;
if (yych == '2') goto yy1119;
@@ -6399,33 +6404,33 @@ yy1095:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 393 "src/ast-lexer.cc"
+#line 398 "src/ast-lexer.cc"
{ OPCODE(I64_TRUNC_S_F32); RETURN(CONVERT); }
-#line 6405 "src/prebuilt/ast-lexer-gen.cc"
+#line 6410 "src/prebuilt/ast-lexer-gen.cc"
yy1097:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 395 "src/ast-lexer.cc"
+#line 400 "src/ast-lexer.cc"
{ OPCODE(I64_TRUNC_S_F64); RETURN(CONVERT); }
-#line 6413 "src/prebuilt/ast-lexer-gen.cc"
+#line 6418 "src/prebuilt/ast-lexer-gen.cc"
yy1099:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 397 "src/ast-lexer.cc"
+#line 402 "src/ast-lexer.cc"
{ OPCODE(I64_TRUNC_U_F32); RETURN(CONVERT); }
-#line 6421 "src/prebuilt/ast-lexer-gen.cc"
+#line 6426 "src/prebuilt/ast-lexer-gen.cc"
yy1101:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 399 "src/ast-lexer.cc"
+#line 404 "src/ast-lexer.cc"
{ OPCODE(I64_TRUNC_U_F64); RETURN(CONVERT); }
-#line 6429 "src/prebuilt/ast-lexer-gen.cc"
+#line 6434 "src/prebuilt/ast-lexer-gen.cc"
yy1103:
yych = *++lexer->cursor;
if (yych == 'n') goto yy1124;
@@ -6435,9 +6440,9 @@ yy1104:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 436 "src/ast-lexer.cc"
+#line 445 "src/ast-lexer.cc"
{ RETURN(ASSERT_MALFORMED); }
-#line 6441 "src/prebuilt/ast-lexer-gen.cc"
+#line 6446 "src/prebuilt/ast-lexer-gen.cc"
yy1106:
yych = *++lexer->cursor;
if (yych == 'n') goto yy1126;
@@ -6495,17 +6500,17 @@ yy1119:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 389 "src/ast-lexer.cc"
+#line 394 "src/ast-lexer.cc"
{ OPCODE(I64_EXTEND_S_I32); RETURN(CONVERT); }
-#line 6501 "src/prebuilt/ast-lexer-gen.cc"
+#line 6506 "src/prebuilt/ast-lexer-gen.cc"
yy1121:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 390 "src/ast-lexer.cc"
+#line 395 "src/ast-lexer.cc"
{ OPCODE(I64_EXTEND_U_I32); RETURN(CONVERT); }
-#line 6509 "src/prebuilt/ast-lexer-gen.cc"
+#line 6514 "src/prebuilt/ast-lexer-gen.cc"
yy1123:
yych = *++lexer->cursor;
if (yych == 'f') goto yy1149;
@@ -6515,57 +6520,57 @@ yy1124:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 442 "src/ast-lexer.cc"
+#line 451 "src/ast-lexer.cc"
{ RETURN(ASSERT_EXHAUSTION); }
-#line 6521 "src/prebuilt/ast-lexer-gen.cc"
+#line 6526 "src/prebuilt/ast-lexer-gen.cc"
yy1126:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 440 "src/ast-lexer.cc"
+#line 449 "src/ast-lexer.cc"
{ RETURN(ASSERT_RETURN_NAN); }
-#line 6529 "src/prebuilt/ast-lexer-gen.cc"
+#line 6534 "src/prebuilt/ast-lexer-gen.cc"
yy1128:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 438 "src/ast-lexer.cc"
+#line 447 "src/ast-lexer.cc"
{ RETURN(ASSERT_UNLINKABLE); }
-#line 6537 "src/prebuilt/ast-lexer-gen.cc"
+#line 6542 "src/prebuilt/ast-lexer-gen.cc"
yy1130:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 400 "src/ast-lexer.cc"
+#line 405 "src/ast-lexer.cc"
{ OPCODE(F32_CONVERT_S_I32); RETURN(CONVERT); }
-#line 6545 "src/prebuilt/ast-lexer-gen.cc"
+#line 6550 "src/prebuilt/ast-lexer-gen.cc"
yy1132:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 402 "src/ast-lexer.cc"
+#line 407 "src/ast-lexer.cc"
{ OPCODE(F32_CONVERT_S_I64); RETURN(CONVERT); }
-#line 6553 "src/prebuilt/ast-lexer-gen.cc"
+#line 6558 "src/prebuilt/ast-lexer-gen.cc"
yy1134:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 404 "src/ast-lexer.cc"
+#line 409 "src/ast-lexer.cc"
{ OPCODE(F32_CONVERT_U_I32); RETURN(CONVERT); }
-#line 6561 "src/prebuilt/ast-lexer-gen.cc"
+#line 6566 "src/prebuilt/ast-lexer-gen.cc"
yy1136:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 406 "src/ast-lexer.cc"
+#line 411 "src/ast-lexer.cc"
{ OPCODE(F32_CONVERT_U_I64); RETURN(CONVERT); }
-#line 6569 "src/prebuilt/ast-lexer-gen.cc"
+#line 6574 "src/prebuilt/ast-lexer-gen.cc"
yy1138:
yych = *++lexer->cursor;
if (yych == '3') goto yy1150;
@@ -6575,33 +6580,33 @@ yy1139:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 401 "src/ast-lexer.cc"
+#line 406 "src/ast-lexer.cc"
{ OPCODE(F64_CONVERT_S_I32); RETURN(CONVERT); }
-#line 6581 "src/prebuilt/ast-lexer-gen.cc"
+#line 6586 "src/prebuilt/ast-lexer-gen.cc"
yy1141:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 403 "src/ast-lexer.cc"
+#line 408 "src/ast-lexer.cc"
{ OPCODE(F64_CONVERT_S_I64); RETURN(CONVERT); }
-#line 6589 "src/prebuilt/ast-lexer-gen.cc"
+#line 6594 "src/prebuilt/ast-lexer-gen.cc"
yy1143:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 405 "src/ast-lexer.cc"
+#line 410 "src/ast-lexer.cc"
{ OPCODE(F64_CONVERT_U_I32); RETURN(CONVERT); }
-#line 6597 "src/prebuilt/ast-lexer-gen.cc"
+#line 6602 "src/prebuilt/ast-lexer-gen.cc"
yy1145:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 407 "src/ast-lexer.cc"
+#line 412 "src/ast-lexer.cc"
{ OPCODE(F64_CONVERT_U_I64); RETURN(CONVERT); }
-#line 6605 "src/prebuilt/ast-lexer-gen.cc"
+#line 6610 "src/prebuilt/ast-lexer-gen.cc"
yy1147:
yych = *++lexer->cursor;
if (yych == '6') goto yy1151;
@@ -6635,43 +6640,48 @@ yy1154:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 410 "src/ast-lexer.cc"
- { OPCODE(F32_REINTERPRET_I32); RETURN(CONVERT); }
-#line 6641 "src/prebuilt/ast-lexer-gen.cc"
+#line 415 "src/ast-lexer.cc"
+ { OPCODE(F32_REINTERPRET_I32); RETURN(CONVERT);
+ }
+#line 6647 "src/prebuilt/ast-lexer-gen.cc"
yy1156:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 412 "src/ast-lexer.cc"
- { OPCODE(F64_REINTERPRET_I64); RETURN(CONVERT); }
-#line 6649 "src/prebuilt/ast-lexer-gen.cc"
+#line 419 "src/ast-lexer.cc"
+ { OPCODE(F64_REINTERPRET_I64); RETURN(CONVERT);
+ }
+#line 6656 "src/prebuilt/ast-lexer-gen.cc"
yy1158:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 411 "src/ast-lexer.cc"
- { OPCODE(I32_REINTERPRET_F32); RETURN(CONVERT); }
-#line 6657 "src/prebuilt/ast-lexer-gen.cc"
+#line 417 "src/ast-lexer.cc"
+ { OPCODE(I32_REINTERPRET_F32); RETURN(CONVERT);
+ }
+#line 6665 "src/prebuilt/ast-lexer-gen.cc"
yy1160:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 413 "src/ast-lexer.cc"
- { OPCODE(I64_REINTERPRET_F64); RETURN(CONVERT); }
-#line 6665 "src/prebuilt/ast-lexer-gen.cc"
+#line 421 "src/ast-lexer.cc"
+ { OPCODE(I64_REINTERPRET_F64); RETURN(CONVERT);
+ }
+#line 6674 "src/prebuilt/ast-lexer-gen.cc"
}
}
-#line 465 "src/ast-lexer.cc"
+#line 474 "src/ast-lexer.cc"
}
}
static WabtAstLexer* wabt_new_lexer(WabtAstLexerSourceType type,
const char* filename) {
- WabtAstLexer* lexer = (WabtAstLexer*)wabt_alloc_zero(sizeof(WabtAstLexer));
+ WabtAstLexer* lexer =
+ static_cast<WabtAstLexer*>(wabt_alloc_zero(sizeof(WabtAstLexer)));
lexer->line = 1;
lexer->filename = filename;
lexer->source.type = type;
@@ -6812,7 +6822,8 @@ static WabtResult scan_forward_for_line_offset(
size_t* out_line_offset) {
assert(line <= find_line);
if (lexer->source.type == WABT_LEXER_SOURCE_TYPE_BUFFER) {
- const char* source_buffer = (const char*)lexer->source.buffer.data;
+ const char* source_buffer =
+ static_cast<const char*>(lexer->source.buffer.data);
const char* buffer_start = source_buffer + line_start_offset;
const char* buffer_end = source_buffer + lexer->source.buffer.size;
return scan_forward_for_line_offset_in_buffer(
@@ -6936,7 +6947,8 @@ WabtResult wabt_ast_lexer_get_source_line(WabtAstLexer* lexer,
}
if (lexer->source.type == WABT_LEXER_SOURCE_TYPE_BUFFER) {
- char* buffer_read_start = (char*)lexer->source.buffer.data + read_start;
+ const char* buffer_read_start =
+ static_cast<const char*>(lexer->source.buffer.data) + read_start;
memcpy(write_start, buffer_read_start, read_length);
} else {
assert(lexer->source.type == WABT_LEXER_SOURCE_TYPE_FILE);
diff --git a/src/prebuilt/ast-parser-gen.cc b/src/prebuilt/ast-parser-gen.cc
index c99211b3..7f627dda 100644
--- a/src/prebuilt/ast-parser-gen.cc
+++ b/src/prebuilt/ast-parser-gen.cc
@@ -1,8 +1,8 @@
-/* A Bison parser, made by GNU Bison 3.0.2. */
+/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "3.0.2"
+#define YYBISON_VERSION "3.0.4"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -88,11 +88,12 @@
#define RELOCATE_STACK(type, array, stack_base, old_byte_size, new_size) \
do { \
if ((stack_base) == (array)) { \
- (stack_base) = (type*)wabt_alloc((new_size) * sizeof(*(stack_base))); \
+ (stack_base) = \
+ static_cast<type*>(wabt_alloc((new_size) * sizeof(*(stack_base)))); \
memcpy((stack_base), (array), old_byte_size); \
} else { \
- (stack_base) = (type*)wabt_realloc((stack_base), \
- (new_size) * sizeof(*(stack_base))); \
+ (stack_base) = static_cast<type*>( \
+ wabt_realloc((stack_base), (new_size) * sizeof(*(stack_base)))); \
} \
/* Cache the pointer in the parser struct to be free'd later. */ \
parser->array = (stack_base); \
@@ -203,27 +204,28 @@ static WabtExprList join_exprs2(WabtLocation* loc, WabtExprList* expr1,
WabtExpr* expr2);
static WabtFuncField* new_func_field(void) {
- return (WabtFuncField*)wabt_alloc_zero(sizeof(WabtFuncField));
+ return static_cast<WabtFuncField*>(wabt_alloc_zero(sizeof(WabtFuncField)));
}
static WabtFunc* new_func(void) {
- return (WabtFunc*)wabt_alloc_zero(sizeof(WabtFunc));
+ return static_cast<WabtFunc*>(wabt_alloc_zero(sizeof(WabtFunc)));
}
static WabtCommand* new_command(void) {
- return (WabtCommand*)wabt_alloc_zero(sizeof(WabtCommand));
+ return static_cast<WabtCommand*>(wabt_alloc_zero(sizeof(WabtCommand)));
}
static WabtModule* new_module(void) {
- return (WabtModule*)wabt_alloc_zero(sizeof(WabtModule));
+ return static_cast<WabtModule*>(wabt_alloc_zero(sizeof(WabtModule)));
}
static WabtImport* new_import(void) {
- return (WabtImport*)wabt_alloc_zero(sizeof(WabtImport));
+ return static_cast<WabtImport*>(wabt_alloc_zero(sizeof(WabtImport)));
}
static WabtTextListNode* new_text_list_node(void) {
- return (WabtTextListNode*)wabt_alloc_zero(sizeof(WabtTextListNode));
+ return static_cast<WabtTextListNode*>(
+ wabt_alloc_zero(sizeof(WabtTextListNode)));
}
static WabtResult parse_const(WabtType type, WabtLiteralType literal_type,
@@ -248,7 +250,7 @@ static void on_read_binary_error(uint32_t offset, const char* error,
#define wabt_ast_parser_lex wabt_ast_lexer_lex
-#line 252 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:339 */
+#line 254 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
@@ -395,7 +397,7 @@ int wabt_ast_parser_parse (WabtAstLexer* lexer, WabtAstParser* parser);
/* Copy the second part of user declarations. */
-#line 399 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:358 */
+#line 401 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:358 */
#ifdef short
# undef short
@@ -701,24 +703,24 @@ static const yytype_uint8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 305, 305, 311, 321, 322, 326, 344, 345, 351,
- 354, 359, 366, 369, 370, 374, 379, 386, 389, 392,
- 397, 404, 410, 421, 425, 429, 436, 441, 448, 449,
- 455, 456, 459, 463, 464, 468, 469, 479, 480, 491,
- 492, 493, 496, 499, 502, 505, 508, 512, 516, 521,
- 524, 528, 532, 536, 540, 544, 548, 552, 558, 564,
- 576, 580, 584, 588, 592, 595, 600, 606, 612, 618,
- 628, 636, 640, 643, 649, 655, 664, 670, 675, 681,
- 686, 692, 700, 701, 709, 710, 718, 723, 724, 730,
- 736, 746, 752, 758, 768, 822, 831, 838, 845, 855,
- 858, 862, 868, 879, 885, 905, 912, 924, 931, 951,
- 973, 980, 993, 1000, 1006, 1012, 1018, 1026, 1031, 1038,
- 1044, 1050, 1056, 1065, 1073, 1078, 1083, 1088, 1095, 1102,
- 1106, 1109, 1120, 1124, 1131, 1135, 1138, 1146, 1154, 1171,
- 1187, 1197, 1204, 1211, 1217, 1256, 1266, 1288, 1298, 1324,
- 1329, 1337, 1345, 1355, 1361, 1367, 1373, 1379, 1385, 1390,
- 1396, 1405, 1410, 1411, 1417, 1426, 1427, 1435, 1447, 1448,
- 1455, 1519
+ 0, 307, 307, 313, 323, 324, 328, 346, 347, 353,
+ 356, 361, 368, 371, 372, 376, 381, 388, 391, 394,
+ 399, 406, 412, 423, 427, 431, 438, 443, 450, 451,
+ 457, 458, 461, 465, 466, 470, 471, 481, 482, 493,
+ 494, 495, 498, 501, 504, 507, 510, 514, 518, 523,
+ 526, 530, 534, 538, 542, 546, 550, 554, 560, 566,
+ 578, 582, 586, 590, 594, 597, 602, 608, 614, 620,
+ 630, 638, 642, 645, 651, 657, 666, 672, 677, 683,
+ 688, 694, 702, 703, 711, 712, 720, 725, 726, 732,
+ 738, 748, 754, 760, 770, 824, 833, 840, 847, 857,
+ 860, 864, 870, 881, 887, 907, 914, 926, 933, 953,
+ 975, 982, 995, 1002, 1008, 1014, 1020, 1028, 1033, 1040,
+ 1046, 1052, 1058, 1067, 1075, 1080, 1085, 1090, 1097, 1104,
+ 1108, 1111, 1122, 1126, 1133, 1137, 1140, 1148, 1156, 1173,
+ 1189, 1199, 1206, 1213, 1219, 1258, 1268, 1290, 1300, 1326,
+ 1331, 1339, 1347, 1357, 1363, 1369, 1375, 1381, 1387, 1392,
+ 1398, 1407, 1412, 1413, 1419, 1428, 1429, 1437, 1449, 1450,
+ 1457, 1521
};
#endif
@@ -1657,333 +1659,333 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio
switch (yytype)
{
case 5: /* NAT */
-#line 266 "src/ast-parser.y" /* yacc.c:1257 */
+#line 268 "src/ast-parser.y" /* yacc.c:1257 */
{}
-#line 1663 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1665 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 6: /* INT */
-#line 266 "src/ast-parser.y" /* yacc.c:1257 */
+#line 268 "src/ast-parser.y" /* yacc.c:1257 */
{}
-#line 1669 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1671 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 7: /* FLOAT */
-#line 266 "src/ast-parser.y" /* yacc.c:1257 */
+#line 268 "src/ast-parser.y" /* yacc.c:1257 */
{}
-#line 1675 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1677 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 8: /* TEXT */
-#line 266 "src/ast-parser.y" /* yacc.c:1257 */
+#line 268 "src/ast-parser.y" /* yacc.c:1257 */
{}
-#line 1681 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1683 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 9: /* VAR */
-#line 266 "src/ast-parser.y" /* yacc.c:1257 */
+#line 268 "src/ast-parser.y" /* yacc.c:1257 */
{}
-#line 1687 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1689 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 35: /* OFFSET_EQ_NAT */
-#line 266 "src/ast-parser.y" /* yacc.c:1257 */
+#line 268 "src/ast-parser.y" /* yacc.c:1257 */
{}
-#line 1693 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1695 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 36: /* ALIGN_EQ_NAT */
-#line 266 "src/ast-parser.y" /* yacc.c:1257 */
+#line 268 "src/ast-parser.y" /* yacc.c:1257 */
{}
-#line 1699 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1701 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 75: /* non_empty_text_list */
-#line 289 "src/ast-parser.y" /* yacc.c:1257 */
+#line 291 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_text_list(&((*yyvaluep).text_list)); }
-#line 1705 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1707 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 76: /* text_list */
-#line 289 "src/ast-parser.y" /* yacc.c:1257 */
+#line 291 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_text_list(&((*yyvaluep).text_list)); }
-#line 1711 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1713 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 77: /* quoted_text */
-#line 288 "src/ast-parser.y" /* yacc.c:1257 */
+#line 290 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_string_slice(&((*yyvaluep).text)); }
-#line 1717 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1719 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 78: /* value_type_list */
-#line 290 "src/ast-parser.y" /* yacc.c:1257 */
+#line 292 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_type_vector(&((*yyvaluep).types)); }
-#line 1723 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1725 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 81: /* func_type */
-#line 280 "src/ast-parser.y" /* yacc.c:1257 */
+#line 282 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_func_signature(&((*yyvaluep).func_sig)); }
-#line 1729 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1731 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 82: /* func_sig */
-#line 280 "src/ast-parser.y" /* yacc.c:1257 */
+#line 282 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_func_signature(&((*yyvaluep).func_sig)); }
-#line 1735 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1737 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 86: /* type_use */
-#line 292 "src/ast-parser.y" /* yacc.c:1257 */
+#line 294 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_var(&((*yyvaluep).var)); }
-#line 1741 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1743 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 88: /* literal */
-#line 286 "src/ast-parser.y" /* yacc.c:1257 */
+#line 288 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_string_slice(&((*yyvaluep).literal).text); }
-#line 1747 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1749 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 89: /* var */
-#line 292 "src/ast-parser.y" /* yacc.c:1257 */
+#line 294 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_var(&((*yyvaluep).var)); }
-#line 1753 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1755 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 90: /* var_list */
-#line 291 "src/ast-parser.y" /* yacc.c:1257 */
+#line 293 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_var_vector_and_elements(&((*yyvaluep).vars)); }
-#line 1759 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1761 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 91: /* bind_var_opt */
-#line 288 "src/ast-parser.y" /* yacc.c:1257 */
+#line 290 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_string_slice(&((*yyvaluep).text)); }
-#line 1765 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1767 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 92: /* bind_var */
-#line 288 "src/ast-parser.y" /* yacc.c:1257 */
+#line 290 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_string_slice(&((*yyvaluep).text)); }
-#line 1771 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1773 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 93: /* labeling_opt */
-#line 288 "src/ast-parser.y" /* yacc.c:1257 */
+#line 290 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_string_slice(&((*yyvaluep).text)); }
-#line 1777 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1779 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 96: /* instr */
-#line 277 "src/ast-parser.y" /* yacc.c:1257 */
+#line 279 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_expr_list(((*yyvaluep).expr_list).first); }
-#line 1783 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1785 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 97: /* plain_instr */
-#line 276 "src/ast-parser.y" /* yacc.c:1257 */
+#line 278 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_expr(((*yyvaluep).expr)); }
-#line 1789 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1791 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 98: /* block_instr */
-#line 276 "src/ast-parser.y" /* yacc.c:1257 */
+#line 278 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_expr(((*yyvaluep).expr)); }
-#line 1795 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1797 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 99: /* block */
-#line 267 "src/ast-parser.y" /* yacc.c:1257 */
+#line 269 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_block(&((*yyvaluep).block)); }
-#line 1801 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1803 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 100: /* expr */
-#line 277 "src/ast-parser.y" /* yacc.c:1257 */
+#line 279 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_expr_list(((*yyvaluep).expr_list).first); }
-#line 1807 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1809 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 101: /* expr1 */
-#line 277 "src/ast-parser.y" /* yacc.c:1257 */
+#line 279 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_expr_list(((*yyvaluep).expr_list).first); }
-#line 1813 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1815 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 102: /* if_ */
-#line 277 "src/ast-parser.y" /* yacc.c:1257 */
+#line 279 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_expr_list(((*yyvaluep).expr_list).first); }
-#line 1819 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1821 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 103: /* instr_list */
-#line 277 "src/ast-parser.y" /* yacc.c:1257 */
+#line 279 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_expr_list(((*yyvaluep).expr_list).first); }
-#line 1825 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1827 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 104: /* expr_list */
-#line 277 "src/ast-parser.y" /* yacc.c:1257 */
+#line 279 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_expr_list(((*yyvaluep).expr_list).first); }
-#line 1831 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1833 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 105: /* const_expr */
-#line 277 "src/ast-parser.y" /* yacc.c:1257 */
+#line 279 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_expr_list(((*yyvaluep).expr_list).first); }
-#line 1837 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1839 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 106: /* func_fields */
-#line 278 "src/ast-parser.y" /* yacc.c:1257 */
+#line 280 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_func_fields(((*yyvaluep).func_fields)); }
-#line 1843 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1845 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 107: /* func_body */
-#line 278 "src/ast-parser.y" /* yacc.c:1257 */
+#line 280 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_func_fields(((*yyvaluep).func_fields)); }
-#line 1849 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1851 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 108: /* func_info */
-#line 279 "src/ast-parser.y" /* yacc.c:1257 */
+#line 281 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_func(((*yyvaluep).func)); wabt_free(((*yyvaluep).func)); }
-#line 1855 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1857 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 109: /* func */
-#line 273 "src/ast-parser.y" /* yacc.c:1257 */
+#line 275 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_exported_func(&((*yyvaluep).exported_func)); }
-#line 1861 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1863 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 110: /* offset */
-#line 277 "src/ast-parser.y" /* yacc.c:1257 */
+#line 279 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_expr_list(((*yyvaluep).expr_list).first); }
-#line 1867 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1869 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 111: /* elem */
-#line 271 "src/ast-parser.y" /* yacc.c:1257 */
+#line 273 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_elem_segment(&((*yyvaluep).elem_segment)); }
-#line 1873 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1875 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 112: /* table */
-#line 275 "src/ast-parser.y" /* yacc.c:1257 */
+#line 277 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_exported_table(&((*yyvaluep).exported_table)); }
-#line 1879 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1881 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 113: /* data */
-#line 283 "src/ast-parser.y" /* yacc.c:1257 */
+#line 285 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_data_segment(&((*yyvaluep).data_segment)); }
-#line 1885 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1887 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 114: /* memory */
-#line 274 "src/ast-parser.y" /* yacc.c:1257 */
+#line 276 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_exported_memory(&((*yyvaluep).exported_memory)); }
-#line 1891 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1893 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 116: /* import_kind */
-#line 282 "src/ast-parser.y" /* yacc.c:1257 */
+#line 284 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_import(((*yyvaluep).import)); wabt_free(((*yyvaluep).import)); }
-#line 1897 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1899 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 117: /* import */
-#line 282 "src/ast-parser.y" /* yacc.c:1257 */
+#line 284 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_import(((*yyvaluep).import)); wabt_free(((*yyvaluep).import)); }
-#line 1903 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1905 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 118: /* inline_import */
-#line 282 "src/ast-parser.y" /* yacc.c:1257 */
+#line 284 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_import(((*yyvaluep).import)); wabt_free(((*yyvaluep).import)); }
-#line 1909 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1911 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 119: /* export_kind */
-#line 272 "src/ast-parser.y" /* yacc.c:1257 */
+#line 274 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_export(&((*yyvaluep).export_)); }
-#line 1915 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1917 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 120: /* export */
-#line 272 "src/ast-parser.y" /* yacc.c:1257 */
+#line 274 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_export(&((*yyvaluep).export_)); }
-#line 1921 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1923 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 123: /* type_def */
-#line 281 "src/ast-parser.y" /* yacc.c:1257 */
+#line 283 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_func_type(&((*yyvaluep).func_type)); }
-#line 1927 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1929 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 124: /* start */
-#line 292 "src/ast-parser.y" /* yacc.c:1257 */
+#line 294 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_var(&((*yyvaluep).var)); }
-#line 1933 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1935 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 125: /* module_fields */
-#line 284 "src/ast-parser.y" /* yacc.c:1257 */
+#line 286 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_module(((*yyvaluep).module)); wabt_free(((*yyvaluep).module)); }
-#line 1939 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1941 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 126: /* raw_module */
-#line 285 "src/ast-parser.y" /* yacc.c:1257 */
+#line 287 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_raw_module(&((*yyvaluep).raw_module)); }
-#line 1945 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1947 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 127: /* module */
-#line 284 "src/ast-parser.y" /* yacc.c:1257 */
+#line 286 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_module(((*yyvaluep).module)); wabt_free(((*yyvaluep).module)); }
-#line 1951 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1953 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 128: /* script_var_opt */
-#line 292 "src/ast-parser.y" /* yacc.c:1257 */
+#line 294 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_var(&((*yyvaluep).var)); }
-#line 1957 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1959 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 130: /* assertion */
-#line 268 "src/ast-parser.y" /* yacc.c:1257 */
+#line 270 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_command(((*yyvaluep).command)); wabt_free(((*yyvaluep).command)); }
-#line 1963 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1965 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 131: /* cmd */
-#line 268 "src/ast-parser.y" /* yacc.c:1257 */
+#line 270 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_command(((*yyvaluep).command)); wabt_free(((*yyvaluep).command)); }
-#line 1969 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1971 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 132: /* cmd_list */
-#line 269 "src/ast-parser.y" /* yacc.c:1257 */
+#line 271 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_command_vector_and_elements(&((*yyvaluep).commands)); }
-#line 1975 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1977 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 134: /* const_list */
-#line 270 "src/ast-parser.y" /* yacc.c:1257 */
+#line 272 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_const_vector(&((*yyvaluep).consts)); }
-#line 1981 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1983 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
case 135: /* script */
-#line 287 "src/ast-parser.y" /* yacc.c:1257 */
+#line 289 "src/ast-parser.y" /* yacc.c:1257 */
{ wabt_destroy_script(&((*yyvaluep).script)); }
-#line 1987 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
+#line 1989 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1257 */
break;
@@ -2275,18 +2277,18 @@ yyreduce:
switch (yyn)
{
case 2:
-#line 305 "src/ast-parser.y" /* yacc.c:1646 */
+#line 307 "src/ast-parser.y" /* yacc.c:1646 */
{
WabtTextListNode* node = new_text_list_node();
DUPTEXT(node->text, (yyvsp[0].text));
node->next = nullptr;
(yyval.text_list).first = (yyval.text_list).last = node;
}
-#line 2286 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2288 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 3:
-#line 311 "src/ast-parser.y" /* yacc.c:1646 */
+#line 313 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.text_list) = (yyvsp[-1].text_list);
WabtTextListNode* node = new_text_list_node();
@@ -2295,17 +2297,17 @@ yyreduce:
(yyval.text_list).last->next = node;
(yyval.text_list).last = node;
}
-#line 2299 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2301 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 4:
-#line 321 "src/ast-parser.y" /* yacc.c:1646 */
+#line 323 "src/ast-parser.y" /* yacc.c:1646 */
{ (yyval.text_list).first = (yyval.text_list).last = nullptr; }
-#line 2305 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2307 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 6:
-#line 326 "src/ast-parser.y" /* yacc.c:1646 */
+#line 328 "src/ast-parser.y" /* yacc.c:1646 */
{
WabtTextListNode node;
node.text = (yyvsp[0].text);
@@ -2316,133 +2318,133 @@ yyreduce:
void* data;
size_t size;
dup_text_list(&text_list, &data, &size);
- (yyval.text).start = (const char*)data;
+ (yyval.text).start = static_cast<const char*>(data);
(yyval.text).length = size;
}
-#line 2323 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2325 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 7:
-#line 344 "src/ast-parser.y" /* yacc.c:1646 */
+#line 346 "src/ast-parser.y" /* yacc.c:1646 */
{ WABT_ZERO_MEMORY((yyval.types)); }
-#line 2329 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2331 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 8:
-#line 345 "src/ast-parser.y" /* yacc.c:1646 */
+#line 347 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.types) = (yyvsp[-1].types);
wabt_append_type_value(&(yyval.types), &(yyvsp[0].type));
}
-#line 2338 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2340 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 9:
-#line 351 "src/ast-parser.y" /* yacc.c:1646 */
+#line 353 "src/ast-parser.y" /* yacc.c:1646 */
{}
-#line 2344 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2346 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 10:
-#line 354 "src/ast-parser.y" /* yacc.c:1646 */
+#line 356 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.global));
(yyval.global).type = (yyvsp[0].type);
(yyval.global).mutable_ = false;
}
-#line 2354 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2356 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 11:
-#line 359 "src/ast-parser.y" /* yacc.c:1646 */
+#line 361 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.global));
(yyval.global).type = (yyvsp[-1].type);
(yyval.global).mutable_ = true;
}
-#line 2364 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2366 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 12:
-#line 366 "src/ast-parser.y" /* yacc.c:1646 */
+#line 368 "src/ast-parser.y" /* yacc.c:1646 */
{ (yyval.func_sig) = (yyvsp[-1].func_sig); }
-#line 2370 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2372 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 13:
-#line 369 "src/ast-parser.y" /* yacc.c:1646 */
+#line 371 "src/ast-parser.y" /* yacc.c:1646 */
{ WABT_ZERO_MEMORY((yyval.func_sig)); }
-#line 2376 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2378 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 14:
-#line 370 "src/ast-parser.y" /* yacc.c:1646 */
+#line 372 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.func_sig));
(yyval.func_sig).param_types = (yyvsp[-1].types);
}
-#line 2385 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2387 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 15:
-#line 374 "src/ast-parser.y" /* yacc.c:1646 */
+#line 376 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.func_sig));
(yyval.func_sig).param_types = (yyvsp[-5].types);
(yyval.func_sig).result_types = (yyvsp[-1].types);
}
-#line 2395 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2397 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 16:
-#line 379 "src/ast-parser.y" /* yacc.c:1646 */
+#line 381 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.func_sig));
(yyval.func_sig).result_types = (yyvsp[-1].types);
}
-#line 2404 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2406 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 17:
-#line 386 "src/ast-parser.y" /* yacc.c:1646 */
+#line 388 "src/ast-parser.y" /* yacc.c:1646 */
{ (yyval.table).elem_limits = (yyvsp[-1].limits); }
-#line 2410 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2412 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 18:
-#line 389 "src/ast-parser.y" /* yacc.c:1646 */
+#line 391 "src/ast-parser.y" /* yacc.c:1646 */
{ (yyval.memory).page_limits = (yyvsp[0].limits); }
-#line 2416 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2418 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 19:
-#line 392 "src/ast-parser.y" /* yacc.c:1646 */
+#line 394 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.limits).has_max = false;
(yyval.limits).initial = (yyvsp[0].u64);
(yyval.limits).max = 0;
}
-#line 2426 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2428 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 20:
-#line 397 "src/ast-parser.y" /* yacc.c:1646 */
+#line 399 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.limits).has_max = true;
(yyval.limits).initial = (yyvsp[-1].u64);
(yyval.limits).max = (yyvsp[0].u64);
}
-#line 2436 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2438 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 21:
-#line 404 "src/ast-parser.y" /* yacc.c:1646 */
+#line 406 "src/ast-parser.y" /* yacc.c:1646 */
{ (yyval.var) = (yyvsp[-1].var); }
-#line 2442 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2444 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 22:
-#line 410 "src/ast-parser.y" /* yacc.c:1646 */
+#line 412 "src/ast-parser.y" /* yacc.c:1646 */
{
if (WABT_FAILED(wabt_parse_uint64((yyvsp[0].literal).text.start,
(yyvsp[0].literal).text.start + (yyvsp[0].literal).text.length, &(yyval.u64)))) {
@@ -2451,97 +2453,97 @@ yyreduce:
WABT_PRINTF_STRING_SLICE_ARG((yyvsp[0].literal).text));
}
}
-#line 2455 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2457 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 23:
-#line 421 "src/ast-parser.y" /* yacc.c:1646 */
+#line 423 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.literal).type = (yyvsp[0].literal).type;
DUPTEXT((yyval.literal).text, (yyvsp[0].literal).text);
}
-#line 2464 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2466 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 24:
-#line 425 "src/ast-parser.y" /* yacc.c:1646 */
+#line 427 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.literal).type = (yyvsp[0].literal).type;
DUPTEXT((yyval.literal).text, (yyvsp[0].literal).text);
}
-#line 2473 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2475 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 25:
-#line 429 "src/ast-parser.y" /* yacc.c:1646 */
+#line 431 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.literal).type = (yyvsp[0].literal).type;
DUPTEXT((yyval.literal).text, (yyvsp[0].literal).text);
}
-#line 2482 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2484 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 26:
-#line 436 "src/ast-parser.y" /* yacc.c:1646 */
+#line 438 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.var).loc = (yylsp[0]);
(yyval.var).type = WABT_VAR_TYPE_INDEX;
(yyval.var).index = (yyvsp[0].u64);
}
-#line 2492 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2494 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 27:
-#line 441 "src/ast-parser.y" /* yacc.c:1646 */
+#line 443 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.var).loc = (yylsp[0]);
(yyval.var).type = WABT_VAR_TYPE_NAME;
DUPTEXT((yyval.var).name, (yyvsp[0].text));
}
-#line 2502 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2504 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 28:
-#line 448 "src/ast-parser.y" /* yacc.c:1646 */
+#line 450 "src/ast-parser.y" /* yacc.c:1646 */
{ WABT_ZERO_MEMORY((yyval.vars)); }
-#line 2508 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2510 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 29:
-#line 449 "src/ast-parser.y" /* yacc.c:1646 */
+#line 451 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.vars) = (yyvsp[-1].vars);
wabt_append_var_value(&(yyval.vars), &(yyvsp[0].var));
}
-#line 2517 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2519 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 30:
-#line 455 "src/ast-parser.y" /* yacc.c:1646 */
+#line 457 "src/ast-parser.y" /* yacc.c:1646 */
{ WABT_ZERO_MEMORY((yyval.text)); }
-#line 2523 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2525 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 32:
-#line 459 "src/ast-parser.y" /* yacc.c:1646 */
+#line 461 "src/ast-parser.y" /* yacc.c:1646 */
{ DUPTEXT((yyval.text), (yyvsp[0].text)); }
-#line 2529 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2531 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 33:
-#line 463 "src/ast-parser.y" /* yacc.c:1646 */
+#line 465 "src/ast-parser.y" /* yacc.c:1646 */
{ WABT_ZERO_MEMORY((yyval.text)); }
-#line 2535 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2537 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 35:
-#line 468 "src/ast-parser.y" /* yacc.c:1646 */
+#line 470 "src/ast-parser.y" /* yacc.c:1646 */
{ (yyval.u64) = 0; }
-#line 2541 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2543 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 36:
-#line 469 "src/ast-parser.y" /* yacc.c:1646 */
+#line 471 "src/ast-parser.y" /* yacc.c:1646 */
{
if (WABT_FAILED(wabt_parse_int64((yyvsp[0].text).start, (yyvsp[0].text).start + (yyvsp[0].text).length, &(yyval.u64),
WABT_PARSE_SIGNED_AND_UNSIGNED))) {
@@ -2550,17 +2552,17 @@ yyreduce:
WABT_PRINTF_STRING_SLICE_ARG((yyvsp[0].text)));
}
}
-#line 2554 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2556 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 37:
-#line 479 "src/ast-parser.y" /* yacc.c:1646 */
+#line 481 "src/ast-parser.y" /* yacc.c:1646 */
{ (yyval.u32) = USE_NATURAL_ALIGNMENT; }
-#line 2560 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2562 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 38:
-#line 480 "src/ast-parser.y" /* yacc.c:1646 */
+#line 482 "src/ast-parser.y" /* yacc.c:1646 */
{
if (WABT_FAILED(wabt_parse_int32((yyvsp[0].text).start, (yyvsp[0].text).start + (yyvsp[0].text).length, &(yyval.u32),
WABT_PARSE_UNSIGNED_ONLY))) {
@@ -2569,182 +2571,182 @@ yyreduce:
WABT_PRINTF_STRING_SLICE_ARG((yyvsp[0].text)));
}
}
-#line 2573 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2575 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 39:
-#line 491 "src/ast-parser.y" /* yacc.c:1646 */
+#line 493 "src/ast-parser.y" /* yacc.c:1646 */
{ (yyval.expr_list) = join_exprs1(&(yylsp[0]), (yyvsp[0].expr)); }
-#line 2579 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2581 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 40:
-#line 492 "src/ast-parser.y" /* yacc.c:1646 */
+#line 494 "src/ast-parser.y" /* yacc.c:1646 */
{ (yyval.expr_list) = join_exprs1(&(yylsp[0]), (yyvsp[0].expr)); }
-#line 2585 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2587 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 41:
-#line 493 "src/ast-parser.y" /* yacc.c:1646 */
+#line 495 "src/ast-parser.y" /* yacc.c:1646 */
{ (yyval.expr_list) = (yyvsp[0].expr_list); }
-#line 2591 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2593 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 42:
-#line 496 "src/ast-parser.y" /* yacc.c:1646 */
+#line 498 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_unreachable_expr();
}
-#line 2599 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2601 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 43:
-#line 499 "src/ast-parser.y" /* yacc.c:1646 */
+#line 501 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_nop_expr();
}
-#line 2607 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2609 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 44:
-#line 502 "src/ast-parser.y" /* yacc.c:1646 */
+#line 504 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_drop_expr();
}
-#line 2615 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2617 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 45:
-#line 505 "src/ast-parser.y" /* yacc.c:1646 */
+#line 507 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_select_expr();
}
-#line 2623 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2625 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 46:
-#line 508 "src/ast-parser.y" /* yacc.c:1646 */
+#line 510 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_br_expr();
(yyval.expr)->br.var = (yyvsp[0].var);
}
-#line 2632 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2634 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 47:
-#line 512 "src/ast-parser.y" /* yacc.c:1646 */
+#line 514 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_br_if_expr();
(yyval.expr)->br_if.var = (yyvsp[0].var);
}
-#line 2641 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2643 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 48:
-#line 516 "src/ast-parser.y" /* yacc.c:1646 */
+#line 518 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_br_table_expr();
(yyval.expr)->br_table.targets = (yyvsp[-1].vars);
(yyval.expr)->br_table.default_target = (yyvsp[0].var);
}
-#line 2651 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2653 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 49:
-#line 521 "src/ast-parser.y" /* yacc.c:1646 */
+#line 523 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_return_expr();
}
-#line 2659 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2661 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 50:
-#line 524 "src/ast-parser.y" /* yacc.c:1646 */
+#line 526 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_call_expr();
(yyval.expr)->call.var = (yyvsp[0].var);
}
-#line 2668 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2670 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 51:
-#line 528 "src/ast-parser.y" /* yacc.c:1646 */
+#line 530 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_call_indirect_expr();
(yyval.expr)->call_indirect.var = (yyvsp[0].var);
}
-#line 2677 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2679 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 52:
-#line 532 "src/ast-parser.y" /* yacc.c:1646 */
+#line 534 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_get_local_expr();
(yyval.expr)->get_local.var = (yyvsp[0].var);
}
-#line 2686 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2688 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 53:
-#line 536 "src/ast-parser.y" /* yacc.c:1646 */
+#line 538 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_set_local_expr();
(yyval.expr)->set_local.var = (yyvsp[0].var);
}
-#line 2695 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2697 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 54:
-#line 540 "src/ast-parser.y" /* yacc.c:1646 */
+#line 542 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_tee_local_expr();
(yyval.expr)->tee_local.var = (yyvsp[0].var);
}
-#line 2704 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2706 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 55:
-#line 544 "src/ast-parser.y" /* yacc.c:1646 */
+#line 546 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_get_global_expr();
(yyval.expr)->get_global.var = (yyvsp[0].var);
}
-#line 2713 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2715 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 56:
-#line 548 "src/ast-parser.y" /* yacc.c:1646 */
+#line 550 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_set_global_expr();
(yyval.expr)->set_global.var = (yyvsp[0].var);
}
-#line 2722 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2724 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 57:
-#line 552 "src/ast-parser.y" /* yacc.c:1646 */
+#line 554 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_load_expr();
(yyval.expr)->load.opcode = (yyvsp[-2].opcode);
(yyval.expr)->load.offset = (yyvsp[-1].u64);
(yyval.expr)->load.align = (yyvsp[0].u32);
}
-#line 2733 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2735 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 58:
-#line 558 "src/ast-parser.y" /* yacc.c:1646 */
+#line 560 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_store_expr();
(yyval.expr)->store.opcode = (yyvsp[-2].opcode);
(yyval.expr)->store.offset = (yyvsp[-1].u64);
(yyval.expr)->store.align = (yyvsp[0].u32);
}
-#line 2744 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2746 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 59:
-#line 564 "src/ast-parser.y" /* yacc.c:1646 */
+#line 566 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_const_expr();
(yyval.expr)->const_.loc = (yylsp[-1]);
@@ -2755,98 +2757,98 @@ yyreduce:
"invalid literal \"" PRIstringslice "\"",
WABT_PRINTF_STRING_SLICE_ARG((yyvsp[0].literal).text));
}
- wabt_free((char*)(yyvsp[0].literal).text.start);
+ wabt_free(const_cast<char*>((yyvsp[0].literal).text.start));
}
-#line 2761 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2763 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 60:
-#line 576 "src/ast-parser.y" /* yacc.c:1646 */
+#line 578 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_unary_expr();
(yyval.expr)->unary.opcode = (yyvsp[0].opcode);
}
-#line 2770 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2772 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 61:
-#line 580 "src/ast-parser.y" /* yacc.c:1646 */
+#line 582 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_binary_expr();
(yyval.expr)->binary.opcode = (yyvsp[0].opcode);
}
-#line 2779 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2781 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 62:
-#line 584 "src/ast-parser.y" /* yacc.c:1646 */
+#line 586 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_compare_expr();
(yyval.expr)->compare.opcode = (yyvsp[0].opcode);
}
-#line 2788 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2790 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 63:
-#line 588 "src/ast-parser.y" /* yacc.c:1646 */
+#line 590 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_convert_expr();
(yyval.expr)->convert.opcode = (yyvsp[0].opcode);
}
-#line 2797 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2799 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 64:
-#line 592 "src/ast-parser.y" /* yacc.c:1646 */
+#line 594 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_current_memory_expr();
}
-#line 2805 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2807 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 65:
-#line 595 "src/ast-parser.y" /* yacc.c:1646 */
+#line 597 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_grow_memory_expr();
}
-#line 2813 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2815 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 66:
-#line 600 "src/ast-parser.y" /* yacc.c:1646 */
+#line 602 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_block_expr();
(yyval.expr)->block = (yyvsp[-2].block);
(yyval.expr)->block.label = (yyvsp[-3].text);
CHECK_END_LABEL((yylsp[0]), (yyval.expr)->block.label, (yyvsp[0].text));
}
-#line 2824 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2826 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 67:
-#line 606 "src/ast-parser.y" /* yacc.c:1646 */
+#line 608 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_loop_expr();
(yyval.expr)->loop = (yyvsp[-2].block);
(yyval.expr)->loop.label = (yyvsp[-3].text);
CHECK_END_LABEL((yylsp[0]), (yyval.expr)->block.label, (yyvsp[0].text));
}
-#line 2835 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2837 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 68:
-#line 612 "src/ast-parser.y" /* yacc.c:1646 */
+#line 614 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_if_expr();
(yyval.expr)->if_.true_ = (yyvsp[-2].block);
(yyval.expr)->if_.true_.label = (yyvsp[-3].text);
CHECK_END_LABEL((yylsp[0]), (yyval.expr)->block.label, (yyvsp[0].text));
}
-#line 2846 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2848 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 69:
-#line 618 "src/ast-parser.y" /* yacc.c:1646 */
+#line 620 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wabt_new_if_expr();
(yyval.expr)->if_.true_ = (yyvsp[-5].block);
@@ -2855,57 +2857,57 @@ yyreduce:
CHECK_END_LABEL((yylsp[-3]), (yyval.expr)->block.label, (yyvsp[-3].text));
CHECK_END_LABEL((yylsp[0]), (yyval.expr)->block.label, (yyvsp[0].text));
}
-#line 2859 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2861 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 70:
-#line 628 "src/ast-parser.y" /* yacc.c:1646 */
+#line 630 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.block));
(yyval.block).sig = (yyvsp[-1].types);
(yyval.block).first = (yyvsp[0].expr_list).first;
}
-#line 2869 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2871 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 71:
-#line 636 "src/ast-parser.y" /* yacc.c:1646 */
+#line 638 "src/ast-parser.y" /* yacc.c:1646 */
{ (yyval.expr_list) = (yyvsp[-1].expr_list); }
-#line 2875 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2877 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 72:
-#line 640 "src/ast-parser.y" /* yacc.c:1646 */
+#line 642 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr_list) = join_exprs2(&(yylsp[-1]), &(yyvsp[0].expr_list), (yyvsp[-1].expr));
}
-#line 2883 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2885 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 73:
-#line 643 "src/ast-parser.y" /* yacc.c:1646 */
+#line 645 "src/ast-parser.y" /* yacc.c:1646 */
{
WabtExpr* expr = wabt_new_block_expr();
expr->block = (yyvsp[0].block);
expr->block.label = (yyvsp[-1].text);
(yyval.expr_list) = join_exprs1(&(yylsp[-2]), expr);
}
-#line 2894 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2896 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 74:
-#line 649 "src/ast-parser.y" /* yacc.c:1646 */
+#line 651 "src/ast-parser.y" /* yacc.c:1646 */
{
WabtExpr* expr = wabt_new_loop_expr();
expr->loop = (yyvsp[0].block);
expr->loop.label = (yyvsp[-1].text);
(yyval.expr_list) = join_exprs1(&(yylsp[-2]), expr);
}
-#line 2905 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2907 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 75:
-#line 655 "src/ast-parser.y" /* yacc.c:1646 */
+#line 657 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr_list) = (yyvsp[0].expr_list);
WabtExpr* if_ = (yyvsp[0].expr_list).last;
@@ -2913,130 +2915,130 @@ yyreduce:
if_->if_.true_.label = (yyvsp[-2].text);
if_->if_.true_.sig = (yyvsp[-1].types);
}
-#line 2917 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2919 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 76:
-#line 664 "src/ast-parser.y" /* yacc.c:1646 */
+#line 666 "src/ast-parser.y" /* yacc.c:1646 */
{
WabtExpr* expr = wabt_new_if_expr();
expr->if_.true_.first = (yyvsp[-5].expr_list).first;
expr->if_.false_ = (yyvsp[-1].expr_list).first;
(yyval.expr_list) = join_exprs1(&(yylsp[-7]), expr);
}
-#line 2928 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2930 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 77:
-#line 670 "src/ast-parser.y" /* yacc.c:1646 */
+#line 672 "src/ast-parser.y" /* yacc.c:1646 */
{
WabtExpr* expr = wabt_new_if_expr();
expr->if_.true_.first = (yyvsp[-1].expr_list).first;
(yyval.expr_list) = join_exprs1(&(yylsp[-3]), expr);
}
-#line 2938 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2940 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 78:
-#line 675 "src/ast-parser.y" /* yacc.c:1646 */
+#line 677 "src/ast-parser.y" /* yacc.c:1646 */
{
WabtExpr* expr = wabt_new_if_expr();
expr->if_.true_.first = (yyvsp[-5].expr_list).first;
expr->if_.false_ = (yyvsp[-1].expr_list).first;
(yyval.expr_list) = join_exprs2(&(yylsp[-8]), &(yyvsp[-8].expr_list), expr);
}
-#line 2949 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2951 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 79:
-#line 681 "src/ast-parser.y" /* yacc.c:1646 */
+#line 683 "src/ast-parser.y" /* yacc.c:1646 */
{
WabtExpr* expr = wabt_new_if_expr();
expr->if_.true_.first = (yyvsp[-1].expr_list).first;
(yyval.expr_list) = join_exprs2(&(yylsp[-4]), &(yyvsp[-4].expr_list), expr);
}
-#line 2959 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2961 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 80:
-#line 686 "src/ast-parser.y" /* yacc.c:1646 */
+#line 688 "src/ast-parser.y" /* yacc.c:1646 */
{
WabtExpr* expr = wabt_new_if_expr();
expr->if_.true_.first = (yyvsp[-1].expr_list).first;
expr->if_.false_ = (yyvsp[0].expr_list).first;
(yyval.expr_list) = join_exprs2(&(yylsp[-2]), &(yyvsp[-2].expr_list), expr);
}
-#line 2970 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2972 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 81:
-#line 692 "src/ast-parser.y" /* yacc.c:1646 */
+#line 694 "src/ast-parser.y" /* yacc.c:1646 */
{
WabtExpr* expr = wabt_new_if_expr();
expr->if_.true_.first = (yyvsp[0].expr_list).first;
(yyval.expr_list) = join_exprs2(&(yylsp[-1]), &(yyvsp[-1].expr_list), expr);
}
-#line 2980 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2982 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 82:
-#line 700 "src/ast-parser.y" /* yacc.c:1646 */
+#line 702 "src/ast-parser.y" /* yacc.c:1646 */
{ WABT_ZERO_MEMORY((yyval.expr_list)); }
-#line 2986 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2988 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 83:
-#line 701 "src/ast-parser.y" /* yacc.c:1646 */
+#line 703 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr_list).first = (yyvsp[-1].expr_list).first;
(yyvsp[-1].expr_list).last->next = (yyvsp[0].expr_list).first;
(yyval.expr_list).last = (yyvsp[0].expr_list).last ? (yyvsp[0].expr_list).last : (yyvsp[-1].expr_list).last;
(yyval.expr_list).size = (yyvsp[-1].expr_list).size + (yyvsp[0].expr_list).size;
}
-#line 2997 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 2999 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 84:
-#line 709 "src/ast-parser.y" /* yacc.c:1646 */
+#line 711 "src/ast-parser.y" /* yacc.c:1646 */
{ WABT_ZERO_MEMORY((yyval.expr_list)); }
-#line 3003 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3005 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 85:
-#line 710 "src/ast-parser.y" /* yacc.c:1646 */
+#line 712 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr_list).first = (yyvsp[-1].expr_list).first;
(yyvsp[-1].expr_list).last->next = (yyvsp[0].expr_list).first;
(yyval.expr_list).last = (yyvsp[0].expr_list).last ? (yyvsp[0].expr_list).last : (yyvsp[-1].expr_list).last;
(yyval.expr_list).size = (yyvsp[-1].expr_list).size + (yyvsp[0].expr_list).size;
}
-#line 3014 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3016 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 88:
-#line 724 "src/ast-parser.y" /* yacc.c:1646 */
+#line 726 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_fields) = new_func_field();
(yyval.func_fields)->type = WABT_FUNC_FIELD_TYPE_RESULT_TYPES;
(yyval.func_fields)->types = (yyvsp[-2].types);
(yyval.func_fields)->next = (yyvsp[0].func_fields);
}
-#line 3025 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3027 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 89:
-#line 730 "src/ast-parser.y" /* yacc.c:1646 */
+#line 732 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_fields) = new_func_field();
(yyval.func_fields)->type = WABT_FUNC_FIELD_TYPE_PARAM_TYPES;
(yyval.func_fields)->types = (yyvsp[-2].types);
(yyval.func_fields)->next = (yyvsp[0].func_fields);
}
-#line 3036 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3038 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 90:
-#line 736 "src/ast-parser.y" /* yacc.c:1646 */
+#line 738 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_fields) = new_func_field();
(yyval.func_fields)->type = WABT_FUNC_FIELD_TYPE_BOUND_PARAM;
@@ -3045,33 +3047,33 @@ yyreduce:
(yyval.func_fields)->bound_type.type = (yyvsp[-2].type);
(yyval.func_fields)->next = (yyvsp[0].func_fields);
}
-#line 3049 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3051 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 91:
-#line 746 "src/ast-parser.y" /* yacc.c:1646 */
+#line 748 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_fields) = new_func_field();
(yyval.func_fields)->type = WABT_FUNC_FIELD_TYPE_EXPRS;
(yyval.func_fields)->first_expr = (yyvsp[0].expr_list).first;
(yyval.func_fields)->next = nullptr;
}
-#line 3060 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3062 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 92:
-#line 752 "src/ast-parser.y" /* yacc.c:1646 */
+#line 754 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_fields) = new_func_field();
(yyval.func_fields)->type = WABT_FUNC_FIELD_TYPE_LOCAL_TYPES;
(yyval.func_fields)->types = (yyvsp[-2].types);
(yyval.func_fields)->next = (yyvsp[0].func_fields);
}
-#line 3071 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3073 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 93:
-#line 758 "src/ast-parser.y" /* yacc.c:1646 */
+#line 760 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_fields) = new_func_field();
(yyval.func_fields)->type = WABT_FUNC_FIELD_TYPE_BOUND_LOCAL;
@@ -3080,11 +3082,11 @@ yyreduce:
(yyval.func_fields)->bound_type.type = (yyvsp[-2].type);
(yyval.func_fields)->next = (yyvsp[0].func_fields);
}
-#line 3084 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3086 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 94:
-#line 768 "src/ast-parser.y" /* yacc.c:1646 */
+#line 770 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.func) = new_func();
WabtFuncField* field = (yyvsp[0].func_fields);
@@ -3137,11 +3139,11 @@ yyreduce:
field = next;
}
}
-#line 3141 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3143 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 95:
-#line 822 "src/ast-parser.y" /* yacc.c:1646 */
+#line 824 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.exported_func));
(yyval.exported_func).func = (yyvsp[-1].func);
@@ -3150,11 +3152,11 @@ yyreduce:
(yyval.exported_func).func->name = (yyvsp[-4].text);
(yyval.exported_func).export_ = (yyvsp[-3].optional_export);
}
-#line 3154 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3156 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 96:
-#line 831 "src/ast-parser.y" /* yacc.c:1646 */
+#line 833 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.exported_func));
(yyval.exported_func).func = (yyvsp[-1].func);
@@ -3162,51 +3164,51 @@ yyreduce:
(yyval.exported_func).func->decl.type_var = (yyvsp[-2].var);
(yyval.exported_func).func->name = (yyvsp[-3].text);
}
-#line 3166 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3168 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 97:
-#line 838 "src/ast-parser.y" /* yacc.c:1646 */
+#line 840 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.exported_func));
(yyval.exported_func).func = (yyvsp[-1].func);
(yyval.exported_func).func->name = (yyvsp[-3].text);
(yyval.exported_func).export_ = (yyvsp[-2].optional_export);
}
-#line 3177 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3179 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 98:
-#line 845 "src/ast-parser.y" /* yacc.c:1646 */
+#line 847 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.exported_func));
(yyval.exported_func).func = (yyvsp[-1].func);
(yyval.exported_func).func->name = (yyvsp[-2].text);
}
-#line 3187 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3189 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 99:
-#line 855 "src/ast-parser.y" /* yacc.c:1646 */
+#line 857 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr_list) = (yyvsp[-1].expr_list);
}
-#line 3195 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3197 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 101:
-#line 862 "src/ast-parser.y" /* yacc.c:1646 */
+#line 864 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.elem_segment));
(yyval.elem_segment).table_var = (yyvsp[-3].var);
(yyval.elem_segment).offset = (yyvsp[-2].expr_list).first;
(yyval.elem_segment).vars = (yyvsp[-1].vars);
}
-#line 3206 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3208 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 102:
-#line 868 "src/ast-parser.y" /* yacc.c:1646 */
+#line 870 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.elem_segment));
(yyval.elem_segment).table_var.loc = (yylsp[-3]);
@@ -3215,22 +3217,22 @@ yyreduce:
(yyval.elem_segment).offset = (yyvsp[-2].expr_list).first;
(yyval.elem_segment).vars = (yyvsp[-1].vars);
}
-#line 3219 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3221 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 103:
-#line 879 "src/ast-parser.y" /* yacc.c:1646 */
+#line 881 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.exported_table).table = (yyvsp[-1].table);
(yyval.exported_table).table.name = (yyvsp[-3].text);
(yyval.exported_table).has_elem_segment = false;
(yyval.exported_table).export_ = (yyvsp[-2].optional_export);
}
-#line 3230 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3232 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 104:
-#line 886 "src/ast-parser.y" /* yacc.c:1646 */
+#line 888 "src/ast-parser.y" /* yacc.c:1646 */
{
WabtExpr* expr = wabt_new_const_expr();
expr->loc = (yylsp[-8]);
@@ -3247,11 +3249,11 @@ yyreduce:
(yyval.exported_table).elem_segment.vars = (yyvsp[-2].vars);
(yyval.exported_table).export_ = (yyvsp[-6].optional_export);
}
-#line 3251 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3253 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 105:
-#line 905 "src/ast-parser.y" /* yacc.c:1646 */
+#line 907 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.data_segment));
(yyval.data_segment).memory_var = (yyvsp[-3].var);
@@ -3259,11 +3261,11 @@ yyreduce:
dup_text_list(&(yyvsp[-1].text_list), &(yyval.data_segment).data, &(yyval.data_segment).size);
wabt_destroy_text_list(&(yyvsp[-1].text_list));
}
-#line 3263 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3265 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 106:
-#line 912 "src/ast-parser.y" /* yacc.c:1646 */
+#line 914 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.data_segment));
(yyval.data_segment).memory_var.loc = (yylsp[-3]);
@@ -3273,11 +3275,11 @@ yyreduce:
dup_text_list(&(yyvsp[-1].text_list), &(yyval.data_segment).data, &(yyval.data_segment).size);
wabt_destroy_text_list(&(yyvsp[-1].text_list));
}
-#line 3277 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3279 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 107:
-#line 924 "src/ast-parser.y" /* yacc.c:1646 */
+#line 926 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.exported_memory));
(yyval.exported_memory).memory = (yyvsp[-1].memory);
@@ -3285,11 +3287,11 @@ yyreduce:
(yyval.exported_memory).has_data_segment = false;
(yyval.exported_memory).export_ = (yyvsp[-2].optional_export);
}
-#line 3289 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3291 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 108:
-#line 931 "src/ast-parser.y" /* yacc.c:1646 */
+#line 933 "src/ast-parser.y" /* yacc.c:1646 */
{
WabtExpr* expr = wabt_new_const_expr();
expr->loc = (yylsp[-7]);
@@ -3309,11 +3311,11 @@ yyreduce:
(yyval.exported_memory).memory.page_limits.has_max = true;
(yyval.exported_memory).export_ = (yyvsp[-5].optional_export);
}
-#line 3313 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3315 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 109:
-#line 951 "src/ast-parser.y" /* yacc.c:1646 */
+#line 953 "src/ast-parser.y" /* yacc.c:1646 */
{
WabtExpr* expr = wabt_new_const_expr();
expr->loc = (yylsp[-6]);
@@ -3333,11 +3335,11 @@ yyreduce:
(yyval.exported_memory).memory.page_limits.has_max = true;
(yyval.exported_memory).export_.has_export = false;
}
-#line 3337 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3339 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 110:
-#line 973 "src/ast-parser.y" /* yacc.c:1646 */
+#line 975 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.exported_global));
(yyval.exported_global).global = (yyvsp[-2].global);
@@ -3345,11 +3347,11 @@ yyreduce:
(yyval.exported_global).global.init_expr = (yyvsp[-1].expr_list).first;
(yyval.exported_global).export_ = (yyvsp[-3].optional_export);
}
-#line 3349 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3351 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 111:
-#line 980 "src/ast-parser.y" /* yacc.c:1646 */
+#line 982 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.exported_global));
(yyval.exported_global).global = (yyvsp[-2].global);
@@ -3357,11 +3359,11 @@ yyreduce:
(yyval.exported_global).global.init_expr = (yyvsp[-1].expr_list).first;
(yyval.exported_global).export_.has_export = false;
}
-#line 3361 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3363 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 112:
-#line 993 "src/ast-parser.y" /* yacc.c:1646 */
+#line 995 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = new_import();
(yyval.import)->kind = WABT_EXTERNAL_KIND_FUNC;
@@ -3369,65 +3371,65 @@ yyreduce:
(yyval.import)->func.decl.flags = WABT_FUNC_DECLARATION_FLAG_HAS_FUNC_TYPE;
(yyval.import)->func.decl.type_var = (yyvsp[-1].var);
}
-#line 3373 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3375 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 113:
-#line 1000 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1002 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = new_import();
(yyval.import)->kind = WABT_EXTERNAL_KIND_FUNC;
(yyval.import)->func.name = (yyvsp[-2].text);
(yyval.import)->func.decl.sig = (yyvsp[-1].func_sig);
}
-#line 3384 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3386 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 114:
-#line 1006 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1008 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = new_import();
(yyval.import)->kind = WABT_EXTERNAL_KIND_TABLE;
(yyval.import)->table = (yyvsp[-1].table);
(yyval.import)->table.name = (yyvsp[-2].text);
}
-#line 3395 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3397 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 115:
-#line 1012 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1014 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = new_import();
(yyval.import)->kind = WABT_EXTERNAL_KIND_MEMORY;
(yyval.import)->memory = (yyvsp[-1].memory);
(yyval.import)->memory.name = (yyvsp[-2].text);
}
-#line 3406 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3408 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 116:
-#line 1018 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1020 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = new_import();
(yyval.import)->kind = WABT_EXTERNAL_KIND_GLOBAL;
(yyval.import)->global = (yyvsp[-1].global);
(yyval.import)->global.name = (yyvsp[-2].text);
}
-#line 3417 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3419 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 117:
-#line 1026 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1028 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = (yyvsp[-1].import);
(yyval.import)->module_name = (yyvsp[-3].text);
(yyval.import)->field_name = (yyvsp[-2].text);
}
-#line 3427 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3429 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 118:
-#line 1031 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1033 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = (yyvsp[-2].import);
(yyval.import)->kind = WABT_EXTERNAL_KIND_FUNC;
@@ -3435,165 +3437,165 @@ yyreduce:
(yyval.import)->func.decl.flags = WABT_FUNC_DECLARATION_FLAG_HAS_FUNC_TYPE;
(yyval.import)->func.decl.type_var = (yyvsp[-1].var);
}
-#line 3439 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3441 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 119:
-#line 1038 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1040 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = (yyvsp[-2].import);
(yyval.import)->kind = WABT_EXTERNAL_KIND_FUNC;
(yyval.import)->func.name = (yyvsp[-3].text);
(yyval.import)->func.decl.sig = (yyvsp[-1].func_sig);
}
-#line 3450 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3452 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 120:
-#line 1044 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1046 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = (yyvsp[-2].import);
(yyval.import)->kind = WABT_EXTERNAL_KIND_TABLE;
(yyval.import)->table = (yyvsp[-1].table);
(yyval.import)->table.name = (yyvsp[-3].text);
}
-#line 3461 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3463 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 121:
-#line 1050 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1052 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = (yyvsp[-2].import);
(yyval.import)->kind = WABT_EXTERNAL_KIND_MEMORY;
(yyval.import)->memory = (yyvsp[-1].memory);
(yyval.import)->memory.name = (yyvsp[-3].text);
}
-#line 3472 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3474 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 122:
-#line 1056 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1058 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = (yyvsp[-2].import);
(yyval.import)->kind = WABT_EXTERNAL_KIND_GLOBAL;
(yyval.import)->global = (yyvsp[-1].global);
(yyval.import)->global.name = (yyvsp[-3].text);
}
-#line 3483 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3485 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 123:
-#line 1065 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1067 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = new_import();
(yyval.import)->module_name = (yyvsp[-2].text);
(yyval.import)->field_name = (yyvsp[-1].text);
}
-#line 3493 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3495 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 124:
-#line 1073 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1075 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.export_));
(yyval.export_).kind = WABT_EXTERNAL_KIND_FUNC;
(yyval.export_).var = (yyvsp[-1].var);
}
-#line 3503 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3505 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 125:
-#line 1078 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1080 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.export_));
(yyval.export_).kind = WABT_EXTERNAL_KIND_TABLE;
(yyval.export_).var = (yyvsp[-1].var);
}
-#line 3513 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3515 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 126:
-#line 1083 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1085 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.export_));
(yyval.export_).kind = WABT_EXTERNAL_KIND_MEMORY;
(yyval.export_).var = (yyvsp[-1].var);
}
-#line 3523 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3525 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 127:
-#line 1088 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1090 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.export_));
(yyval.export_).kind = WABT_EXTERNAL_KIND_GLOBAL;
(yyval.export_).var = (yyvsp[-1].var);
}
-#line 3533 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3535 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 128:
-#line 1095 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1097 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.export_) = (yyvsp[-1].export_);
(yyval.export_).name = (yyvsp[-2].text);
}
-#line 3542 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3544 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 129:
-#line 1102 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1104 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.optional_export));
(yyval.optional_export).has_export = false;
}
-#line 3551 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3553 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 131:
-#line 1109 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1111 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.optional_export));
(yyval.optional_export).has_export = true;
(yyval.optional_export).export_.name = (yyvsp[-1].text);
}
-#line 3561 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3563 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 132:
-#line 1120 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1122 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.func_type));
(yyval.func_type).sig = (yyvsp[-1].func_sig);
}
-#line 3570 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3572 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 133:
-#line 1124 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1126 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_type).name = (yyvsp[-2].text);
(yyval.func_type).sig = (yyvsp[-1].func_sig);
}
-#line 3579 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3581 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 134:
-#line 1131 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1133 "src/ast-parser.y" /* yacc.c:1646 */
{ (yyval.var) = (yyvsp[-1].var); }
-#line 3585 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3587 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 135:
-#line 1135 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1137 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = new_module();
}
-#line 3593 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3595 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 136:
-#line 1138 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1140 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WabtModuleField* field;
@@ -3602,11 +3604,11 @@ yyreduce:
&field->func_type);
INSERT_BINDING((yyval.module), func_type, func_types, (yylsp[0]), (yyvsp[0].func_type).name);
}
-#line 3606 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3608 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 137:
-#line 1146 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1148 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WabtModuleField* field;
@@ -3615,11 +3617,11 @@ yyreduce:
INSERT_BINDING((yyval.module), global, globals, (yylsp[0]), (yyvsp[0].exported_global).global.name);
APPEND_INLINE_EXPORT((yyval.module), GLOBAL, (yylsp[0]), (yyvsp[0].exported_global), (yyval.module)->globals.size - 1);
}
-#line 3619 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3621 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 138:
-#line 1154 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1156 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WabtModuleField* field;
@@ -3637,11 +3639,11 @@ yyreduce:
}
}
-#line 3641 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3643 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 139:
-#line 1171 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1173 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WabtModuleField* field;
@@ -3658,11 +3660,11 @@ yyreduce:
&data_segment_field->data_segment);
}
}
-#line 3662 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3664 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 140:
-#line 1187 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1189 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WabtModuleField* field;
@@ -3673,11 +3675,11 @@ yyreduce:
APPEND_INLINE_EXPORT((yyval.module), FUNC, (yylsp[0]), (yyvsp[0].exported_func), (yyval.module)->funcs.size - 1);
wabt_free((yyvsp[0].exported_func).func);
}
-#line 3677 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3679 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 141:
-#line 1197 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1199 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WabtModuleField* field;
@@ -3685,11 +3687,11 @@ yyreduce:
APPEND_ITEM_TO_VECTOR((yyval.module), ElemSegment, elem_segment, elem_segments,
&field->elem_segment);
}
-#line 3689 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3691 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 142:
-#line 1204 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1206 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WabtModuleField* field;
@@ -3697,22 +3699,22 @@ yyreduce:
APPEND_ITEM_TO_VECTOR((yyval.module), DataSegment, data_segment, data_segments,
&field->data_segment);
}
-#line 3701 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3703 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 143:
-#line 1211 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1213 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WabtModuleField* field;
APPEND_FIELD_TO_LIST((yyval.module), field, START, start, (yylsp[0]), (yyvsp[0].var));
(yyval.module)->start = &field->start;
}
-#line 3712 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3714 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 144:
-#line 1217 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1219 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WabtModuleField* field;
@@ -3752,11 +3754,11 @@ yyreduce:
wabt_free((yyvsp[0].import));
APPEND_ITEM_TO_VECTOR((yyval.module), Import, import, imports, &field->import);
}
-#line 3756 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3758 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 145:
-#line 1256 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1258 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WabtModuleField* field = wabt_append_module_field((yyval.module));
@@ -3764,11 +3766,11 @@ yyreduce:
APPEND_ITEM_TO_VECTOR((yyval.module), Export, export, exports, &field->export_);
INSERT_BINDING((yyval.module), export, exports, (yylsp[0]), (yyvsp[0].export_).name);
}
-#line 3768 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3770 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 146:
-#line 1266 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1268 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.raw_module).type = WABT_RAW_MODULE_TYPE_TEXT;
(yyval.raw_module).text = (yyvsp[-1].module);
@@ -3791,11 +3793,11 @@ yyreduce:
}
}
}
-#line 3795 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3797 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 147:
-#line 1288 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1290 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.raw_module).type = WABT_RAW_MODULE_TYPE_BINARY;
(yyval.raw_module).binary.name = (yyvsp[-2].text);
@@ -3803,11 +3805,11 @@ yyreduce:
dup_text_list(&(yyvsp[-1].text_list), &(yyval.raw_module).binary.data, &(yyval.raw_module).binary.size);
wabt_destroy_text_list(&(yyvsp[-1].text_list));
}
-#line 3807 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3809 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 148:
-#line 1298 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1300 "src/ast-parser.y" /* yacc.c:1646 */
{
if ((yyvsp[0].raw_module).type == WABT_RAW_MODULE_TYPE_TEXT) {
(yyval.module) = (yyvsp[0].raw_module).text;
@@ -3829,31 +3831,31 @@ yyreduce:
(yyval.module)->loc = (yyvsp[0].raw_module).binary.loc;
}
}
-#line 3833 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3835 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 149:
-#line 1324 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1326 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.var));
(yyval.var).type = WABT_VAR_TYPE_INDEX;
(yyval.var).index = INVALID_VAR_INDEX;
}
-#line 3843 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3845 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 150:
-#line 1329 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1331 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.var));
(yyval.var).type = WABT_VAR_TYPE_NAME;
DUPTEXT((yyval.var).name, (yyvsp[0].text));
}
-#line 3853 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3855 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 151:
-#line 1337 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1339 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.action));
(yyval.action).loc = (yylsp[-4]);
@@ -3862,11 +3864,11 @@ yyreduce:
(yyval.action).invoke.name = (yyvsp[-2].text);
(yyval.action).invoke.args = (yyvsp[-1].consts);
}
-#line 3866 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3868 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 152:
-#line 1345 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1347 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.action));
(yyval.action).loc = (yylsp[-3]);
@@ -3874,119 +3876,119 @@ yyreduce:
(yyval.action).type = WABT_ACTION_TYPE_GET;
(yyval.action).invoke.name = (yyvsp[-1].text);
}
-#line 3878 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3880 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 153:
-#line 1355 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1357 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command();
(yyval.command)->type = WABT_COMMAND_TYPE_ASSERT_MALFORMED;
(yyval.command)->assert_malformed.module = (yyvsp[-2].raw_module);
(yyval.command)->assert_malformed.text = (yyvsp[-1].text);
}
-#line 3889 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3891 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 154:
-#line 1361 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1363 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command();
(yyval.command)->type = WABT_COMMAND_TYPE_ASSERT_INVALID;
(yyval.command)->assert_invalid.module = (yyvsp[-2].raw_module);
(yyval.command)->assert_invalid.text = (yyvsp[-1].text);
}
-#line 3900 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3902 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 155:
-#line 1367 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1369 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command();
(yyval.command)->type = WABT_COMMAND_TYPE_ASSERT_UNLINKABLE;
(yyval.command)->assert_unlinkable.module = (yyvsp[-2].raw_module);
(yyval.command)->assert_unlinkable.text = (yyvsp[-1].text);
}
-#line 3911 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3913 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 156:
-#line 1373 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1375 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command();
(yyval.command)->type = WABT_COMMAND_TYPE_ASSERT_UNINSTANTIABLE;
(yyval.command)->assert_uninstantiable.module = (yyvsp[-2].raw_module);
(yyval.command)->assert_uninstantiable.text = (yyvsp[-1].text);
}
-#line 3922 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3924 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 157:
-#line 1379 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1381 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command();
(yyval.command)->type = WABT_COMMAND_TYPE_ASSERT_RETURN;
(yyval.command)->assert_return.action = (yyvsp[-2].action);
(yyval.command)->assert_return.expected = (yyvsp[-1].consts);
}
-#line 3933 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3935 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 158:
-#line 1385 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1387 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command();
(yyval.command)->type = WABT_COMMAND_TYPE_ASSERT_RETURN_NAN;
(yyval.command)->assert_return_nan.action = (yyvsp[-1].action);
}
-#line 3943 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3945 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 159:
-#line 1390 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1392 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command();
(yyval.command)->type = WABT_COMMAND_TYPE_ASSERT_TRAP;
(yyval.command)->assert_trap.action = (yyvsp[-2].action);
(yyval.command)->assert_trap.text = (yyvsp[-1].text);
}
-#line 3954 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3956 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 160:
-#line 1396 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1398 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command();
(yyval.command)->type = WABT_COMMAND_TYPE_ASSERT_EXHAUSTION;
(yyval.command)->assert_trap.action = (yyvsp[-2].action);
(yyval.command)->assert_trap.text = (yyvsp[-1].text);
}
-#line 3965 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3967 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 161:
-#line 1405 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1407 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command();
(yyval.command)->type = WABT_COMMAND_TYPE_ACTION;
(yyval.command)->action = (yyvsp[0].action);
}
-#line 3975 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3977 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 163:
-#line 1411 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1413 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command();
(yyval.command)->type = WABT_COMMAND_TYPE_MODULE;
(yyval.command)->module = *(yyvsp[0].module);
wabt_free((yyvsp[0].module));
}
-#line 3986 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 3988 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 164:
-#line 1417 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1419 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command();
(yyval.command)->type = WABT_COMMAND_TYPE_REGISTER;
@@ -3994,27 +3996,27 @@ yyreduce:
(yyval.command)->register_.var = (yyvsp[-1].var);
(yyval.command)->register_.var.loc = (yylsp[-1]);
}
-#line 3998 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 4000 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 165:
-#line 1426 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1428 "src/ast-parser.y" /* yacc.c:1646 */
{ WABT_ZERO_MEMORY((yyval.commands)); }
-#line 4004 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 4006 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 166:
-#line 1427 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1429 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.commands) = (yyvsp[-1].commands);
wabt_append_command_value(&(yyval.commands), (yyvsp[0].command));
wabt_free((yyvsp[0].command));
}
-#line 4014 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 4016 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 167:
-#line 1435 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1437 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.const_).loc = (yylsp[-2]);
if (WABT_FAILED(parse_const((yyvsp[-2].type), (yyvsp[-1].literal).type, (yyvsp[-1].literal).text.start,
@@ -4023,28 +4025,28 @@ yyreduce:
"invalid literal \"" PRIstringslice "\"",
WABT_PRINTF_STRING_SLICE_ARG((yyvsp[-1].literal).text));
}
- wabt_free((char*)(yyvsp[-1].literal).text.start);
+ wabt_free(const_cast<char*>((yyvsp[-1].literal).text.start));
}
-#line 4029 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 4031 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 168:
-#line 1447 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1449 "src/ast-parser.y" /* yacc.c:1646 */
{ WABT_ZERO_MEMORY((yyval.consts)); }
-#line 4035 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 4037 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 169:
-#line 1448 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1450 "src/ast-parser.y" /* yacc.c:1646 */
{
(yyval.consts) = (yyvsp[-1].consts);
wabt_append_const_value(&(yyval.consts), &(yyvsp[0].const_));
}
-#line 4044 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 4046 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
case 170:
-#line 1455 "src/ast-parser.y" /* yacc.c:1646 */
+#line 1457 "src/ast-parser.y" /* yacc.c:1646 */
{
WABT_ZERO_MEMORY((yyval.script));
(yyval.script).commands = (yyvsp[0].commands);
@@ -4104,11 +4106,11 @@ yyreduce:
}
parser->script = (yyval.script);
}
-#line 4108 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 4110 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
break;
-#line 4112 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
+#line 4114 "src/prebuilt/ast-parser-gen.cc" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -4343,7 +4345,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 1522 "src/ast-parser.y" /* yacc.c:1906 */
+#line 1524 "src/ast-parser.y" /* yacc.c:1906 */
static void append_expr_list(WabtExprList* expr_list, WabtExprList* expr) {
diff --git a/src/prebuilt/ast-parser-gen.h b/src/prebuilt/ast-parser-gen.h
index 11b9f11b..e3f7afae 100644
--- a/src/prebuilt/ast-parser-gen.h
+++ b/src/prebuilt/ast-parser-gen.h
@@ -1,8 +1,8 @@
-/* A Bison parser, made by GNU Bison 3.0.2. */
+/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/resolve-names.cc b/src/resolve-names.cc
index f620a4ec..9e89ed7f 100644
--- a/src/resolve-names.cc
+++ b/src/resolve-names.cc
@@ -62,7 +62,8 @@ struct FindDuplicateBindingContext {
static void on_duplicate_binding(WabtBindingHashEntry* a,
WabtBindingHashEntry* b,
void* user_data) {
- FindDuplicateBindingContext* fdbc = (FindDuplicateBindingContext*)user_data;
+ FindDuplicateBindingContext* fdbc =
+ static_cast<FindDuplicateBindingContext*>(user_data);
/* choose the location that is later in the file */
WabtLocation* a_loc = &a->binding.loc;
WabtLocation* b_loc = &b->binding.loc;
@@ -155,43 +156,43 @@ static void resolve_local_var(Context* ctx, WabtVar* var) {
}
static WabtResult begin_block_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
push_label(ctx, &expr->block.label);
return WABT_OK;
}
static WabtResult end_block_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
pop_label(ctx);
return WABT_OK;
}
static WabtResult begin_loop_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
push_label(ctx, &expr->loop.label);
return WABT_OK;
}
static WabtResult end_loop_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
pop_label(ctx);
return WABT_OK;
}
static WabtResult on_br_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
resolve_label_var(ctx, &expr->br.var);
return WABT_OK;
}
static WabtResult on_br_if_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
resolve_label_var(ctx, &expr->br_if.var);
return WABT_OK;
}
static WabtResult on_br_table_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
size_t i;
WabtVarVector* targets = &expr->br_table.targets;
for (i = 0; i < targets->size; ++i) {
@@ -204,55 +205,55 @@ static WabtResult on_br_table_expr(WabtExpr* expr, void* user_data) {
}
static WabtResult on_call_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
resolve_func_var(ctx, &expr->call.var);
return WABT_OK;
}
static WabtResult on_call_indirect_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
resolve_func_type_var(ctx, &expr->call_indirect.var);
return WABT_OK;
}
static WabtResult on_get_global_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
resolve_global_var(ctx, &expr->get_global.var);
return WABT_OK;
}
static WabtResult on_get_local_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
resolve_local_var(ctx, &expr->get_local.var);
return WABT_OK;
}
static WabtResult begin_if_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
push_label(ctx, &expr->if_.true_.label);
return WABT_OK;
}
static WabtResult end_if_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
pop_label(ctx);
return WABT_OK;
}
static WabtResult on_set_global_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
resolve_global_var(ctx, &expr->set_global.var);
return WABT_OK;
}
static WabtResult on_set_local_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
resolve_local_var(ctx, &expr->set_local.var);
return WABT_OK;
}
static WabtResult on_tee_local_expr(WabtExpr* expr, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
resolve_local_var(ctx, &expr->tee_local.var);
return WABT_OK;
}
diff --git a/src/stream.cc b/src/stream.cc
index 14a2c284..64073d0f 100644
--- a/src/stream.cc
+++ b/src/stream.cc
@@ -125,14 +125,16 @@ void wabt_write_memory_dump(WabtStream* stream,
WabtPrintChars print_chars,
const char* prefix,
const char* desc) {
- const uint8_t* p = (const uint8_t*)start;
+ const uint8_t* p = static_cast<const uint8_t*>(start);
const uint8_t* end = p + size;
while (p < end) {
const uint8_t* line = p;
const uint8_t* line_end = p + DUMP_OCTETS_PER_LINE;
if (prefix)
wabt_writef(stream, "%s", prefix);
- wabt_writef(stream, "%07" PRIzx ": ", (size_t)p - (size_t)start + offset);
+ wabt_writef(stream, "%07" PRIzx ": ",
+ reinterpret_cast<intptr_t>(p) -
+ reinterpret_cast<intptr_t>(start) + offset);
while (p < line_end) {
int i;
for (i = 0; i < DUMP_OCTETS_PER_GROUP; ++i, ++p) {
diff --git a/src/tools/wasm-interp.cc b/src/tools/wasm-interp.cc
index 05642d47..691c4353 100644
--- a/src/tools/wasm-interp.cc
+++ b/src/tools/wasm-interp.cc
@@ -763,7 +763,7 @@ static WabtResult expect(Context* ctx, const char* s) {
static WabtResult expect_key(Context* ctx, const char* key) {
size_t keylen = strlen(key);
size_t quoted_len = keylen + 2 + 1;
- char* quoted = (char*)alloca(quoted_len);
+ char* quoted = static_cast<char*>(alloca(quoted_len));
wabt_snprintf(quoted, quoted_len, "\"%s\"", key);
EXPECT(quoted);
EXPECT(":");
@@ -777,7 +777,7 @@ static WabtResult parse_uint32(Context* ctx, uint32_t* out_int) {
int c = read_char(ctx);
if (c >= '0' && c <= '9') {
uint32_t last_result = result;
- result = result * 10 + (uint32_t)(c - '0');
+ result = result * 10 + static_cast<uint32_t>(c - '0');
if (result < last_result) {
print_parse_error(ctx, "uint32 overflow");
return WABT_ERROR;
@@ -1010,7 +1010,7 @@ static char* create_module_path(Context* ctx, WabtStringSlice filename) {
const char* spec_json_filename = ctx->loc.filename;
WabtStringSlice dirname = get_dirname(spec_json_filename);
size_t path_len = dirname.length + 1 + filename.length + 1;
- char* path = (char*)wabt_alloc(path_len);
+ char* path = static_cast<char*>(wabt_alloc(path_len));
if (dirname.length == 0) {
wabt_snprintf(path, path_len, PRIstringslice,
@@ -1074,10 +1074,10 @@ static WabtResult run_action(Context* ctx,
module_index = wabt_find_binding_index_by_name(&ctx->env.module_bindings,
&action->module_name);
} else {
- module_index = (int)ctx->env.modules.size - 1;
+ module_index = static_cast<int>(ctx->env.modules.size) - 1;
}
- assert(module_index < (int)ctx->env.modules.size);
+ assert(module_index < static_cast<int>(ctx->env.modules.size));
WabtInterpreterModule* module = &ctx->env.modules.data[module_index];
switch (action->type) {
@@ -1125,20 +1125,19 @@ static WabtResult on_action_command(Context* ctx, Action* action) {
static WabtBinaryErrorHandler* new_custom_error_handler(Context* ctx,
const char* desc) {
size_t header_size = ctx->source_filename.length + strlen(desc) + 100;
- char* header = (char*)wabt_alloc(header_size);
+ char* header = static_cast<char*>(wabt_alloc(header_size));
wabt_snprintf(header, header_size, PRIstringslice ":%d: %s passed",
WABT_PRINTF_STRING_SLICE_ARG(ctx->source_filename),
ctx->command_line_number, desc);
- WabtDefaultErrorHandlerInfo* info =
- (WabtDefaultErrorHandlerInfo*)wabt_alloc_zero(
- sizeof(WabtDefaultErrorHandlerInfo));
+ WabtDefaultErrorHandlerInfo* info = static_cast<WabtDefaultErrorHandlerInfo*>(
+ wabt_alloc_zero(sizeof(WabtDefaultErrorHandlerInfo)));
info->header = header;
info->out_file = stdout;
info->print_header = WABT_PRINT_ERROR_HEADER_ONCE;
- WabtBinaryErrorHandler* error_handler =
- (WabtBinaryErrorHandler*)wabt_alloc_zero(sizeof(WabtBinaryErrorHandler));
+ WabtBinaryErrorHandler* error_handler = static_cast<WabtBinaryErrorHandler*>(
+ wabt_alloc_zero(sizeof(WabtBinaryErrorHandler)));
error_handler->on_error = wabt_default_binary_error_callback;
error_handler->user_data = info;
return error_handler;
@@ -1147,8 +1146,8 @@ static WabtBinaryErrorHandler* new_custom_error_handler(Context* ctx,
static void destroy_custom_error_handler(
WabtBinaryErrorHandler* error_handler) {
WabtDefaultErrorHandlerInfo* info =
- (WabtDefaultErrorHandlerInfo*)error_handler->user_data;
- wabt_free((void*)info->header);
+ static_cast<WabtDefaultErrorHandlerInfo*>(error_handler->user_data);
+ wabt_free(const_cast<void*>(static_cast<const void*>(info->header)));
wabt_free(info);
wabt_free(error_handler);
}
@@ -1194,15 +1193,16 @@ static WabtResult on_register_command(Context* ctx,
const WabtStringSlice* module_name = &ctx->env.modules.data[i].name;
if (!wabt_string_slice_is_empty(module_name) &&
wabt_string_slices_are_equal(&name, module_name)) {
- module_index = (int)i;
+ module_index = static_cast<int>(i);
break;
}
}
} else {
- module_index = (int)ctx->env.modules.size - 1;
+ module_index = static_cast<int>(ctx->env.modules.size) - 1;
}
- if (module_index < 0 || module_index >= (int)ctx->env.modules.size) {
+ if (module_index < 0 ||
+ module_index >= static_cast<int>(ctx->env.modules.size)) {
print_command_error(ctx, "unknown module in register");
return WABT_ERROR;
}
@@ -1653,7 +1653,7 @@ static WabtResult read_and_run_spec_json(const char* spec_json_filename) {
if (WABT_FAILED(result))
return WABT_ERROR;
- ctx.json_data = (char*)data;
+ ctx.json_data = static_cast<char*>(data);
ctx.json_data_size = size;
result = parse_commands(&ctx);
diff --git a/src/tools/wasm-link.cc b/src/tools/wasm-link.cc
index d4085e67..a9e3274b 100644
--- a/src/tools/wasm-link.cc
+++ b/src/tools/wasm-link.cc
@@ -742,14 +742,15 @@ static void write_binary(Context* ctx) {
/* Write known sections first */
for (i = FIRST_KNOWN_SECTION; i < WABT_NUM_BINARY_SECTIONS; i++) {
- write_combined_section(ctx, (WabtBinarySection)i, &sections[i]);
+ write_combined_section(ctx, static_cast<WabtBinarySection>(i),
+ &sections[i]);
}
write_names_section(ctx);
/* Generate a new set of reloction sections */
for (i = FIRST_KNOWN_SECTION; i < WABT_NUM_BINARY_SECTIONS; i++) {
- write_reloc_section(ctx, (WabtBinarySection)i, &sections[i]);
+ write_reloc_section(ctx, static_cast<WabtBinarySection>(i), &sections[i]);
}
for (i = 0; i < WABT_NUM_BINARY_SECTIONS; i++) {
@@ -826,7 +827,7 @@ int main(int argc, char** argv) {
if (WABT_FAILED(result))
return result;
WabtLinkerInputBinary* b = wabt_append_binary(&context.inputs);
- b->data = (uint8_t*)data;
+ b->data = static_cast<uint8_t*>(data);
b->size = size;
b->filename = input_filename;
result = wabt_read_binary_linker(b);
diff --git a/src/tools/wasmdump.cc b/src/tools/wasmdump.cc
index 2fb58980..fb8fecf0 100644
--- a/src/tools/wasmdump.cc
+++ b/src/tools/wasmdump.cc
@@ -150,7 +150,7 @@ int main(int argc, char** argv) {
if (WABT_FAILED(result))
return result;
- uint8_t* data = (uint8_t*)void_data;
+ uint8_t* data = static_cast<uint8_t*>(void_data);
// Perform serveral passed over the binary in order to print out different
// types of information.
diff --git a/src/tools/wasmopcodecnt.cc b/src/tools/wasmopcodecnt.cc
index e415106f..52ec99c3 100644
--- a/src/tools/wasmopcodecnt.cc
+++ b/src/tools/wasmopcodecnt.cc
@@ -144,7 +144,7 @@ typedef void (*display_name_fcn)(FILE* out, intmax_t value);
static void display_opcode_name(FILE* out, intmax_t opcode) {
if (opcode >= 0 && opcode < WABT_NUM_OPCODES)
- fprintf(out, "%s", wabt_get_opcode_name((WabtOpcode)opcode));
+ fprintf(out, "%s", wabt_get_opcode_name(static_cast<WabtOpcode>(opcode)));
else
fprintf(out, "?(%" PRIdMAX ")", opcode);
}
@@ -210,13 +210,13 @@ static int opcode_counter_gt(WabtIntCounter* counter_1,
const char* name_2 = "?2";
if (counter_1->value < WABT_NUM_OPCODES) {
const char* opcode_name =
- wabt_get_opcode_name((WabtOpcode)counter_1->value);
+ wabt_get_opcode_name(static_cast<WabtOpcode>(counter_1->value));
if (opcode_name)
name_1 = opcode_name;
}
if (counter_2->value < WABT_NUM_OPCODES) {
const char* opcode_name =
- wabt_get_opcode_name((WabtOpcode)counter_2->value);
+ wabt_get_opcode_name(static_cast<WabtOpcode>(counter_2->value));
if (opcode_name)
name_2 = opcode_name;
}
diff --git a/src/type-checker.cc b/src/type-checker.cc
index 488ff9be..53dcd13c 100644
--- a/src/type-checker.cc
+++ b/src/type-checker.cc
@@ -22,9 +22,9 @@
return WABT_ERROR; \
} while (0)
-#define COMBINE_RESULT(result_var, result) \
- do { \
- (result_var) = (WabtResult)((result_var) | (result)); \
+#define COMBINE_RESULT(result_var, result) \
+ do { \
+ (result_var) = static_cast<WabtResult>((result_var) | (result)); \
} while (0)
static void WABT_PRINTF_FORMAT(2, 3)
diff --git a/src/validator.cc b/src/validator.cc
index 61fb484f..587e19a9 100644
--- a/src/validator.cc
+++ b/src/validator.cc
@@ -67,7 +67,7 @@ static void WABT_PRINTF_FORMAT(3, 4)
}
static void on_typechecker_error(const char* msg, void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
print_error(ctx, ctx->expr_loc, "%s", msg);
}
@@ -758,7 +758,7 @@ static void check_export(Context* ctx, const WabtExport* export_) {
static void on_duplicate_binding(WabtBindingHashEntry* a,
WabtBindingHashEntry* b,
void* user_data) {
- Context* ctx = (Context*)user_data;
+ Context* ctx = static_cast<Context*>(user_data);
/* choose the location that is later in the file */
WabtLocation* a_loc = &a->binding.loc;
WabtLocation* b_loc = &b->binding.loc;
diff --git a/src/vector.cc b/src/vector.cc
index b7135e67..25254adf 100644
--- a/src/vector.cc
+++ b/src/vector.cc
@@ -40,8 +40,9 @@ void wabt_resize_vector(void** data,
size_t old_size = *size;
wabt_ensure_capacity(data, capacity, desired_size, elt_byte_size);
if (desired_size > old_size) {
- memset((void*)((size_t)*data + old_size * elt_byte_size), 0,
- (desired_size - old_size) * elt_byte_size);
+ memset(reinterpret_cast<void*>(reinterpret_cast<intptr_t>(*data) +
+ old_size * elt_byte_size),
+ 0, (desired_size - old_size) * elt_byte_size);
}
*size = desired_size;
}
@@ -51,7 +52,8 @@ void* wabt_append_element(void** data,
size_t* capacity,
size_t elt_byte_size) {
wabt_ensure_capacity(data, capacity, *size + 1, elt_byte_size);
- void* p = (void*)((size_t)*data + (*size)++ * elt_byte_size);
+ void* p = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(*data) +
+ (*size)++ * elt_byte_size);
memset(p, 0, elt_byte_size);
return p;
}
@@ -59,11 +61,12 @@ void* wabt_append_element(void** data,
void wabt_extend_elements(void** dst,
size_t* dst_size,
size_t* dst_capacity,
- const void** src,
+ void* const* src,
size_t src_size,
size_t elt_byte_size) {
wabt_ensure_capacity(dst, dst_capacity, *dst_size + src_size, elt_byte_size);
- memcpy((void*)((size_t)*dst + (*dst_size * elt_byte_size)), *src,
- src_size * elt_byte_size);
+ memcpy(reinterpret_cast<void*>(reinterpret_cast<intptr_t>(*dst) +
+ (*dst_size * elt_byte_size)),
+ *src, src_size * elt_byte_size);
*dst_size += src_size;
}
diff --git a/src/vector.h b/src/vector.h
index 7f544ea4..d46c66d8 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -41,52 +41,54 @@
* void wabt_extend_widgets(WabtWidgetVector* dst, const WabtWidgetVector* src);
*/
-#define WABT_DEFINE_VECTOR(name, type) \
- struct type##Vector { \
- type* data; \
- size_t size; \
- size_t capacity; \
- }; \
- \
- WABT_EXTERN_C_BEGIN \
- static WABT_INLINE void wabt_destroy_##name##_vector(type##Vector* vec) \
- WABT_UNUSED; \
- static WABT_INLINE void wabt_resize_##name##_vector( \
- type##Vector* vec, size_t desired) WABT_UNUSED; \
- static WABT_INLINE void wabt_reserve_##name##s(type##Vector* vec, \
- size_t desired) WABT_UNUSED; \
- static WABT_INLINE type* wabt_append_##name(type##Vector* vec) WABT_UNUSED; \
- static WABT_INLINE void wabt_append_##name##_value( \
- type##Vector* vec, const type* value) WABT_UNUSED; \
- static WABT_INLINE void wabt_extend_##name##s( \
- type##Vector* dst, const type##Vector* src) WABT_UNUSED; \
- WABT_EXTERN_C_END \
- \
- void wabt_destroy_##name##_vector(type##Vector* vec) { \
- wabt_free(vec->data); \
- vec->data = nullptr; \
- vec->size = 0; \
- vec->capacity = 0; \
- } \
- void wabt_resize_##name##_vector(type##Vector* vec, size_t size) { \
- wabt_resize_vector((void**)&vec->data, &vec->size, &vec->capacity, size, \
- sizeof(type)); \
- } \
- void wabt_reserve_##name##s(type##Vector* vec, size_t desired) { \
- wabt_ensure_capacity((void**)&vec->data, &vec->capacity, desired, \
- sizeof(type)); \
- } \
- type* wabt_append_##name(type##Vector* vec) { \
- return (type*)wabt_append_element((void**)&vec->data, &vec->size, \
- &vec->capacity, sizeof(type)); \
- } \
- void wabt_append_##name##_value(type##Vector* vec, const type* value) { \
- type* slot = wabt_append_##name(vec); \
- *slot = *value; \
- } \
- void wabt_extend_##name##s(type##Vector* dst, const type##Vector* src) { \
- wabt_extend_elements((void**)&dst->data, &dst->size, &dst->capacity, \
- (const void**)&src->data, src->size, sizeof(type)); \
+#define WABT_DEFINE_VECTOR(name, type) \
+ struct type##Vector { \
+ type* data; \
+ size_t size; \
+ size_t capacity; \
+ }; \
+ \
+ WABT_EXTERN_C_BEGIN \
+ static WABT_INLINE void wabt_destroy_##name##_vector(type##Vector* vec) \
+ WABT_UNUSED; \
+ static WABT_INLINE void wabt_resize_##name##_vector( \
+ type##Vector* vec, size_t desired) WABT_UNUSED; \
+ static WABT_INLINE void wabt_reserve_##name##s(type##Vector* vec, \
+ size_t desired) WABT_UNUSED; \
+ static WABT_INLINE type* wabt_append_##name(type##Vector* vec) WABT_UNUSED; \
+ static WABT_INLINE void wabt_append_##name##_value( \
+ type##Vector* vec, const type* value) WABT_UNUSED; \
+ static WABT_INLINE void wabt_extend_##name##s( \
+ type##Vector* dst, const type##Vector* src) WABT_UNUSED; \
+ WABT_EXTERN_C_END \
+ \
+ void wabt_destroy_##name##_vector(type##Vector* vec) { \
+ wabt_free(vec->data); \
+ vec->data = nullptr; \
+ vec->size = 0; \
+ vec->capacity = 0; \
+ } \
+ void wabt_resize_##name##_vector(type##Vector* vec, size_t size) { \
+ wabt_resize_vector(reinterpret_cast<void**>(&vec->data), &vec->size, \
+ &vec->capacity, size, sizeof(type)); \
+ } \
+ void wabt_reserve_##name##s(type##Vector* vec, size_t desired) { \
+ wabt_ensure_capacity(reinterpret_cast<void**>(&vec->data), &vec->capacity, \
+ desired, sizeof(type)); \
+ } \
+ type* wabt_append_##name(type##Vector* vec) { \
+ return static_cast<type*>( \
+ wabt_append_element(reinterpret_cast<void**>(&vec->data), &vec->size, \
+ &vec->capacity, sizeof(type))); \
+ } \
+ void wabt_append_##name##_value(type##Vector* vec, const type* value) { \
+ type* slot = wabt_append_##name(vec); \
+ *slot = *value; \
+ } \
+ void wabt_extend_##name##s(type##Vector* dst, const type##Vector* src) { \
+ wabt_extend_elements( \
+ reinterpret_cast<void**>(&dst->data), &dst->size, &dst->capacity, \
+ reinterpret_cast<void* const*>(&src->data), src->size, sizeof(type)); \
}
#define WABT_DESTROY_VECTOR_AND_ELEMENTS(v, name) \
@@ -117,7 +119,7 @@ void* wabt_append_element(void** data,
void wabt_extend_elements(void** dst,
size_t* dst_size,
size_t* dst_capacity,
- const void** src,
+ void* const* src,
size_t src_size,
size_t elt_byte_size);
WABT_EXTERN_C_END
diff --git a/src/writer.cc b/src/writer.cc
index a44af47e..2a715747 100644
--- a/src/writer.cc
+++ b/src/writer.cc
@@ -34,7 +34,7 @@ static WabtResult write_data_to_file(size_t offset,
void* user_data) {
if (size == 0)
return WABT_OK;
- WabtFileWriter* writer = (WabtFileWriter*)user_data;
+ WabtFileWriter* writer = static_cast<WabtFileWriter*>(user_data);
if (offset != writer->offset) {
if (fseek(writer->file, offset, SEEK_SET) != 0) {
ERROR("fseek offset=%" PRIzd " failed, errno=%d\n", size, errno);
@@ -108,10 +108,12 @@ static WabtResult write_data_to_output_buffer(size_t offset,
const void* data,
size_t size,
void* user_data) {
- WabtMemoryWriter* writer = (WabtMemoryWriter*)user_data;
+ WabtMemoryWriter* writer = static_cast<WabtMemoryWriter*>(user_data);
size_t end = offset + size;
ensure_output_buffer_capacity(&writer->buf, end);
- memcpy((void*)((size_t)writer->buf.start + offset), data, size);
+ memcpy(reinterpret_cast<void*>(reinterpret_cast<intptr_t>(writer->buf.start) +
+ offset),
+ data, size);
if (end > writer->buf.size)
writer->buf.size = end;
return WABT_OK;
@@ -121,13 +123,15 @@ static WabtResult move_data_in_output_buffer(size_t dst_offset,
size_t src_offset,
size_t size,
void* user_data) {
- WabtMemoryWriter* writer = (WabtMemoryWriter*)user_data;
+ WabtMemoryWriter* writer = static_cast<WabtMemoryWriter*>(user_data);
size_t src_end = src_offset + size;
size_t dst_end = dst_offset + size;
size_t end = src_end > dst_end ? src_end : dst_end;
ensure_output_buffer_capacity(&writer->buf, end);
- void* dst = (void*)((size_t)writer->buf.start + dst_offset);
- void* src = (void*)((size_t)writer->buf.start + src_offset);
+ void* dst = reinterpret_cast<void*>(
+ reinterpret_cast<size_t>(writer->buf.start) + dst_offset);
+ void* src = reinterpret_cast<void*>(
+ reinterpret_cast<size_t>(writer->buf.start) + src_offset);
memmove(dst, src, size);
if (end > writer->buf.size)
writer->buf.size = end;
@@ -176,7 +180,7 @@ WabtResult wabt_write_output_buffer_to_file(WabtOutputBuffer* buf,
}
ssize_t bytes = fwrite(buf->start, 1, buf->size, file);
- if (bytes < 0 || (size_t)bytes != buf->size) {
+ if (bytes < 0 || static_cast<size_t>(bytes) != buf->size) {
ERROR("failed to write %" PRIzd " bytes to %s\n", buf->size, filename);
return WABT_ERROR;
}