Skip to content

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Oct 27, 2025

I did have to update the test for emscripten_get_compiler_setting which was using this internal settings
to test for compiler settings that return strings. I changed to a different (non-inernal) setting: CLOSURE_WARNINGS.

I think we should probably followup by making emscripten_get_compiler_setting not report internal setting since the
whole point of internal settings is that we should be free to remove/change them at any time without breaking any
user code. See #25663

@sbc100 sbc100 requested review from dschuff and kripken October 27, 2025 16:10
@juj
Copy link
Collaborator

juj commented Oct 27, 2025

Hmm, does(n't) removing this prevent this user code from working?

https://github.com/juj/wasm_webgpu/blob/54c51d715d68f22a62e1f84eb072737e8a8270c0/lib/lib_webgpu.js#L1-L4

If not, then LGTM. Though I suppose that's what this was for.

(It would be nice to get a better construct for downstream users to #ifdef check the version. I think we had an open bug about that somewhere)

@sbc100
Copy link
Collaborator Author

sbc100 commented Oct 27, 2025

I see. Its kind of shame that internal settings like this are exposed to user libraries. I was kind of hoping that internal settings we internal in the sense that we were free to add/remove/change them with impunity.

But I guess it turns out that they are visible in this way to use JS libraries.

@sbc100
Copy link
Collaborator Author

sbc100 commented Oct 27, 2025

I guess we should add test to test_jslib.py and document that this setting is used externally like this.

@juj
Copy link
Collaborator

juj commented Oct 27, 2025

Its kind of shame that internal settings like this are exposed to user libraries. I was kind of hoping that internal settings we internal in the sense that we were free to add/remove/change them with impunity.

I agree it would be good for settings_internal.js to be internal.

FWIW, back in 2023 it seems like you were agreeing with manually parsing EMSCRIPTEN_VERSION as a good solution, #19469 (comment) to avoid depending on changes to Emscripten.

Not sure if EMSCRIPTEN_VERSION was back then located in settings.js though.

sbc100 added a commit to sbc100/emscripten that referenced this pull request Oct 27, 2025
I proposed removing this internal setting in emscripten-core#25661 but it turns
out it was useful for externally managed JS library files.

However, I don't think it should be tested as part of
emscripten_get_compiler_setting.c since C/C++ can already get the
compiler version using VERSION macros, no need for the runtime check.

Indeed I hope we can stop exposing any internal settings to
emscripten_get_compiler_setting: emscripten-core#25663
sbc100 added a commit to sbc100/emscripten that referenced this pull request Oct 27, 2025
I proposed removing this internal setting in emscripten-core#25661 but it turns
out it was useful for externally managed JS library files.

However, I don't think it should be tested as part of
emscripten_get_compiler_setting.c since C/C++ can already get the
compiler version using VERSION macros, no need for the runtime check.

Indeed I hope we can stop exposing any internal settings to
emscripten_get_compiler_setting: emscripten-core#25663
sbc100 added a commit to sbc100/emscripten that referenced this pull request Oct 27, 2025
I proposed removing this internal setting in emscripten-core#25661 but it turns
out it was useful for externally managed JS library files.

However, I don't think it should be tested as part of
emscripten_get_compiler_setting.c since C/C++ can already get the
compiler version using VERSION macros, no need for the runtime check.

Indeed I hope we can stop exposing any internal settings to
emscripten_get_compiler_setting: emscripten-core#25663
sbc100 added a commit that referenced this pull request Oct 27, 2025
I proposed removing this internal setting in #25661 but it turns out it
was useful for externally managed JS library files.

However, I don't think it should be tested as part of
`emscripten_get_compiler_setting.c` since C/C++ can already get the
compiler version using `VERSION` macros. . There should be no need for
the runtime checks.

Indeed I hope we can stop exposing any internal settings to
emscripten_get_compiler_setting: #25663

Also, add test for @juj's specific use case for `EMSCRIPTEN_VERSION` in
a JS library file.
@sbc100 sbc100 marked this pull request as draft October 27, 2025 21:27
@kripken
Copy link
Member

kripken commented Oct 28, 2025

That setting was intentionally added for this purpose, to be used as in that test.

Someone asked for a way to get the emscripten version at runtime, and we had other requests for such things, so a general "get compiler setting" option seemed simplest, plus adding that option with the version in it.

@sbc100
Copy link
Collaborator Author

sbc100 commented Oct 28, 2025

That setting was intentionally added for this purpose, to be used as in that test.

Someone asked for a way to get the emscripten version at runtime, and we had other requests for such things, so a general "get compiler setting" option seemed simplest, plus adding that option with the version in it.

But the runtime version of emscripten and build time version are always the same right? By definition? At the build time version is available much more simply via __EMSCRIPTEN_XXX__ version macros.

I did a global github search and could only find one use of this.. which could easily be replaced by a build time check.

@kripken
Copy link
Member

kripken commented Oct 28, 2025

Oh, are you saying there is an easy way to capture the build-time value and make it available at runtime? Yeah, I guess it could be saved as a string with a C preprocessor #?

@kripken
Copy link
Member

kripken commented Oct 28, 2025

Seems reasonable. In that case I'm ok to remove this, but perhaps we could add to the changelog or docs an example of the other way.

@sbc100
Copy link
Collaborator Author

sbc100 commented Oct 28, 2025

I decided to abandon this for now. Since its needed for @juj's external JS library use case.

@sbc100 sbc100 closed this Oct 28, 2025
@sbc100 sbc100 deleted the remove_unused_settings branch October 28, 2025 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants