fixed adding file problem
[c11concurrency-benchmarks.git] / gdax-orderbook-hpp / demo / dependencies / libcds-2.3.2 / cds / compiler / vc / 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-2017
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_VC_DEFS_H
32 #define CDSLIB_COMPILER_VC_DEFS_H
33 //@cond
34
35 // Compiler version
36 #define CDS_COMPILER_VERSION    _MSC_VER
37
38 // Compiler name
39 // Supported compilers: MS VC 2015 +
40 // C++ compiler versions:
41 #define CDS_COMPILER_MSVC14         1900    // 2015 vc14
42 #define CDS_COMPILER_MSVC14_1       1910    // 2017 vc14.1
43 #define CDS_COMPILER_MSVC14_1_3     1911    // 2017 vc14.1 (VS 15.3)
44 #define CDS_COMPILER_MSVC14_1_5     1912    // 2017 vc14.1 (VS 15.5)
45 #define CDS_COMPILER_MSVC15         2000    // next Visual Studio
46
47 #if CDS_COMPILER_VERSION < CDS_COMPILER_MSVC14
48 #   error "Only MS Visual C++ 14 (2015) and above is supported"
49 #endif
50
51 #if _MSC_VER == 1900
52 #   define  CDS_COMPILER__NAME  "MS Visual C++ 2015"
53 #   define  CDS_COMPILER__NICK  "vc14"
54 #   define  CDS_COMPILER_LIBCDS_SUFFIX "vcv140"
55 #elif _MSC_VER < 2000 
56 #   define  CDS_COMPILER__NAME  "MS Visual C++ 2017"
57 #   define  CDS_COMPILER__NICK  "vc141"
58 #   define  CDS_COMPILER_LIBCDS_SUFFIX "vcv141"
59 #else
60 #   define  CDS_COMPILER__NAME  "MS Visual C++"
61 #   define  CDS_COMPILER__NICK  "msvc"
62 #   define  CDS_COMPILER_LIBCDS_SUFFIX "vc"
63 #endif
64
65 // OS interface
66 #define CDS_OS_INTERFACE CDS_OSI_WINDOWS
67
68 // OS name
69 #if defined(_WIN64)
70 #   define CDS_OS_TYPE      CDS_OS_WIN64
71 #   define CDS_OS__NAME     "Win64"
72 #   define CDS_OS__NICK     "Win64"
73 #elif defined(_WIN32)
74 #   define CDS_OS_TYPE      CDS_OS_WIN32
75 #   define CDS_OS__NAME     "Win32"
76 #   define CDS_OS__NICK     "Win32"
77 #endif
78
79 // Processor architecture
80 #ifdef _M_IX86
81 #   define CDS_BUILD_BITS       32
82 #   define CDS_PROCESSOR_ARCH   CDS_PROCESSOR_X86
83 #   define CDS_PROCESSOR__NAME  "Intel x86"
84 #   define CDS_PROCESSOR__NICK  "x86"
85 #elif _M_X64
86 #   define CDS_BUILD_BITS       64
87 #   define CDS_PROCESSOR_ARCH   CDS_PROCESSOR_AMD64
88 #   define CDS_PROCESSOR__NAME  "AMD64"
89 #   define CDS_PROCESSOR__NICK  "amd64"
90 #else
91 #   define CDS_BUILD_BITS        -1
92 #   define CDS_PROCESSOR_ARCH    CDS_PROCESSOR_UNKNOWN
93 #   define CDS_PROCESSOR__NAME    "<<Undefined>>"
94 #   error Microsoft Visual C++ compiler is supported for x86 only
95 #endif
96
97 #define  __attribute__( _x )
98
99 #ifdef CDS_BUILD_LIB
100 #   define CDS_EXPORT_API          __declspec(dllexport)
101 #else
102 #   define CDS_EXPORT_API          __declspec(dllimport)
103 #endif
104
105 #define alignof     __alignof
106
107 // Memory leaks detection (debug build only)
108 #ifdef _DEBUG
109 #   define _CRTDBG_MAP_ALLOC
110 #   define _CRTDBG_MAPALLOC
111 #   include <stdlib.h>
112 #   include <crtdbg.h>
113 #   define CDS_MSVC_MEMORY_LEAKS_DETECTING_ENABLED
114 #endif
115
116 // *************************************************
117 // Alignment macro
118
119 #define CDS_TYPE_ALIGNMENT(n)     __declspec( align(n))
120 #define CDS_DATA_ALIGNMENT(n)     __declspec( align(n))
121 #define CDS_CLASS_ALIGNMENT(n)    __declspec( align(n))
122
123 // Attributes
124 #define CDS_DEPRECATED( reason ) [[deprecated( reason )]]
125
126 #define CDS_NORETURN __declspec(noreturn)
127
128 // Exceptions
129 #if defined( _CPPUNWIND )
130 #   define CDS_EXCEPTION_ENABLED
131 #endif
132
133
134 // double-width CAS support
135 //#define CDS_DCAS_SUPPORT
136
137 // Byte order
138 //  It seems, MSVC works only on little-endian architecture?..
139 #if !defined(CDS_ARCH_LITTLE_ENDIAN) && !defined(CDS_ARCH_BIG_ENDIAN)
140 #   define CDS_ARCH_LITTLE_ENDIAN
141 #endif
142
143 //if constexpr support (C++17)
144 #ifndef constexpr_if
145     // Standard way to check if the compiler supports "if constexpr"
146     // Of course, MS VC doesn't support any standard way
147 #   if defined __cpp_if_constexpr
148 #       if __cpp_if_constexpr >= 201606
149 #           define constexpr_if if constexpr
150 #       endif
151 #   elif CDS_COMPILER_VERSION >= CDS_COMPILER_MSVC14_1_3 && _MSVC_LANG > CDS_CPLUSPLUS_14
152         // MS-specific WTF.
153         // Don't work in /std:c++17 because /std:c++17 key defines _MSVC_LANG=201402 (c++14) in VC 15.3
154 #       define constexpr_if if constexpr
155 #   endif
156 #endif
157
158 // Sanitizer attributes (not supported)
159 #define CDS_SUPPRESS_SANITIZE( ... )
160
161 #include <cds/compiler/vc/compiler_barriers.h>
162
163 //@endcond
164 #endif // #ifndef CDSLIB_COMPILER_VC_DEFS_H