Skip to content

Commit 2f9af8a

Browse files
committed
Run more of out tests with -sNO_DEFAULT_TO_CXX
We were previously only applying this flag to tests that use `self.build` (i.e. most test). Now we apply it to and even larger set. The code size changes here only occur in debug builds where we enumerate all known JS symbols, and there are come JS symbols are the C++ only.
1 parent da25bce commit 2f9af8a

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

test/common.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,11 @@ def setUp(self):
839839
self.js_engines = config.JS_ENGINES.copy()
840840
self.settings_mods = {}
841841
self.emcc_args = ['-Wclosure', '-Werror', '-Wno-limited-postlink-optimizations']
842+
# TODO(https://github.com/emscripten-core/emscripten/issues/11121)
843+
# For historical reasons emcc compiles and links as C++ by default.
844+
# However we want to run our tests in a more strict manner. We can
845+
# remove this if the issue above is ever fixed.
846+
self.set_setting('NO_DEFAULT_TO_CXX')
842847
self.ldflags = []
843848
# Increate stack trace limit to maximise usefulness of test failure reports
844849
self.node_args = ['--stack-trace-limit=50']
@@ -1042,12 +1047,6 @@ def build(self, filename, libraries=None, includes=None, force_c=False, js_outfi
10421047
filename = test_file(filename)
10431048
suffix = '.js' if js_outfile else '.wasm'
10441049
compiler = [compiler_for(filename, force_c)]
1045-
if compiler[0] == EMCC:
1046-
# TODO(https://github.com/emscripten-core/emscripten/issues/11121)
1047-
# For historical reasons emcc compiles and links as C++ by default.
1048-
# However we want to run our tests in a more strict manner. We can
1049-
# remove this if the issue above is ever fixed.
1050-
compiler.append('-sNO_DEFAULT_TO_CXX')
10511050

10521051
if force_c:
10531052
assert shared.suffix(filename) != '.c', 'force_c is not needed for source files ending in .c'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8416
1+
8385
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
23086
1+
23001
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7245
1+
7212
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19710
1+
19625

test/test_other.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3108,7 +3108,7 @@ def test_embind_tsgen_val(self):
31083108
self.assertExists('embind_tsgen_val.d.ts')
31093109

31103110
def test_embind_tsgen_bigint(self):
3111-
args = [EMCC, test_file('other/embind_tsgen_bigint.cpp'), '-lembind', '--embind-emit-tsd', 'embind_tsgen_bigint.d.ts']
3111+
args = [EMXX, test_file('other/embind_tsgen_bigint.cpp'), '-lembind', '--embind-emit-tsd', 'embind_tsgen_bigint.d.ts']
31123112
# Check that TypeScript generation fails when code contains bigints but their support is not enabled
31133113
stderr = self.expect_fail(args)
31143114
self.assertContained("Missing primitive type to TS type for 'int64_t", stderr)
@@ -3118,14 +3118,14 @@ def test_embind_tsgen_bigint(self):
31183118

31193119
def test_embind_tsgen_memory64(self):
31203120
# Check that when memory64 is enabled longs & unsigned longs are mapped to bigint in the generated TS bindings
3121-
self.run_process([EMCC, test_file('other/embind_tsgen_memory64.cpp'),
3121+
self.run_process([EMXX, test_file('other/embind_tsgen_memory64.cpp'),
31223122
'-lembind', '--embind-emit-tsd', 'embind_tsgen_memory64.d.ts', '-sMEMORY64', '-Wno-experimental'] +
31233123
self.get_emcc_args())
31243124
self.assertFileContents(test_file('other/embind_tsgen_memory64.d.ts'), read_file('embind_tsgen_memory64.d.ts'))
31253125

31263126
def test_embind_tsgen_exceptions(self):
31273127
# Check that when Wasm exceptions and assertions are enabled bindings still generate.
3128-
self.run_process([EMCC, test_file('other/embind_tsgen.cpp'),
3128+
self.run_process([EMXX, test_file('other/embind_tsgen.cpp'),
31293129
'-lembind', '--embind-emit-tsd', 'embind_tsgen.d.ts', '-fwasm-exceptions', '-sASSERTIONS'])
31303130
self.assertFileContents(test_file('other/embind_tsgen.d.ts'), read_file('embind_tsgen.d.ts'))
31313131

0 commit comments

Comments
 (0)