diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 96a538c48f8..2455b177e15 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2008-03-01 Janne Blomqvist + + PR gcc/35063 + * gthr.h: Add __gthread_mutex_destroy as a function that must be + implemented. + * gthr-vxworks.h (__gthread_mutex_destroy): Null implementation. + * gthr-single.h (__gthread_mutex_destroy): Likewise. + * gthr-rtems.h (__gthread_mutex_destroy): Likewise. + * gthr-mipssde.h (__gthread_mutex_destroy): Likewise. + * gthr-nks.h (__gthread_mutex_destroy): Likewise. + * gthr-solaris.h (__gthread_mutex_destroy): Call mutex_destroy. + * gthr-win32.h (__GTHREAD_MUTEX_DESTROY_FUNCTION): Remove. + (__gthread_mutex_destroy_function): Rename to + __gthread_mutex_destroy. + * gthr-dce.h (__gthread_mutex_destroy): Call + pthread_mutex_destroy. + * gthr-tpf.h (__gthread_mutex_destroy): Likewise. + * gthr-posix.h (__gthread_mutex_destroy): Likewise. + * gthr-posix95.h (__gthread_mutex_destroy): Likewise. + 2008-03-01 Alexandre Oliva * df-scan.c (df_ref_chain_change_bb): Simplify. diff --git a/gcc/gthr-dce.h b/gcc/gthr-dce.h index d876c659e06..e95a4e5c87d 100644 --- a/gcc/gthr-dce.h +++ b/gcc/gthr-dce.h @@ -71,6 +71,7 @@ __gthrw(pthread_getspecific) __gthrw(pthread_setspecific) __gthrw(pthread_create) __gthrw(pthread_mutex_init) +__gthrw(pthread_mutex_destroy) __gthrw(pthread_mutex_lock) __gthrw(pthread_mutex_trylock) __gthrw(pthread_mutex_unlock) @@ -474,6 +475,15 @@ __gthread_mutex_init_function (__gthread_mutex_t *mutex) __gthrw_(pthread_mutex_init) (mutex, pthread_mutexattr_default); } +static inline int +__gthread_mutx_destroy (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_mutex_destroy) (mutex); + else + return 0; +} + static inline int __gthread_mutex_lock (__gthread_mutex_t *mutex) { diff --git a/gcc/gthr-mipssde.h b/gcc/gthr-mipssde.h index 28111e3929e..b8cf24ebc75 100644 --- a/gcc/gthr-mipssde.h +++ b/gcc/gthr-mipssde.h @@ -134,6 +134,12 @@ __gthread_setspecific (__gthread_key_t key, const void *ptr) return __gthrw_(__sdethread_setspecific) (key, ptr); } +static inline int +__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex)) +{ + return 0; +} + static inline int __gthread_mutex_lock (__gthread_mutex_t *mutex) { diff --git a/gcc/gthr-nks.h b/gcc/gthr-nks.h index 2c2b3e973a5..14027e0871b 100644 --- a/gcc/gthr-nks.h +++ b/gcc/gthr-nks.h @@ -341,6 +341,12 @@ __gthread_mutex_init_function (__gthread_mutex_t *mutex) *mutex = NXMutexAlloc (0, 0, &info); } +static inline int +__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex)) +{ + return 0; +} + static inline int __gthread_mutex_lock (__gthread_mutex_t *mutex) { diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h index ad6822e26ad..b0c9ebbc370 100644 --- a/gcc/gthr-posix.h +++ b/gcc/gthr-posix.h @@ -94,6 +94,7 @@ __gthrw3(pthread_mutex_lock) __gthrw3(pthread_mutex_trylock) __gthrw3(pthread_mutex_unlock) __gthrw3(pthread_mutex_init) +__gthrw3(pthread_mutex_destroy) __gthrw3(pthread_cond_broadcast) __gthrw3(pthread_cond_wait) #else @@ -106,6 +107,7 @@ __gthrw(pthread_mutex_lock) __gthrw(pthread_mutex_trylock) __gthrw(pthread_mutex_unlock) __gthrw(pthread_mutex_init) +__gthrw(pthread_mutex_destroy) __gthrw(pthread_cond_broadcast) __gthrw(pthread_cond_wait) #endif @@ -676,6 +678,15 @@ __gthread_setspecific (__gthread_key_t key, const void *ptr) return __gthrw_(pthread_setspecific) (key, ptr); } +static inline int +__gthread_mutex_destroy (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_mutex_destroy) (mutex); + else + return 0; +} + static inline int __gthread_mutex_lock (__gthread_mutex_t *mutex) { diff --git a/gcc/gthr-posix95.h b/gcc/gthr-posix95.h index eb54c925f6f..d993c1309af 100644 --- a/gcc/gthr-posix95.h +++ b/gcc/gthr-posix95.h @@ -80,13 +80,14 @@ __gthrw(pthread_create) __gthrw(pthread_cancel) __gthrw(pthread_self) +__gthrw(pthread_mutex_init) +__gthrw(pthread_mutex_destroy) __gthrw(pthread_mutex_lock) __gthrw(pthread_mutex_trylock) __gthrw(pthread_mutex_unlock) __gthrw(pthread_mutexattr_init) __gthrw(pthread_mutexattr_destroy) -__gthrw(pthread_mutex_init) __gthrw(pthread_cond_broadcast) __gthrw(pthread_cond_wait) @@ -639,6 +640,15 @@ __gthread_setspecific (__gthread_key_t key, const void *ptr) return __gthrw_(pthread_setspecific) (key, ptr); } +static inline int +__gthread_mutex_destroy (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_mutex_destroy) (mutex); + else + return 0; +} + static inline int __gthread_mutex_lock (__gthread_mutex_t *mutex) { diff --git a/gcc/gthr-rtems.h b/gcc/gthr-rtems.h index f678abac646..425d7dee0e9 100644 --- a/gcc/gthr-rtems.h +++ b/gcc/gthr-rtems.h @@ -110,6 +110,12 @@ __gthread_setspecific (__gthread_key_t key, const void *ptr) return rtems_gxx_setspecific (key, ptr); } +static inline int +__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex)) +{ + return 0; +} + static inline int __gthread_mutex_lock (__gthread_mutex_t *mutex) { diff --git a/gcc/gthr-single.h b/gcc/gthr-single.h index c3a903deb65..7dd1f5471cf 100644 --- a/gcc/gthr-single.h +++ b/gcc/gthr-single.h @@ -215,6 +215,12 @@ __gthread_active_p (void) return 0; } +static inline int +__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex)) +{ + return 0; +} + static inline int __gthread_mutex_lock (__gthread_mutex_t * UNUSED(mutex)) { diff --git a/gcc/gthr-solaris.h b/gcc/gthr-solaris.h index 5665ecdb4b6..a726bfa1fd9 100644 --- a/gcc/gthr-solaris.h +++ b/gcc/gthr-solaris.h @@ -461,6 +461,15 @@ __gthread_setspecific (__gthread_key_t key, const void *ptr) return __gthrw_(thr_setspecific) (key, (void *) ptr); } +static inline int +__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex)) +{ + if (__gthread_active_p ()) + return __gthrw_(mutex_destroy) (mutex); + else + return 0; +} + static inline int __gthread_mutex_lock (__gthread_mutex_t *mutex) { diff --git a/gcc/gthr-tpf.h b/gcc/gthr-tpf.h index b63d527e886..fd80bd49df3 100644 --- a/gcc/gthr-tpf.h +++ b/gcc/gthr-tpf.h @@ -92,6 +92,7 @@ __gthrw(pthread_mutexattr_init) __gthrw(pthread_mutexattr_settype) __gthrw(pthread_mutexattr_destroy) __gthrw(pthread_mutex_init) +__gthrw(pthread_mutex_destroy) static inline int __gthread_active_p (void) @@ -144,6 +145,15 @@ __gthread_setspecific (__gthread_key_t key, const void *ptr) return -1; } +static inline int +__gthread_mutex_destroy (__gthread_mutex_t *mutex) +{ + if (__tpf_pthread_active ()) + return __gthrw_(pthread_mutex_destroy) (mutex); + else + return 0; +} + static inline int __gthread_mutex_lock (__gthread_mutex_t *mutex) { diff --git a/gcc/gthr-vxworks.h b/gcc/gthr-vxworks.h index c11d3a20cab..ba813140d76 100644 --- a/gcc/gthr-vxworks.h +++ b/gcc/gthr-vxworks.h @@ -60,6 +60,12 @@ __gthread_mutex_init_function (__gthread_mutex_t *mutex) *mutex = semMCreate (SEM_Q_PRIORITY | SEM_INVERSION_SAFE | SEM_DELETE_SAFE); } +static inline int +__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex)) +{ + return 0; +} + static inline int __gthread_mutex_lock (__gthread_mutex_t *mutex) { diff --git a/gcc/gthr-win32.h b/gcc/gthr-win32.h index 6a32c1a134c..b75c8654a08 100644 --- a/gcc/gthr-win32.h +++ b/gcc/gthr-win32.h @@ -359,9 +359,6 @@ typedef struct { __gthread_recursive_mutex_init_function #define __GTHREAD_RECURSIVE_MUTEX_INIT_DEFAULT {-1, 0, 0, 0} -#define __GTHREAD_MUTEX_DESTROY_FUNCTION \ - __gthread_mutex_destroy_function - #if __MINGW32_MAJOR_VERSION >= 1 || \ (__MINGW32_MAJOR_VERSION == 0 && __MINGW32_MINOR_VERSION > 2) #define MINGW32_SUPPORTS_MT_EH 1 @@ -619,7 +616,7 @@ __gthread_mutex_init_function (__gthread_mutex_t *mutex) } static inline void -__gthread_mutex_destroy_function (__gthread_mutex_t *mutex) +__gthread_mutex_destroy (__gthread_mutex_t *mutex) { CloseHandle ((HANDLE) mutex->sema); } diff --git a/gcc/gthr.h b/gcc/gthr.h index a37b9119922..a145ef1a9de 100644 --- a/gcc/gthr.h +++ b/gcc/gthr.h @@ -73,6 +73,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA void *__gthread_getspecific (__gthread_key_t key) int __gthread_setspecific (__gthread_key_t key, const void *ptr) + int __gthread_mutex_destroy (__gthread_mutex_t *mutex); + int __gthread_mutex_lock (__gthread_mutex_t *mutex); int __gthread_mutex_trylock (__gthread_mutex_t *mutex); int __gthread_mutex_unlock (__gthread_mutex_t *mutex); diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 210a37274f4..8ed3624e01d 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2008-03-01 Janne Blomqvist + + PR libfortran/35063 + * io/unit.c (destroy_unit_mutex): Call __gthread_mutex_destroy + instead of macro kludge. + 2008-02-25 Janne Blomqvist PR fortran/29549 diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c index 2ec776f0d68..a54061d2f84 100644 --- a/libgfortran/io/unit.c +++ b/libgfortran/io/unit.c @@ -209,13 +209,7 @@ insert_unit (int n) static void destroy_unit_mutex (gfc_unit * u) { -#ifdef __GTHREAD_MUTEX_DESTROY_FUNCTION - __GTHREAD_MUTEX_DESTROY_FUNCTION (&u->lock); -#else -#ifdef __CYGWIN__ - pthread_mutex_destroy (&u->lock); -#endif -#endif + __gthread_mutex_destroy (&u->lock); free_mem (u); }