Remove compiler-specific C++11 compatibility macro magic
authorkhizmax <libcds.dev@gmail.com>
Sun, 21 Sep 2014 18:50:22 +0000 (22:50 +0400)
committerkhizmax <libcds.dev@gmail.com>
Sun, 21 Sep 2014 18:50:22 +0000 (22:50 +0400)
cds/compiler/clang/defs.h
cds/compiler/gcc/defs.h
cds/compiler/icl/defs.h
cds/compiler/vc/defs.h
projects/Win/vc12/cds.vcxproj
projects/Win/vc12/cds.vcxproj.filters

index c17115ac462a1400547193df83bc0712b346d89a..55f7d793dd5b04f16ffe1cc0b2165acbac8a46b2 100644 (file)
@@ -10,7 +10,7 @@
 #define  CDS_COMPILER__NAME    ("clang " __clang_version__)
 #define  CDS_COMPILER__NICK    "clang"
 
-#if defined(_LIBCPP_VERSION)
+#if defined(_LIBCPP_VERSION) && !defined(CDS_USE_BOOST_ATOMIC)
     // Note: Clang libc++ atomic leads to program crash.
     // So, we use libcds atomic implementation
 #   define CDS_USE_LIBCDS_ATOMIC
 #define alignof __alignof__
 
 // Variadic template support (only if -std=c++0x compile-line option provided)
-#if __has_feature(cxx_variadic_templates)
-#   define CDS_CXX11_VARIADIC_TEMPLATE_SUPPORT
-#endif
+#define CDS_CXX11_VARIADIC_TEMPLATE_SUPPORT
 
 // Default template arguments for function templates
-#if __has_feature(cxx_default_function_template_args)
-#   define CDS_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS_SUPPORT
-#endif
+#define CDS_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS_SUPPORT
 
-#if __has_feature(cxx_deleted_functions)
 // C++11 delete definition ( function declaration = delete)
-#   define CDS_CXX11_DELETE_DEFINITION_SUPPORT
-#endif
+#define CDS_CXX11_DELETE_DEFINITION_SUPPORT
 
-#if __has_feature(cxx_defaulted_functions)
 // C++11 explicitly-defaulted function (= default) [std 8.4.2 [dcl.fct.def.default]]
-#   define CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT
-#endif
+#define CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT
 
 // Explicit conversion operators
-#if __has_feature(cxx_explicit_conversions)
-#   define CDS_CXX11_EXPLICIT_CONVERSION_OPERATOR_SUPPORT
-#endif
+#define CDS_CXX11_EXPLICIT_CONVERSION_OPERATOR_SUPPORT
 
 // C++11 template alias
-#if __has_feature(cxx_alias_templates)
-#   define CDS_CXX11_TEMPLATE_ALIAS_SUPPORT
-#endif
+#define CDS_CXX11_TEMPLATE_ALIAS_SUPPORT
 
 // C++11 inline namespace
-#if __has_feature(cxx_inline_namespaces)
-#   define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
-#endif
+#define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
 
 // Lambda
-#if __has_feature(cxx_lambdas)
-#   define CDS_CXX11_LAMBDA_SUPPORT
-#endif
+#define CDS_CXX11_LAMBDA_SUPPORT
 
 // RValue
-#if __has_feature(cxx_rvalue_references)
-#   define CDS_RVALUE_SUPPORT
-#   define CDS_MOVE_SEMANTICS_SUPPORT
-#endif
+#define CDS_RVALUE_SUPPORT
+#define CDS_MOVE_SEMANTICS_SUPPORT
 
-#if __has_feature(cxx_constexpr)
-#   define CDS_CONSTEXPR    constexpr
-#   define CDS_CONSTEXPR_CONST constexpr const
-#else
-#   define CDS_CONSTEXPR
-#   define CDS_CONSTEXPR_CONST const
-#endif
+#define CDS_CONSTEXPR    constexpr
+#define CDS_CONSTEXPR_CONST constexpr const
 
-#if __has_feature(cxx_noexcept)
-#   define CDS_NOEXCEPT_SUPPORT        noexcept
-#   define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
-#else
-#   define CDS_NOEXCEPT_SUPPORT
-#   define CDS_NOEXCEPT_SUPPORT_(expr)
-#endif
+#define CDS_NOEXCEPT_SUPPORT        noexcept
+#define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
 
 // C++11 thread_local keyword
