[libcxx] Improve the gcc workaround for the missing __has_include macro.
NFC.
llvm-svn: 284237
diff --git a/libcxx/include/__threading_support b/libcxx/include/__threading_support
index af3109e..36f1701 100644
--- a/libcxx/include/__threading_support
+++ b/libcxx/include/__threading_support
@@ -19,20 +19,18 @@
#ifndef _LIBCPP_HAS_NO_THREADS
-// 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>
-#define _LIBCPP_HAS_EXTERNAL_THREADING_HEADER
-#elif !defined(__has_include) || __has_include(<__external_threading>)
-#include <__external_threading>
-#define _LIBCPP_HAS_EXTERNAL_THREADING_HEADER
-#endif
+#ifndef __libcpp_has_include
+ #ifndef __has_include
+ #define __libcpp_has_include(x) 0
+ #else
+ #define __libcpp_has_include(x) __has_include(x)
+ #endif
#endif
-#if !defined(_LIBCPP_HAS_EXTERNAL_THREADING_HEADER)
+#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) && \
+ __libcpp_has_include(<__external_threading>)
+#include <__external_threading>
+#else
#include <pthread.h>
#include <sched.h>
@@ -241,7 +239,7 @@
_LIBCPP_END_NAMESPACE_STD
-#endif // !_LIBCPP_HAS_EXTERNAL_THREADING_HEADER
+#endif // !_LIBCPP_HAS_THREAD_API_EXTERNAL || !__libcpp_has_include(<__external_threading>)
#endif // _LIBCPP_HAS_NO_THREADS