X-Git-Url: https://git.lttng.org/?p=urcu.git;a=blobdiff_plain;f=include%2Furcu%2Ftls-compat.h;fp=include%2Furcu%2Ftls-compat.h;h=25cf375a23462dc53536c5da2cc4d5206466081b;hp=24ef1b9a42b6dccad0f4864dc574654fffc3b60e;hb=e915ab84fd0c02d37504f3eb1e1f3be93ea6dc37;hpb=ee990caca068cbc4618c4b10956096c40ab0b330 diff --git a/include/urcu/tls-compat.h b/include/urcu/tls-compat.h index 24ef1b9..25cf375 100644 --- a/include/urcu/tls-compat.h +++ b/include/urcu/tls-compat.h @@ -34,7 +34,12 @@ extern "C" { #ifdef CONFIG_RCU_TLS -#if defined (__cplusplus) && (__cplusplus >= 201103L) +/* + * Don't use C++ 'thread_local' on MacOs, the implementation is incompatible + * with C and will result in a link error when accessing an extern variable + * provided by the C library from C++ code. + */ +#if defined (__cplusplus) && (__cplusplus >= 201103L) && !defined(__APPLE__) # define URCU_TLS_STORAGE_CLASS thread_local #elif defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) # define URCU_TLS_STORAGE_CLASS _Thread_local