Bug 24831 - [4.1/4.2 regression] gthr-dce.h:77: error: expected expression before '{' token
Summary: [4.1/4.2 regression] gthr-dce.h:77: error: expected expression before '{' token
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2005-11-13 04:24 UTC by John David Anglin
Modified: 2006-01-26 22:31 UTC (History)
2 users (show)

See Also:
Host: hppa1.1-hp-hpux10.20
Target: hppa1.1-hp-hpux10.20
Build: hppa1.1-hp-hpux10.20
Known to work:
Known to fail:
Last reconfirmed: 2005-11-25 22:11:47


Attachments
Tentative patch to accomodate expressions, absent functions et al (2.03 KB, patch)
2005-11-29 14:27 UTC, Alexandre Oliva
Details | Diff
aoliva-gthr.d (5.68 KB, text/plain)
2006-01-17 00:20 UTC, dave
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2005-11-13 04:24:23 UTC
./xgcc -B./ -B/opt/gnu/gcc/gcc-4.1.0/hppa1.1-hp-hpux10.20/bin/ -isystem /opt/gnu
/gcc/gcc-4.1.0/hppa1.1-hp-hpux10.20/include -isystem /opt/gnu/gcc/gcc-4.1.0/hppa
1.1-hp-hpux10.20/sys-include -L/xxx/gnu/gcc-3.3/objdir/gcc/../ld -O2   -DIN_GCC
   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style
-definition  -isystem ./include  -fPIC -g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED
  -I. -I -I../../gcc/gcc -I../../gcc/gcc/ -I../../gcc/gcc/../include -I../../gcc
/gcc/../libcpp/include -I/opt/gnu/gcc/gcc-4.1.0/include  -threads -fexceptions
-c ../../gcc/gcc/unwind-dw2.c -o libgcc/threads/unwind-dw2.o
In file included from ../../gcc/gcc/gthr.h:103,
                 from ../../gcc/gcc/unwind-dw2.c:42:
../../gcc/gcc/gthr-dce.h:77: error: expected expression before '{' token
../../gcc/gcc/gthr-dce.h:77: warning: type defaults to 'int' in declaration of '
__gthrw_pthread_once_init'
../../gcc/gcc/gthr-dce.h:79: error: 'pthread_key_delete' undeclared here (not in
 a function)
../../gcc/gcc/gthr-dce.h:79: warning: type defaults to 'int' in declaration of '
__gthrw_pthread_key_delete'
../../gcc/gcc/unwind-dw2.c: In function 'uw_init_context_1':
../../gcc/gcc/unwind-dw2.c:1253: error: invalid initializer
make[3]: *** [libgcc/threads/unwind-dw2.o] Error 1
Comment 1 Alexandre Oliva 2005-11-14 13:55:01 UTC
So is pthread_key_delete not declared in HP-UX's DCE headers?  Is it actually the correct spelling, or have we always had a harmless typo in gthr-dce.h?  It looks suspicious because pthread_keycreate doesn't have the second underscore.

Anyhow, it seems to me like we could simply remove or comment out the pthread_key_delete line, since this function is not used anywhere.

Could you please test such a change?  Thanks,
Comment 2 dave 2005-11-14 19:15:56 UTC
Subject: Re:  [4.1 regression] gthr-dce.h:77: error: expected expression before '{' token

> So is pthread_key_delete not declared in HP-UX's DCE headers?  Is it actually
> the correct spelling, or have we always had a harmless typo in gthr-dce.h?  It
> looks suspicious because pthread_keycreate doesn't have the second underscore.

It's not declared, and as far as I can tell, not available in HP-UX 10.20.
pthread_keycreate is available.  I don't have DCE threads installed under
HP-UX 11 but the functions are pthread_key_create and pthread_key_delete
for the posix threads library.

> Anyhow, it seems to me like we could simply remove or comment out the
> pthread_key_delete line, since this function is not used anywhere.
> 
> Could you please test such a change?  Thanks,

I'll test it when my current build completes.

