-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Fix iostream related issues #5047
Conversation
igrr
commented
Aug 14, 2018
- add stubs for more exception throw calls (Missing __throw_bad_cast stub #3358)
- make putc_r implementation weak (multiple definition of `_putc_r' #4630)
- fix incorrect return value of _write_r call
- add device test for output to std::cout
std::stringstream test_stream(""); | ||
test_stream << "hello stream"; | ||
|
||
Serial.readString(); |
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.
Why is this needed ?
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.
Same comment as @d-a-v
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.
Was meant to clean up UART RX buffer just in case there was something in there. Chances are, the test will also work without this.
And I have messed up the indentation in this line...
if (file == STDOUT_FILENO) { | ||
while(len--) { | ||
while(pos--) { |
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.
Does this address a current issue or ongoing discussion? Maybe a link could be added in the PR description if that's the case.
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.
Haven't seen this reported, probably because including iostream header caused compilation error, so no one got as far as using iostreams. Found when writing the test case.
newlib provides its own implementation of _putc_r, which will call _write_r (possibly after buffering). Make our implementation weak to allow using the one from newlib. Fixes #4630
Should return number of bytes written, actually returned zero. This resulted in std::cout going into failed state after the first write.
1d8fe68
to
6e906b2
Compare