4f7244904e13e954480e1d4ed1cbafb3f9dc2888
[libcds.git] / cds / compiler / clang / defs.h
1 //$$CDS-header$$
2
3 #ifndef __CDS_COMPILER_CLANG_DEFS_H
4 #define __CDS_COMPILER_CLANG_DEFS_H
5
6 // Compiler version
7 #define CDS_COMPILER_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
8
9 // Compiler name
10 #define  CDS_COMPILER__NAME    ("clang " __clang_version__)
11 #define  CDS_COMPILER__NICK    "clang"
12
13 #if CDS_COMPILER_VERSION < 30300
14 #   error "Compiler version error. Clang version 3.3.0 and above is supported"
15 #endif
16
17
18 #if defined(_LIBCPP_VERSION) && !defined(CDS_USE_BOOST_ATOMIC)
19     // Note: Clang libc++ atomic leads to program crash.
20     // So, we use libcds atomic implementation
21 #   define CDS_USE_LIBCDS_ATOMIC
22 #endif
23
24 #include <cds/compiler/gcc/compiler_macro.h>
25
26 #define alignof __alignof__
27
28 // C++11 inline namespace
29 #define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
30
31 // Lambda
32 #define CDS_CXX11_LAMBDA_SUPPORT
33
34 // RValue
35 #define CDS_RVALUE_SUPPORT
36 #define CDS_MOVE_SEMANTICS_SUPPORT
37
38 #define CDS_CONSTEXPR    constexpr
39 #define CDS_CONSTEXPR_CONST constexpr const
40
41 #define CDS_NOEXCEPT_SUPPORT        noexcept
42 #define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
43
44 // C++11 thread_local keyword
45 #define CDS_CXX11_THREAD_LOCAL_SUPPORT
46
47 // Full SFINAE support
48 #define CDS_CXX11_SFINAE
49
50 // *************************************************
51 // Alignment macro
52
53 #define CDS_TYPE_ALIGNMENT(n)   __attribute__ ((aligned (n)))
54 #define CDS_CLASS_ALIGNMENT(n)  __attribute__ ((aligned (n)))
55 #define CDS_DATA_ALIGNMENT(n)   __attribute__ ((aligned (n)))
56
57
58 #include <cds/compiler/gcc/compiler_barriers.h>
59
60 #endif // #ifndef __CDS_COMPILER_GCC_DEFS_H