Include <threads.h> if possible to get thread_local definition
IN C23, thread_local is a reserved keyword and we shall therefore do nothing to redefine it. glibc has it defined for older standard version with the right conditions. v2 by Yu Watanabe: Move the definition to missing_threads.h like the way we define e.g. missing syscalls or missing definitions, and include it by the users. Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
This commit is contained in:
committed by
Yu Watanabe
co-authored by
Yu Watanabe
parent
efcde781de
commit
5545f336fd
@@ -297,20 +297,6 @@ static inline int __coverity_check_and_return__(int condition) {
|
||||
p != (typeof(p)) POINTER_MAX; \
|
||||
p = *(++_l))
|
||||
|
||||
/* Define C11 thread_local attribute even on older gcc compiler
|
||||
* version */
|
||||
#ifndef thread_local
|
||||
/*
|
||||
* Don't break on glibc < 2.16 that doesn't define __STDC_NO_THREADS__
|
||||
* see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53769
|
||||
*/
|
||||
#if __STDC_VERSION__ >= 201112L && !(defined(__STDC_NO_THREADS__) || (defined(__GNU_LIBRARY__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 16))
|
||||
#define thread_local _Thread_local
|
||||
#else
|
||||
#define thread_local __thread
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DEFINE_TRIVIAL_DESTRUCTOR(name, type, func) \
|
||||
static inline void name(type *p) { \
|
||||
func(p); \
|
||||
|
||||
Reference in New Issue
Block a user