Boost logo

Boost :

From: Jonathan Wakely (cow_at_[hidden])
Date: 2004-10-05 11:35:56

On Tue, Oct 05, 2004 at 06:23:46PM +0200, Markus Sch?pflin wrote:

> Jonathan Wakely wrote:
> >On Tue, Oct 05, 2004 at 04:28:46PM +0100, John Maddock wrote:
> >
> >
> >>>Markus, I believe what you're seeing is the problem that prompted the
> >>>GCC developers to unconditionally define _REENTRANT even when -pthread
> >>>is not given (and which breaks Boost for GCC 3.4), see
> >>>
> >>
> >>That's what I thought, but suggests that
> >>_REENTRANT *is* defined, even without -pthread (unless this is an
> >>artifact of including <iostream>).
> >
> ><iostream> includes <ostream> which includes <ios> which includes <iosfwd>
> >which includes $platform/bits/c++io.h which includes gthr.h which includes
> >gthr-default.h which defines _REENTRANT to 1.
> That's what I also discovered.
> >Solution: define _REENTRANT before including anything, or include a
> >libstdc++ header (which will define _REENTRANT and include pthread.h)
> The native compiler (toolset tru64cxx65) doesn't define _REENTRANT and
> things seem to work out correctly.

If you use the tru64cxx65 equivalent of -pthread then I bet it _does_
define _REENTRANT. The problem is that GCC was changed so that _REENTRANT
is defined whether or not -pthread is used.

> GCC's include files OTOH unconditionally define _REENTRANT before including
> "pthread.h" which forces boost to also include "pthread.h", if I understand
> things correctly.

Near enough, yeah.

> But reentrant is not defined at the point where "pthread.h" is included
> which leads to the problem described.

Why not though, that's the question.

Since <boost/config.h> is included first by shared_ptr.hpp, that should
include <string> (or any other libstdc++ header) which should define
_REENTRANT and therefore it should be set when we come to pthread.h

If you want to, run the test with the GCC flag -save-temps and send me the
preprocessed .ii file, and I'll get medieval on it.


"Hell is other people's code."
	- Me, after a day spent refactoring particularly smelly garbage.

Boost list run by bdawes at, gregod at, cpdaniel at, john at