Skip to content

Commit 48ace16

Browse files
authored
Improve longjmp stubs. NFC (#18338)
- Use `elif` here so its clear that we either include one block or the next, but never both. - Fix signature of setjmp. - Include the `_emscripten_throw_longjmp` stub regardless of `INCLUDE_FULL_LIBRARY` settings. This final fix is a prerequisite for #16003.
1 parent b313178 commit 48ace16

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/library.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,9 +1241,7 @@ mergeInto(LibraryManager.library, {
12411241
#if SUPPORT_LONGJMP == 'emscripten'
12421242
_emscripten_throw_longjmp__sig: 'v',
12431243
_emscripten_throw_longjmp: function() { throw Infinity; },
1244-
#endif
1245-
1246-
#if !SUPPORT_LONGJMP
1244+
#elif !SUPPORT_LONGJMP
12471245
#if !INCLUDE_FULL_LIBRARY
12481246
// These are in order to print helpful error messages when either longjmp of
12491247
// setjmp is used.
@@ -1258,17 +1256,19 @@ mergeInto(LibraryManager.library, {
12581256
// built with SUPPORT_LONGJMP=1, the object file contains references of not
12591257
// longjmp but _emscripten_throw_longjmp, which is called from
12601258
// emscripten_longjmp.
1261-
_emscripten_throw_longjmp: function() { error('longjmp support was disabled (SUPPORT_LONGJMP=0), but it is required by the code (either set SUPPORT_LONGJMP=1, or remove uses of it in the project)'); },
12621259
get _emscripten_throw_longjmp__deps() {
12631260
return this.longjmp__deps;
12641261
},
12651262
#endif
1263+
_emscripten_throw_longjmp: function() {
1264+
error('longjmp support was disabled (SUPPORT_LONGJMP=0), but it is required by the code (either set SUPPORT_LONGJMP=1, or remove uses of it in the project)');
1265+
},
12661266
// will never be emitted, as the dep errors at compile time
12671267
longjmp: function(env, value) {
1268-
abort('longjmp not supported');
1268+
abort('longjmp not supported (build with -s SUPPORT_LONGJMP)');
12691269
},
1270-
setjmp: function(env, value) {
1271-
abort('setjmp not supported');
1270+
setjmp: function(env) {
1271+
abort('setjmp not supported (build with -s SUPPORT_LONGJMP)');
12721272
},
12731273
#endif
12741274

0 commit comments

Comments
 (0)