other/2764: Fixinclude should fix PTHREAD...Solaris2.7
Wolfgang Bangerth
wolfgang.bangerth@iwr.uni-heidelberg.de
Fri May 11 00:06:00 GMT 2001
The following reply was made to PR other/2764; it has been noted by GNATS.
From: Wolfgang Bangerth <wolfgang.bangerth@iwr.uni-heidelberg.de>
To: Bruce Korb <bkorb@veritas.com>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: other/2764: Fixinclude should fix PTHREAD...Solaris2.7
Date: Fri, 11 May 2001 08:56:36 +0200 (MET DST)
On Thu, 10 May 2001, Bruce Korb wrote:
> Well, Sun fixed the problem for 2.8 and I don't have access
> to 2.7. Here's the 2.8 code:
>
> typedef struct _pthread_mutex { /* = mutex_t in synch.h */
> struct {
> uint16_t __pthread_mutex_flag1;
> uint8_t __pthread_mutex_flag2;
> uint8_t __pthread_mutex_ceiling;
> uint32_t __pthread_mutex_type;
> } __pthread_mutex_flags;
> union {
> struct {
> uint8_t __pthread_mutex_pad[8];
> } __pthread_mutex_lock64;
> upad64_t __pthread_mutex_owner64;
> } __pthread_mutex_lock;
> upad64_t __pthread_mutex_data;
> } pthread_mutex_t;
> #define PTHREAD_MUTEX_INITIALIZER {{0, 0, 0, 0}, {{{0}}}, 0}
>
> assuming this works for this struct, I would guess at:
>
> #define PTHREAD_MUTEX_INITIALIZER {{{0,0,0,0}, 0}, {{{0}}}, 0}
>
> being correct, but the original is close enough that
> it should have worked. All anyone but a true guru can do
> is keep playing with variations until something works.
> I think GCC likes to see more braces than any other compiler
> on earth. Good luck.
I tried but it did not work, so I investigated a little more and to my
surprise found the following
#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
typedef int64_t pad64_t;
typedef uint64_t upad64_t;
#else
typedef union {
double _d;
int32_t _l[2];
} pad64_t;
typedef union {
double _d;
uint32_t _l[2];
} upad64_t;
#endif
Please don't ask we why they don't change the declaration to be
all-__STDC__ anyway. Nevertheless, the point is that if I give -ansi on
the command line, then a different declaration is chosen than if I omitted
it...
In any case, the following works:
#define PTHREAD_MUTEX_INITIALIZER {{{0},0}, {{{0}}}, {0}}
i.e. a pair of braces around the last element. That works for both
declarations of upad64_t, so if that could be fixincluded, that would be
great!
Regards
Wolfgang
-------------------------------------------------------------------------
Wolfgang Bangerth email: wolfgang.bangerth@iwr.uni-heidelberg.de
www: http://gaia.iwr.uni-heidelberg.de/~wolf
More information about the Gcc-prs
mailing list