The checks did not work in __config, since no header defining _NEWLIB_VERSION was included before. This patch moves the two checks for newlib to the headers that actually need it - and after they already include relevant headers.
Details
- Reviewers
EricWF ldionne - Group Reviewers
Restricted Project - Commits
- rG8deaa4a1471d: [libc++] Move checks for newlib to actually work
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Since this include was deleted as "dead code" before, I added a comment why it is not dead
libcxx/include/__config | ||
---|---|---|
13 | Please do this later in the file, Specifically after we #define __has_include in the case where we don't have it. |
I am slightly concerned that this also introduces a bunch of declarations in __config, which is the most included file of the library. That would also be the first time we include unistd.h in the libc++ headers (as opposed to the sources used to build the dylib). That might not be an issue, but it's something to keep in mind.
Is this necessary for libc++ to work with Newlib? I thought we already supported it as-is (we certainly have some code paths that are conditionals to it).
Another way would be to include _newlib_version.h if it exists, would that be better? Would then be a newlib specific patch.
Is this necessary for libc++ to work with Newlib? I thought we already supported it as-is (we certainly have some code paths that are conditionals to it).
__config has a check for newlib which never works, due to the preprocessor macro not being set without an include (line 933 in the patched revision)
We could lift the two macros that depend on _NEWLIB_VERSION into the headers that use them.
Then we'll avoid the include in config.
Is this review still relevant? If not, let's abandon it to clear up the review queue.
Ouch oops.. sorry, was really scatterbrained this year .. I'll look into it in the next 2 days, feel free to close afterwards if you don't read from me
Again, sorry
LGTM with nitpick. Once updated, do you need someone to commit this for you? If so, please provide Author Name <email@domain> for attribution. Thanks!
libcxx/include/fstream | ||
---|---|---|
201 | You can remove this level of #if, we never expect users to define it, and I'd rather not give the impression that we allow users to. |
Removed the unnecessary check as requested.
I cannot commit myself, please use "Mara Sophie Grosch <littlefox@lf-net.org>" as commit author. Thank you and sorry it took so long.
Please do this later in the file,
Specifically after we #define __has_include in the case where we don't have it.