diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-12-22 14:03:21 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-12-22 14:03:21 -0800 |
commit | 89972f57fc1d98a2990a635878df39867d1f98f9 (patch) | |
tree | acc8af2fa4cc19441c5d5459661d6040074a1e6c /src/asm2wasm.h | |
parent | 58cb71723a5243f8a347e51e9ceb20b664719585 (diff) | |
parent | 397ddb4bbced30b96d6f05dddaea6a395269cf34 (diff) | |
download | binaryen-89972f57fc1d98a2990a635878df39867d1f98f9.tar.gz binaryen-89972f57fc1d98a2990a635878df39867d1f98f9.tar.bz2 binaryen-89972f57fc1d98a2990a635878df39867d1f98f9.zip |
Merge pull request #28 from WebAssembly/wall
Fix warnings found by GCC
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r-- | src/asm2wasm.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h index 2d92efbfd..ec47abb7f 100644 --- a/src/asm2wasm.h +++ b/src/asm2wasm.h @@ -358,7 +358,7 @@ private: abort(); // avoid warning } - unsigned bytesToShift(unsigned bytes) { + int32_t bytesToShift(unsigned bytes) { switch (bytes) { case 1: return 0; case 2: return 1; @@ -1402,11 +1402,12 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) { assert(index >= min); index -= min; assert(index >= 0); + size_t index_s = index; case_.name = getNextId("switch-case"); - if (ret->targets.size() <= index) { - ret->targets.resize(index+1); + if (ret->targets.size() <= index_s) { + ret->targets.resize(index_s+1); } - ret->targets[index] = case_.name; + ret->targets[index_s] = case_.name; } ret->cases.push_back(case_); } @@ -1431,7 +1432,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) { // given HEAP32[addr >> 2], we need an absolute address, and would like to remove that shift. // if there is a shift, we can just look through it, etc. processUnshifted = [&](Ref ptr, unsigned bytes) { - unsigned shifts = bytesToShift(bytes); + auto shifts = bytesToShift(bytes); if (ptr[0] == BINARY && ptr[1] == RSHIFT && ptr[3][0] == NUM && ptr[3][1]->getInteger() == shifts) { return process(ptr[2]); // look through it } else if (ptr[0] == NUM) { |