diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2018-11-27 15:12:21 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-27 15:12:21 -0800 |
commit | 5d92d866d8326b1908328485cccd2f8ebe57ac75 (patch) | |
tree | 6f34e8815437b66c0ee083a61c1147a4257b68c6 /src/wasm-interpreter.h | |
parent | 70b949ffdc3e5f3fa83dd4044f632c95159674cf (diff) | |
download | binaryen-5d92d866d8326b1908328485cccd2f8ebe57ac75.tar.gz binaryen-5d92d866d8326b1908328485cccd2f8ebe57ac75.tar.bz2 binaryen-5d92d866d8326b1908328485cccd2f8ebe57ac75.zip |
Remove default cases (#1757)
Where reasonable from a readability perspective, remove default cases
in switches over types and instructions. This makes future feature
additions easier by making the compiler complain about each location
where new types and instructions are not yet handled.
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r-- | src/wasm-interpreter.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 8bd951eef..aeacdfc20 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -296,8 +296,9 @@ public: case ReinterpretFloat64: return value.castToI64(); case DemoteFloat64: return value.demote(); - default: WASM_UNREACHABLE(); + case InvalidUnary: WASM_UNREACHABLE(); } + WASM_UNREACHABLE(); } Flow visitBinary(Binary *curr) { NOTE_ENTER("Binary"); @@ -417,8 +418,10 @@ public: case MinFloat64: return left.min(right); case MaxFloat32: case MaxFloat64: return left.max(right); - default: WASM_UNREACHABLE(); + + case InvalidBinary: WASM_UNREACHABLE(); } + WASM_UNREACHABLE(); } Flow visitSelect(Select *curr) { NOTE_ENTER("Select"); @@ -575,8 +578,10 @@ public: } case f32: return Literal(load32u(addr)).castToF32(); case f64: return Literal(load64u(addr)).castToF64(); - default: WASM_UNREACHABLE(); + case none: + case unreachable: WASM_UNREACHABLE(); } + WASM_UNREACHABLE(); } virtual void store(Store* store, Address addr, Literal value) { switch (store->valueType) { @@ -602,7 +607,8 @@ public: // write floats carefully, ensuring all bits reach memory case f32: store32(addr, value.reinterpreti32()); break; case f64: store64(addr, value.reinterpreti64()); break; - default: WASM_UNREACHABLE(); + case none: + case unreachable: WASM_UNREACHABLE(); } } @@ -862,7 +868,6 @@ public: case Or: computed = computed.or_(value.value); break; case Xor: computed = computed.xor_(value.value); break; case Xchg: computed = value.value; break; - default: WASM_UNREACHABLE(); } instance.doAtomicStore(addr, curr->bytes, computed); return loaded; @@ -939,8 +944,8 @@ public: instance.memorySize = newSize; return Literal(int32_t(ret)); } - default: WASM_UNREACHABLE(); } + WASM_UNREACHABLE(); } void trap(const char* why) override { |