diff options
author | Bruce Mitchener <bruce.mitchener@gmail.com> | 2014-01-20 15:03:35 +0700 |
---|---|---|
committer | Bruce Mitchener <bruce.mitchener@gmail.com> | 2014-01-21 10:40:47 +0700 |
commit | e7ae95bd86e363d6c51ca00abacb6733fc0d01cb (patch) | |
tree | c4080c38043a205edca3d850be4ea74e0901a9f0 | |
parent | 9339aabb90aeb8999fae8e2761142d94e0877b3e (diff) |
Move workaround for emscripten from include/exception to library.js.
-rw-r--r-- | src/library.js | 15 | ||||
-rw-r--r-- | system/include/libcxx/exception | 4 | ||||
-rw-r--r-- | tests/core/test_exceptions_std.in | 1 | ||||
-rw-r--r-- | tests/core/test_exceptions_std.out | 3 |
4 files changed, 19 insertions, 4 deletions
diff --git a/src/library.js b/src/library.js index c915125c..5e53805f 100644 --- a/src/library.js +++ b/src/library.js @@ -4539,7 +4539,20 @@ LibraryManager.library = { } }, - _ZNSt9exceptionD2Ev: function(){}, // XXX a dependency of dlmalloc, but not actually needed if libcxx is not anyhow included + // Destructors for std::exception since we don't have them implemented in libcxx as we aren't using libcxxabi. + // These are also needed for the dlmalloc tests. + _ZNSt9exceptionD1Ev: function() {}, + _ZNSt9exceptionD2Ev: function() {}, + + _ZNKSt9exception4whatEv__deps: ['_malloc'], + _ZNKSt9exception4whatEv: function() { + if (!__ZNKSt9exception4whatEv.buffer) { + var name = "std::exception"; + __ZNKSt9exception4whatEv.buffer = _malloc(name.length + 1); + writeStringToMemory(name, __ZNKSt9exception4whatEv.buffer); + } + return __ZNKSt9exception4whatEv.buffer; + }, _ZNSt9type_infoD2Ev: function(){}, diff --git a/system/include/libcxx/exception b/system/include/libcxx/exception index ddd75bd4..cad802e0 100644 --- a/system/include/libcxx/exception +++ b/system/include/libcxx/exception @@ -91,8 +91,8 @@ class _LIBCPP_EXCEPTION_ABI exception { public: _LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {} - virtual ~exception() _NOEXCEPT {} // XXX EMSCRIPTEN - implement in header - virtual const char* what() const _NOEXCEPT { return "std::exception"; } // XXX EMSCRIPTEN - implement in header + virtual ~exception() _NOEXCEPT; + virtual const char* what() const _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI bad_exception diff --git a/tests/core/test_exceptions_std.in b/tests/core/test_exceptions_std.in index 4b5905d8..3b9f874b 100644 --- a/tests/core/test_exceptions_std.in +++ b/tests/core/test_exceptions_std.in @@ -7,6 +7,7 @@ int main() { throw e; } catch (std::exception e) { + printf("what? %s\n", e.what()); printf("caught std::exception\n"); } return 0; diff --git a/tests/core/test_exceptions_std.out b/tests/core/test_exceptions_std.out index c1660de4..eddab21c 100644 --- a/tests/core/test_exceptions_std.out +++ b/tests/core/test_exceptions_std.out @@ -1 +1,2 @@ -caught std::exception
\ No newline at end of file +what? std::exception +caught std::exception |