From: khizmax Date: Sun, 21 Sep 2014 18:50:22 +0000 (+0400) Subject: Remove compiler-specific C++11 compatibility macro magic X-Git-Tag: v2.0.0~312 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=commitdiff_plain;h=4d0da13a7bb8f52c891172567f8329fdc8a8f7b3 Remove compiler-specific C++11 compatibility macro magic --- diff --git a/cds/compiler/clang/defs.h b/cds/compiler/clang/defs.h index c17115ac..55f7d793 100644 --- a/cds/compiler/clang/defs.h +++ b/cds/compiler/clang/defs.h @@ -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 @@ -21,90 +21,41 @@ #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() -# define CDS_CXX11_STDLIB_THREAD -# endif - -# if __has_include() -# define CDS_CXX11_STDLIB_CHRONO -# endif - -# if __has_include() -# define CDS_CXX11_STDLIB_MUTEX -# endif - -# if __has_include() -# define CDS_CXX11_STDLIB_CONDITION_VARIABLE -# endif -#endif +#define CDS_CXX11_THREAD_LOCAL_SUPPORT // Full SFINAE support #define CDS_CXX11_SFINAE diff --git a/cds/compiler/gcc/defs.h b/cds/compiler/gcc/defs.h index 682fcd1b..471a905d 100644 --- a/cds/compiler/gcc/defs.h +++ b/cds/compiler/gcc/defs.h @@ -26,94 +26,42 @@ // *************************************** // 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 ‘foo’ 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 diff --git a/cds/compiler/icl/defs.h b/cds/compiler/icl/defs.h index e43603df..195b69a0 100644 --- a/cds/compiler/icl/defs.h +++ b/cds/compiler/icl/defs.h @@ -78,95 +78,42 @@ # define alignof __alignof__ #endif -// Memory leaks detection (debug build only) -//#ifdef _DEBUG -//# define _CRTDBG_MAP_ALLOC -//# define _CRTDBG_MAPALLOC -//# include -//# include -//# 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 diff --git a/cds/compiler/vc/defs.h b/cds/compiler/vc/defs.h index 615d2104..8e20209d 100644 --- a/cds/compiler/vc/defs.h +++ b/cds/compiler/vc/defs.h @@ -121,12 +121,6 @@ # 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 diff --git a/projects/Win/vc12/cds.vcxproj b/projects/Win/vc12/cds.vcxproj index 2c887aed..36f23cfd 100644 --- a/projects/Win/vc12/cds.vcxproj +++ b/projects/Win/vc12/cds.vcxproj @@ -644,7 +644,6 @@ - diff --git a/projects/Win/vc12/cds.vcxproj.filters b/projects/Win/vc12/cds.vcxproj.filters index 8bd0824a..4c3f6759 100644 --- a/projects/Win/vc12/cds.vcxproj.filters +++ b/projects/Win/vc12/cds.vcxproj.filters @@ -830,9 +830,6 @@ Header Files\cds\compiler\gcc\ia64 - - Header Files\cds\compiler\gcc - Header Files\cds\details