-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add error handling for stderrno when errno is invalid #25762
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
Conversation
26b0edf to
6f0aa29
Compare
sbc100
left a comment
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.
lgtm % nits
|
It looks this does come at a codesize cost. It is a very small one so maybe fine. Can you run |
Done. |
| "a.out.js": 245483, | ||
| "a.out.nodebug.wasm": 574056, | ||
| "total": 819539, | ||
| "a.out.nodebug.wasm": 573907, |
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.
How did this one get smaller?? Strange.
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.
possibly heavy optimization takes the return "Unknown error" branch and avoids the more complicated
s = (char *)&errmsgstr + errmsgidx[e];?
This is to match llvm-libc's behavior when an invalid errno is specified.
When errno is specified as -1, for instance, the current behavior prints "Success". With this change, any invalid errno emits out "Unknown error %d".