[Openmp-commits] [PATCH] D76755: Fix build on macOS sdk 10.12 and newer

Ni Hui via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Mar 24 21:52:21 PDT 2020


nihui created this revision.
nihui added a reviewer: OpenMP.
Herald added a project: OpenMP.
Herald added a subscriber: openmp-commits.

syscall() has been deprecated and is not available on macOS 10.12.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76755

Files:
  openmp/runtime/src/kmp_wrapper_getpid.h


Index: openmp/runtime/src/kmp_wrapper_getpid.h
===================================================================
--- openmp/runtime/src/kmp_wrapper_getpid.h
+++ openmp/runtime/src/kmp_wrapper_getpid.h
@@ -22,7 +22,12 @@
 #include <unistd.h>
 #if KMP_OS_DARWIN
 // OS X
+#include <Availability.h>
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_12
+#define __kmp_gettid() pthread_mach_thread_np(pthread_self())
+#else
 #define __kmp_gettid() syscall(SYS_thread_selfid)
+#endif
 #elif KMP_OS_FREEBSD
 #include <pthread_np.h>
 #define __kmp_gettid() pthread_getthreadid_np()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76755.252495.patch
Type: text/x-patch
Size: 574 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200325/a21137c9/attachment.bin>


More information about the Openmp-commits mailing list