Boost logo

Boost :

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


On Wed, Oct 06, 2004 at 01:11:57PM +0100, Jonathan Wakely wrote:

> On Wed, Oct 06, 2004 at 12:36:58PM +0100, John Maddock wrote:
>
> > #ifdef __GLIBCXX__ // gcc 3.4 and greater:
> > # ifdef _GLIBCXX_HAVE_GTHR_DEFAULT
> > //
> > // If the std lib has thread support turned on, then turn it on in
> > Boost
> > // as well. We do this because some gcc-3.4 std lib headers define
> > _REENTANT
> > // while others do not...
> > //
> > # define BOOST_HAS_THREADS
> > # else
> > # define BOOST_DISABLE_THREADS
> > # endif
> > #endif
>
> John, this comment (which is in the current version in CVS) is
> misleading, and IMHO the whole thing is redundant.
>
> If *any* 3.4 libstdc++ header is included and _GLIBCXX_HAVE_GTHR_DEFAULT
> is defined then gthr-default.h will be included and therefore _REENTRANT
> will be defined, and therefore BOOST_HAS_THREADS will be defined anyway
> by boost/config/suffix.hpp
> (this is the case for GCC configured for MT support.)
>
> If _GLIBCXX_HAVE_GTHR_DEFAULT is not defined then gthr-default.h will
> not be included, and _REENTRANT will not be defined, and
> BOOST_DISABLE_THREADS will be defined by boost/config/suffix.hpp
> (this is the case for GCC configured with no support for MT.)
>
> I don't think that bit of preprocessor code changes anything (but I
> might be wrong again)

For the record, what I wrote above is complete nonsense.

Markus noted that not all libstdc++ headers include gthr.h and so won't
necessarily get _REENTRANT defined, in particular <utility> doesn't
include gthr.h.

All libstdc++ headers do, however, include <bits/c++config.h> which
defines _GLIBCXX_HAVE_GTHR_DEFAULT, so John's current checks in
boost/config/stdlib/libstdcpp3.hpp would seem to be the best choice, and
the comment *is* valid.

My sincere apologies for confusing the issue even further!

jon

-- 
"That which needs to be proved cannot be worth much."
	- Nietzsche

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk