diff options
author | Derek Schuff <dschuff@chromium.org> | 2016-04-21 13:16:59 -0700 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2016-04-21 13:16:59 -0700 |
commit | 36bb0ed43c9e0644cc92b6508ec2fff290c17034 (patch) | |
tree | c76e64b0f18811c0fb1f559972810169a4b0fb55 | |
parent | 20ecea3457553e308bede7037a5ac625916e074f (diff) | |
download | binaryen-36bb0ed43c9e0644cc92b6508ec2fff290c17034.tar.gz binaryen-36bb0ed43c9e0644cc92b6508ec2fff290c17034.tar.bz2 binaryen-36bb0ed43c9e0644cc92b6508ec2fff290c17034.zip |
Move Fatal into utilities.h (#376)
Follow-on from #372. Probably we should do even better for error
handling, and that might mean a cpp file in support, but for now this is
a small improvement.
-rw-r--r-- | src/support/utilities.h | 18 | ||||
-rw-r--r-- | src/wasm-linker.h | 18 |
2 files changed, 18 insertions, 18 deletions
diff --git a/src/support/utilities.h b/src/support/utilities.h index d8ca23463..3ff1f9c5e 100644 --- a/src/support/utilities.h +++ b/src/support/utilities.h @@ -54,6 +54,24 @@ std::unique_ptr<T> make_unique(Args&&... args) return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); } +// For fatal errors which could arise from input (i.e. not assertion failures) +class Fatal { + public: + Fatal() { + std::cerr << "Fatal: "; + } + template<typename T> + Fatal &operator<<(T arg) { + std::cerr << arg; + return *this; + } + ~Fatal() { + std::cerr << "\n"; + exit(1); + } +}; + + } // namespace wasm #endif // wasm_support_utilities_h diff --git a/src/wasm-linker.h b/src/wasm-linker.h index b24056526..ceb948c4e 100644 --- a/src/wasm-linker.h +++ b/src/wasm-linker.h @@ -34,24 +34,6 @@ namespace wasm { cashew::IString EMSCRIPTEN_ASM_CONST("emscripten_asm_const"); -// For fatal errors which could arise from input (i.e. not assertion failures) -class Fatal { - public: - Fatal() { - std::cerr << "Fatal: "; - } - template<typename T> - Fatal &operator<<(T arg) { - std::cerr << arg; - return *this; - } - ~Fatal() { - std::cerr << "\n"; - exit(1); - } -}; - - // Wasm module linking/layout information class Linker { public: |