EricWF updated this revision to Diff 102782. https://reviews.llvm.org/D34249
Files: src/experimental/filesystem/operations.cpp Index: src/experimental/filesystem/operations.cpp =================================================================== --- src/experimental/filesystem/operations.cpp +++ src/experimental/filesystem/operations.cpp @@ -18,9 +18,25 @@ #include <unistd.h> #include <sys/stat.h> #include <sys/statvfs.h> +#include <sys/time.h> /* for ::utimes as used in __last_write_time */ #include <fcntl.h> /* values for fchmodat */ -#if !defined(UTIME_OMIT) -#include <sys/time.h> // for ::utimes as used in __last_write_time + +#if defined(__APPLE__) +#include <Availability.h> +#endif + +// We can use the presence of UTIME_OMIT to detect platforms that do not +// provide utimensat, with some exceptions on OS X. +#if !defined(UTIME_OMIT) || \ + (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && \ + __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_11_0) || \ + (defined(__WATCH_OS_VERSION_MIN_REQUIRED) && \ + __WATCH_OS_VERSION_MIN_REQUIRED < __WATCHOS_4_0) || \ + (defined(__TV_OS_VERSION_MIN_REQUIRED) && \ + __TV_OS_VERSION_MIN_REQUIRED < __TVOS_11_0) || \ + (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ + __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_13) +#define _LIBCPP_HAS_NO_UTIMENSAT #endif _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM @@ -682,9 +698,7 @@ using namespace std::chrono; std::error_code m_ec; - // We can use the presence of UTIME_OMIT to detect platforms that do not - // provide utimensat. -#if !defined(UTIME_OMIT) +#if defined(_LIBCPP_HAS_NO_UTIMENSAT) // This implementation has a race condition between determining the // last access time and attempting to set it to the same value using // ::utimes
Index: src/experimental/filesystem/operations.cpp =================================================================== --- src/experimental/filesystem/operations.cpp +++ src/experimental/filesystem/operations.cpp @@ -18,9 +18,25 @@ #include <unistd.h> #include <sys/stat.h> #include <sys/statvfs.h> +#include <sys/time.h> /* for ::utimes as used in __last_write_time */ #include <fcntl.h> /* values for fchmodat */ -#if !defined(UTIME_OMIT) -#include <sys/time.h> // for ::utimes as used in __last_write_time + +#if defined(__APPLE__) +#include <Availability.h> +#endif + +// We can use the presence of UTIME_OMIT to detect platforms that do not +// provide utimensat, with some exceptions on OS X. +#if !defined(UTIME_OMIT) || \ + (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && \ + __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_11_0) || \ + (defined(__WATCH_OS_VERSION_MIN_REQUIRED) && \ + __WATCH_OS_VERSION_MIN_REQUIRED < __WATCHOS_4_0) || \ + (defined(__TV_OS_VERSION_MIN_REQUIRED) && \ + __TV_OS_VERSION_MIN_REQUIRED < __TVOS_11_0) || \ + (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ + __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_13) +#define _LIBCPP_HAS_NO_UTIMENSAT #endif _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM @@ -682,9 +698,7 @@ using namespace std::chrono; std::error_code m_ec; - // We can use the presence of UTIME_OMIT to detect platforms that do not - // provide utimensat. -#if !defined(UTIME_OMIT) +#if defined(_LIBCPP_HAS_NO_UTIMENSAT) // This implementation has a race condition between determining the // last access time and attempting to set it to the same value using // ::utimes
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits