Add support for Intel C++ compiler for Linux (icc 15)
[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) || defined(__amd64__) || defined(__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) || defined(__i386__) || defined(__i386)
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 #define CDS_CONSTEXPR    constexpr
82 #define CDS_CONSTEXPR_CONST constexpr const
83
84 #define CDS_NOEXCEPT_SUPPORT        noexcept
85 #define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
86
87 // C++11 inline namespace
88 #define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
89
90 // *************************************************
91 // Alignment macro
92
93 #if CDS_OS_INTERFACE == CDS_OSI_WINDOWS
94 #   define CDS_TYPE_ALIGNMENT(n)     __declspec( align(n) )
95 #   define CDS_DATA_ALIGNMENT(n)     __declspec( align(n) )
96 #   define CDS_CLASS_ALIGNMENT(n)    __declspec( align(n) )
97 #else
98 #   define CDS_TYPE_ALIGNMENT(n)   __attribute__ ((aligned (n)))
99 #   define CDS_CLASS_ALIGNMENT(n)  __attribute__ ((aligned (n)))
100 #   define CDS_DATA_ALIGNMENT(n)   __attribute__ ((aligned (n)))
101 #endif
102
103 #include <cds/compiler/icl/compiler_barriers.h>
104
105 //@endcond
106 #endif // #ifndef __CDS_COMPILER_VC_DEFS_H