diff options
author | Thomas Haller <thaller@redhat.com> | 2017-10-13 10:45:15 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-10-13 12:47:55 +0200 |
commit | 373684fdc09c508982eff8c7d3fee88ffa1f9627 (patch) | |
tree | d280089720a8dbb32d8693d57df6d73fcab6bc14 | |
parent | d554f535af520c866d7623de143be91a002a6a9f (diff) | |
download | NetworkManager-373684fdc09c508982eff8c7d3fee88ffa1f9627.tar.gz |
shared: add _nm_thread_local macro
Copied and adjusted from systemd.
-rw-r--r-- | shared/nm-utils/nm-macros-internal.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/shared/nm-utils/nm-macros-internal.h b/shared/nm-utils/nm-macros-internal.h index f511c142b8..435cef6568 100644 --- a/shared/nm-utils/nm-macros-internal.h +++ b/shared/nm-utils/nm-macros-internal.h @@ -32,6 +32,22 @@ #define _nm_const __attribute__ ((const)) #define _nm_printf(a,b) __attribute__ ((__format__ (__printf__, a, b))) +/*****************************************************************************/ + +#ifdef thread_local +#define _nm_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 _nm_thread_local _Thread_local +#else +#define _nm_thread_local __thread +#endif + +/*****************************************************************************/ + #include "nm-glib.h" /*****************************************************************************/ |