Skip to content

Commit 420db67

Browse files
authored
Improve docs for -sEXPORT_EXCEPTION_HANDLING_HELPERS. NFC (#26009)
1 parent b9d53b0 commit 420db67

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

site/source/docs/tools_reference/settings_reference.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,10 +1131,10 @@ the JS library:
11311131
Given an WebAssembly.Exception object, returns the actual user-thrown C++
11321132
object address in Wasm memory.
11331133

1134-
Setting this option also adds refcount increasing and decreasing functions
1135-
('incrementExceptionRefcount' and 'decrementExceptionRefcount') in the JS
1136-
library because if you catch an exception from JS, you may need to manipulate
1137-
the refcount manually not to leak memory.
1134+
Setting this option also adds refcount incrementing and decrementing
1135+
functions ('incrementExceptionRefcount' and 'decrementExceptionRefcount') in
1136+
the JS library because if you catch an exception from JS, you may need to
1137+
manipulate the refcount manually to avoid memory leaks.
11381138

11391139
See test_EXPORT_EXCEPTION_HANDLING_HELPERS in test/test_core.py for an
11401140
example usage.

src/settings.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -765,10 +765,10 @@ var DISABLE_EXCEPTION_THROWING = false;
765765
// Given an WebAssembly.Exception object, returns the actual user-thrown C++
766766
// object address in Wasm memory.
767767
//
768-
// Setting this option also adds refcount increasing and decreasing functions
769-
// ('incrementExceptionRefcount' and 'decrementExceptionRefcount') in the JS
770-
// library because if you catch an exception from JS, you may need to manipulate
771-
// the refcount manually not to leak memory.
768+
// Setting this option also adds refcount incrementing and decrementing
769+
// functions ('incrementExceptionRefcount' and 'decrementExceptionRefcount') in
770+
// the JS library because if you catch an exception from JS, you may need to
771+
// manipulate the refcount manually to avoid memory leaks.
772772
//
773773
// See test_EXPORT_EXCEPTION_HANDLING_HELPERS in test/test_core.py for an
774774
// example usage.

tools/link.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,11 +1835,10 @@ def get_full_import_name(name):
18351835
# enabling EH, errors out.
18361836
if settings.DISABLE_EXCEPTION_CATCHING and not settings.WASM_EXCEPTIONS:
18371837
exit_with_error('EXPORT_EXCEPTION_HANDLING_HELPERS requires either of -fexceptions or -fwasm-exceptions')
1838-
# We also export refcount increasing and decreasing functions because if you
1839-
# catch an exception, be it an Emscripten exception or a Wasm exception, in
1840-
# JS, you may need to manipulate the refcount manually not to leak memory.
1841-
# What you need to do is different depending on the kind of EH you use
1842-
# (https://github.com/emscripten-core/emscripten/issues/17115).
1838+
# We also export refcount incrementing and decrementing functions because if
1839+
# you catch an exception from JS, you may need to manipulate the refcount
1840+
# manually to avoid memory leaks. See test_EXPORT_EXCEPTION_HANDLING_HELPERS
1841+
# in test/test_core.py for an example usage.
18431842
settings.EXPORTED_FUNCTIONS += ['getExceptionMessage', 'incrementExceptionRefcount', 'decrementExceptionRefcount']
18441843
if settings.WASM_EXCEPTIONS:
18451844
settings.REQUIRED_EXPORTS += ['__cpp_exception']

0 commit comments

Comments
 (0)