[libcxx] r273093 - Remove Apple specific guard for utimensat. Use !defined(UTIME_OMIT) instead.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 18 12:11:41 PDT 2016


Author: ericwf
Date: Sat Jun 18 14:11:40 2016
New Revision: 273093

URL: http://llvm.org/viewvc/llvm-project?rev=273093&view=rev
Log:
Remove Apple specific guard for utimensat. Use !defined(UTIME_OMIT) instead.

As pointed out by @majnemer this is a better way to detect utimensat on all
platforms. The Apple specific guard is unneeded.

Modified:
    libcxx/trunk/src/experimental/filesystem/operations.cpp

Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=273093&r1=273092&r2=273093&view=diff
==============================================================================
--- libcxx/trunk/src/experimental/filesystem/operations.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/operations.cpp Sat Jun 18 14:11:40 2016
@@ -19,7 +19,7 @@
 #include <sys/stat.h>
 #include <sys/statvfs.h>
 #include <fcntl.h>  /* values for fchmodat */
-#if defined(__APPLE__)
+#if !defined(UTIME_OMIT)
 #include <sys/time.h> // for ::utimes as used in __last_write_time
 #endif
 
@@ -507,10 +507,9 @@ void __last_write_time(const path& p, fi
     using namespace std::chrono;
     std::error_code m_ec;
 
-    // We can use the presence of UTIME_OMIT to detect GLIBC versions that
-    // do not provide utimensat.
-    // FIXME: Use utimensat when it becomes available on OS X.
-#if defined(__APPLE__) || !defined(UTIME_OMIT)
+    // We can use the presence of UTIME_OMIT to detect platforms that do not
+    // provide utimensat.
+#if !defined(UTIME_OMIT)
     // This implementation has a race condition between determining the
     // last access time and attempting to set it to the same value using
     // ::utimes




More information about the cfe-commits mailing list