@@ -180,7 +180,7 @@ extern "C" {
180
180
// object. Zero-fill the object. If memory can't be allocated, call
181
181
// std::terminate. Return a pointer to the memory to be used for the
182
182
// user's exception object.
183
- void *__cxa_allocate_exception (size_t thrown_size) _NOEXCEPT {
183
+ void *__cxa_allocate_exception (size_t thrown_size) throw() {
184
184
size_t actual_size = cxa_exception_size_from_exception_thrown_size (thrown_size);
185
185
186
186
// Allocate extra space before the __cxa_exception header to ensure the
@@ -198,7 +198,7 @@ void *__cxa_allocate_exception(size_t thrown_size) _NOEXCEPT {
198
198
199
199
200
200
// Free a __cxa_exception object allocated with __cxa_allocate_exception.
201
- void __cxa_free_exception (void *thrown_object) _NOEXCEPT {
201
+ void __cxa_free_exception (void *thrown_object) throw() {
202
202
// Compute the size of the padding before the header.
203
203
size_t header_offset = get_cxa_exception_offset ();
204
204
char *raw_buffer =
@@ -254,15 +254,15 @@ will call terminate, assuming that there was no handler for the
254
254
exception.
255
255
*/
256
256
257
- #if defined(__USING_WASM_EXCEPTIONS__) && !defined(NDEBUG)
257
+ #if defined(__EMSCRIPTEN__) && defined( __USING_WASM_EXCEPTIONS__) && !defined(NDEBUG)
258
258
extern " C" {
259
259
void __throw_exception_with_stack_trace (_Unwind_Exception*);
260
260
} // extern "C"
261
261
#endif
262
262
263
263
void
264
264
#ifdef __USING_WASM_EXCEPTIONS__
265
- // In wasm, destructors return their argument
265
+ // In Wasm, a destructor returns its argument
266
266
__cxa_throw (void *thrown_object, std::type_info *tinfo, void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)) {
267
267
#else
268
268
__cxa_throw (void *thrown_object, std::type_info *tinfo, void (_LIBCXXABI_DTOR_FUNC *dest)(void *)) {
@@ -287,14 +287,10 @@ __cxa_throw(void *thrown_object, std::type_info *tinfo, void (_LIBCXXABI_DTOR_FU
287
287
288
288
#ifdef __USING_SJLJ_EXCEPTIONS__
289
289
_Unwind_SjLj_RaiseException (&exception_header->unwindHeader );
290
- #elif __USING_WASM_EXCEPTIONS__
291
- #ifdef NDEBUG
292
- _Unwind_RaiseException (&exception_header->unwindHeader );
293
- #else
290
+ #elif defined(__EMSCRIPTEN__) && defined(__USING_WASM_EXCEPTIONS__) && !defined(NDEBUG)
294
291
// In debug mode, call a JS library function to use WebAssembly.Exception JS
295
292
// API, which enables us to include stack traces
296
293
__throw_exception_with_stack_trace (&exception_header->unwindHeader );
297
- #endif
298
294
#else
299
295
_Unwind_RaiseException (&exception_header->unwindHeader );
300
296
#endif
@@ -312,7 +308,7 @@ The adjusted pointer is computed by the personality routine during phase 1
312
308
313
309
Requires: exception is native
314
310
*/
315
- void *__cxa_get_exception_ptr (void *unwind_exception) _NOEXCEPT {
311
+ void *__cxa_get_exception_ptr (void *unwind_exception) throw () {
316
312
#if defined(_LIBCXXABI_ARM_EHABI)
317
313
return reinterpret_cast <void *>(
318
314
static_cast <_Unwind_Control_Block*>(unwind_exception)->barrier_cache .bitpattern [0 ]);
@@ -327,7 +323,7 @@ void *__cxa_get_exception_ptr(void *unwind_exception) _NOEXCEPT {
327
323
The routine to be called before the cleanup. This will save __cxa_exception in
328
324
__cxa_eh_globals, so that __cxa_end_cleanup() can recover later.
329
325
*/
330
- bool __cxa_begin_cleanup (void *unwind_arg) _NOEXCEPT {
326
+ bool __cxa_begin_cleanup (void *unwind_arg) throw () {
331
327
_Unwind_Exception* unwind_exception = static_cast <_Unwind_Exception*>(unwind_arg);
332
328
__cxa_eh_globals* globals = __cxa_get_globals ();
333
329
__cxa_exception* exception_header =
@@ -451,7 +447,7 @@ to terminate or unexpected during unwinding.
451
447
_Unwind_Exception and return a pointer to that.
452
448
*/
453
449
void *
454
- __cxa_begin_catch (void * unwind_arg) _NOEXCEPT
450
+ __cxa_begin_catch (void * unwind_arg) throw ()
455
451
{
456
452
_Unwind_Exception* unwind_exception = static_cast <_Unwind_Exception*>(unwind_arg);
457
453
bool native_exception = __isOurExceptionClass (unwind_exception);
@@ -644,6 +640,10 @@ void __cxa_rethrow() {
644
640
}
645
641
#ifdef __USING_SJLJ_EXCEPTIONS__
646
642
_Unwind_SjLj_RaiseException (&exception_header->unwindHeader );
643
+ #elif defined(__EMSCRIPTEN__) && defined(__USING_WASM_EXCEPTIONS__) && !defined(NDEBUG)
644
+ // In debug mode, call a JS library function to use WebAssembly.Exception JS
645
+ // API, which enables us to include stack traces
646
+ __throw_exception_with_stack_trace (&exception_header->unwindHeader );
647
647
#else
648
648
_Unwind_RaiseException (&exception_header->unwindHeader );
649
649
#endif
@@ -667,7 +667,7 @@ void __cxa_rethrow() {
667
667
Requires: If thrown_object is not NULL, it is a native exception.
668
668
*/
669
669
void
670
- __cxa_increment_exception_refcount (void *thrown_object) _NOEXCEPT {
670
+ __cxa_increment_exception_refcount (void *thrown_object) throw () {
671
671
if (thrown_object != NULL )
672
672
{
673
673
__cxa_exception* exception_header = cxa_exception_from_thrown_object (thrown_object);
@@ -684,7 +684,7 @@ __cxa_increment_exception_refcount(void *thrown_object) _NOEXCEPT {
684
684
Requires: If thrown_object is not NULL, it is a native exception.
685
685
*/
686
686
_LIBCXXABI_NO_CFI
687
- void __cxa_decrement_exception_refcount (void *thrown_object) _NOEXCEPT {
687
+ void __cxa_decrement_exception_refcount (void *thrown_object) throw () {
688
688
if (thrown_object != NULL )
689
689
{
690
690
__cxa_exception* exception_header = cxa_exception_from_thrown_object (thrown_object);
@@ -707,7 +707,7 @@ void __cxa_decrement_exception_refcount(void *thrown_object) _NOEXCEPT {
707
707
been no exceptions thrown, ever, on this thread, we can return NULL without
708
708
the need to allocate the exception-handling globals.
709
709
*/
710
- void *__cxa_current_primary_exception () _NOEXCEPT {
710
+ void *__cxa_current_primary_exception () throw () {
711
711
// get the current exception
712
712
__cxa_eh_globals* globals = __cxa_get_globals_fast ();
713
713
if (NULL == globals)
@@ -769,8 +769,13 @@ __cxa_rethrow_primary_exception(void* thrown_object)
769
769
dep_exception_header->unwindHeader .exception_cleanup = dependent_exception_cleanup;
770
770
#ifdef __USING_SJLJ_EXCEPTIONS__
771
771
_Unwind_SjLj_RaiseException (&dep_exception_header->unwindHeader );
772
+ #elif defined(__EMSCRIPTEN__) && defined(__USING_WASM_EXCEPTIONS__) && !defined(NDEBUG)
773
+ // In debug mode, call a JS library function to use
774
+ // WebAssembly.Exception JS API, which enables us to include stack
775
+ // traces
776
+ __throw_exception_with_stack_trace (&exception_header->unwindHeader );
772
777
#else
773
- _Unwind_RaiseException (&dep_exception_header ->unwindHeader );
778
+ _Unwind_RaiseException (&exception_header ->unwindHeader );
774
779
#endif
775
780
// Some sort of unwinding error. Note that terminate is a handler.
776
781
__cxa_begin_catch (&dep_exception_header->unwindHeader );
@@ -779,10 +784,10 @@ __cxa_rethrow_primary_exception(void* thrown_object)
779
784
}
780
785
781
786
bool
782
- __cxa_uncaught_exception () _NOEXCEPT { return __cxa_uncaught_exceptions () != 0 ; }
787
+ __cxa_uncaught_exception () throw () { return __cxa_uncaught_exceptions () != 0 ; }
783
788
784
789
unsigned int
785
- __cxa_uncaught_exceptions () _NOEXCEPT
790
+ __cxa_uncaught_exceptions () throw ()
786
791
{
787
792
// This does not report foreign exceptions in flight
788
793
__cxa_eh_globals* globals = __cxa_get_globals_fast ();
0 commit comments