diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-01-14 13:21:42 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-01-14 13:21:42 -0800 |
commit | 3cb5ffa5da8700e967812084f126b69873f8c108 (patch) | |
tree | 0b1fcfe28db4f4aa71f6dbd58f0592f1c34183c1 /src | |
parent | edfccbf2708ee4cb5e9cae5a04badf6f2b84b799 (diff) |
clear message when exception catching is disabled and an exception is thrown
Diffstat (limited to 'src')
-rw-r--r-- | src/jsifier.js | 2 | ||||
-rw-r--r-- | src/library.js | 9 | ||||
-rw-r--r-- | src/parseTools.js | 4 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 44d9cc53..b9209dd2 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1150,7 +1150,7 @@ function JSify(data, functionsOnly, givenFunctions) { var ptr = makeStructuralAccess(item.ident, 0); return (EXCEPTION_DEBUG ? 'Module.print("Resuming exception");' : '') + 'if (' + makeGetValue('_llvm_eh_exception.buf', 0, 'void*') + ' == 0) { ' + makeSetValue('_llvm_eh_exception.buf', 0, ptr, 'void*') + ' } ' + - 'throw ' + ptr + ';'; + makeThrow('ptr') + ';'; }); makeFuncLineActor('invoke', function(item) { // Wrapping in a function lets us easily return values if we are diff --git a/src/library.js b/src/library.js index 7ae17fb7..b70aadbc 100644 --- a/src/library.js +++ b/src/library.js @@ -4894,12 +4894,12 @@ LibraryManager.library = { } else { __ZSt18uncaught_exceptionv.uncaught_exception++; } - throw ptr; + {{{ makeThrow('ptr') }}}; }, __cxa_rethrow__deps: ['llvm_eh_exception', '__cxa_end_catch'], __cxa_rethrow: function() { ___cxa_end_catch.rethrown = true; - throw {{{ makeGetValue('_llvm_eh_exception.buf', '0', 'void*') }}}; + {{{ makeThrow(makeGetValue('_llvm_eh_exception.buf', '0', 'void*')) }}}; }, llvm_eh_exception__postset: '_llvm_eh_exception.buf = allocate(12, "void*", ALLOC_STATIC);', llvm_eh_exception: function() { @@ -4962,11 +4962,10 @@ LibraryManager.library = { }, _Unwind_Resume_or_Rethrow: function(ptr) { - throw ptr; + {{{ makeThrow('ptr') }}}; }, - _Unwind_RaiseException__deps: ['llvm_eh_exception', '__cxa_find_matching_catch'], _Unwind_RaiseException: function(ptr) { - throw ptr; + {{{ makeThrow('ptr') }}}; }, _Unwind_DeleteException: function(ptr) {}, diff --git a/src/parseTools.js b/src/parseTools.js index 32bf70e9..07e044b9 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1666,6 +1666,10 @@ function makeStructuralAccess(ident, i) { } } +function makeThrow(what) { + return 'throw ' + what + (DISABLE_EXCEPTION_CATCHING ? ' + " - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 to catch."' : '') + ';'; +} + // From parseLLVMSegment function finalizeLLVMParameter(param, noIndexizeFunctions) { var ret; |