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/binaryen-c.cpp | |
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/binaryen-c.cpp')
-rw-r--r-- | src/binaryen-c.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index e2ad349a0..aeef53343 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -49,7 +49,8 @@ BinaryenLiteral toBinaryenLiteral(Literal x) { case Type::i64: ret.i64 = x.geti64(); break; case Type::f32: ret.i32 = x.reinterpreti32(); break; case Type::f64: ret.i64 = x.reinterpreti64(); break; - default: abort(); + case Type::none: + case Type::unreachable: WASM_UNREACHABLE(); } return ret; } @@ -60,8 +61,10 @@ Literal fromBinaryenLiteral(BinaryenLiteral x) { case Type::i64: return Literal(x.i64); case Type::f32: return Literal(x.i32).castToF32(); case Type::f64: return Literal(x.i64).castToF64(); - default: abort(); + case Type::none: + case Type::unreachable: WASM_UNREACHABLE(); } + WASM_UNREACHABLE(); } // Mutexes (global for now; in theory if multiple modules @@ -657,7 +660,8 @@ BinaryenExpressionRef BinaryenConst(BinaryenModuleRef module, BinaryenLiteral va std::cout << "));\n"; break; } - default: WASM_UNREACHABLE(); + case Type::none: + case Type::unreachable: WASM_UNREACHABLE(); } } return static_cast<Expression*>(ret); |