]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgcc: replace CONST_CAST2 macro
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Thu, 29 Jan 2026 08:26:26 +0000 (09:26 +0100)
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Fri, 6 Feb 2026 08:02:04 +0000 (09:02 +0100)
libgcc/ChangeLog:

* config/i386/gthr-win32.h: Replace CONST_CAST2 with expanded
expression where used.
* config/pa/gthr-dce.h: Likewise.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
libgcc/config/i386/gthr-win32.h
libgcc/config/pa/gthr-dce.h

index 633dff7ed734c6c8d77172bc7432403023ce01d7..2c7504ef26536b6c4e40566a69ef940b87e117b9 100644 (file)
@@ -86,15 +86,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 # 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
@@ -720,7 +711,13 @@ __gthread_getspecific (__gthread_key_t __key)
 __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 ();
index b21ea8336c76330e3a20d623d4457cf63c1b3011..ea40492e1f2b7946901445d543b39217ae57fd85 100644 (file)
@@ -36,15 +36,6 @@ 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>
@@ -470,8 +461,13 @@ __gthread_getspecific (__gthread_key_t __key)
 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