public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: other/2764: Fixinclude should fix PTHREAD...Solaris2.7
@ 2001-05-11  8:06 Bruce Korb
  0 siblings, 0 replies; 2+ messages in thread
From: Bruce Korb @ 2001-05-11  8:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR other/2764; it has been noted by GNATS.

From: Bruce Korb <bkorb@veritas.com>
To: Wolfgang Bangerth <wolfgang.bangerth@iwr.uni-heidelberg.de>,
   gcc-patches@gcc.gnu.org
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: other/2764: Fixinclude should fix PTHREAD...Solaris2.7
Date: Fri, 11 May 2001 08:00:19 -0700

 Wolfgang Bangerth wrote:
 > 
 > 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!
 
 Unfortunately, it breaks Solaris 2.8.
 I think you will need to constrain the fix to your specific version.
 Here is the pthread.h version for Solaris 2.8:
 
   #pragma ident   "@(#)pthread.h  1.28    99/11/15 SMI"
 
 I suggest you try the following inclhack.def fix.
 You will need to fetch AutoGen from the infrastructure
 directory to try it.  But, please fix the version in the
 "select" clause  :-)  Also, please honor the "Reply-To:"
 clause, or I won't see your replies until Monday.
 
 fix = {
   hackname = solaris27_mutex_init;
   select = '@\(#\)pthread.h' "[ \t]+1.28[ \t]+99/11/15";
   files = pthread.h;
   c_fix = format;
   c_fix_arg = "%1, {0}}";
   c_fix_arg = "(define[ \t]+PTHREAD_MUTEX_INITIALIZER.*),[ \t]*0}$";
   test_text = "#define PTHREAD_MUTEX_INITIALIZER {{{0},0}, {{{0}}}, 0}";
 };


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: other/2764: Fixinclude should fix PTHREAD...Solaris2.7
@ 2001-05-11  0:06 Wolfgang Bangerth
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Bangerth @ 2001-05-11  0:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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
 
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-05-11  8:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-11  8:06 other/2764: Fixinclude should fix PTHREAD...Solaris2.7 Bruce Korb
  -- strict thread matches above, loose matches on Subject: below --
2001-05-11  0:06 Wolfgang Bangerth

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).