Boost logo

Boost :

Subject: [boost] [Lockfree] examples with clang
From: Rich E (reakinator_at_[hidden])
Date: 2012-07-07 20:34:07


Hi all,

I've been attempting to test Lockfree (while at the same time learning to
work with boost from trunk, so bare with me I'm a bit new) using Clang 4.0,
the version that will ship with Xcode 4.5. It appears that the
preprocessor check is only for gcc. If I change:

#if __cplusplus < 201103L

to

#if __cplusplus < 201103L && ( defined( __clang__ ) && !
__has_include(<atomic>) )

and compile the examples with (from libs/lockfree/examples):

../../../bjam toolset=clang cxxflags="-std=c++0x -stdlib=libc++"
linkflags="-stdlib=libc++"

Then the examples work correctly (queue output: "produced 40000000
objects. consumed 40000000 objects."). I'm sure there is a more elegant
way to check for libc++ existence when compiling with clang, possibly with
boost/config.hpp?

Also, I think a message in the dummy main would be nice to inform the user
that lockfree won't work with their current setup / compile method.

Cheers,
Rich


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