This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: libstdc++/3195: STL warning needs fixinc assistance
- From: Bruce Korb <bkorb at pacbell dot net>
- To: Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>, GCC-Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Phil Edwards <phil at jaj dot com>, pfeifer at dbai dot tuwien dot ac dot at, bangerth at dealii dot org, Sylvain dot Pion at sophia dot inria dot fr, gcc-gnats at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Wed, 06 Nov 2002 21:25:29 -0800
- Subject: Re: libstdc++/3195: STL warning needs fixinc assistance
- Organization: Home
- References: <Pine.LNX.4.44.0211061647020.7551-100000@gandalf.ticam.utexas.edu>
Wolfgang Bangerth wrote:
> > > State-Changed-Why:
> > > This has recently been fixed with some fixinclude hacks, as
> > > far as I know.
> >
> > They were proposed and discussed, but were any of them approved and checked
> > in? I don't see anything obvious in gcc/ChangeLog.
>
> Doh. I was referring to the message Gerald sent here:
> http://gcc.gnu.org/ml/gcc-patches/2002-10/msg01414.html
> and even looked into the inclhack.def file and found something on
> PTHREAD_MUTEX_INITIALIZER there, so was under the impression that they
> must have fixed it. But you're right, the thing that is in there is older.
> I'll re-open/re-suspend the report, sorry for the noise (this is not a
> good day, generating too much noise today :-( ).
>
> In any case, Gerald, Bruce, what's the state of the matter?
I've looked at the relevant headers in Solaris 2.6, 2.7, 2.8 and 2.9.
They're all wrong and they cannot be fixed with a simple fix, a la:
> --- /usr/include/pthread.h Sat Apr 6 21:12:32 2002
> +++ ....../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 \
> - {{0, 0, 0, DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}
> + {{0, 0, 0, DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, {0}}
>
> #define PTHREAD_COND_INITIALIZER \
> {{{0, 0, 0, 0}, DEFAULT_TYPE, _COND_MAGIC}, 0}
The problem is that the field initializer that was changed from
``0'' to ``{0}'' sometimes needs to be the former and sometimes
the latter. What is really needed is a #define initializer
for the padint64_t that depends on a memory model. Where that
initialzer will fit in that structure initializer depends on the
version of the pthread_mutex_t *AND* *ALSO* the pthread_cond_t.
These are defined in /usr/include/sys/sync.h, not /usr/include/pthread.h.
I recommend that some interested party write some C code that
inserts a #define of PADINT64_INITIALIZER into pthread.h and then
replaces both the mutex initializer and the cond initializer text
with a concoction that is dependent on the version of sys/synch.h.
See the gcc/fixinc/fixfixes.c file for guidance. Yummy. The fix
should compile into a noop for platforms other than Solaris.