Including unistd.h allows the systems default headers to define some more preprocessor macros we might need for configuration.
This fixes a check for newlib, see https://bugs.llvm.org/show_bug.cgi?id=45862
LittleFox94 on May 13 2020, 10:34 AM.Authored by
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.
__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)