diff --git a/libcxx/src/chrono.cpp b/libcxx/src/chrono.cpp --- a/libcxx/src/chrono.cpp +++ b/libcxx/src/chrono.cpp @@ -12,7 +12,7 @@ #include // clock_gettime, CLOCK_MONOTONIC and CLOCK_REALTIME #include "include/apple_availability.h" -#if !defined(_WIN32) +#if __has_include() #include #endif diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp --- a/libcxx/src/filesystem/operations.cpp +++ b/libcxx/src/filesystem/operations.cpp @@ -36,10 +36,6 @@ #define _LIBCPP_USE_COPYFILE #endif -#if !defined(_WIN32) -#include -#endif - #if !defined(__APPLE__) && _POSIX_TIMERS > 0 #define _LIBCPP_USE_CLOCK_GETTIME #endif diff --git a/libcxx/src/thread.cpp b/libcxx/src/thread.cpp --- a/libcxx/src/thread.cpp +++ b/libcxx/src/thread.cpp @@ -23,9 +23,9 @@ # endif #endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) -#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__CloudABI__) || defined(__Fuchsia__) || defined(__wasi__) -# include -#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__CloudABI__) || defined(__Fuchsia__) || defined(__wasi__) +#if __has_include() +#include +#endif #if defined(__NetBSD__) #pragma weak pthread_create // Do not create libpthread dependency