summaryrefslogtreecommitdiffstats
path: root/libcxx/include/__threading_support
diff options
context:
space:
mode:
authorAsiri Rathnayake <asiri.rathnayake@arm.com>2016-09-13 09:32:32 +0000
committerAsiri Rathnayake <asiri.rathnayake@arm.com>2016-09-13 09:32:32 +0000
commitd547ac0df9ee094e1d93aae9a5dec72f030e2436 (patch)
tree0ee7417f4aafab15c510114c88e78a7cb3be2ec1 /libcxx/include/__threading_support
parentf8199a736c683a9934d597031cd2c36139ab5c45 (diff)
downloadbcm5719-llvm-d547ac0df9ee094e1d93aae9a5dec72f030e2436.tar.gz
bcm5719-llvm-d547ac0df9ee094e1d93aae9a5dec72f030e2436.zip
[libcxx] Fix gcc builds.
Step around a gcc pre-processor defect which causes it to fail to parse the __has_include macro check. llvm-svn: 281310
Diffstat (limited to 'libcxx/include/__threading_support')
-rw-r--r--libcxx/include/__threading_support15
1 files changed, 13 insertions, 2 deletions
diff --git a/libcxx/include/__threading_support b/libcxx/include/__threading_support
index b36a52ec9cc..86dc8c7be82 100644
--- a/libcxx/include/__threading_support
+++ b/libcxx/include/__threading_support
@@ -19,9 +19,20 @@
#ifndef _LIBCPP_HAS_NO_THREADS
-#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) && (!defined(__has_include) || __has_include(<__external_threading>))
+// These checks are carefully arranged so as not to trigger a gcc pre-processor
+// defect which causes it to fail to parse the __has_include check below, the
+// redundancy is intentional.
+#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
+#if !defined(__clang__) && (_GNUC_VER < 500)
#include <__external_threading>
-#else
+#define _LIBCPP_EXTERNAL_THREADING
+#elif !defined(__has_include) || __has_include(<__external_threading>)
+#include <__external_threading>
+#define _LIBCPP_EXTERNAL_THREADING
+#endif
+#endif
+
+#if !defined(_LIBCPP_EXTERNAL_THREADING)
#include <pthread.h>
#include <sched.h>
#endif
OpenPOWER on IntegriCloud