cmdline: allow overriding -jsD directives (#26576)#26639
Open
subhaushsingh wants to merge 2 commits intoemscripten-core:mainfrom
Open
cmdline: allow overriding -jsD directives (#26576)#26639subhaushsingh wants to merge 2 commits intoemscripten-core:mainfrom
subhaushsingh wants to merge 2 commits intoemscripten-core:mainfrom
Conversation
aff073f to
02426d8
Compare
sbc100
reviewed
Apr 7, 2026
Collaborator
sbc100
left a comment
There was a problem hiding this comment.
Thanks!
lgtm % test comments
test/test_jslib.py
Outdated
| 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.run_process([EMCC, test_file('hello_world.c'), '-jsDCUSTOM_JS_OPTION=1', '-jsDCUSTOM_JS_OPTION=2']) |
Collaborator
There was a problem hiding this comment.
Can you replace these two lines with:
self.do_runf('jslib/test_jslib_custom_settings.c', '1\n')
# verify that the settings can be specified more then once, and that the last one wins.
self.do_runf('jslib/test_jslib_custom_settings.c', '2\n', cflags=['-jsDCUSTOM_JS_OPTION=2'])
Then you can also delete the test/jslib/test_jslib_custom_settings.out file
73088d2 to
9855548
Compare
Contributor
Author
|
@sbc100 It looks like the Codesize Checks are failing due to a pre-existing stale baseline on main (specifically test_codesize_cxx_lto.json showing a +206 byte drift). This seems unrelated to my -jsD logic. Could you please run the rebaseline-tests workflow on main to unblock the CI? Thanks! |
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.
The Problem
-jsDFOO=1 -jsDFOO=2triggers an error:cannot change built-in settings values with a -jsD directive.FOOto the internalsettingsdictionary. When the second flag appears, the compiler mistakenly thinks a protected system setting (likeWASM) is being overwritten.The Fix
user_js_defines: A set intools/cmdline.pyto track which keys were introduced by the user during the current run.-jsDin this session.Verification
test/test_jslib.pythat specifically tests duplicate/overridden-jsDflags.-jsDWASM=0) still correctly fails as intended.