Skip to content

Commit a032746

Browse files
author
Benjamin Schaaf
committed
[libcxx] Fix compiling for macOS versions before 10.13
utimensat was introduced in macOS 10.13. UTIME_OMIT is still defined even when targeting 10.9 from newer versions of macOS, so this can't be used as a signal for utimensat availability.
1 parent 595195e commit a032746

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

libcxx/src/filesystem/time_utils.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@
3232
# include <sys/time.h> // for ::utimes as used in __last_write_time
3333
#endif
3434

35+
// MacOS version 10.13 introduces utimensat
36+
#if defined(__APPLE__)
37+
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
38+
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101300)
39+
# define _LIBCPP_USE_UTIMENSAT
40+
# endif
3541
// We can use the presence of UTIME_OMIT to detect platforms that provide utimensat.
36-
#if defined(UTIME_OMIT)
42+
#elif defined(UTIME_OMIT)
3743
# define _LIBCPP_USE_UTIMENSAT
3844
#endif
3945

0 commit comments

Comments
 (0)