Remove cstdint_boost.h, csdtint_std.h wrappers
[libcds.git] / cds / compiler / icl / defs.h
1 //$$CDS-header$$
2
3 #ifndef __CDS_COMPILER_ICL_DEFS_H
4 #define __CDS_COMPILER_ICL_DEFS_H
5 //@cond
6
7 // Compiler version
8 #ifdef __ICL
9 #   define CDS_COMPILER_VERSION    __ICL
10 #else
11 #   define CDS_COMPILER_VERSION    __INTEL_COMPILER
12 #endif
13
14 // Compiler name
15 // Supported compilers: MS VC 2008, 2010, 2012
16 //
17 #   define  CDS_COMPILER__NAME  "Intel C++"
18 #   define  CDS_COMPILER__NICK  "icl"
19
20 // OS name
21 #if defined(_WIN64)
22 #   define CDS_OS_INTERFACE CDS_OSI_WINDOWS
23 #   define CDS_OS_TYPE      CDS_OS_WIN64
24 #   define CDS_OS__NAME     "Win64"
25 #   define CDS_OS__NICK     "Win64"
26 #elif defined(_WIN32)
27 #   define CDS_OS_INTERFACE CDS_OSI_WINDOWS
28 #   define CDS_OS_TYPE      CDS_OS_WIN32
29 #   define CDS_OS__NAME     "Win32"
30 #   define CDS_OS__NICK     "Win32"
31 #elif defined( __linux__ )
32 #   define CDS_OS_INTERFACE     CDS_OSI_UNIX
33 #   define CDS_OS_TYPE          CDS_OS_LINUX
34 #   define CDS_OS__NAME         "linux"
35 #   define CDS_OS__NICK         "linux"
36 #endif
37
38 // Processor architecture
39 #if defined(_M_X64) || defined(_M_AMD64)
40 #   define CDS_BUILD_BITS       64
41 #   define CDS_PROCESSOR_ARCH   CDS_PROCESSOR_AMD64
42 #   define CDS_PROCESSOR__NAME  "AMD64"
43 #   define CDS_PROCESSOR__NICK  "amd64"
44 #elif defined(_M_IX86)
45 #   define CDS_BUILD_BITS       32
46 #   define CDS_PROCESSOR_ARCH   CDS_PROCESSOR_X86
47 #   define CDS_PROCESSOR__NAME  "Intel x86"
48 #   define CDS_PROCESSOR__NICK  "x86"
49 #else
50 #   define CDS_BUILD_BITS        -1
51 #   define CDS_PROCESSOR_ARCH    CDS_PROCESSOR_UNKNOWN
52 #   define CDS_PROCESSOR__NAME    "<<Undefined>>"
53 #   error Intel C++ compiler is supported for x86 only
54 #endif
55
56 #if CDS_OS_INTERFACE == CDS_OSI_WINDOWS
57 #   define  __attribute__( _x )
58 #   define  CDS_STDCALL    __stdcall
59 #else
60 #   if CDS_PROCESSOR_ARCH == CDS_PROCESSOR_X86
61 #       define CDS_STDCALL __attribute__((stdcall))
62 #   else
63 #       define CDS_STDCALL
64 #   endif
65 #endif
66
67 #if CDS_OS_INTERFACE == CDS_OSI_WINDOWS
68 #   ifdef CDS_BUILD_LIB
69 #       define CDS_EXPORT_API          __declspec(dllexport)
70 #   else
71 #       define CDS_EXPORT_API          __declspec(dllimport)
72 #   endif
73 #endif
74
75 #if CDS_OS_INTERFACE == CDS_OSI_WINDOWS
76 #   define alignof     __alignof
77 #else
78 #   define alignof __alignof__
79 #endif
80
81 //#if CDS_COMPILER_VERSION < 1600
82 //#   include <boost/static_assert.hpp>
83 //#   define static_assert(_expr, _msg)     BOOST_STATIC_ASSERT((_expr))
84 //#endif
85
86 // Memory leaks detection (debug build only)
87 //#ifdef _DEBUG
88 //#   define _CRTDBG_MAP_ALLOC
89 //#   define _CRTDBG_MAPALLOC
90 //#   include <stdlib.h>
91 //#   include <crtdbg.h>
92 //#   define CDS_MSVC_MEMORY_LEAKS_DETECTING_ENABLED
93 //#endif
94
95 #if CDS_COMPILER_VERSION < 1400
96 #   define CDS_CONSTEXPR
97 #   define CDS_CONSTEXPR_CONST const
98 #else
99 #   define CDS_CONSTEXPR    constexpr
100 #   define CDS_CONSTEXPR_CONST constexpr const
101 #endif
102
103 // noexcept is not yet supported
104 #if CDS_COMPILER_VERSION < 1400
105 #   define CDS_NOEXCEPT_SUPPORT
106 #   define CDS_NOEXCEPT_SUPPORT_(expr)
107 #else
108 #   define CDS_NOEXCEPT_SUPPORT        noexcept
109 #   define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
110 #endif
111
112 // C++11 atomic support
113 #if CDS_COMPILER_VERSION >= 1300 && CDS_OS_INTERFACE == CDS_OSI_WINDOWS && _MSC_VER >= 1700
114     // Intel C++ 13 supports C++11 atomic standard for VC++ 2012
115 #   define CDS_CXX11_ATOMIC_SUPPORT     1
116 #endif
117
118
119 // Lambda (ICL 12 +)
120 #if CDS_COMPILER_VERSION >= 1200
121 #   define CDS_CXX11_LAMBDA_SUPPORT
122 #endif
123
124 // RValue (ICL 10+)
125 #if CDS_COMPILER_VERSION >= 1200
126 #   define CDS_RVALUE_SUPPORT
127 #   define CDS_MOVE_SEMANTICS_SUPPORT
128 #endif
129
130 // Default template arguments for function templates (ICL 12.1+)
131 #if CDS_COMPILER_VERSION >= 1201
132 #   define CDS_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS_SUPPORT
133 #endif
134
135 // C++11 delete definition ( function declaration = delete)
136 #if CDS_COMPILER_VERSION >= 1200
137 #   define CDS_CXX11_DELETE_DEFINITION_SUPPORT
138 #endif
139
140 // C++11 explicitly-defaulted function (= default) [std 8.4.2 [dcl.fct.def.default]]
141 #if CDS_COMPILER_VERSION >= 1200
142 #   define CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT
143 #endif
144
145 // Variadic template support (ICL 12.1+)
146 #if CDS_COMPILER_VERSION >= 1201
147 #   define CDS_CXX11_VARIADIC_TEMPLATE_SUPPORT     1
148 #endif
149
150 // C++11 template alias
151 #if CDS_COMPILER_VERSION >= 1201
152 #   define CDS_CXX11_TEMPLATE_ALIAS_SUPPORT
153 #endif
154
155 // C++11 inline namespace
156 #if CDS_COMPILER_VERSION >= 1400
157 #   define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
158 #endif
159
160 // Explicit conversion operator
161 //#if CDS_COMPILER_VERSION >= 1800
162 //#   define CDS_CXX11_EXPLICIT_CONVERSION_OPERATOR_SUPPORT
163 //#endif
164
165 // Thread support library (thread, mutex, condition variable)
166 #if _MSC_VER >= 1700
167     // MS VC 11+
168 #   define CDS_CXX11_STDLIB_THREAD
169 #   define CDS_CXX11_STDLIB_MUTEX
170 #   define CDS_CXX11_STDLIB_CONDITION_VARIABLE
171 #   define CDS_CXX11_STDLIB_CHRONO
172 #endif
173
174 #if defined( CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT ) && defined(CDS_MOVE_SEMANTICS_SUPPORT) && CDS_COMPILER_VERSION < 1400
175     // Intel C++ bug: move ctor & assignment operator cannot be defaulted
176     // http://software.intel.com/en-us/forums/topic/394395
177 #   define CDS_DISABLE_DEFAULT_MOVE_CTOR
178 #endif
179
180
181 // *************************************************
182 // Alignment macro
183
184 #if CDS_OS_INTERFACE == CDS_OSI_WINDOWS
185 #   define CDS_TYPE_ALIGNMENT(n)     __declspec( align(n) )
186 #   define CDS_DATA_ALIGNMENT(n)     __declspec( align(n) )
187 #   define CDS_CLASS_ALIGNMENT(n)    __declspec( align(n) )
188 #else
189 #   define CDS_TYPE_ALIGNMENT(n)   __attribute__ ((aligned (n)))
190 #   define CDS_CLASS_ALIGNMENT(n)  __attribute__ ((aligned (n)))
191 #   define CDS_DATA_ALIGNMENT(n)   __attribute__ ((aligned (n)))
192 #endif
193
194 #include <cds/compiler/icl/compiler_barriers.h>
195
196 //@endcond
197 #endif // #ifndef __CDS_COMPILER_VC_DEFS_H