Skip to content

Don't emit code to call main if there is no main#5850

Merged
kripken merged 3 commits intoincomingfrom
no-callMain-without-main
Nov 28, 2017
Merged

Don't emit code to call main if there is no main#5850
kripken merged 3 commits intoincomingfrom
no-callMain-without-main

Conversation

@kripken
Copy link
Copy Markdown
Member

@kripken kripken commented Nov 26, 2017

No description provided.

@curiousdannii
Copy link
Copy Markdown
Contributor

curiousdannii commented Nov 26, 2017

You should be able to put these lines behind #if HAS_MAIN too:

https://github.com/kripken/emscripten/blob/137382c98097eee658285b7a25dc8470fa55f332/src/postamble.js#L389-L396

@saschanaz
Copy link
Copy Markdown
Collaborator

(That jsifier.js looks very Python-ish, I incorrectly thought they are even invalid 😮)

}

#if HAS_MAIN
Module['callMain'] = Module.callMain = function callMain(args) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Module['callMain'] and Module.callMain are same in JS, can we remove the latter part?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, I'm actually not sure why we have this pattern. I suspect it is very old, and either worked around a closure compiler bug or a bug in our understanding of closure compiler ;) We should remove it across the codebase, leaving only Module['X'].

@kripken
Copy link
Copy Markdown
Member Author

kripken commented Nov 26, 2017

Thanks @curiousdannii , adding.

@kripken kripken merged commit c56eb77 into incoming Nov 28, 2017
@kripken kripken deleted the no-callMain-without-main branch November 28, 2017 19:46
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