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/passes/Print.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/passes/Print.cpp')
-rw-r--r-- | src/passes/Print.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 14ef584be..a70a96f17 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -292,7 +292,7 @@ struct PrintExpressionContents : public Visitor<PrintExpressionContents> { case ExtendS8Int64: o << "i64.extend8_s"; break; case ExtendS16Int64: o << "i64.extend16_s"; break; case ExtendS32Int64: o << "i64.extend32_s"; break; - default: abort(); + case InvalidUnary: WASM_UNREACHABLE(); } } void visitBinary(Binary* curr) { @@ -378,7 +378,7 @@ struct PrintExpressionContents : public Visitor<PrintExpressionContents> { case GtFloat64: o << "f64.gt"; break; case GeFloat64: o << "f64.ge"; break; - default: abort(); + case InvalidBinary: WASM_UNREACHABLE(); } restoreNormalColor(o); } @@ -395,7 +395,6 @@ struct PrintExpressionContents : public Visitor<PrintExpressionContents> { switch (curr->op) { case CurrentMemory: printMedium(o, "current_memory"); break; case GrowMemory: printMedium(o, "grow_memory"); break; - default: WASM_UNREACHABLE(); } } void visitNop(Nop* curr) { @@ -775,7 +774,7 @@ struct PrintSExpression : public Visitor<PrintSExpression> { decIndent(); break; } - default: { + case CurrentMemory: { o << ')'; } } @@ -819,7 +818,7 @@ struct PrintSExpression : public Visitor<PrintSExpression> { case ExternalKind::Table: o << "table"; break; case ExternalKind::Memory: o << "memory"; break; case ExternalKind::Global: o << "global"; break; - default: WASM_UNREACHABLE(); + case ExternalKind::Invalid: WASM_UNREACHABLE(); } o << ' '; printName(curr->value, o) << "))"; |