-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add better error message when mixing exceptions modes. NFC #23738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9438,6 +9438,22 @@ def test_exceptions_c_linker(self): | |
| stderr = self.expect_fail([EMCC, '-sSTRICT', test_file('other/test_exceptions_c_linker.c')]) | ||
| self.assertContained('error: undefined symbol: __cxa_find_matching_catch_1', stderr) | ||
|
|
||
| def test_exceptions_mismatch(self): | ||
| create_file('main.c', ''' | ||
| #include <setjmp.h> | ||
| int main() { | ||
| jmp_buf buf; | ||
| longjmp(buf, 8); | ||
| } | ||
| ''') | ||
| self.emcc('main.c', ['-c']) | ||
| err = self.expect_fail([EMCC, 'main.o', '-fwasm-exceptions']) | ||
| self.assertContained('error: undefined reference to `emscripten_longjmp`. One or more object files was not compiled with `-fwasm-exceptions`. Build with `-sASSERTIONS=0` to have wasm-ld report which one.', err) | ||
|
|
||
| err = self.expect_fail([EMCC, 'main.o', '-fwasm-exceptions', '-sASSERTIONS=0']) | ||
| self.assertContained('wasm-ld: error: main.o: undefined symbol: emscripten_longjmp', err) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like a big improvement to me. When Emscripten invokes wasm-ld it would be nice if it could detect this error and add the extra context about this since one doesn't see the instruction to pass If it's too inconvenient this by itself is quite helpful.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Emscripten doesn't currently capture and parse the output of wasm-ld. Its just fails if/when wasm-ld fails. I'm not sure I want to go down the route of trying to get fancy with parsing the error output of wasm-ld. I decided that showing the more specific error when |
||
|
|
||
|
|
||
| @with_all_eh_sjlj | ||
| def test_exceptions_stack_trace_and_message(self): | ||
| src = r''' | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm,
-sASSERTIONS=0is the default right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-sASSERTIONS=1is the default for-O0but-sASSERTIONS=0is the default of-O1and above.