Remove CDS_CXX11_VARIADIC_TEMPLATE_SUPPORT macro and emulating code
[libcds.git] / cds / compiler / vc / defs.h
1 //$$CDS-header$$
2
3 #ifndef __CDS_COMPILER_VC_DEFS_H
4 #define __CDS_COMPILER_VC_DEFS_H
5 //@cond
6
7 // Compiler version
8 #define CDS_COMPILER_VERSION    _MSC_VER
9
10 // Compiler name
11 // Supported compilers: MS VC 2013
12 // C++ compiler versions:
13 #define CDS_COMPILER_MSVC12 1800    // 2013 vc12
14
15 #if CDS_COMPILER_VERSION < CDS_COMPILER_MSVC12
16 #   error "Only MS Visual C++ 12 (2013) and above is supported"
17 #endif
18
19 #if _MSC_VER == 1800
20 #   define  CDS_COMPILER__NAME  "MS Visual C++ 2013"
21 #   define  CDS_COMPILER__NICK  "vc12"
22 #else
23 #   define  CDS_COMPILER__NAME  "MS Visual C++"
24 #   define  CDS_COMPILER__NICK  "msvc"
25 #endif
26
27 // OS interface
28 #define CDS_OS_INTERFACE CDS_OSI_WINDOWS
29
30 // OS name
31 #if defined(_WIN64)
32 #   define CDS_OS_TYPE      CDS_OS_WIN64
33 #   define CDS_OS__NAME     "Win64"
34 #   define CDS_OS__NICK     "Win64"
35 #elif defined(_WIN32)
36 #   define CDS_OS_TYPE      CDS_OS_WIN32
37 #   define CDS_OS__NAME     "Win32"
38 #   define CDS_OS__NICK     "Win32"
39 #endif
40
41 // Processor architecture
42 #ifdef _M_IX86
43 #   define CDS_BUILD_BITS       32
44 #   define CDS_PROCESSOR_ARCH   CDS_PROCESSOR_X86
45 #   define CDS_PROCESSOR__NAME  "Intel x86"
46 #   define CDS_PROCESSOR__NICK  "x86"
47 #elif _M_X64
48 #   define CDS_BUILD_BITS       64
49 #   define CDS_PROCESSOR_ARCH   CDS_PROCESSOR_AMD64
50 #   define CDS_PROCESSOR__NAME  "AMD64"
51 #   define CDS_PROCESSOR__NICK  "amd64"
52 #else
53 #   define CDS_BUILD_BITS        -1
54 #   define CDS_PROCESSOR_ARCH    CDS_PROCESSOR_UNKNOWN
55 #   define CDS_PROCESSOR__NAME    "<<Undefined>>"
56 #   error Microsoft Visual C++ compiler is supported for x86 only
57 #endif
58
59 #define  __attribute__( _x )
60
61 #define  CDS_STDCALL    __stdcall
62
63 #ifdef CDS_BUILD_LIB
64 #   define CDS_EXPORT_API          __declspec(dllexport)
65 #else
66 #   define CDS_EXPORT_API          __declspec(dllimport)
67 #endif
68
69 #define alignof     __alignof
70
71 // Memory leaks detection (debug build only)
72 #ifdef _DEBUG
73 #   define _CRTDBG_MAP_ALLOC
74 #   define _CRTDBG_MAPALLOC
75 #   include <stdlib.h>
76 #   include <crtdbg.h>
77 #   define CDS_MSVC_MEMORY_LEAKS_DETECTING_ENABLED
78 #endif
79
80 // constexpr is not yet supported
81 #define CDS_CONSTEXPR
82 #define CDS_CONSTEXPR_CONST const
83
84 // noexcept is not yet supported
85 //#define CDS_NOEXCEPT_SUPPORT        noexcept
86 //#define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
87 #define CDS_NOEXCEPT_SUPPORT
88 #define CDS_NOEXCEPT_SUPPORT_(expr)
89
90 // Lambda (VC 10 +)
91 #define CDS_CXX11_LAMBDA_SUPPORT
92
93 // RValue (VC 10+)
94 #define CDS_RVALUE_SUPPORT
95 #define CDS_MOVE_SEMANTICS_SUPPORT
96
97 // Default template arguments for function templates (VC12+)
98 #define CDS_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS_SUPPORT
99
100 // C++11 delete definition ( function declaration = delete)
101 #define CDS_CXX11_DELETE_DEFINITION_SUPPORT
102
103 // C++11 explicitly-defaulted function (= default) [std 8.4.2 [dcl.fct.def.default]]
104 #define CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT
105
106 // C++11 inline namespace
107 //#define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
108
109 #if CDS_COMPILER_VERSION == CDS_COMPILER_MSVC12
110     // VC12: move ctor cannot be defaulted
111     // Error: C2610 [move ctor] is not a special member function which can be defaulted
112 #   define CDS_DISABLE_DEFAULT_MOVE_CTOR
113 #endif
114
115 // Full SFINAE support
116 //#if CDS_COMPILER_VERSION >= ????
117 //#   define CDS_CXX11_SFINAE
118 //#endif
119
120
121 // *************************************************
122 // Alignment macro
123
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
128 #include <cds/compiler/vc/compiler_barriers.h>
129
130 //@endcond
131 #endif // #ifndef __CDS_COMPILER_VC_DEFS_H