Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename abort JS helper function #21778

Merged
merged 2 commits into from Apr 22, 2024
Merged

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Apr 17, 2024

Also, remove the comment which I believe is not longer relevant with this change.

@sbc100 sbc100 requested review from dschuff and kripken April 17, 2024 20:35
@sbc100 sbc100 enabled auto-merge (squash) April 17, 2024 20:38
_Noreturn void abort(void)
{
#if __EMSCRIPTEN__
_abort_js();
#else
Copy link
Member

Choose a reason for hiding this comment

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

What's the advantage of including this .c file if it just forwards out to JS? Implementing it in JS directly seems simpler.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry I should have mentioned, this was needed as part of an experiment I'm doing to remove the underscore name mangling. One place where that is an issue is where the new library function name abort vs _abort clashed with some existing JS symbol, in this case the JS abort utility defined in the preamble.

Avoiding these clashing names seems like a good thing to avoid confusion anyway.. since if you read the current JS abort library function it looks like its infinite recursion, when in fact its calling from the C-facing abort to the JS-flavored abort (that later takes a string argument).

Copy link
Member

Choose a reason for hiding this comment

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

I see. Yeah, as a workaround for that problem this sounds reasonable (with a comment in the source maybe saying that is why it is needed).

Copy link
Member

Choose a reason for hiding this comment

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

Can you also mention this in the commit description?

src/library.js Show resolved Hide resolved
@sbc100
Copy link
Collaborator Author

sbc100 commented Apr 17, 2024

I can put this on hold for now until that experiment is closer to landing.

@kripken
Copy link
Member

kripken commented Apr 17, 2024

(can or can't in the last comment?)

@sbc100
Copy link
Collaborator Author

sbc100 commented Apr 17, 2024

(can or can't in the last comment?)

Sorry, I can/will put this on hold.

Also, remove the comment which I believe is not longer relevant with
this change.
@sbc100
Copy link
Collaborator Author

sbc100 commented Apr 18, 2024

Actually I think this change is good to go now.

I've also improved the standalone version of abort to trap rather than exit(1).

src/library.js Outdated Show resolved Hide resolved
src/library.js Outdated Show resolved Hide resolved
src/library.js Outdated Show resolved Hide resolved
system/lib/libc/musl/src/exit/abort.c Outdated Show resolved Hide resolved
system/lib/libc/musl/src/exit/abort.c Outdated Show resolved Hide resolved
system/lib/libc/musl/src/exit/abort.c Outdated Show resolved Hide resolved
system/lib/standalone/standalone.c Show resolved Hide resolved
#if __EMSCRIPTEN__
/* In emscripten we call out JS to perform the actual abort where it can
* produce a nice error.
* Note that the JS library function not called `abort` to avoid conflict with
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Note that the JS library function not called `abort` to avoid conflict with
* Note that the JS library function is not called `abort` to avoid conflict with

_Noreturn void abort(void)
{
#if __EMSCRIPTEN__
_abort_js();
#else
Copy link
Member

Choose a reason for hiding this comment

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

Can you also mention this in the commit description?

@sbc100 sbc100 merged commit d955011 into emscripten-core:main Apr 22, 2024
29 checks passed
@sbc100 sbc100 deleted the rename_abort branch April 22, 2024 19:30
sbc100 added a commit to sbc100/emscripten that referenced this pull request Apr 23, 2024
sbc100 added a commit that referenced this pull request Apr 23, 2024
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.

None yet

3 participants