fixinc help with Solaris 9?

Bruce Korb bkorb@pacbell.net
Wed Oct 23 20:26:00 GMT 2002


Gerald Pfeifer wrote:

> And the diff is at the end of this message.  (BTW, in case this is of
> interest to someone here, the root of the problems is the following in
> sys/types.h:
> 
>    #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
> 
> Weird, isn't it?)

That's not so weird.  The OS needs 64 bit objects to play
with.  What's weird is the way its _USAGE_ keeps changing:

  http://gcc.gnu.org/ml/gcc-patches/2002-10/msg00874.html

It is used in both ``struct _lwp_mutex'' and ``struct _lwp_cond''.
Both of these initializers need fixing, and the initializer
layout will have to depend upon the version of sys/synch.h.

I would suggest adding:

> #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
> #  define  UPAD64_INITIALIZER  0
> #else
> #  define  UPAD64_INITIALIZER  {0}
> #endif

to pthread.h and then substitute that for the misused zeroes,
the precise format depending upon the sys/synch.h version:

> --- /usr/include/pthread.h      Sat Apr  6 21:12:32 2002
> +++ ..../sparc-sun-solaris2.9/3.2.1/include/pthread.h   Thu Oct 24 00:17:55 2002
> @@ -81,9 +81,9 @@
>   * of the corresponding types in sys/types.h (e.g. PTHREAD_MUTEX_INITIALIZER
>   * should be consistent with the definition for pthread_mutex_t).
>   */
>  #define        PTHREAD_MUTEX_INITIALIZER               /* = DEFAULTMUTEX */    \
> -       {{0, 0, 0, DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}
> -       {{0, 0, 0, DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, {0}}
> +       {{0, 0, 0, DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, UPAD64_INITIALIZER }
> 
>  #define        PTHREAD_COND_INITIALIZER                /* = DEFAULTCV */       \
> -        {{{0, 0, 0, 0}, DEFAULT_TYPE, _COND_MAGIC}, 0}
> +        {{{0, 0, 0, 0}, DEFAULT_TYPE, _COND_MAGIC}, UPAD64_INITIALIZER }



More information about the Libstdc++ mailing list