diff options
-rw-r--r-- | src/compiler-support.h | 8 | ||||
-rw-r--r-- | src/shell-interface.h | 4 | ||||
-rw-r--r-- | src/support/utilities.h | 4 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/compiler-support.h b/src/compiler-support.h index bf2885993..3dd873383 100644 --- a/src/compiler-support.h +++ b/src/compiler-support.h @@ -36,6 +36,14 @@ # define WASM_UNREACHABLE() abort() #endif +#ifdef __GNUC__ +#define WASM_NORETURN __attribute__((noreturn)) +#elif defined(_MSC_VER) +#define WASM_NORETURN __declspec(noreturn) +#else +#define WASM_NORETURN +#endif + // The code might contain TODOs or stubs that read some values but do nothing // with them. The compiler might fail with [-Werror,-Wunused-variable]. // The WASM_UNUSED(varible) is a wrapper that helps to suppress the error. diff --git a/src/shell-interface.h b/src/shell-interface.h index ef92f40cd..1dcbe4c28 100644 --- a/src/shell-interface.h +++ b/src/shell-interface.h @@ -142,8 +142,8 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface { std::cout << "exit()\n"; throw ExitException(); } - std::cout << "callImport " << import->name.str << "\n"; - WASM_UNREACHABLE(); + Fatal() << "callImport: unknown import: " << import->module.str << "." + << import->name.str; } Literal callTable(Index index, LiteralList& arguments, WasmType result, ModuleInstance& instance) override { diff --git a/src/support/utilities.h b/src/support/utilities.h index 92e7c226f..66e7ed797 100644 --- a/src/support/utilities.h +++ b/src/support/utilities.h @@ -17,6 +17,8 @@ #ifndef wasm_support_utilities_h #define wasm_support_utilities_h +#include "compiler-support.h" + #include <cassert> #include <cstdint> #include <cstring> @@ -69,7 +71,7 @@ class Fatal { std::cerr << arg; return *this; } - ~Fatal() { + WASM_NORETURN ~Fatal() { std::cerr << "\n"; exit(1); } |