unistd.h isn't guaranteed to exist when the target isn't Windows, in particular if the target is bare-metal (i.e. no operating system). Handle this by using __has_include instead, though in filesystem/operations.cpp we already unconditionally include it so just remove the extra include.
Details
Details
- Reviewers
LittleFox94 ldionne - Group Reviewers
Restricted Project - Commits
- rG4d25f4453d60: [libc++] Adjust how we guard the inclusion of unistd.h
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libcxx/src/filesystem/operations.cpp | ||
---|---|---|
40 | It's done unconditionally in line 22 |
libcxx/src/filesystem/operations.cpp | ||
---|---|---|
40 | Good catch! |
libcxx/include/__config | ||
---|---|---|
1556 | Because I didn't know about it. Looks like all the compiler version we support (in llvm/cmake/modules/CheckCompilerVersion.cmake) implement it, so it makes sense to use it. |
Naive question: why not use __has_include?