[PATCH] D34249: [libc++] Don't use UTIME_OMIT to detect utimensat on Apple

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 15 21:34:30 PDT 2017


dexonsmith added inline comments.


================
Comment at: src/experimental/filesystem/operations.cpp:23-28
+// 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
----------------
EricWF wrote:
> dexonsmith wrote:
> > Sadly this isn't quite sufficient.  As per Jack's suggested SDK patch in the PR, we need to enumerate the platforms :/.  I think this should be the right logic for the four Darwin platforms:
> > 
> >     (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)
> > 
> Do we have to do the below dance for all of those macros?
> 
> ```
> #if !defined(__FOO_VERSION_MIN_REQUIRED) && defined(__ENVIROMENT_FOO_VERSION_MIN_REQUIRED)
> #define __FOO_VERSION_MIN_REQUIRED __ENVIROMENT_FOO_VERSION_REQUIRED
> #endif
> ```
Nope.  I just advised you to use the wrong ones.  Use the `__ENVIRONMENT` versions pre-defined by Clang.


================
Comment at: src/experimental/filesystem/operations.cpp:22-24
+#if defined(__APPLE__)
+#include <Availability.h>
+#endif
----------------
I only just noticed you were including Availability.h.  That shouldn't be necessary, since the macros should be defined by the compiler.


https://reviews.llvm.org/D34249





More information about the cfe-commits mailing list