From 5d92d866d8326b1908328485cccd2f8ebe57ac75 Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Tue, 27 Nov 2018 15:12:21 -0800 Subject: 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. --- src/wasm/wasm-validator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/wasm/wasm-validator.cpp') diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 769f17d59..0b0d165ed 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -671,7 +671,7 @@ void FunctionValidator::visitBinary(Binary* curr) { shouldBeEqualOrFirstIsUnreachable(curr->left->type, f64, curr, "f64 op"); break; } - default: WASM_UNREACHABLE(); + case InvalidBinary: WASM_UNREACHABLE(); } } @@ -753,7 +753,7 @@ void FunctionValidator::visitUnary(Unary* curr) { case DemoteFloat64: shouldBeEqual(curr->value->type, f64, curr, "demote type must be correct"); break; case ReinterpretInt32: shouldBeEqual(curr->value->type, i32, curr, "reinterpret/i32 type must be correct"); break; case ReinterpretInt64: shouldBeEqual(curr->value->type, i64, curr, "reinterpret/i64 type must be correct"); break; - default: abort(); + case InvalidUnary: WASM_UNREACHABLE(); } } @@ -790,7 +790,6 @@ void FunctionValidator::visitHost(Host* curr) { break; } case CurrentMemory: break; - default: WASM_UNREACHABLE(); } } @@ -863,7 +862,8 @@ void FunctionValidator::validateAlignment(size_t align, Type type, Index bytes, shouldBeTrue(align <= 8, curr, "alignment must not exceed natural"); break; } - default: {} + case none: + case unreachable: {} } } -- cgit v1.2.3