This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: minor corrections to gthr-dce.h


Forwarded message:
>From dave Tue May 15 20:56:39 EDT 2001
Subject: PATCH: minor corrections to gthr-dce.h
To: gcc-bugs@gcc.gnu.org
Date: Tue, 15 May 2001 20:56:39 -0400 (EDT)
From: "John David Anglin" <dave@hiauly1>
X-Mailer: ELM [version 2.4 PL25]
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 1993      

The following patch fixes a number of compilation warnings about unused
arguments and the missing declaration for pthread_key_delete under hpux 10.20.

I am not sufficiently versed in dce thread implementations to know whether
the library check is suitable for all systems to determine whether or not
pthread_key_delete is available.  I know it will work for hpux 10 and 11.
Possibly, a configure check is needed.

Testing is rather limited at the moment.  I know that libgcc builds ok and
that the UNUSED macro works with C++ code.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2001-05-15  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* gthr-dce.h (UNUSED): Attribute unused macro.
	(__gthread_key_dtor): Make arguments UNUSED.
	(__gthread_key_delete): Revise for compatibility with DRAFT4
	implementation.

--- gthr-dce.h.orig	Wed Sep  6 02:55:34 2000
+++ gthr-dce.h	Tue May 15 19:48:41 2001
@@ -37,6 +37,12 @@
 
 #include <pthread.h>
 
+#ifdef __cplusplus
+#define UNUSED(x) x
+#else
+#define UNUSED(x) x __attribute__((unused))
+#endif
+
 typedef pthread_key_t __gthread_key_t;
 typedef pthread_once_t __gthread_once_t;
 typedef pthread_mutex_t __gthread_mutex_t;
@@ -412,17 +418,26 @@
 }
 
 static inline int
-__gthread_key_dtor (__gthread_key_t key, void *ptr)
+__gthread_key_dtor (UNUSED (__gthread_key_t key), UNUSED (void *ptr))
 {
   /* Nothing needed. */
   return 0;
 }
 
+#if defined (__PTHREAD_LIBRARY_VERSION_1) && __PTHREAD_LIBRARY_VERSION_1 >= 1
 static inline int
 __gthread_key_delete (__gthread_key_t key)
 {
   return pthread_key_delete (key);
 }
+#else
+static inline int
+__gthread_key_delete (UNUSED (__gthread_key_t key))
+{
+  /* Operation is not supported.  */
+  return -1;
+}
+#endif
 
 static inline void *
 __gthread_getspecific (__gthread_key_t key)
@@ -469,4 +484,6 @@
 
 #endif /* _LIBOBJC */
 
+#undef UNUSED
+
 #endif /* not __gthr_dce_h */


-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]