# define __GTHREAD_INLINE static inline
#endif
-/* Make sure CONST_CAST2 (origin in system.h) is declared. */
-#ifndef CONST_CAST2
-#ifdef __cplusplus
-#define CONST_CAST2(TOTYPE,FROMTYPE,X) (const_cast<TOTYPE> (X))
-#else
-#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
-#endif
-#endif
-
#ifndef ATTRIBUTE_UNUSED
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif
__GTHREAD_WIN32_INLINE int
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
- if (TlsSetValue (__key, CONST_CAST2(void *, const void *, __ptr)))
+ if (TlsSetValue (__key,
+#ifdef __cplusplus
+ const_cast<void *> (__ptr)
+#else
+ (__extension__ (union {const void *_q; void *_nq;})(__ptr))._nq
+#endif
+ ))
return 0;
else
return (int) GetLastError ();
DCE threads are based on POSIX threads draft 4, and many things
have changed since then. */
-/* Make sure CONST_CAST2 (original in system.h) is defined. */
-#ifndef CONST_CAST2
-#ifdef __cplusplus
-#define CONST_CAST2(TOTYPE,FROMTYPE,X) (const_cast<TOTYPE> (X))
-#else
-#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
-#endif
-#endif
-
#define __GTHREADS 1
#include <pthread.h>
static inline int
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
- return __gthrw_(pthread_setspecific)
- (__key, CONST_CAST2(void *, const void *, __ptr));
+ return __gthrw_(pthread_setspecific) (__key,
+#ifdef __cplusplus
+ const_cast<void *> (__ptr)
+#else
+ (__extension__ (union {const void *_q; void *_nq;})(__ptr))._nq
+#endif
+ );
}
static inline void