From 94c6766bf11f8d9e835988b946f178d3bac368b8 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 27 Oct 2020 23:19:58 -0700 Subject: [PATCH] Conditional GPR_STDCPP_TLS on Apple --- include/grpc/impl/codegen/port_platform.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index 74a10bec38e..ece20204a0a 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -201,16 +201,22 @@ #if TARGET_OS_IPHONE #define GPR_PLATFORM_STRING "ios" #define GPR_CPU_IPHONE 1 -#define GPR_STDCPP_TLS 1 #define GRPC_CFSTREAM 1 /* the c-ares resolver isn't safe to enable on iOS */ #define GRPC_ARES 0 #else /* TARGET_OS_IPHONE */ #define GPR_PLATFORM_STRING "osx" #define GPR_CPU_POSIX 1 -#define GPR_STDCPP_TLS 1 #define GPR_POSIX_CRASH_HANDLER 1 #endif +#ifdef __has_feature +#if __has_feature(cxx_thread_local) +#define GPR_STDCPP_TLS 1 +#endif +#endif +#ifndef GPR_STDCPP_TLS +#define GPR_PTHREAD_TLS 1 +#endif #define GPR_APPLE 1 #define GPR_GCC_ATOMIC 1 #define GPR_POSIX_LOG 1