Skip to content

Conversation

juj
Copy link
Collaborator

@juj juj commented Sep 19, 2025

Fix -sEXIT_RUNTIME in MINIMAL_RUNTIME build mode. Fixes 13 tests in minimal0 suite, e.g. minimal0.test_static_variable.

…inimal0 suite, e.g. minimal0.test_static_variable.
Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The throw exit(${code})code is not dependent onEXIT_RUNTIME` so maybe the catch here should not be either?

i.e. do we want the "silently suppress exit exception" to only happen when EXIT_RUNTIME is set? and otherwise we just let the exit exception propagate the top level?

@juj
Copy link
Collaborator Author

juj commented Sep 19, 2025

The throw exit(${code})code is not dependent onEXIT_RUNTIME` so maybe the catch here should not be either?

Then it would increase code size for no benefit.

If user is building with -sEXIT_RUNTIME=0, then they would likely not call exit(0) anywhere, hence emitting code to catch exit()s would be redundant.

#if RUNTIME_DEBUG
dbg(`main() called ${e}.`); // e.g. "main() called exit(0)."
#endif
// Report to Module that the program exited. TODO: Find a way to not emit
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap this in #if expectToReceiveOnModule('onExit').

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.

2 participants