Dave
Comment 3 Mark Mitchell 2005-11-19 02:14:30 UTC
HP-UX 10 is not a primary platform, but this seems an easy fix; let's fix it if we can.
Comment 4 dave 2005-11-21 04:55:04 UTC
Subject: Re:  [4.1 regression] gthr-dce.h:77: error: expected expression before '{' token

> Anyhow, it seems to me like we could simply remove or comment out the
> pthread_key_delete line, since this function is not used anywhere.
> 
> Could you please test such a change?  Thanks,

Removing the pthread_key_delete line eliminates one error.  However,
we still are left with:

...
-c ../../gcc/gcc/unwind-dw2.c -o libgcc/threads/unwind-dw2.o
In file included from ../../gcc/gcc/gthr.h:103,
                 from ../../gcc/gcc/unwind-dw2.c:42:
../../gcc/gcc/gthr-dce.h:77: error: expected expression before '{' token
../../gcc/gcc/gthr-dce.h:77: warning: type defaults to 'int' in declaration of '
__gthrw_pthread_once_init'
../../gcc/gcc/unwind-dw2.c: In function 'uw_init_context_1':
../../gcc/gcc/unwind-dw2.c:1259: error: invalid initializer

In HP-UX 10.20, we have:

./pthread.h:#define pthread_once_init   cma_once_init
./dce/cma.h:#define cma_once_init       {0, 0, 0}

I'll remove the __gthrw stuff for pthread_once_init as a test.

Dave
Comment 5 dave 2005-11-24 22:33:17 UTC
Subject: Re:  [4.1 regression] gthr-dce.h:77: error: expected expression before '{' token

> HP-UX 10 is not a primary platform, but this seems an easy fix; let's fix it if
> we can.

The enclosed change appears to fix the "__gthrw" regressions on HP-UX 10.
I say appears because it hasn't been fully tested.  It would need another
bootstrap and check for that.

On HP-UX 10.20, pthread_once_init and pthread_getunique_np are macro
defines.  pthread_once_init is an initializer and pthread_getunique_np
is an expression (not a function).  pthread_key_delete is not defined.

I've added some changes to fix warnings about unused arguments arising
from this file.

I'm not really sure how best to handle the issues arising from trying
to use "__gthrw".  This could vary from one system to another.  Possibly,
HP-UX 10 is the only user of this file.

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

Index: gthr-dce.h
===================================================================
--- gthr-dce.h	(revision 107400)
+++ gthr-dce.h	(working copy)
@@ -55,12 +55,12 @@
 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) \
@@ -74,9 +74,7 @@
 #endif
 
 __gthrw(pthread_once);
-__gthrw(pthread_once_init);
 __gthrw(pthread_keycreate);
-__gthrw(pthread_key_delete);
 __gthrw(pthread_getspecific);
 __gthrw(pthread_setspecific);
 __gthrw(pthread_create);
@@ -96,7 +94,6 @@
 __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);
@@ -262,7 +259,7 @@
     {
       pthread_t self = __gthrw_pthread_self ();
 
-      return (objc_thread_t) __gthrw_pthread_getunique_np (&self);
+      return (objc_thread_t) pthread_getunique_np (&self);
     }
   else
     return (objc_thread_t) 1;
@@ -371,7 +368,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 +379,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 +390,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 +402,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 +413,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.  */
Comment 6 Andrew Pinski 2005-11-25 21:11:02 UTC
Hmm, GTHREAD_USE_WEAK should be zero so that this should not matter at all.
Did someone forget to include the tm.h file or a different file for this code?
Comment 7 dave 2005-11-25 21:36:24 UTC
Subject: Re:  [4.1/4.2 regression] gthr-dce.h:77: error: expected expression before '{' token

> Hmm, GTHREAD_USE_WEAK should be zero so that this should not matter at all.
> Did someone forget to include the tm.h file or a different file for this code?

We're using the "#else" part of this code:

#if SUPPORTS_WEAK && GTHREAD_USE_WEAK
# define __gthrw(name) \
  extern __typeof(name) __gthrw_ ## name __attribute__ ((__weakref__(#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))
#endif

SUPPORTS_WEAK should be zero on HP-UX 10.

