Boost logo

Boost Testing :

From: John Maddock (john_at_[hidden])
Date: 2005-04-04 05:09:41

> It doesn't work.. But not for the reasons that are displayed for Stephen.
> It doesn't get as far as attempting to link it fails to build the regex
> library before that. All of the errors are of this kind:
> Error : illegal initialization
> (instantiating:
> 'boost::cpp_regex_traits<char>::get_mutex_inst()')
> ../../../boost/regex/v4/cpp_regex_traits.hpp line 1011 static
> static_mutex s_mutex = BOOST_STATIC_MUTEX_INIT;
> Possibly a config issue? OK.. a bit of investigation.. After preprocessing
> that line looks like (+context):
> template <class charT>
> static_mutex& cpp_regex_traits<charT>::get_mutex_inst()
> {
> static static_mutex s_mutex = { {0x32AAABA7, {}}, } ;
> return s_mutex;
> }
> [Note.. having two identical files: boost/regex/static_mutex.hpp, and
> boost/regex/pending/static_mutex.hpp is a really nasty thing to do. Spent
> some time trying to figure out why my changing one has no effect on the
> compile.]

Blast, forgot to do a cvs remove on the boost/regex.hpp version, will get
rid of it now.

> Looking further up if I change the static_mutex implemention as such:
> + inline static_mutex() { pthread_mutex_init(&m_mutex,0); }
> +#define BOOST_STATIC_MUTEX_INIT boost::static_mutex()

> Then the regex lib compiles, and the test passes.

I bet it does, but you've just introduced a race condition! The whole point
of static_mutex is that it is statically initialized (hence the name). How
about if you change



Strictly speaking I think this is no longer legal, but you know what C++
compilers are like... ;-)

> So we are down to the differences between Stephen's setup of
> OSX-10.3/CW-9.3 and mine of OSX10.2/CW-8.3.

Yes, I think there must still be something different between you - either
that or their are regressions in CW 9.3 - seems unlikely though,

Thanks again,


Boost-testing list run by mbergal at