Added copyright and license
[libcds.git] / cds / compiler / icl / defs.h
1 /*
2     This file is a part of libcds - Concurrent Data Structures library
3
4     (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
5
6     Source code repo: http://github.com/khizmax/libcds/
7     Download: http://sourceforge.net/projects/libcds/files/
8     
9     Redistribution and use in source and binary forms, with or without
10     modification, are permitted provided that the following conditions are met:
11
12     * Redistributions of source code must retain the above copyright notice, this
13       list of conditions and the following disclaimer.
14
15     * Redistributions in binary form must reproduce the above copyright notice,
16       this list of conditions and the following disclaimer in the documentation
17       and/or other materials provided with the distribution.
18
19     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23     FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     
29 */
30
31 #ifndef CDSLIB_COMPILER_ICL_DEFS_H
32 #define CDSLIB_COMPILER_ICL_DEFS_H
33 //@cond
34
35 // Compiler version
36 #ifdef __ICL
37 #   define CDS_COMPILER_VERSION    __ICL
38 #else
39 #   define CDS_COMPILER_VERSION    __INTEL_COMPILER
40 #endif
41
42 // Compiler name
43 // Supported compilers: MS VC 2008, 2010, 2012
44 //
45 #   define  CDS_COMPILER__NAME  "Intel C++"
46 #   define  CDS_COMPILER__NICK  "icl"
47
48 // OS name
49 #if defined(_WIN64)
50 #   define CDS_OS_INTERFACE CDS_OSI_WINDOWS
51 #   define CDS_OS_TYPE      CDS_OS_WIN64
52 #   define CDS_OS__NAME     "Win64"
53 #   define CDS_OS__NICK     "Win64"
54 #elif defined(_WIN32)
55 #   define CDS_OS_INTERFACE CDS_OSI_WINDOWS
56 #   define CDS_OS_TYPE      CDS_OS_WIN32
57 #   define CDS_OS__NAME     "Win32"
58 #   define CDS_OS__NICK     "Win32"
59 #elif defined( __linux__ )
60 #   define CDS_OS_INTERFACE     CDS_OSI_UNIX
61 #   define CDS_OS_TYPE          CDS_OS_LINUX
62 #   define CDS_OS__NAME         "linux"
63 #   define CDS_OS__NICK         "linux"
64 #endif
65
66 // Processor architecture
67 #if defined(_M_X64) || defined(_M_AMD64) || defined(__amd64__) || defined(__amd64)
68 #   define CDS_BUILD_BITS       64
69 #   define CDS_PROCESSOR_ARCH   CDS_PROCESSOR_AMD64
70 #   define CDS_PROCESSOR__NAME  "AMD64"
71 #   define CDS_PROCESSOR__NICK  "amd64"
72 #elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
73 #   define CDS_BUILD_BITS       32
74 #   define CDS_PROCESSOR_ARCH   CDS_PROCESSOR_X86
75 #   define CDS_PROCESSOR__NAME  "Intel x86"
76 #   define CDS_PROCESSOR__NICK  "x86"
77 #else
78 #   define CDS_BUILD_BITS        -1
79 #   define CDS_PROCESSOR_ARCH    CDS_PROCESSOR_UNKNOWN
80 #   define CDS_PROCESSOR__NAME    "<<Undefined>>"
81 #   error Intel C++ compiler is supported for x86 only
82 #endif
83
84 #if CDS_OS_INTERFACE == CDS_OSI_WINDOWS
85 #   define  __attribute__( _x )
86 #   define  CDS_STDCALL    __stdcall
87 #else
88 #   if CDS_PROCESSOR_ARCH == CDS_PROCESSOR_X86
89 #       define CDS_STDCALL __attribute__((stdcall))
90 #   else
91 #       define CDS_STDCALL
92 #   endif
93 #endif
94
95 #if CDS_OS_INTERFACE == CDS_OSI_WINDOWS
96 #   ifdef CDS_BUILD_LIB
97 #       define CDS_EXPORT_API          __declspec(dllexport)
98 #   else
99 #       define CDS_EXPORT_API          __declspec(dllimport)
100 #   endif
101 #endif
102
103 #if CDS_OS_INTERFACE == CDS_OSI_WINDOWS
104 #   define alignof     __alignof
105 #else
106 #   define alignof __alignof__
107 #endif
108
109 #define CDS_CONSTEXPR    constexpr
110
111 #define CDS_NOEXCEPT_SUPPORT        noexcept
112 #define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
113
114 // C++11 inline namespace
115 #define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
116
117 // Inheriting constructors
118 #define CDS_CXX11_INHERITING_CTOR
119
120 // *************************************************
121 // Alignment macro
122
123 #if CDS_OS_INTERFACE == CDS_OSI_WINDOWS
124 #   define CDS_TYPE_ALIGNMENT(n)     __declspec( align(n) )
125 #   define CDS_DATA_ALIGNMENT(n)     __declspec( align(n) )
126 #   define CDS_CLASS_ALIGNMENT(n)    __declspec( align(n) )
127 #else
128 #   define CDS_TYPE_ALIGNMENT(n)   __attribute__ ((aligned (n)))
129 #   define CDS_CLASS_ALIGNMENT(n)  __attribute__ ((aligned (n)))
130 #   define CDS_DATA_ALIGNMENT(n)   __attribute__ ((aligned (n)))
131 #endif
132
133 // Attributes
134 #if CDS_OS_INTERFACE == CDS_OSI_WINDOWS
135 #   define CDS_DEPRECATED( reason ) __declspec(deprecated( reason ))
136 #else
137 #   define CDS_DEPRECATED( reason ) __attribute__((deprecated( reason )))
138 #endif
139
140 #include <cds/compiler/icl/compiler_barriers.h>
141
142 //@endcond
143 #endif // #ifndef CDSLIB_COMPILER_VC_DEFS_H