Dave
Comment 8 Andrew Pinski 2005-11-25 22:11:47 UTC
Since GTHREAD_USE_WEAK and/or SUPPORTS_WEAK is false, we should not do the asm("xxx") shit which is causing all of the issues.
Comment 9 Alexandre Oliva 2005-11-29 14:27:13 UTC
Created attachment 10362 [details]
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).

Sorry for taking so long to get to this, I've been away for most of last week.
Comment 10 dave 2005-12-03 03:19:32 UTC
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)
> 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                                  dave.anglin@nrc-cnrc.gc.ca
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;
     }
 }
Comment 11 dave 2006-01-17 00:20:09 UTC
Subject: Re:  [4.1/4.2 regression] gthr-dce.h:77: error: expected expression before '{' token

Alex,

> Created an attachment (id=10362)
>  --> (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).

We are coming up to release for 4.1 and I'd really like to try to get
this issue fixed.  I been running the enclosed iversion of your patch
for some time on the trunk for hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11.
I haven't seen any issues.  I haven't tried it recently on hpux10.

If there's something I can do to promote its review, let me know.

Dave
Comment 12 dave 2006-01-17 00:20:09 UTC
Created attachment 10656 [details]
aoliva-gthr.d
Comment 13 John David Anglin 2006-01-26 22:00:33 UTC
Subject: Bug 24831

Author: danglin
Date: Thu Jan 26 22:00:28 2006
New Revision: 110278

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110278
Log:
	PR other/24829
	PR target/24831
	* gthr-dce.h: Do not gthrw-ify pthread_once_init,
	pthread_key_delete.  From John David Anglin.  gthrw-ify
	pthread_getunique_np only if it it's not a macro.  Delete
	UNUSED macro.
	(__gthread_objc_condition_allocate, __gthread_objc_condition_deallocate,
	__gthread_objc_condition_wait, __gthread_objc_condition_broadcast,
	__gthread_objc_condition_signal, __gthread_key_delete): Add
	"__attribute__ ((__unused__))" to unused arguments.
	(__gthread_recursive_mutex_init_function): Add missing return.
	* gthr-dce.h, gthr-tpf.h, gthr-solaris.h, gthr-posix.h,
	gthr-posix95.h: Use macro-based approach for name redirection
	on targets missing weakref.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gthr-dce.h
    trunk/gcc/gthr-posix.h
    trunk/gcc/gthr-posix95.h
    trunk/gcc/gthr-solaris.h
    trunk/gcc/gthr-tpf.h

Comment 14 John David Anglin 2006-01-26 22:26:54 UTC
Subject: Bug 24831

Author: danglin
Date: Thu Jan 26 22:26:49 2006
New Revision: 110280

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110280
Log:
2006-01-26 Alexandre Oliva  <aoliva@redhat.com>

	PR other/24829
	PR target/24831
	* gthr-dce.h: Do not gthrw-ify pthread_once_init,
	pthread_key_delete.  From John David Anglin.  gthrw-ify
	pthread_getunique_np only if it it's not a macro.  Delete
	UNUSED macro.
	(__gthread_objc_condition_allocate, __gthread_objc_condition_deallocate,
	__gthread_objc_condition_wait, __gthread_objc_condition_broadcast,
	__gthread_objc_condition_signal, __gthread_key_delete): Add
	"__attribute__ ((__unused__))" to unused arguments.
	(__gthread_recursive_mutex_init_function): Add missing return.
	* gthr-dce.h, gthr-tpf.h, gthr-solaris.h, gthr-posix.h,
	gthr-posix95.h: Use macro-based approach for name redirection
	on targets missing weakref.


Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/gthr-dce.h
    branches/gcc-4_1-branch/gcc/gthr-posix.h
    branches/gcc-4_1-branch/gcc/gthr-posix95.h
    branches/gcc-4_1-branch/gcc/gthr-solaris.h
    branches/gcc-4_1-branch/gcc/gthr-tpf.h

Comment 15 John David Anglin 2006-01-26 22:31:46 UTC
Fixed by patch.