]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gthr-dce.h (CONST_CAST2): Define if not defined.
authorJohn David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Sun, 2 Aug 2009 01:38:27 +0000 (01:38 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Sun, 2 Aug 2009 01:38:27 +0000 (01:38 +0000)
* gthr-dce.h (CONST_CAST2): Define if not defined.
(__gthread_setspecific): Use CONST_CAST2 to fix warning.

From-SVN: r150342

gcc/ChangeLog
gcc/gthr-dce.h

index 3dabbd8ed1c87c0ee80f12ca6e4fe17fe4b592c4..f42623d9cbe13aa67144258e284b9b01ae4a9572 100644 (file)
@@ -1,5 +1,8 @@
 2009-08-01  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
+       * gthr-dce.h (CONST_CAST2): Define if not defined.
+       (__gthread_setspecific): Use CONST_CAST2 to fix warning.
+
        * config.gcc (hppa[12]*-*-hpux10*): Add stdint support.
 
 2009-04-17  Paolo Bonzini  <bonzini@gnu.org>
index be92813dc2394b3e10a9ae891aa5a0ef26d0d69c..4226359f0a0e2360b48210aab45ed24adf0875f4 100644 (file)
@@ -37,6 +37,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    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>
@@ -462,7 +471,8 @@ __gthread_getspecific (__gthread_key_t __key)
 static inline int
 __gthread_setspecific (__gthread_key_t __key, const void *__ptr)
 {
-  return __gthrw_(pthread_setspecific) (__key, (void *) __ptr);
+  return __gthrw_(pthread_setspecific)
+    (__key, CONST_CAST2(void *, const void *, __ptr));
 }
 
 static inline void