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 // C++11 atomic support - only for libc++
14 // Note: Clang libc++ atomic leads to program crash.
15 // So, we use libcds atomic implementation
16 //#if __has_feature(cxx_atomic) && defined(_LIBCPP_VERSION)
17 //# define CDS_CXX11_ATOMIC_SUPPORT 1
21 #include <cds/compiler/gcc/compiler_macro.h>
24 #define alignof __alignof__
26 // Variadic template support (only if -std=c++0x compile-line option provided)
27 #if __has_feature(cxx_variadic_templates)
28 # define CDS_CXX11_VARIADIC_TEMPLATE_SUPPORT
31 // Default template arguments for function templates
32 #if __has_feature(cxx_default_function_template_args)
33 # define CDS_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS_SUPPORT
36 #if __has_feature(cxx_deleted_functions)
37 // C++11 delete definition ( function declaration = delete)
38 # define CDS_CXX11_DELETE_DEFINITION_SUPPORT
41 #if __has_feature(cxx_defaulted_functions)
42 // C++11 explicitly-defaulted function (= default) [std 8.4.2 [dcl.fct.def.default]]
43 # define CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT
46 // Explicit conversion operators
47 #if __has_feature(cxx_explicit_conversions)
48 # define CDS_CXX11_EXPLICIT_CONVERSION_OPERATOR_SUPPORT
51 // C++11 template alias
52 #if __has_feature(cxx_alias_templates)
53 # define CDS_CXX11_TEMPLATE_ALIAS_SUPPORT
56 // C++11 inline namespace
57 #if __has_feature(cxx_inline_namespaces)
58 # define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
62 #if __has_feature(cxx_lambdas)
63 # define CDS_CXX11_LAMBDA_SUPPORT
67 #if __has_feature(cxx_rvalue_references)
68 # define CDS_RVALUE_SUPPORT
69 # define CDS_MOVE_SEMANTICS_SUPPORT
72 #if __has_feature(cxx_constexpr)
73 # define CDS_CONSTEXPR constexpr
74 # define CDS_CONSTEXPR_CONST constexpr const
76 # define CDS_CONSTEXPR
77 # define CDS_CONSTEXPR_CONST const
80 #if __has_feature(cxx_noexcept)
81 # define CDS_NOEXCEPT_SUPPORT noexcept
82 # define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
84 # define CDS_NOEXCEPT_SUPPORT
85 # define CDS_NOEXCEPT_SUPPORT_(expr)
88 // C++11 thread_local keyword
89 #if __has_feature(cxx_thread_local) // CLang 3.3
90 # define CDS_CXX11_THREAD_LOCAL_SUPPORT
94 #include <cds/compiler/cstdint_std.h>
96 // Thread support library (thread, mutex, condition variable, chrono)
97 #if CDS_COMPILER_VERSION >= 30100
98 # if __has_include(<thread>)
99 # define CDS_CXX11_STDLIB_THREAD
102 # if __has_include(<chrono>)
103 # define CDS_CXX11_STDLIB_CHRONO
106 # if __has_include(<mutex>)
107 # define CDS_CXX11_STDLIB_MUTEX
110 # if __has_include(<condition_variable>)
111 # define CDS_CXX11_STDLIB_CONDITION_VARIABLE
115 // Full SFINAE support
116 #define CDS_CXX11_SFINAE
118 // *************************************************
121 #define CDS_TYPE_ALIGNMENT(n) __attribute__ ((aligned (n)))
122 #define CDS_CLASS_ALIGNMENT(n) __attribute__ ((aligned (n)))
123 #define CDS_DATA_ALIGNMENT(n) __attribute__ ((aligned (n)))
126 #include <cds/compiler/gcc/compiler_barriers.h>
128 #endif // #ifndef __CDS_COMPILER_GCC_DEFS_H