Skip to content

Commit 5a5cf7a

Browse files
committed
Enable C++ exception catches in wasm builds
The Emscripten build linked with exception catching enabled, but separately compiled C++ objects still need -fexceptions for normal try/catch semantics. Without it, wasm could let exceptions escape through paths that native builds catch internally.
1 parent 1813e06 commit 5a5cf7a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Makefile.emscripten

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ endif
1515
# Emscripten stuff
1616
EMFLAGS := --bind -s WASM=1 -s MODULARIZE=1 -s EXPORT_ES6=1 -s EXPORT_NAME="'TIVarsLib'" -s NO_EXIT_RUNTIME=1 -s ASSERTIONS=$(ASSERTIONS) -s DISABLE_EXCEPTION_CATCHING=0 -s EXPORTED_RUNTIME_METHODS="['FS','getExceptionMessage','decrementExceptionRefcount']" $(DEBUG_EMFLAGS)
1717

18-
CXXFLAGS := $(OPTFLAGS) -std=c++2a -DTH_GDB_SUPPORT=1 -Ivendor/pugixml -W -Wall -Wextra
18+
CXXFLAGS := $(OPTFLAGS) -std=c++2a -DTH_GDB_SUPPORT=1 -Ivendor/pugixml -W -Wall -Wextra -fexceptions
1919
CFLAGS := $(OPTFLAGS) -std=c2x -W -Wall -Wextra
2020
LFLAGS := $(OPTFLAGS) $(EMFLAGS)
2121

0 commit comments

Comments
 (0)