3 #ifndef __CDS_COMPILER_CLANG_DEFS_H
4 #define __CDS_COMPILER_CLANG_DEFS_H
7 #define CDS_COMPILER_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
10 #define CDS_COMPILER__NAME ("clang " __clang_version__)
11 #define CDS_COMPILER__NICK "clang"
13 #if defined(_LIBCPP_VERSION)
14 // Note: Clang libc++ atomic leads to program crash.
15 // So, we use libcds atomic implementation
16 # define CDS_USE_LIBCDS_ATOMIC
19 #include <cds/compiler/gcc/compiler_macro.h>
21 #define alignof __alignof__
23 // Variadic template support (only if -std=c++0x compile-line option provided)
24 #if __has_feature(cxx_variadic_templates)
25 # define CDS_CXX11_VARIADIC_TEMPLATE_SUPPORT
28 // Default template arguments for function templates
29 #if __has_feature(cxx_default_function_template_args)
30 # define CDS_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS_SUPPORT
33 #if __has_feature(cxx_deleted_functions)
34 // C++11 delete definition ( function declaration = delete)
35 # define CDS_CXX11_DELETE_DEFINITION_SUPPORT
38 #if __has_feature(cxx_defaulted_functions)
39 // C++11 explicitly-defaulted function (= default) [std 8.4.2 [dcl.fct.def.default]]
40 # define CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT
43 // Explicit conversion operators
44 #if __has_feature(cxx_explicit_conversions)
45 # define CDS_CXX11_EXPLICIT_CONVERSION_OPERATOR_SUPPORT
48 // C++11 template alias
49 #if __has_feature(cxx_alias_templates)
50 # define CDS_CXX11_TEMPLATE_ALIAS_SUPPORT
53 // C++11 inline namespace
54 #if __has_feature(cxx_inline_namespaces)
55 # define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
59 #if __has_feature(cxx_lambdas)
60 # define CDS_CXX11_LAMBDA_SUPPORT
64 #if __has_feature(cxx_rvalue_references)
65 # define CDS_RVALUE_SUPPORT
66 # define CDS_MOVE_SEMANTICS_SUPPORT
69 #if __has_feature(cxx_constexpr)
70 # define CDS_CONSTEXPR constexpr
71 # define CDS_CONSTEXPR_CONST constexpr const
73 # define CDS_CONSTEXPR
74 # define CDS_CONSTEXPR_CONST const
77 #if __has_feature(cxx_noexcept)
78 # define CDS_NOEXCEPT_SUPPORT noexcept
79 # define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
81 # define CDS_NOEXCEPT_SUPPORT
82 # define CDS_NOEXCEPT_SUPPORT_(expr)
85 // C++11 thread_local keyword
86 #if __has_feature(cxx_thread_local) // CLang 3.3
87 # define CDS_CXX11_THREAD_LOCAL_SUPPORT
90 // Thread support library (thread, mutex, condition variable, chrono)
91 #if CDS_COMPILER_VERSION >= 30100
92 # if __has_include(<thread>)
93 # define CDS_CXX11_STDLIB_THREAD
96 # if __has_include(<chrono>)
97 # define CDS_CXX11_STDLIB_CHRONO
100 # if __has_include(<mutex>)
101 # define CDS_CXX11_STDLIB_MUTEX
104 # if __has_include(<condition_variable>)
105 # define CDS_CXX11_STDLIB_CONDITION_VARIABLE
109 // Full SFINAE support
110 #define CDS_CXX11_SFINAE
112 // *************************************************
115 #define CDS_TYPE_ALIGNMENT(n) __attribute__ ((aligned (n)))
116 #define CDS_CLASS_ALIGNMENT(n) __attribute__ ((aligned (n)))
117 #define CDS_DATA_ALIGNMENT(n) __attribute__ ((aligned (n)))
120 #include <cds/compiler/gcc/compiler_barriers.h>
122 #endif // #ifndef __CDS_COMPILER_GCC_DEFS_H