This is the mail archive of the 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]
Other format: [Raw text]

pthread.h INITIALIZER macros on solaris (solaris9 & 10 need fixes)

I know this has come up a few times before :-) but I'm trying to get
the following macros from pthread.h to compile cleanly on all solaris2
versions with "-c -W -Wall" and also with "-c -W -Wall -ansi".  Here's
a testcase:

#include <pthread.h>
#define AU __attribute__ ((__unused__))

void foo(void)
  pthread_mutex_t pmut AU = PTHREAD_MUTEX_INITIALIZER;
  pthread_cond_t pcond AU = PTHREAD_COND_INITIALIZER;
  pthread_rwlock_t prwl AU = PTHREAD_RWLOCK_INITIALIZER;
  pthread_once_t po AU = PTHREAD_ONCE_INIT;

If I can get this working, I'd like to install the testcase to ensure
it stays working, or at least we notice when it breaks with later
releases of solaris.  (Crossing my fingers...)  They so helpfully
change this area for every release. :-(

(If you recall, the reason -ansi is important is that relevant things
like upad64_t defined in the solaris headers change when -ansi is
used.  The upad64_t thing is a rathole...)

The current solaris_mutex_init_2 does a partial job to fix this,
however it omits fixing the RWLOCK initializer.  Also it doesn't
trigger correctly on solaris9 because sun rearranged the macro
definition so the fixinc pattern doesn't match.  I'm also finding that
solaris10 headers fix the upad64_t by never using the union if the
compiler is GCC!  So we don't need the upad64_t fix there, but there's
still a problem with PTHREAD_ONCE_INIT separate from the upad64_t
issue that is common to all solaris versions I have.  (I have a simple
fix for that.)

I'm playing with fixincludes but I only have access to solaris7, 9 and
10 and I don't know if there are multiple versions of pthread.h and
other headers within an individual solaris release that affect this

For reference, here's a few past discussions in this area:

If you could let me see how your various solaris boxes define the
pthread.h macros, and how upad64_t is defined in sys/types.h on the
same boxes, I'm willing to tackle this issue again for solaris 9 and
10. :-)

Testing my upcoming patch(es) would also be greatly appreciated!

Kaveh R. Ghazi

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