-
Notifications
You must be signed in to change notification settings - Fork 3k
Add configuration for IO flushing during exit. #2741
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
This change allows program which doesn't use the IO subsystem to completelly get rid of it in the binary generated. IO's are still flushed by default but it can be overriden in configuration.
The footprint results and preserving the current behavior +1. error() function shouldn't call What do you think ? |
I think using the assert() -> abort() makes sense not flushing the streams and reserving error() and flushing the streams for non optimized builds which can be guarded by NDEBUG for the size reduction @0xc0170 is this what you were suggesting? |
Yes,
@pan- Does that sound feasible? |
@sg- @0xc0170 I still see two issues:
|
That seems like incorrect behavior and should be an easy fix
given this is intended for the return value of main and even if main returns there is no where to go it seems we could patch this to use _exit or is that nonsense? |
@pan- Let's resolve this one today (those 2 issues remaining about _exit, exit), I'll talk to you |
To summarise the discussion with @pan- : we overwrite The above issues about @sg- What do you think? |
/morph test |
@mbed-bot: TEST HOST_OSES=ALL |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 962 All builds and test passed! |
[Build 986] |
Description
This PR allows application to enable or disable the flush of standard I/O's when
exit
is called.This change can save a lot of space for applications which don't use standard stream because even if
NDEBUG
is enabled, a lot of the I/O subsystem is stilled pulled when the exit function invokefflush
over standard streams.By default, the streams are still flushed but the user can override this behavior in the configuration file:
Related PRs
With #2715, this PR allows user to completely remove the IO subsystem from their application.
Gain:
The test have been conducted upon mbed-os-example-blinky compiled with NDEBUG enabled.