diff options
author | JF Bastien <jfb@chromium.org> | 2015-12-22 13:51:20 -0800 |
---|---|---|
committer | JF Bastien <jfb@chromium.org> | 2015-12-22 13:51:20 -0800 |
commit | e3c5ca02fde4282a3797be6ecea5a473ac8c3a1d (patch) | |
tree | 430845f9b7a4121f876ea5c6e0980a760a597c03 /src/asm2wasm.h | |
parent | 4726dcfd02ca4bea786fe4b6ef4629e3e2a1561d (diff) | |
download | binaryen-e3c5ca02fde4282a3797be6ecea5a473ac8c3a1d.tar.gz binaryen-e3c5ca02fde4282a3797be6ecea5a473ac8c3a1d.tar.bz2 binaryen-e3c5ca02fde4282a3797be6ecea5a473ac8c3a1d.zip |
Fix warnings found by GCC
My previous patch addressed all LLVM warnings, this one addresses all the GCC ones as well (mostly signed / unsigned mix).
The patch also turns on -Wall -Werror.
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..0c7f58a04 100644 --- a/src/asm2wasm.h +++ b/src/asm2wasm.h @@ -358,7 +358,7 @@ private: abort(); // avoid warning } - unsigned bytesToShift(unsigned bytes) { + int64_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) { |