public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Wolfgang Bangerth <wolfgang.bangerth@iwr.uni-heidelberg.de>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org
Subject: Re: other/2764: Fixinclude should fix PTHREAD...Solaris2.7
Date: Fri, 11 May 2001 00:06:00 -0000	[thread overview]
Message-ID: <20010511070601.31698.qmail@sourceware.cygnus.com> (raw)

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
 
 


             reply	other threads:[~2001-05-11  0:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-11  0:06 Wolfgang Bangerth [this message]
2001-05-11  8:06 Bruce Korb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010511070601.31698.qmail@sourceware.cygnus.com \
    --to=wolfgang.bangerth@iwr.uni-heidelberg.de \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).