-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
If compiling against libc++ without filesystem, don't reference fstream #37762
Conversation
PR #37762: Size comparison from ff7398a to d3f3ecc Full report (5 builds for cc32xx, stm32, tizen)
|
d3f3ecc
to
e963197
Compare
PR #37762: Size comparison from 64ae4d8 to e963197 Full report (73 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
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.
It seems to me we should completely remove the SetupPayloadHelper from the compile units in these cases (and probably static assert we have a file system in the header to prevent bad includes).
This is more work, but it also seems much more correct.
SetupPayloadHelper uses filesystem calls, which may not be implemented when using a standard library which does't provide such functionality (such as libc++ on embedded targets). This change avoids compiling in the helper functions into the library on these targets by default, as the only in-tree consumer of these functions currently is the qrcodetool which is only built on host.
e963197
to
753d120
Compare
@andy31415 Does this look better to you? I didn't find a good property to |
PR #37762: Size comparison from 16c99f6 to 753d120 Full report (73 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
SetupPayloadHelper.cpp is compiled as part of the
setup_payload
static library, which is built for (almost?) all targets, even if those targets may not have an onboard filesystem. For GCC's libstdc++ this doesn't matter as it still provides a stub for std::ifstream, but LLVM's libc++ doesn't and throws a compiletime error because of this reference.The alternative to this patch is to move out SetupPayloadHelper.cpp from the
setup_payload
library into theqrcodetool
executable, since that seems to be the only place the contents of SetupPayloadHelper are in use?Testing
Tested on EFR32 with GCC and ARM LLVM toolchains.