This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[basic-improvements] Remove __gthread_key_dtor
- From: Zack Weinberg <zack at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 29 Oct 2002 14:33:46 -0800
- Subject: [basic-improvements] Remove __gthread_key_dtor
The __gthread_key_dtor routine does nothing useful in any gthr-*.h
implementation. This patch removes it, which in turn allows some
minor simplifications in unwind-sjlj.c.
Tested by building an i386-linux -> i386-aout cross compiler,
which includes a compilation of unwind-sjlj.c.
zw
* gthr.h, gthr-dce.h, gthr-posix.h, gthr-rtems.h,
gthr-solaris.h, gthr-win32.h: Remove __gthread_key_dtor.
* unwind-sjlj.c (fc_key_dtor): Delete.
(fc_key_init): Adjust __gthread_key_create call to match.
===================================================================
Index: gthr-dce.h
--- gthr-dce.h 1 Oct 2002 17:31:48 -0000 1.17.8.1
+++ gthr-dce.h 29 Oct 2002 22:20:12 -0000
@@ -425,13 +425,6 @@ __gthread_key_create (__gthread_key_t *k
}
static inline int
-__gthread_key_dtor (UNUSED (__gthread_key_t key), UNUSED (void *ptr))
-{
- /* Nothing needed. */
- return 0;
-}
-
-static inline int
__gthread_key_delete (UNUSED (__gthread_key_t key))
{
/* Operation is not supported. */
===================================================================
Index: gthr-posix.h
--- gthr-posix.h 1 Oct 2002 17:31:48 -0000 1.22.8.1
+++ gthr-posix.h 29 Oct 2002 22:20:12 -0000
@@ -450,16 +450,6 @@ __gthread_key_create (__gthread_key_t *k
}
static inline int
-__gthread_key_dtor (__gthread_key_t key, void *ptr)
-{
- /* Just reset the key value to zero. */
- if (ptr)
- return pthread_setspecific (key, 0);
- else
- return 0;
-}
-
-static inline int
__gthread_key_delete (__gthread_key_t key)
{
return pthread_key_delete (key);
===================================================================
Index: gthr-rtems.h
--- gthr-rtems.h 4 Jun 2002 11:30:45 -0000 1.7
+++ gthr-rtems.h 29 Oct 2002 22:20:12 -0000
@@ -53,7 +53,6 @@ typedef void *__gthread_mutex_t;
/* generic per task variables */
extern int rtems_gxx_once (__gthread_once_t *once, void (*func) (void));
extern int rtems_gxx_key_create (__gthread_key_t *key, void (*dtor) (void *));
-extern int rtems_gxx_key_dtor (__gthread_key_t key, void *ptr);
extern int rtems_gxx_key_delete (__gthread_key_t key);
extern void *rtems_gxx_getspecific (__gthread_key_t key);
extern int rtems_gxx_setspecific (__gthread_key_t key, const void *ptr);
@@ -83,12 +82,6 @@ static inline int
__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
{
return rtems_gxx_key_create( key, dtor );
-}
-
-static inline int
-__gthread_key_dtor (__gthread_key_t key, void *ptr)
-{
- return rtems_gxx_key_dtor(key, ptr);
}
static inline int
===================================================================
Index: gthr-solaris.h
--- gthr-solaris.h 4 Jun 2002 11:30:46 -0000 1.13
+++ gthr-solaris.h 29 Oct 2002 22:20:12 -0000
@@ -418,13 +418,6 @@ __gthread_key_create (__gthread_key_t *k
}
static inline int
-__gthread_key_dtor (__gthread_key_t key, void *ptr)
-{
- /* Nothing needed. */
- return 0;
-}
-
-static inline int
__gthread_key_delete (__gthread_key_t key)
{
/* Not possible. */
===================================================================
Index: gthr-win32.h
--- gthr-win32.h 1 Oct 2002 17:31:48 -0000 1.17.8.1
+++ gthr-win32.h 29 Oct 2002 22:20:12 -0000
@@ -396,13 +396,6 @@ __gthread_key_create (__gthread_key_t *k
return __gthr_win32_key_create (key, dtor);
}
-static inline int
-__gthread_key_dtor (__gthread_key_t key, void *ptr)
-{
- /* Nothing needed. */
- return 0;
-}
-
static inline int
__gthread_key_delete (__gthread_key_t key)
{
@@ -509,15 +502,6 @@ __gthread_key_create (__gthread_key_t *k
else
status = (int) GetLastError ();
return status;
-}
-
-/* Currently, this routine is called only for Mingw runtime, and if
- -mthreads option is chosen to link in the thread support DLL. */
-static inline int
-__gthread_key_dtor (__gthread_key_t key, void *ptr)
-{
- /* Nothing needed. */
- return 0;
}
static inline int
===================================================================
Index: gthr.h
--- gthr.h 4 Jun 2002 11:30:44 -0000 1.12
+++ gthr.h 29 Oct 2002 22:20:12 -0000
@@ -62,8 +62,6 @@ Software Foundation, 59 Temple Place - S
int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
int __gthread_key_delete (__gthread_key_t key)
- int __gthread_key_dtor (__gthread_key_t key, void *ptr)
-
void *__gthread_getspecific (__gthread_key_t key)
int __gthread_setspecific (__gthread_key_t key, const void *ptr)
===================================================================
Index: unwind-sjlj.c
--- unwind-sjlj.c 17 Sep 2002 22:58:48 -0000 1.8.8.1
+++ unwind-sjlj.c 29 Oct 2002 22:20:12 -0000
@@ -92,15 +92,9 @@ static __gthread_key_t fc_key;
static int use_fc_key = -1;
static void
-fc_key_dtor (void *ptr)
-{
- __gthread_key_dtor (fc_key, ptr);
-}
-
-static void
fc_key_init (void)
{
- use_fc_key = __gthread_key_create (&fc_key, fc_key_dtor) == 0;
+ use_fc_key = __gthread_key_create (&fc_key, 0) == 0;
}
static void