-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Deprecate DISABLE_EXCEPTION_CATCHING=2 #13733
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
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 |
---|---|---|
|
@@ -1236,7 +1236,6 @@ def test_exceptions_3(self): | |
self.do_run('src.js', 'Caught exception: Hello\nDone.', args=['2'], no_build=True) | ||
|
||
def test_exceptions_allowed(self): | ||
self.set_setting('DISABLE_EXCEPTION_CATCHING', 2) | ||
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. Shouldn't we set it to 0 instead and not delete the line? The same for other functions. 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. No because we set 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. No I meant 0, not 1. The default setting for Or does setting 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. Yes exactly, setting EXCEPTION_CATCHING_ALLOWED now implies DISABLE_EXCEPTION_CATCHING. Also setting 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. I see. But why is setting 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. It seems cleaner to me that they should never be specified together. Don't you think they should be 100% mutually exclusive? That fact that internally we set 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. True, but |
||
# Wasm does not add an underscore to function names. For wasm, the | ||
# mismatches are fixed in fixImports() function in JS glue code. | ||
self.set_setting('EXCEPTION_CATCHING_ALLOWED', ["_Z12somefunctionv"]) | ||
|
@@ -1267,7 +1266,7 @@ def test_exceptions_allowed(self): | |
fake_size += os.path.getsize('test_exceptions_allowed.wasm') | ||
shutil.copyfile('test_exceptions_allowed.js', 'fake.js') | ||
|
||
self.set_setting('DISABLE_EXCEPTION_CATCHING') | ||
self.clear_setting('EXCEPTION_CATCHING_ALLOWED') | ||
self.do_run_from_file(src, empty_output, assert_returncode=NON_ZERO) | ||
disabled_size = os.path.getsize('test_exceptions_allowed.js') | ||
if self.is_wasm(): | ||
|
@@ -1278,33 +1277,55 @@ def test_exceptions_allowed(self): | |
print('empty_size: %d' % empty_size) | ||
print('fake_size: %d' % fake_size) | ||
print('disabled_size: %d' % disabled_size) | ||
self.assertEqual(empty_size, fake_size) | ||
# empty list acts the same as fully disabled | ||
self.assertEqual(empty_size, disabled_size) | ||
# big change when we disable exception catching of the function | ||
self.assertGreater(size - empty_size, 0.01 * size) | ||
# full disable can remove a little bit more | ||
self.assertLess(disabled_size, empty_size) | ||
self.assertLess(disabled_size, fake_size) | ||
|
||
def test_exceptions_allowed_2(self): | ||
self.set_setting('DISABLE_EXCEPTION_CATCHING', 2) | ||
# Wasm does not add an underscore to function names. For wasm, the | ||
# mismatches are fixed in fixImports() function in JS glue code. | ||
self.set_setting('EXCEPTION_CATCHING_ALLOWED', ["main"]) | ||
self.set_setting('EXCEPTION_CATCHING_ALLOWED', ['main']) | ||
# otherwise it is inlined and not identified | ||
self.set_setting('INLINING_LIMIT') | ||
|
||
self.do_core_test('test_exceptions_allowed_2.cpp') | ||
|
||
def test_exceptions_allowed_uncaught(self): | ||
self.emcc_args += ['-std=c++11'] | ||
self.set_setting('DISABLE_EXCEPTION_CATCHING', 2) | ||
# Wasm does not add an underscore to function names. For wasm, the | ||
# mismatches are fixed in fixImports() function in JS glue code. | ||
self.set_setting('EXCEPTION_CATCHING_ALLOWED', ["_Z4testv"]) | ||
self.set_setting('EXCEPTION_CATCHING_ALLOWED', ['_Z4testv']) | ||
# otherwise it is inlined and not identified | ||
self.set_setting('INLINING_LIMIT') | ||
|
||
self.do_core_test('test_exceptions_allowed_uncaught.cpp') | ||
|
||
def test_exceptions_allowed_misuse(self): | ||
self.set_setting('EXCEPTION_CATCHING_ALLOWED', ['foo']) | ||
|
||
# Test old =2 setting for DISABLE_EXCEPTION_CATCHING | ||
self.set_setting('DISABLE_EXCEPTION_CATCHING', 2) | ||
err = self.expect_fail([EMCC, test_file('hello_world.c')] + self.get_emcc_args()) | ||
self.assertContained('error: DISABLE_EXCEPTION_CATCHING=X is no longer needed when specifying EXCEPTION_CATCHING_ALLOWED [-Wdeprecated] [-Werror]', err) | ||
|
||
# =0 should also be a warning | ||
self.set_setting('DISABLE_EXCEPTION_CATCHING', 0) | ||
err = self.expect_fail([EMCC, test_file('hello_world.c')] + self.get_emcc_args()) | ||
self.assertContained('error: DISABLE_EXCEPTION_CATCHING=X is no longer needed when specifying EXCEPTION_CATCHING_ALLOWED [-Wdeprecated] [-Werror]', err) | ||
|
||
# =1 should be a hard error | ||
self.set_setting('DISABLE_EXCEPTION_CATCHING', 1) | ||
err = self.expect_fail([EMCC, test_file('hello_world.c')] + self.get_emcc_args()) | ||
self.assertContained('error: DISABLE_EXCEPTION_CATCHING and EXCEPTION_CATCHING_ALLOWED are mutually exclusive', err) | ||
|
||
# even setting an empty list should trigger the error; | ||
self.set_setting('EXCEPTION_CATCHING_ALLOWED', []) | ||
err = self.expect_fail([EMCC, test_file('hello_world.c')] + self.get_emcc_args()) | ||
self.assertContained('error: DISABLE_EXCEPTION_CATCHING and EXCEPTION_CATCHING_ALLOWED are mutually exclusive', err) | ||
|
||
@with_both_exception_handling | ||
def test_exceptions_uncaught(self): | ||
# needs to flush stdio streams | ||
|
Uh oh!
There was an error while loading. Please reload this page.