[PATCH] D34249: [libc++] Don't use UTIME_OMIT to detect utimensat on Apple
Eric Fiselier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 15 13:50:08 PDT 2017
EricWF created this revision.
This fixes llvm.org/PR33469.
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
@@ -19,7 +19,15 @@
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <fcntl.h> /* values for fchmodat */
-#if !defined(UTIME_OMIT)
+
+// 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(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 1030)
+#define _LIBCPP_HAS_NO_UTIMENSAT
+#endif
+
+#if defined(_LIBCPP_HAS_NO_UTIMENSAT)
#include <sys/time.h> // for ::utimes as used in __last_write_time
#endif
@@ -682,9 +690,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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34249.102719.patch
Type: text/x-patch
Size: 1180 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170615/7f1f634d/attachment.bin>
More information about the cfe-commits
mailing list