From 4f2c83f0558706eb8d93314f935f89d420121441 Mon Sep 17 00:00:00 2001 From: Asiri Rathnayake Date: Fri, 14 Oct 2016 13:56:58 +0000 Subject: [PATCH] [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 --- include/__threading_support | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/include/__threading_support b/include/__threading_support index af3109efd..36f1701f1 100644 --- a/include/__threading_support +++ b/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 #include @@ -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