#define CDS_COMPILER__NAME ("clang " __clang_version__)
#define CDS_COMPILER__NICK "clang"
-// C++11 atomic support - only for libc++
-// Note: Clang libc++ atomic leads to program crash.
-// So, we use libcds atomic implementation
-//#if __has_feature(cxx_atomic) && defined(_LIBCPP_VERSION)
-//# define CDS_CXX11_ATOMIC_SUPPORT 1
-//#endif
-
+#if defined(_LIBCPP_VERSION)
+ // Note: Clang libc++ atomic leads to program crash.
+ // So, we use libcds atomic implementation
+# define CDS_USE_LIBCDS_ATOMIC
+#endif
#include <cds/compiler/gcc/compiler_macro.h>
-
#define alignof __alignof__
// Variadic template support (only if -std=c++0x compile-line option provided)
#else
# if defined(CDS_USE_LIBCDS_ATOMIC)
# error "Libcds does not support atomic implementation for the processor architecture. Try to use C++11-compatible compiler and remove CDS_USE_LIBCDS_ATOMIC flag from compiler command line"
-# elif !defined(CDS_USE_BOOST_ATOMIC) && !defined(CDS_CXX11_ATOMIC_SUPPORT)
-# error "The current compiler does not support C++11 atomic. Try to use boost.atomic (-DCDS_USE_BOOST_ATOMIC) or C++11 compiler"
# else
# define CDS_PROCESSOR_ARCH CDS_PROCESSOR_UNKNOWN
# define CDS_BUILD_BITS 32
#ifndef __CDS_COMPILER_GCC_CXX11_ATOMIC_PATCHES_H
#define __CDS_COMPILER_GCC_CXX11_ATOMIC_PATCHES_H
-#if CDS_CXX11_ATOMIC_SUPPORT == 1
-# if CDS_COMPILER_VERSION >= 40600 && CDS_COMPILER_VERSION < 40700
- // GCC 4.6.x has no atomic_thread_fence/atomic_signal_fence
- namespace std {
- inline void atomic_thread_fence(memory_order order)
- {
- switch(order)
- {
- case memory_order_relaxed:
- case memory_order_consume:
- break;
- case memory_order_release:
- case memory_order_acquire:
- case memory_order_acq_rel:
- case memory_order_seq_cst:
- __sync_synchronize();
- break;
- default:;
- }
-
- }
- inline void atomic_signal_fence(memory_order order)
- {
- switch(order)
- {
- case memory_order_relaxed:
- break;
- case memory_order_consume:
- case memory_order_release:
- case memory_order_acquire:
- case memory_order_acq_rel:
- case memory_order_seq_cst:
- CDS_COMPILER_RW_BARRIER;
- break;
- default:;
- }
- }
- } // namespace std
-# endif
-#endif
-
#endif // #ifndef __CDS_COMPILER_GCC_CXX11_ATOMIC_PATCHES_H
// Compiler version
#define CDS_COMPILER_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
-#if CDS_COMPILER_VERSION < 40300
-# error "Compiler version error. GCC version 4.3.0 and above is supported"
+#if CDS_COMPILER_VERSION < 40800
+# error "Compiler version error. GCC version 4.8.0 and above is supported"
#endif
// Compiler name
#endif
#define CDS_COMPILER__NICK "gcc"
-// C++11 atomic support
-#if CDS_COMPILER_VERSION >= 40700
-# define CDS_CXX11_ATOMIC_SUPPORT 1
-#elif defined(CDS_CXX11_ATOMIC_GCC)
-# define CDS_CXX11_ATOMIC_SUPPORT 1
-#endif
-
-
#include <cds/compiler/gcc/compiler_macro.h>
#ifndef __CDS_COMPILER_ICL_CXX11_ATOMIC_PATCHES_WIN_H
#define __CDS_COMPILER_ICL_CXX11_ATOMIC_PATCHES_WIN_H
-//@cond
-#if CDS_COMPILER == CDS_COMPILER_INTEL && CDS_CXX11_ATOMIC_SUPPORT == 1 && _MSC_VER < 1700
-
-namespace std {
- typedef std::atomic<size_t> atomic_size_t;
-
- // Fences
- static inline void atomic_thread_fence(memory_order order) CDS_NOEXCEPT
- {
- CDS_COMPILER_RW_BARRIER;
- }
- static inline void atomic_signal_fence(memory_order order) CDS_NOEXCEPT
- {
- CDS_COMPILER_RW_BARRIER;
- }
-
-}
-
-#endif
-//@endcond
-
#endif // #ifndef __CDS_COMPILER_ICL_CXX11_ATOMIC_PATCHES_WIN_H
# define alignof __alignof__
#endif
-//#if CDS_COMPILER_VERSION < 1600
-//# include <boost/static_assert.hpp>
-//# define static_assert(_expr, _msg) BOOST_STATIC_ASSERT((_expr))
-//#endif
-
// Memory leaks detection (debug build only)
//#ifdef _DEBUG
//# define _CRTDBG_MAP_ALLOC
# define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
#endif
-// C++11 atomic support
-#if CDS_COMPILER_VERSION >= 1300 && CDS_OS_INTERFACE == CDS_OSI_WINDOWS && _MSC_VER >= 1700
- // Intel C++ 13 supports C++11 atomic standard for VC++ 2012
-# define CDS_CXX11_ATOMIC_SUPPORT 1
-#endif
-
// Lambda (ICL 12 +)
#if CDS_COMPILER_VERSION >= 1200
#define CDS_NOEXCEPT_SUPPORT
#define CDS_NOEXCEPT_SUPPORT_(expr)
-// C++11 atomic support
-#define CDS_CXX11_ATOMIC_SUPPORT 1
-
// Lambda (VC 10 +)
//#define CDS_CXX11_LAMBDA_SUPPORT
//@cond
#if defined(CDS_USE_BOOST_ATOMIC)
+ // boost atomic
# include <boost/version.hpp>
# if BOOST_VERSION >= 105400
# include <boost/atomic.hpp>
# else
# error "Boost version 1.54 or above is needed for boost.atomic"
# endif
-#elif CDS_CXX11_ATOMIC_SUPPORT == 1 && !defined(CDS_USE_LIBCDS_ATOMIC)
- // Compiler supports C++11 atomic (conditionally defined in cds/details/defs.h)
+#elif defined(CDS_USE_LIBCDS_ATOMIC)
+ // libcds atomic
+# include <cds/compiler/cxx11_atomic.h>
+# define CDS_ATOMIC cds::cxx11_atomics
+# define CDS_CXX11_ATOMIC_BEGIN_NAMESPACE namespace cds { namespace cxx11_atomics {
+# define CDS_CXX11_ATOMIC_END_NAMESPACE }}
+#else
+ // Compiler provided C++11 atomic
# include <cds/compiler/cxx11_atomic_prepatches.h>
# include <atomic>
# define CDS_ATOMIC std
# define CDS_CXX11_ATOMIC_END_NAMESPACE }
# include <cds/compiler/cxx11_atomic_patches.h>
#else
-# include <cds/compiler/cxx11_atomic.h>
-# define CDS_ATOMIC cds::cxx11_atomics
-# define CDS_CXX11_ATOMIC_BEGIN_NAMESPACE namespace cds { namespace cxx11_atomics {
-# define CDS_CXX11_ATOMIC_END_NAMESPACE }}
#endif
//@endcond