Don't change WASM_EXCEPTIONS mode when setting -fno-exceptions#26184
Merged
dschuff merged 1 commit intoemscripten-core:mainfrom Jan 28, 2026
Merged
Don't change WASM_EXCEPTIONS mode when setting -fno-exceptions#26184dschuff merged 1 commit intoemscripten-core:mainfrom
dschuff merged 1 commit intoemscripten-core:mainfrom
Conversation
We have 3 main user-facing EH flags, `-fwasm-exceptions`, `-fexceptions`, and `-fno-exceptions`. IIRC they aren't supposed to be mutually exclusive, -fwasm-exceptions` composes with the other 2, setting the mode of codegen, where the other 2 set whether exceptions compile. If you do `em++ -fno-exceptions -fwasm-exceptions` on a file that has try/catch, you get the expected compile-time error. However if you do `em++ -fwasm-exceptions -fno-exceptions` you should get the same error, but instead you get `clang++: error: invalid argument '-fwasm-exceptions' not allowed with '-enable-emscripten-sjlj'`. This is because the underlying clang is indeed getting passed the `-mllvm -enable-emscripten-sjlj` flag in the latter case but not the former case.
Member
Author
|
I think this is an OK solution? aside from the effect tested for here, it will affect the error checking for combinations with settings like DISABLE_EXCEPTION_CATCHING, but I think not in a way that should break things? |
aheejin
approved these changes
Jan 28, 2026
Member
aheejin
left a comment
There was a problem hiding this comment.
I can't figure out why the error changes from the top of my head, but -fno-exceptions changing the exception kind is certainly weird to me.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have 3 main user-facing EH flags,
-fwasm-exceptions,-fexceptions,and
-fno-exceptions. IIRC they aren't supposed to be mutually exclusive,-fwasm-exceptions` composes with the other 2, setting the mode of codegen,
where the other 2 set whether exceptions compile.
If you do
em++ -fno-exceptions -fwasm-exceptionson a file that has try/catch,you get the expected compile-time error. However if you do
em++ -fwasm-exceptions -fno-exceptionsyou should get the same error, butinstead you get
clang++: error: invalid argument '-fwasm-exceptions' not allowed with '-enable-emscripten-sjlj'.This is because the underlying clang is indeed getting passed the
-mllvm -enable-emscripten-sjljflag in the latter case but not the former case.