| @@ -52,29 +52,35 @@ typedef pthread_mutex_t __gthread_recurs | | | @@ -52,29 +52,35 @@ typedef pthread_mutex_t __gthread_recurs |
52 | #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT | | 52 | #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT |
53 | #if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER) | | 53 | #if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER) |
54 | #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER | | 54 | #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER |
55 | #elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) | | 55 | #elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) |
56 | #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP | | 56 | #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP |
57 | #else | | 57 | #else |
58 | #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function | | 58 | #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function |
59 | #endif | | 59 | #endif |
60 | | | 60 | |
61 | #if SUPPORTS_WEAK && GTHREAD_USE_WEAK | | 61 | #if SUPPORTS_WEAK && GTHREAD_USE_WEAK |
62 | # ifndef __gthrw_pragma | | 62 | # ifndef __gthrw_pragma |
63 | # define __gthrw_pragma(pragma) | | 63 | # define __gthrw_pragma(pragma) |
64 | # endif | | 64 | # endif |
| | | 65 | # ifdef __clang__ |
| | | 66 | # define __gthrw2(name,name2,type) \ |
| | | 67 | static __typeof(type) name __attribute__ ((__weakref__(#name2))); \ |
| | | 68 | __gthrw_pragma(weak type) |
| | | 69 | # else |
65 | # define __gthrw2(name,name2,type) \ | | 70 | # define __gthrw2(name,name2,type) \ |
66 | extern __typeof(type) name __attribute__ ((__weakref__(#name2))); \ | | 71 | extern __typeof(type) name __attribute__ ((__weakref__(#name2))); \ |
67 | __gthrw_pragma(weak type) | | 72 | __gthrw_pragma(weak type) |
| | | 73 | # endif |
68 | # define __gthrw_(name) __gthrw_ ## name | | 74 | # define __gthrw_(name) __gthrw_ ## name |
69 | #else | | 75 | #else |
70 | # define __gthrw2(name,name2,type) | | 76 | # define __gthrw2(name,name2,type) |
71 | # define __gthrw_(name) name | | 77 | # define __gthrw_(name) name |
72 | #endif | | 78 | #endif |
73 | | | 79 | |
74 | /* Typically, __gthrw_foo is a weak reference to symbol foo. */ | | 80 | /* Typically, __gthrw_foo is a weak reference to symbol foo. */ |
75 | #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name) | | 81 | #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name) |
76 | | | 82 | |
77 | /* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to | | 83 | /* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to |
78 | map a subset of the POSIX pthread API to mangled versions of their | | 84 | map a subset of the POSIX pthread API to mangled versions of their |
79 | names. */ | | 85 | names. */ |
80 | #if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_) | | 86 | #if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_) |