From 6631bed1f8f4072708ce9262f090e43847381f60 Mon Sep 17 00:00:00 2001 From: khizmax Date: Sat, 20 Sep 2014 19:56:16 +0400 Subject: [PATCH] Remove CDS_CXX11_ATOMIC_SUPPORT --- cds/compiler/clang/defs.h | 13 +++---- cds/compiler/gcc/compiler_macro.h | 2 - cds/compiler/gcc/cxx11_atomic_patches.h | 41 --------------------- cds/compiler/gcc/defs.h | 12 +----- cds/compiler/icl/cxx11_atomic_patches_win.h | 21 ----------- cds/compiler/icl/defs.h | 11 ------ cds/compiler/vc/defs.h | 3 -- cds/cxx11_atomic.h | 15 +++++--- 8 files changed, 16 insertions(+), 102 deletions(-) diff --git a/cds/compiler/clang/defs.h b/cds/compiler/clang/defs.h index af1239ba..c17115ac 100644 --- a/cds/compiler/clang/defs.h +++ b/cds/compiler/clang/defs.h @@ -10,17 +10,14 @@ #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 - #define alignof __alignof__ // Variadic template support (only if -std=c++0x compile-line option provided) diff --git a/cds/compiler/gcc/compiler_macro.h b/cds/compiler/gcc/compiler_macro.h index c9e89bcb..3617dbe3 100644 --- a/cds/compiler/gcc/compiler_macro.h +++ b/cds/compiler/gcc/compiler_macro.h @@ -104,8 +104,6 @@ #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 diff --git a/cds/compiler/gcc/cxx11_atomic_patches.h b/cds/compiler/gcc/cxx11_atomic_patches.h index c6818878..62faf5df 100644 --- a/cds/compiler/gcc/cxx11_atomic_patches.h +++ b/cds/compiler/gcc/cxx11_atomic_patches.h @@ -3,45 +3,4 @@ #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 diff --git a/cds/compiler/gcc/defs.h b/cds/compiler/gcc/defs.h index 0df786dd..682fcd1b 100644 --- a/cds/compiler/gcc/defs.h +++ b/cds/compiler/gcc/defs.h @@ -6,8 +6,8 @@ // 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 @@ -18,14 +18,6 @@ #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 diff --git a/cds/compiler/icl/cxx11_atomic_patches_win.h b/cds/compiler/icl/cxx11_atomic_patches_win.h index b5719d7e..06249f37 100644 --- a/cds/compiler/icl/cxx11_atomic_patches_win.h +++ b/cds/compiler/icl/cxx11_atomic_patches_win.h @@ -3,25 +3,4 @@ #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 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 diff --git a/cds/compiler/icl/defs.h b/cds/compiler/icl/defs.h index 5f2809b3..e43603df 100644 --- a/cds/compiler/icl/defs.h +++ b/cds/compiler/icl/defs.h @@ -78,11 +78,6 @@ # define alignof __alignof__ #endif -//#if CDS_COMPILER_VERSION < 1600 -//# include -//# define static_assert(_expr, _msg) BOOST_STATIC_ASSERT((_expr)) -//#endif - // Memory leaks detection (debug build only) //#ifdef _DEBUG //# define _CRTDBG_MAP_ALLOC @@ -109,12 +104,6 @@ # 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 diff --git a/cds/compiler/vc/defs.h b/cds/compiler/vc/defs.h index f9272317..e8d14ba3 100644 --- a/cds/compiler/vc/defs.h +++ b/cds/compiler/vc/defs.h @@ -87,9 +87,6 @@ #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 diff --git a/cds/cxx11_atomic.h b/cds/cxx11_atomic.h index d61a49a6..f54ec19a 100644 --- a/cds/cxx11_atomic.h +++ b/cds/cxx11_atomic.h @@ -91,6 +91,7 @@ namespace cxx11_atomics { //@cond #if defined(CDS_USE_BOOST_ATOMIC) + // boost atomic # include # if BOOST_VERSION >= 105400 # include @@ -100,8 +101,14 @@ namespace cxx11_atomics { # 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 +# 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 # include # define CDS_ATOMIC std @@ -109,10 +116,6 @@ namespace cxx11_atomics { # define CDS_CXX11_ATOMIC_END_NAMESPACE } # include #else -# include -# 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 -- 2.34.1