2 This file is a part of libcds - Concurrent Data Structures library
4 (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
6 Source code repo: http://github.com/khizmax/libcds/
7 Download: http://sourceforge.net/projects/libcds/files/
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met:
12 * Redistributions of source code must retain the above copyright notice, this
13 list of conditions and the following disclaimer.
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.
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.
31 #ifndef CDSLIB_COMPILER_VC_DEFS_H
32 #define CDSLIB_COMPILER_VC_DEFS_H
36 #define CDS_COMPILER_VERSION _MSC_VER
39 // Supported compilers: MS VC 2013 +
40 // C++ compiler versions:
41 #define CDS_COMPILER_MSVC12 1800 // 2013 vc12
42 #define CDS_COMPILER_MSVC14 1900 // 2015 vc14
43 #define CDS_COMPILER_MSVC14_1 1910 // 2017 vc14.1
45 #if CDS_COMPILER_VERSION < CDS_COMPILER_MSVC12
46 # error "Only MS Visual C++ 12 (2013) Update 4 and above is supported"
50 # define CDS_COMPILER__NAME "MS Visual C++ 2013"
51 # define CDS_COMPILER__NICK "vc12"
52 # define CDS_COMPILER_LIBCDS_SUFFIX "vc12"
53 #elif _MSC_VER == 1900
54 # define CDS_COMPILER__NAME "MS Visual C++ 2015"
55 # define CDS_COMPILER__NICK "vc14"
56 # define CDS_COMPILER_LIBCDS_SUFFIX "vcv140"
57 #elif _MSC_VER == 1910
58 # define CDS_COMPILER__NAME "MS Visual C++ 2017"
59 # define CDS_COMPILER__NICK "vc141"
60 # define CDS_COMPILER_LIBCDS_SUFFIX "vcv141"
62 # define CDS_COMPILER__NAME "MS Visual C++"
63 # define CDS_COMPILER__NICK "msvc"
64 # define CDS_COMPILER_LIBCDS_SUFFIX "vc"
68 #define CDS_OS_INTERFACE CDS_OSI_WINDOWS
72 # define CDS_OS_TYPE CDS_OS_WIN64
73 # define CDS_OS__NAME "Win64"
74 # define CDS_OS__NICK "Win64"
76 # define CDS_OS_TYPE CDS_OS_WIN32
77 # define CDS_OS__NAME "Win32"
78 # define CDS_OS__NICK "Win32"
81 // Processor architecture
83 # define CDS_BUILD_BITS 32
84 # define CDS_PROCESSOR_ARCH CDS_PROCESSOR_X86
85 # define CDS_PROCESSOR__NAME "Intel x86"
86 # define CDS_PROCESSOR__NICK "x86"
88 # define CDS_BUILD_BITS 64
89 # define CDS_PROCESSOR_ARCH CDS_PROCESSOR_AMD64
90 # define CDS_PROCESSOR__NAME "AMD64"
91 # define CDS_PROCESSOR__NICK "amd64"
93 # define CDS_BUILD_BITS -1
94 # define CDS_PROCESSOR_ARCH CDS_PROCESSOR_UNKNOWN
95 # define CDS_PROCESSOR__NAME "<<Undefined>>"
96 # error Microsoft Visual C++ compiler is supported for x86 only
99 #define __attribute__( _x )
102 # define CDS_EXPORT_API __declspec(dllexport)
104 # define CDS_EXPORT_API __declspec(dllimport)
107 #define alignof __alignof
109 // Memory leaks detection (debug build only)
111 # define _CRTDBG_MAP_ALLOC
112 # define _CRTDBG_MAPALLOC
115 # define CDS_MSVC_MEMORY_LEAKS_DETECTING_ENABLED
118 // constexpr is not yet supported
119 #define CDS_CONSTEXPR
122 #if CDS_COMPILER_VERSION > CDS_COMPILER_MSVC12
123 # define CDS_NOEXCEPT_SUPPORT noexcept
124 # define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
126 # define CDS_NOEXCEPT_SUPPORT
127 # define CDS_NOEXCEPT_SUPPORT_(expr)
130 // C++11 inline namespace
131 #if CDS_COMPILER_VERSION > CDS_COMPILER_MSVC12
132 # define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
135 #if CDS_COMPILER_VERSION == CDS_COMPILER_MSVC12
136 // VC12: move ctor cannot be defaulted
137 // Error: C2610 [move ctor] is not a special member function which can be defaulted
138 # define CDS_DISABLE_DEFAULT_MOVE_CTOR
141 // Full SFINAE support
142 #if CDS_COMPILER_VERSION > CDS_COMPILER_MSVC12
143 # define CDS_CXX11_SFINAE
146 // Inheriting constructors
147 #if CDS_COMPILER_VERSION > CDS_COMPILER_MSVC12
148 # define CDS_CXX11_INHERITING_CTOR
151 // *************************************************
154 #define CDS_TYPE_ALIGNMENT(n) __declspec( align(n))
155 #define CDS_DATA_ALIGNMENT(n) __declspec( align(n))
156 #define CDS_CLASS_ALIGNMENT(n) __declspec( align(n))
159 #if CDS_COMPILER_VERSION >= CDS_COMPILER_MSVC14
160 # define CDS_DEPRECATED( reason ) [[deprecated( reason )]]
162 # define CDS_DEPRECATED( reason ) __declspec(deprecated( reason ))
165 #define CDS_NORETURN __declspec(noreturn)
169 #if defined( _CPPUNWIND )
170 # define CDS_EXCEPTION_ENABLED
174 // double-width CAS support
175 //#define CDS_DCAS_SUPPORT
178 // It seems, MSVC works only on little-endian architecture?..
179 #if !defined(CDS_ARCH_LITTLE_ENDIAN) && !defined(CDS_ARCH_BIG_ENDIAN)
180 # define CDS_ARCH_LITTLE_ENDIAN
183 // Sanitizer attributes (not supported)
184 #define CDS_SUPPRESS_SANITIZE( ... )
186 #include <cds/compiler/vc/compiler_barriers.h>
189 #endif // #ifndef CDSLIB_COMPILER_VC_DEFS_H