-#if __has_feature(cxx_thread_local)         // CLang 3.3
-#   define CDS_CXX11_THREAD_LOCAL_SUPPORT
-#endif
-
-// Thread support library (thread, mutex, condition variable, chrono)
-#if CDS_COMPILER_VERSION >= 30100
-#   if __has_include(<thread>)
-#       define CDS_CXX11_STDLIB_THREAD
-#   endif
-
-#   if __has_include(<chrono>)
-#       define CDS_CXX11_STDLIB_CHRONO
-#   endif
-
-#   if __has_include(<mutex>)
-#       define CDS_CXX11_STDLIB_MUTEX
-#   endif
-
-#   if __has_include(<condition_variable>)
-#       define CDS_CXX11_STDLIB_CONDITION_VARIABLE
-#   endif
-#endif
+#define CDS_CXX11_THREAD_LOCAL_SUPPORT
 
 // Full SFINAE support
 #define CDS_CXX11_SFINAE
index 682fcd1b31f5b4e1a5ed9b5736671d6a3b22bc34..471a905d9f027e41a2b998b31e02e4b156e1fd48 100644 (file)
 // ***************************************
 // C++11 features
 
-// Variadic template support (only if -std=c++0x compile-line option provided)
-#if CDS_COMPILER_VERSION >= 40300
-#   define CDS_CXX11_VARIADIC_TEMPLATE_SUPPORT
-#endif
+#define CDS_CXX11_VARIADIC_TEMPLATE_SUPPORT
 
 // RValue
-#if CDS_COMPILER_VERSION >= 40300
-#   define CDS_RVALUE_SUPPORT
-#   define CDS_MOVE_SEMANTICS_SUPPORT
-#endif
+#define CDS_RVALUE_SUPPORT
+#define CDS_MOVE_SEMANTICS_SUPPORT
 
-// Default template arguments for function templates
-#if CDS_COMPILER_VERSION >= 40300
-#   define CDS_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS_SUPPORT
-#endif
+#define CDS_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS_SUPPORT
 
 // C++11 inline namespace
-#if CDS_COMPILER_VERSION >= 40400
-#   define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
-#endif
+#define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
 
-// Delete definition and explicitly-defaulted function
-#if CDS_COMPILER_VERSION >= 40400
 // C++11 delete definition ( function declaration = delete)
-#   define CDS_CXX11_DELETE_DEFINITION_SUPPORT
+#define CDS_CXX11_DELETE_DEFINITION_SUPPORT
 
 // C++11 explicitly-defaulted function (= default) [std 8.4.2 [dcl.fct.def.default]]
-#   define CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT
-#endif
+#define CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT
 
 // Lambda
-#if CDS_COMPILER_VERSION >= 40500
-#   define CDS_CXX11_LAMBDA_SUPPORT
-#   if CDS_COMPILER_VERSION < 40800
-#       define CDS_BUG_STATIC_MEMBER_IN_LAMBDA
-#   endif
-#endif
+#define CDS_CXX11_LAMBDA_SUPPORT
 
 // Explicit conversion operator
-#if CDS_COMPILER_VERSION >= 40500
-#   define CDS_CXX11_EXPLICIT_CONVERSION_OPERATOR_SUPPORT
-#endif
+#define CDS_CXX11_EXPLICIT_CONVERSION_OPERATOR_SUPPORT
 
-#if CDS_COMPILER_VERSION >= 40600
-#   define CDS_CONSTEXPR    constexpr
-#   define CDS_NOEXCEPT_SUPPORT        noexcept
-#   define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
-#   if CDS_COMPILER_VERSION >= 40600 && CDS_COMPILER_VERSION < 40700
-    // GCC 4.6.x does not allow noexcept specification in defaulted function
-    // void foo() noexcept = default
-    // error: function \91foo\92 defaulted on its first declaration must not have an exception-specification
-#       define CDS_NOEXCEPT_DEFAULTED
-#       define CDS_NOEXCEPT_DEFAULTED_(expr)
-    // GCC 4.6.x: constexpr and const are incompatible in variable declaration
-#       define CDS_CONSTEXPR_CONST const
-#   else
-#       define CDS_CONSTEXPR_CONST constexpr const
-#   endif
-#else
-#   define CDS_CONSTEXPR
-#   define CDS_CONSTEXPR_CONST const
-#   define CDS_NOEXCEPT_SUPPORT
-#   define CDS_NOEXCEPT_SUPPORT_(expr)
-#endif
+// constexpr
+#define CDS_CONSTEXPR    constexpr
+
+// noexcept
+#define CDS_NOEXCEPT_SUPPORT        noexcept
+#define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
+#define CDS_CONSTEXPR_CONST constexpr const
 
 // C++11 template alias
