Fix: tls-compat.h exposes compiler-dependent public configuration
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 20 Apr 2020 15:30:49 +0000 (11:30 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 21 Apr 2020 14:03:03 +0000 (10:03 -0400)
commitf08d6c01cefc2a525712acd1fb76f4442d1ef45f
treebda4f9df3937d000f56a6879dd34b55b91708ce9
parentcec89bbacc3f12f4bb27cf810511fc3e8d725a64
Fix: tls-compat.h exposes compiler-dependent public configuration

Exposing the storage class chosen by ax_tls.m4 in a public header is
a bad idea, because if a recent gcc is used when configuring
liburcu, thus detecting C11, it will choose _Thread_local. Then, if an
external project uses urcu/tls-compat.h with an older gcc (e.g. 4.8),
it will fail to build, because that storage class is unknown, and
__thread should be used instead.

Therefore, use a preprocessor conditional on __cplusplus to detect C++11
(and use thread_local). Else, the STDC version is used to select
_Thread_local. Else check if _MSC_VER is defined to select
__declspec(thread), or else rely on __thread as fallback.

Remove ax_tls.m4 because it is now unused.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
configure.ac
include/urcu/tls-compat.h
m4/ax_tls.m4 [deleted file]
This page took 0.025888 seconds and 4 git commands to generate.