------- Comment #10 from dave at hiauly1 dot hia dot nrc dot ca 2005-12-03
03:19 -------
Subject: Re: [4.1/4.2 regression] gthr-dce.h:77: error: expected expression
before '{' token
> Created an attachment (id=10362)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10362&action=view)
> --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10362&action=view)
> Tentative patch to accomodate expressions, absent functions et al
>
> Dave, could you please give this patch a try? I haven't tested it yet, but I
> think the approach is promising. It certainly conflicts with your patch.
> I've
> tried to merge the essential bits from it (i.e., the UNUSED changes are not
> in).
I tested the enclosed change on hppa1.1-hp-hpux10.20 (merged the UNUSED
changes back in ;). The run is still not quite done. Anyway, your revised
approach fixes all the objc fails. There are no new regressions so far.
I definitely think the warning fixes should be applied to 4.2.
Dave
--
J. David Anglin [EMAIL PROTECTED]
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
Index: gthr-dce.h
===================================================================
--- gthr-dce.h (revision 107616)
+++ gthr-dce.h (working copy)
@@ -55,51 +55,54 @@
typedef pthread_mutex_t __gthread_mutex_t;
typedef pthread_mutex_t __gthread_recursive_mutex_t;
-#define __GTHREAD_ONCE_INIT __gthrw_pthread_once_init
+#define __GTHREAD_ONCE_INIT pthread_once_init
#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
__gthread_recursive_mutex_init_function
-#define __GTHREAD_MUTEX_INIT_DEFAULT __gthrw_pthread_once_init
+#define __GTHREAD_MUTEX_INIT_DEFAULT pthread_once_init
#if SUPPORTS_WEAK && GTHREAD_USE_WEAK
# define __gthrw(name) \
- extern __typeof(name) __gthrw_ ## name __attribute__ ((__weakref__(#name)))
+ extern __typeof(name) __gthrw_ ## name __attribute__ ((__weakref__(#name)));
+# define __gthrw_(name) __gthrw_ ## name
#else
-# define __gthrw_asmname(cname) __gthrw_asmnamep (__USER_LABEL_PREFIX__,
cname)
-# define __gthrw_asmnamep(prefix, cname) __gthrw_string (prefix) cname
-# define __gthrw_string(x) #x
-# define __gthrw(name) \
- extern __typeof(name) __gthrw_ ## name __asm (__gthrw_asmname (#name))
+# define __gthrw(name)
+# define __gthrw_(name) name
#endif
-__gthrw(pthread_once);
-__gthrw(pthread_once_init);
-__gthrw(pthread_keycreate);
-__gthrw(pthread_key_delete);
-__gthrw(pthread_getspecific);
-__gthrw(pthread_setspecific);
-__gthrw(pthread_create);
-__gthrw(pthread_mutex_init);
-__gthrw(pthread_mutex_lock);
-__gthrw(pthread_mutex_trylock);
-__gthrw(pthread_mutex_unlock);
-__gthrw(pthread_mutexattr_create);
-__gthrw(pthread_mutexattr_setkind_np);
-__gthrw(pthread_mutexattr_delete);
+__gthrw(pthread_once)
+__gthrw(pthread_keycreate)
+__gthrw(pthread_getspecific)
+__gthrw(pthread_setspecific)
+__gthrw(pthread_create)
+__gthrw(pthread_mutex_init)
+__gthrw(pthread_mutex_lock)
+__gthrw(pthread_mutex_trylock)
+__gthrw(pthread_mutex_unlock)
+__gthrw(pthread_mutexattr_create)
+__gthrw(pthread_mutexattr_setkind_np)
+__gthrw(pthread_mutexattr_delete)
#ifdef _LIBOBJC
/* Objective-C. */
-__gthrw(pthread_cond_broadcast);
-__gthrw(pthread_cond_destroy);
-__gthrw(pthread_cond_init);
-__gthrw(pthread_cond_signal);
-__gthrw(pthread_cond_wait);
-__gthrw(pthread_exit);
-__gthrw(pthread_getunique_np);
-__gthrw(pthread_mutex_destroy);
-__gthrw(pthread_self);
-__gthrw(pthread_yield);
+__gthrw(pthread_cond_broadcast)
+__gthrw(pthread_cond_destroy)
+__gthrw(pthread_cond_init)
+__gthrw(pthread_cond_signal)
+__gthrw(pthread_cond_wait)
+__gthrw(pthread_exit)
+
+#ifdef pthread_getunique_np
+# define __gthrw_pthread_getunique_np pthread_getunique_np
+#else
+__gthrw(pthread_getunique_np)
+# define __gthrw_pthread_getunique_np __gthrw_(pthread_getunique_np)
+#endif
+
+__gthrw(pthread_mutex_destroy)
+__gthrw(pthread_self)
+__gthrw(pthread_yield)
#endif
#if SUPPORTS_WEAK && GTHREAD_USE_WEAK
@@ -107,7 +110,7 @@
static inline int
__gthread_active_p (void)
{
- static void *const __gthread_active_ptr = (void *) &__gthrw_pthread_create;
+ static void *const __gthread_active_ptr = (void *)
&__gthrw_(pthread_create);
return __gthread_active_ptr != 0;
}
@@ -137,7 +140,7 @@
{
if (__gthread_active_p ())
/* Initialize the thread storage key. */
- return __gthrw_pthread_keycreate (&_objc_thread_storage, NULL);
+ return __gthrw_(pthread_keycreate) (&_objc_thread_storage, NULL);
else
return -1;
}
@@ -164,7 +167,7 @@
if (!__gthread_active_p ())
return NULL;
- if (!(__gthrw_pthread_create (&new_thread_handle, pthread_attr_default,
+ if (!(__gthrw_(pthread_create) (&new_thread_handle, pthread_attr_default,
(void *) func, arg)))
{
/* ??? May not work! (64bit) */
@@ -201,7 +204,7 @@
}
/* Change the priority. */
- if (pthread_setprio (__gthrw_pthread_self (), sys_priority) >= 0)
+ if (pthread_setprio (__gthrw_(pthread_self) (), sys_priority) >= 0)
return 0;
else
/* Failed */
@@ -216,7 +219,7 @@
if (__gthread_active_p ())
{
- if ((sys_priority = pthread_getprio (__gthrw_pthread_self ())) >= 0)
+ if ((sys_priority = pthread_getprio (__gthrw_(pthread_self) ())) >= 0)
{
if (sys_priority >= PRI_FG_MIN_NP
&& sys_priority <= PRI_FG_MAX_NP)
@@ -239,7 +242,7 @@
__gthread_objc_thread_yield (void)
{
if (__gthread_active_p ())
- __gthrw_pthread_yield ();
+ __gthrw_(pthread_yield) ();
}
/* Terminate the current thread. */
@@ -248,7 +251,7 @@
{
if (__gthread_active_p ())
/* exit the thread */
- __gthrw_pthread_exit (&__objc_thread_exit_status);
+ __gthrw_(pthread_exit) (&__objc_thread_exit_status);
/* Failed if we reached here */
return -1;
@@ -260,7 +263,7 @@
{
if (__gthread_active_p ())
{
- pthread_t self = __gthrw_pthread_self ();
+ pthread_t self = __gthrw_(pthread_self) ();
return (objc_thread_t) __gthrw_pthread_getunique_np (&self);
}
@@ -273,7 +276,7 @@
__gthread_objc_thread_set_data (void *value)
{
if (__gthread_active_p ())
- return __gthrw_pthread_setspecific (_objc_thread_storage, value);
+ return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
else
{
thread_local_storage = value;
@@ -289,7 +292,7 @@
if (__gthread_active_p ())
{
- if (!(__gthrw_pthread_getspecific (_objc_thread_storage, &value)))
+ if (!(__gthrw_(pthread_getspecific) (_objc_thread_storage, &value)))
return value;
return NULL;
@@ -308,7 +311,7 @@
{
mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
- if (__gthrw_pthread_mutex_init ((pthread_mutex_t *) mutex->backend,
+ if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend,
pthread_mutexattr_default))
{
objc_free (mutex->backend);
@@ -326,7 +329,7 @@
{
if (__gthread_active_p ())
{
- if (__gthrw_pthread_mutex_destroy ((pthread_mutex_t *) mutex->backend))
+ if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *)
mutex->backend))
return -1;
objc_free (mutex->backend);
@@ -341,7 +344,7 @@
__gthread_objc_mutex_lock (objc_mutex_t mutex)
{
if (__gthread_active_p ())
- return __gthrw_pthread_mutex_lock ((pthread_mutex_t *) mutex->backend);
+ return __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend);
else
return 0;
}
@@ -351,7 +354,7 @@
__gthread_objc_mutex_trylock (objc_mutex_t mutex)
{
if (__gthread_active_p ()
- && __gthrw_pthread_mutex_trylock ((pthread_mutex_t *) mutex->backend) !=
1)
+ && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend)
!= 1)
return -1;
return 0;
@@ -362,7 +365,7 @@
__gthread_objc_mutex_unlock (objc_mutex_t mutex)
{
if (__gthread_active_p ())
- return __gthrw_pthread_mutex_unlock ((pthread_mutex_t *) mutex->backend);
+ return __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *)
mutex->backend);
else
return 0;
}
@@ -371,7 +374,7 @@
/* Allocate a condition. */
static inline int
-__gthread_objc_condition_allocate (objc_condition_t condition)
+__gthread_objc_condition_allocate (UNUSED (objc_condition_t condition))
{
if (__gthread_active_p ())
/* Unimplemented. */
@@ -382,7 +385,7 @@
/* Deallocate a condition. */
static inline int
-__gthread_objc_condition_deallocate (objc_condition_t condition)
+__gthread_objc_condition_deallocate (UNUSED (objc_condition_t condition))
{
if (__gthread_active_p ())
/* Unimplemented. */
@@ -393,7 +396,8 @@
/* Wait on the condition */
static inline int
-__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
+__gthread_objc_condition_wait (UNUSED (objc_condition_t condition),
+ UNUSED (objc_mutex_t mutex))
{
if (__gthread_active_p ())
/* Unimplemented. */
@@ -404,7 +408,7 @@
/* Wake up all threads waiting on this condition. */
static inline int
-__gthread_objc_condition_broadcast (objc_condition_t condition)
+__gthread_objc_condition_broadcast (UNUSED (objc_condition_t condition))
{
if (__gthread_active_p ())
/* Unimplemented. */
@@ -415,7 +419,7 @@
/* Wake up one thread waiting on this condition. */
static inline int
-__gthread_objc_condition_signal (objc_condition_t condition)
+__gthread_objc_condition_signal (UNUSED (objc_condition_t condition))
{
if (__gthread_active_p ())
/* Unimplemented. */
@@ -430,7 +434,7 @@
__gthread_once (__gthread_once_t *once, void (*func) (void))
{
if (__gthread_active_p ())
- return __gthrw_pthread_once (once, func);
+ return __gthrw_(pthread_once) (once, func);
else
return -1;
}
@@ -438,7 +442,7 @@
static inline int
__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
{
- return __gthrw_pthread_keycreate (key, dtor);
+ return __gthrw_(pthread_keycreate) (key, dtor);
}
static inline int
@@ -452,7 +456,7 @@
__gthread_getspecific (__gthread_key_t key)
{
void *ptr;
- if (__gthrw_pthread_getspecific (key, &ptr) == 0)
+ if (__gthrw_(pthread_getspecific) (key, &ptr) == 0)
return ptr;
else
return 0;
@@ -461,21 +465,21 @@
static inline int
__gthread_setspecific (__gthread_key_t key, const void *ptr)
{
- return __gthrw_pthread_setspecific (key, (void *) ptr);
+ return __gthrw_(pthread_setspecific) (key, (void *) ptr);
}
static inline void
__gthread_mutex_init_function (__gthread_mutex_t *mutex)
{
if (__gthread_active_p ())
- __gthrw_pthread_mutex_init (mutex, pthread_mutexattr_default);
+ __gthrw_(pthread_mutex_init) (mutex, pthread_mutexattr_default);
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
{
if (__gthread_active_p ())
- return __gthrw_pthread_mutex_lock (mutex);
+ return __gthrw_(pthread_mutex_lock) (mutex);
else
return 0;
}
@@ -484,7 +488,7 @@
__gthread_mutex_trylock (__gthread_mutex_t *mutex)
{
if (__gthread_active_p ())
- return __gthrw_pthread_mutex_trylock (mutex);
+ return __gthrw_(pthread_mutex_trylock) (mutex);
else
return 0;
}
@@ -493,7 +497,7 @@
__gthread_mutex_unlock (__gthread_mutex_t *mutex)
{
if (__gthread_active_p ())
- return __gthrw_pthread_mutex_unlock (mutex);
+ return __gthrw_(pthread_mutex_unlock) (mutex);
else
return 0;
}
@@ -506,13 +510,13 @@
pthread_mutexattr_t attr;
int r;
- r = __gthrw_pthread_mutexattr_create (&attr);
+ r = __gthrw_(pthread_mutexattr_create) (&attr);
if (!r)
- r = __gthrw_pthread_mutexattr_setkind_np (&attr, MUTEX_RECURSIVE_NP);
+ r = __gthrw_(pthread_mutexattr_setkind_np) (&attr, MUTEX_RECURSIVE_NP);
if (!r)
- r = __gthrw_pthread_mutex_init (mutex, attr);
+ r = __gthrw_(pthread_mutex_init) (mutex, attr);
if (!r)
- r = __gthrw_pthread_mutexattr_delete (&attr);
+ r = __gthrw_(pthread_mutexattr_delete) (&attr);
return r;
}
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24831