--- Utilities/cmlibuv/src/unix/core.c +++ Utilities/cmlibuv/src/unix/core.c @@ -559,10 +559,24 @@ * will unwind the thread when it's in the cancel state. Work around that * by making the system call directly. Musl libc is unaffected. */ + +#if defined(__GNUC__) +#define GCC_VERSION \ + (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +#endif +#if defined(__clang__) || (defined(GCC_VERSION) && (GCC_VERSION >= 40500)) +/* gcc diagnostic pragmas available */ +# define GCC_DIAGNOSTIC_AVAILABLE +#endif + int uv__close_nocancel(int fd) { -#if defined(__APPLE__) +#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 + +#if defined(GCC_DIAGNOSTIC_AVAILABLE) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdollar-in-identifier-extension" +#endif + #if defined(__LP64__) || TARGET_OS_IPHONE extern int close$NOCANCEL(int); return close$NOCANCEL(fd); @@ -570,7 +584,9 @@ extern int close$NOCANCEL$UNIX2003(int); return close$NOCANCEL$UNIX2003(fd); #endif +#if defined(GCC_DIAGNOSTIC_AVAILABLE) #pragma GCC diagnostic pop +#endif #elif defined(__linux__) && defined(__SANITIZE_THREAD__) && defined(__clang__) long rc; __sanitizer_syscall_pre_close(fd); @@ -1368,8 +1384,12 @@ if (name == NULL) return UV_EINVAL; +#if ( defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED < 1050) + unsetenv(name); +#else if (unsetenv(name) != 0) return UV__ERR(errno); +#endif return 0; } --- Utilities/cmlibuv/src/unix/fs.c +++ Utilities/cmlibuv/src/unix/fs.c @@ -1072,7 +1072,7 @@ return -1; } -#elif defined(__APPLE__) || \ +#elif defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 || \ defined(__DragonFly__) || \ defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) @@ -1198,7 +1198,7 @@ ts[0] = uv__fs_to_timespec(req->atime); ts[1] = uv__fs_to_timespec(req->mtime); return utimensat(AT_FDCWD, req->path, ts, AT_SYMLINK_NOFOLLOW); -#elif defined(__APPLE__) || \ +#elif defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 || \ defined(__DragonFly__) || \ defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) || \ @@ -1452,7 +1452,7 @@ dst->st_blksize = src->st_blksize; dst->st_blocks = src->st_blocks; -#if defined(__APPLE__) +#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 dst->st_atim.tv_sec = src->st_atimespec.tv_sec; dst->st_atim.tv_nsec = src->st_atimespec.tv_nsec; dst->st_mtim.tv_sec = src->st_mtimespec.tv_sec; --- Utilities/cmlibuv/src/unix/tty.c +++ Utilities/cmlibuv/src/unix/tty.c @@ -87,7 +87,7 @@ int dummy; result = ioctl(fd, TIOCGPTN, &dummy) != 0; -#elif defined(__APPLE__) +#elif defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 char dummy[256]; result = ioctl(fd, TIOCPTYGNAME, &dummy) != 0;