-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Flip some negated #if checks. NFC
#25487
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -601,15 +601,7 @@ function(${args}) { | |
| warn('To build in STANDALONE_WASM mode without a main(), use emcc --no-entry'); | ||
| } | ||
| } | ||
| if (!RELOCATABLE) { | ||
| // emit a stub that will fail at runtime | ||
| LibraryManager.library[symbol] = new Function(`abort('missing function: ${symbol}');`); | ||
| // We have already warned/errored about this function, so for the purposes of Closure use, mute all type checks | ||
| // regarding this function, marking ot a variadic function that can take in anything and return anything. | ||
| // (not useful to warn/error multiple times) | ||
| LibraryManager.library[symbol + '__docs'] = '/** @type {function(...*):?} */'; | ||
| isStub = true; | ||
| } else { | ||
| if (RELOCATABLE) { | ||
| // Create a stub for this symbol which can later be replaced by the | ||
| // dynamic linker. If this stub is called before the symbol is | ||
| // resolved assert in debug builds or trap in release builds. | ||
|
|
@@ -626,6 +618,14 @@ function(${args}) { | |
| const functionBody = assertion + `return ${target}(...args);`; | ||
| LibraryManager.library[symbol] = new Function('...args', functionBody); | ||
| isStub = true; | ||
| } else { | ||
| // emit a stub that will fail at runtime | ||
| LibraryManager.library[symbol] = new Function(`abort('missing function: ${symbol}');`); | ||
| // We have already warned/errored about this function, so for the purposes of Closure use, mute all type checks | ||
| // regarding this function, marking ot a variadic function that can take in anything and return anything. | ||
| // (not useful to warn/error multiple times) | ||
| LibraryManager.library[symbol + '__docs'] = '/** @type {function(...*):?} */'; | ||
| isStub = true; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just noticed the |
||
| } | ||
| } | ||
|
|
||
|
|
||
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OTOH, "not relocatable == normal", and it's nice to have the normal path first? Then reading the more complex relocatable one after is easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one has annoyed me for a while. Every time I read I feel like have to do mental work for some reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the negation here is annoying, how about
var ABSOLUTE = !RELOCATABLEor some better name for "simple, absolute-addressed single file with no linking involved" - ?(Perhaps "linked file", "relocated file", "flat file" - maybe there is a good term?)
That would avoid the negation, and also let us keep having the simple code first in each such if-else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually in this case I like the
if RELOCATABLE.The code here is part of the undefined symbol handling. Its within a block and its already an error in most cases.
It reads like this:
I think this is more logical that the other way around:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, I can live with this one. Reading the others again now.