--- src/unix/darwin-proctitle.c.orig +++ src/unix/darwin-proctitle.c @@ -41,9 +41,11 @@ strncpy(namebuf, name, sizeof(namebuf) - 1); namebuf[sizeof(namebuf) - 1] = '\0'; +#if TARGET_OS_IPHONE || (MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) err = pthread_setname_np(namebuf); if (err) return UV__ERR(err); +#endif return 0; } --- src/unix/fs.c.orig +++ src/unix/fs.c @@ -1061,7 +1061,7 @@ return -1; } -#elif defined(__APPLE__) || \ +#elif (defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1050)) || \ defined(__DragonFly__) || \ defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) @@ -1441,7 +1441,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; --- src/unix/tty.c.orig +++ src/unix/tty.c @@ -85,7 +85,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; --- src/unix/udp.c.orig +++ src/unix/udp.c @@ -855,6 +855,7 @@ !defined(__NetBSD__) && \ !defined(__ANDROID__) && \ !defined(__DragonFly__) & \ + (!defined(__APPLE__) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)) && \ !defined(__QNX__) static int uv__udp_set_source_membership4(uv_udp_t* handle, const struct sockaddr_in* multicast_addr, @@ -1047,6 +1048,7 @@ !defined(__NetBSD__) && \ !defined(__ANDROID__) && \ !defined(__DragonFly__) && \ + (!defined(__APPLE__) || (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)) && \ !defined(__QNX__) int err; union uv__sockaddr mcast_addr; --- test/test-fs.c.orig +++ test/test-fs.c @@ -1410,7 +1410,7 @@ ASSERT(0 == uv_fs_fstat(NULL, &req, file, NULL)); ASSERT(req.result == 0); s = req.ptr; -# if defined(__APPLE__) +# if defined(__APPLE__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050) ASSERT(s->st_birthtim.tv_sec == t.st_birthtimespec.tv_sec); ASSERT(s->st_birthtim.tv_nsec == t.st_birthtimespec.tv_nsec); # elif defined(__linux__) @@ -1451,7 +1451,7 @@ ASSERT(s->st_size == (uint64_t) t.st_size); ASSERT(s->st_blksize == (uint64_t) t.st_blksize); ASSERT(s->st_blocks == (uint64_t) t.st_blocks); -#if defined(__APPLE__) +#if defined(__APPLE__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050) ASSERT(s->st_atim.tv_sec == t.st_atimespec.tv_sec); ASSERT(s->st_atim.tv_nsec == t.st_atimespec.tv_nsec); ASSERT(s->st_mtim.tv_sec == t.st_mtimespec.tv_sec); --- src/unix/core.c.orig +++ src/unix/core.c @@ -527,18 +527,31 @@ * 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__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdollar-in-identifier-extension" -#if defined(__LP64__) || TARGET_OS_IPHONE +#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__) || __LP64__ || (defined(TARGET_OS_IPHONE) && (TARGET_OS_IPHONE > 0)) extern int close$NOCANCEL(int); return close$NOCANCEL(fd); -#else +# else extern int close$NOCANCEL$UNIX2003(int); return close$NOCANCEL$UNIX2003(fd); -#endif -#pragma GCC diagnostic pop +# endif +# if defined(GCC_DIAGNOSTIC_AVAILABLE) +# pragma GCC diagnostic pop +# endif #elif defined(__linux__) return syscall(SYS_close, fd); #else