[libcxx] Improve the gcc workaround for the missing __has_include macro.

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284237 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Asiri Rathnayake
2016-10-14 13:56:58 +00:00
parent 7250d3341e
commit 4f2c83f055

View File

@@ -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 @@ void __libcpp_tls_set(__libcpp_tls_key __key, void* __p)
_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