-#if CDS_COMPILER_VERSION >= 40700
-#   define CDS_CXX11_TEMPLATE_ALIAS_SUPPORT
-#endif
+#define CDS_CXX11_TEMPLATE_ALIAS_SUPPORT
 
 // C++11 thread_local keyword
-#if CDS_COMPILER_VERSION >= 40800
-#   define CDS_CXX11_THREAD_LOCAL_SUPPORT
-#endif
-
-
-#if defined( CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT ) && defined(CDS_MOVE_SEMANTICS_SUPPORT) && CDS_COMPILER_VERSION >= 40400 && CDS_COMPILER_VERSION < 40600
-    // GCC 4.4 - 4.5 bug: move ctor & assignment operator cannot be defaulted
-#   define CDS_DISABLE_DEFAULT_MOVE_CTOR
-#endif
-
-// Thread support library (thread, mutex, condition variable, chrono)
-#if CDS_COMPILER_VERSION >= 40800
-#   define CDS_CXX11_STDLIB_THREAD
-#   define CDS_CXX11_STDLIB_MUTEX
-#   define CDS_CXX11_STDLIB_CONDITION_VARIABLE
-#   define CDS_CXX11_STDLIB_CHRONO
-#endif
+#define CDS_CXX11_THREAD_LOCAL_SUPPORT
 
 // Full SFINAE support
 #if CDS_COMPILER_VERSION >= 40700
index e43603df5b05de4130d01eedc95de3e1c317e0c1..195b69a04799de290018ccd400fda560f61625dc 100644 (file)
 #   define alignof __alignof__
 #endif
 
-// Memory leaks detection (debug build only)
-//#ifdef _DEBUG
-//#   define _CRTDBG_MAP_ALLOC
-//#   define _CRTDBG_MAPALLOC
-//#   include <stdlib.h>
-//#   include <crtdbg.h>
-//#   define CDS_MSVC_MEMORY_LEAKS_DETECTING_ENABLED
-//#endif
-
-#if CDS_COMPILER_VERSION < 1400
-#   define CDS_CONSTEXPR
-#   define CDS_CONSTEXPR_CONST const
-#else
-#   define CDS_CONSTEXPR    constexpr
-#   define CDS_CONSTEXPR_CONST constexpr const
-#endif
-
-// noexcept is not yet supported
-#if CDS_COMPILER_VERSION < 1400
-#   define CDS_NOEXCEPT_SUPPORT
-#   define CDS_NOEXCEPT_SUPPORT_(expr)
-#else
-#   define CDS_NOEXCEPT_SUPPORT        noexcept
-#   define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
-#endif
+#define CDS_CONSTEXPR    constexpr
+#define CDS_CONSTEXPR_CONST constexpr const
 
+#define CDS_NOEXCEPT_SUPPORT        noexcept
+#define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
 
 // Lambda (ICL 12 +)
-#if CDS_COMPILER_VERSION >= 1200
-#   define CDS_CXX11_LAMBDA_SUPPORT
-#endif
+#define CDS_CXX11_LAMBDA_SUPPORT
 
 // RValue (ICL 10+)
-#if CDS_COMPILER_VERSION >= 1200
-#   define CDS_RVALUE_SUPPORT
-#   define CDS_MOVE_SEMANTICS_SUPPORT
-#endif
+#define CDS_RVALUE_SUPPORT
+#define CDS_MOVE_SEMANTICS_SUPPORT
 
 // Default template arguments for function templates (ICL 12.1+)
-#if CDS_COMPILER_VERSION >= 1201
-#   define CDS_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS_SUPPORT
-#endif
+#define CDS_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS_SUPPORT
 
 // C++11 delete definition ( function declaration = delete)
-#if CDS_COMPILER_VERSION >= 1200
-#   define CDS_CXX11_DELETE_DEFINITION_SUPPORT
-#endif
+#define CDS_CXX11_DELETE_DEFINITION_SUPPORT
 
 // C++11 explicitly-defaulted function (= default) [std 8.4.2 [dcl.fct.def.default]]
