[Lockfree] examples with clang

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

hi,
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
the preprocessor check is for the c++11 standard. the tests require an implementation of atomic<>, as i don't want to show implementation details in the examples. c++11-compliant compilers will provide a correct implementation of <atomic>, but most implementations that i have seen are not complete yet. once boost.atomic is merged, i will use that instead, but until then, the examples are more for reading than for compiling on your favorite compiler. cheers, tim
participants (2)
-
Rich E
-
Tim Blechmann