From 0ea11bee7b974e193ffc34b5b1d7f0d5825b263a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 6 May 2022 12:05:49 +0200 Subject: utils: add _nl_thread_local macro --- include/netlink-private/utils.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/netlink-private/utils.h b/include/netlink-private/utils.h index dca05b9..93a04c9 100644 --- a/include/netlink-private/utils.h +++ b/include/netlink-private/utils.h @@ -72,6 +72,23 @@ /*****************************************************************************/ +#ifdef thread_local +#define _nl_thread_local thread_local +/* + * Don't break on glibc < 2.16 that doesn't define __STDC_NO_THREADS__ + * see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53769 + */ +#elif __STDC_VERSION__ >= 201112L && \ + !(defined(__STDC_NO_THREADS__) || \ + (defined(__GNU_LIBRARY__) && __GLIBC__ == 2 && \ + __GLIBC_MINOR__ < 16)) +#define _nl_thread_local _Thread_local +#else +#define _nl_thread_local __thread +#endif + +/*****************************************************************************/ + #define _NL_STATIC_ASSERT(cond) ((void) sizeof (char[(cond) ? 1 : -1])) /*****************************************************************************/ -- cgit v0.12