-#if CDS_COMPILER_VERSION >= 1200
-#   define CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT
-#endif
+#define CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT
 
 // Variadic template support (ICL 12.1+)
-#if CDS_COMPILER_VERSION >= 1201
-#   define CDS_CXX11_VARIADIC_TEMPLATE_SUPPORT     1
-#endif
+#define CDS_CXX11_VARIADIC_TEMPLATE_SUPPORT     1
 
 // C++11 template alias
-#if CDS_COMPILER_VERSION >= 1201
-#   define CDS_CXX11_TEMPLATE_ALIAS_SUPPORT
-#endif
+#define CDS_CXX11_TEMPLATE_ALIAS_SUPPORT
 
 // C++11 inline namespace
-#if CDS_COMPILER_VERSION >= 1400
-#   define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
-#endif
+#define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
 
 // Explicit conversion operator
 //#if CDS_COMPILER_VERSION >= 1800
 //#   define CDS_CXX11_EXPLICIT_CONVERSION_OPERATOR_SUPPORT
 //#endif
 
-// Thread support library (thread, mutex, condition variable)
-#if _MSC_VER >= 1700
-    // MS VC 11+
-#   define CDS_CXX11_STDLIB_THREAD
-#   define CDS_CXX11_STDLIB_MUTEX
-#   define CDS_CXX11_STDLIB_CONDITION_VARIABLE
-#   define CDS_CXX11_STDLIB_CHRONO
-#endif
-
-#if defined( CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT ) && defined(CDS_MOVE_SEMANTICS_SUPPORT) && CDS_COMPILER_VERSION < 1400
-    // Intel C++ bug: move ctor & assignment operator cannot be defaulted
-    // http://software.intel.com/en-us/forums/topic/394395
-#   define CDS_DISABLE_DEFAULT_MOVE_CTOR
-#endif
-
-
 // *************************************************
 // Alignment macro
 
index 615d21042c3ea42cfae82dfb5579db2ce03aeb3b..8e20209d281b2bc1afe888e7832e2411f6831db7 100644 (file)
 #   define CDS_DISABLE_DEFAULT_MOVE_CTOR
 #endif
 
-// Thread support library (thread, mutex, condition variable)
-#define CDS_CXX11_STDLIB_THREAD
-#define CDS_CXX11_STDLIB_MUTEX
-#define CDS_CXX11_STDLIB_CONDITION_VARIABLE
-#define CDS_CXX11_STDLIB_CHRONO
-
 // Full SFINAE support
 //#if CDS_COMPILER_VERSION >= ????
 //#   define CDS_CXX11_SFINAE
index 2c887aed35a91bf392e6df4b4a06f0cb6baeb332..36f23cfd724cb846c736afae510b1aa8d4663d7c 100644 (file)
     <ClInclude Include="..\..\..\cds\compiler\cxx11_atomic.h" />\r
     <ClInclude Include="..\..\..\cds\compiler\gcc\amd64\cxx11_atomic.h" />\r
     <ClInclude Include="..\..\..\cds\compiler\gcc\compiler_macro.h" />\r
-    <ClInclude Include="..\..\..\cds\compiler\gcc\cxx11_atomic_patches.h" />\r
     <ClInclude Include="..\..\..\cds\compiler\gcc\ia64\cxx11_atomic.h" />\r
     <ClInclude Include="..\..\..\cds\compiler\gcc\sparc\cxx11_atomic.h" />\r
     <ClInclude Include="..\..\..\cds\compiler\gcc\x86\cxx11_atomic.h" />\r
index 8bd0824a6875205bee79b4e9fe144fa0e3e0c332..4c3f67590bc9bba45765af637ff00a25974174c7 100644 (file)
     <ClInclude Include="..\..\..\cds\compiler\gcc\ia64\cxx11_atomic.h">\r
       <Filter>Header Files\cds\compiler\gcc\ia64</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="..\..\..\cds\compiler\gcc\cxx11_atomic_patches.h">\r
-      <Filter>Header Files\cds\compiler\gcc</Filter>\r
-    </ClInclude>\r
     <ClInclude Include="..\..\..\cds\details\bounded_container.h">\r
       <Filter>Header Files\cds\details</Filter>\r
     </ClInclude>\r