Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion test/jslib/test_jslib_custom_settings.out

This file was deleted.

5 changes: 4 additions & 1 deletion test/test_jslib.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,10 @@ def test_jslib_legacy(self):
# See https://github.com/emscripten-core/emscripten/issues/10580.
def test_jslib_custom_settings(self):
self.cflags += ['--js-library', test_file('jslib/test_jslib_custom_settings.js'), '-jsDCUSTOM_JS_OPTION=1']
self.do_run_in_out_file_test('jslib/test_jslib_custom_settings.c')
self.do_runf('jslib/test_jslib_custom_settings.c', '1\n')

# verify that the settings can be specified more than once, and that the last one wins.
self.do_runf('jslib/test_jslib_custom_settings.c', '2\n', cflags=['-jsDCUSTOM_JS_OPTION=2'])

self.assert_fail([EMCC, '-jsDWASM=0'], 'cannot change built-in settings values with a -jsD directive')

Expand Down
4 changes: 3 additions & 1 deletion tools/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ def parse_args(newargs): # noqa: C901, PLR0912, PLR0915
"""
should_exit = False
skip = False
user_js_defines = set()
LEGACY_ARGS = {'--js-opts', '--llvm-opts', '--llvm-lto', '--memory-init-file'}
LEGACY_FLAGS = {'--separate-asm', '--jcache', '--proxy-to-worker', '--default-obj-ext',
'--embind-emit-tsd', '--remove-duplicates', '--no-heap-copy'}
Expand Down Expand Up @@ -575,8 +576,9 @@ def consume_arg_file():
key, value = key.split('=')
else:
value = '1'
if key in settings.keys():
if key in settings.keys() and key not in user_js_defines:
exit_with_error(f'{arg}: cannot change built-in settings values with a -jsD directive. Pass -s{key}={value} instead!')
user_js_defines.add(key)
# Apply user -jsD settings
settings[key] = value
newargs[i] = ''
Expand Down
Loading