OnixS C++ CME MDP Premium Market Data Handler  5.8.9
API Documentation
Compiler.h
Go to the documentation of this file.
1 /*
2 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3 *
4 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5 * and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable ONIXS Software
8 * Services Agreement (the Agreement) and Customer end user license agreements granting
9 * a non-assignable, non-transferable and non-exclusive license to use the software
10 * for it's own data processing purposes under the terms defined in the Agreement.
11 *
12 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13 * of this source code or associated reference material to any other location for further reproduction
14 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15 *
16 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17 * the terms of the Agreement is a violation of copyright law.
18 */
19 
20 #pragma once
21 
22 #if !(defined(ONIXS_CMEMDH_DOXYGEN) && ONIXS_CMEMDH_DOXYGEN)
23 
25 
26 #if defined(_MSC_VER) && defined(_MSVC_LANG)
27 # define ONIXS_CURRENT_CXX_STD _MSVC_LANG
28 #else
29 # define ONIXS_CURRENT_CXX_STD __cplusplus
30 #endif
31 
32 # if defined(ONIXS_CMEMDH_CXX11)
33 # if (ONIXS_CURRENT_CXX_STD < 201103L)
34 # error C++11 was targeted during the OnixS SDK compilation but is not detected now
35 # endif
36 # endif
37 
38 # if defined(ONIXS_CMEMDH_CXX14)
39 # if (ONIXS_CURRENT_CXX_STD < 201402L)
40 # error C++14 was targeted during the OnixS SDK compilation but is not detected now
41 # endif
42 # endif
43 
44 # if defined(ONIXS_CMEMDH_CXX17)
45 # if (ONIXS_CURRENT_CXX_STD < 201703L)
46 # error C++17 was targeted during the OnixS SDK compilation but is not detected now
47 # endif
48 # endif
49 
50 # if defined(ONIXS_CMEMDH_CXX20)
51 # if !(ONIXS_CURRENT_CXX_STD > 201703L)
52 # error C++20 was targeted during the OnixS SDK compilation but is not detected now
53 # endif
54 # endif
55 
56 # if defined(ONIXS_CMEMDH_COMPILER_IS_GNU) | defined(ONIXS_CMEMDH_COMPILER_IS_Clang)
57 # define ONIXS_CMEMDH_COMPILER_IS_GNU_or_Clang
58 # endif
59 
60 # if defined(ONIXS_CMEMDH_COMPILER_IS_GNU_or_Clang)
61 
62 # define ONIXS_CMEMDH_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
63 # define ONIXS_CMEMDH_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
64 # define ONIXS_CMEMDH_UNUSED __attribute__((__unused__))
65 # define ONIXS_CMEMDH_MAY_ALIAS __attribute__((__may_alias__))
66 # define ONIXS_CMEMDH_HOTPATH __attribute__((hot))
67 # define ONIXS_CMEMDH_COLDPATH __attribute__((noinline,cold))
68 # define ONIXS_CMEMDH_NORETURN __attribute__ ((__noreturn__))
69 # define ONIXS_CMEMDH_NODISCARD __attribute__((warn_unused_result))
70 # define ONIXS_CMEMDH_PURE
71 
72 #elif defined(ONIXS_CMEMDH_COMPILER_IS_MSVC)
73 
74 # define ONIXS_CMEMDH_LIKELY(cond) ((cond))
75 # define ONIXS_CMEMDH_UNLIKELY(cond) ((cond))
76 # define ONIXS_CMEMDH_PURE
77 # define ONIXS_CMEMDH_UNUSED
78 # define ONIXS_CMEMDH_MAY_ALIAS
79 # define ONIXS_CMEMDH_HOTPATH
80 # define ONIXS_CMEMDH_COLDPATH
81 # define ONIXS_CMEMDH_NORETURN __declspec(noreturn)
82 # define ONIXS_CMEMDH_NODISCARD _Check_return_
83 
84 #else
85 # error Unsupported compiler
86 #endif
87 
88 #if defined(ONIXS_CMEMDH_CXX11)
89 
90 # define ONIXS_CMEMDH_NOEXCEPT noexcept
91 # define ONIXS_CMEMDH_CHECK_NOTHROW(equation) ONIXS_CMEMDH_STATIC_ASSERT(noexcept((equation)))
92 # define ONIXS_CMEMDH_EXPLICIT explicit
93 # define ONIXS_CMEMDH_CONST_OR_CONSTEXPR constexpr
94 # define ONIXS_CMEMDH_FINAL final
95 # define ONIXS_CMEMDH_OVERRIDE override
96 # define ONIXS_CMEMDH_CONSTEXPR constexpr
97 # define ONIXS_CMEMDH_NULLPTR nullptr
98 # define ONIXS_CMEMDH_DELETED_FUNCTION = delete
99 # define ONIXS_CMEMDH_STATIC_ASSERT(X) static_assert(X, #X)
100 # define ONIXS_CMEMDH_STATIC_ASSERT_MSG(X, MSG) static_assert(X, MSG)
101 # define ONIXS_CMEMDH_ALIGNAS(X) alignas(X)
102 # define ONIXS_CMEMDH_DEFAULT =default
103 
104 #else
105 
106 # define ONIXS_CMEMDH_NOEXCEPT throw()
107 # define ONIXS_CMEMDH_CHECK_NOTHROW(equation) ONIXS_CMEMDH_STATIC_ASSERT((true))
108 # define ONIXS_CMEMDH_EXPLICIT
109 # define ONIXS_CMEMDH_CONST_OR_CONSTEXPR const
110 # define ONIXS_CMEMDH_FINAL
111 # define ONIXS_CMEMDH_OVERRIDE
112 # define ONIXS_CMEMDH_CONSTEXPR
113 # define ONIXS_CMEMDH_DELETED_FUNCTION
114 # define ONIXS_CMEMDH_DEFAULT {}
115 
116 
117 # if defined ONIXS_CMEMDH_COMPILER_IS_GNU_or_Clang
118 # define ONIXS_CMEMDH_NULLPTR __null
119 # else
120 # define ONIXS_CMEMDH_NULLPTR 0
121 # endif
122 
123 
124 # define ONIXS_CMEMDH_STATIC_ASSERT_JOIN(X, Y) ONIXS_CMEMDH_STATIC_ASSERT_JOIN_IMPL(X, Y)
125 # define ONIXS_CMEMDH_STATIC_ASSERT_JOIN_IMPL(X, Y) X##Y
126 template<bool> struct ONIXS_ILINK3StaticAssert;
127 template<> struct ONIXS_ILINK3StaticAssert<true>{};
128 # define ONIXS_CMEMDH_STATIC_ASSERT(X) enum { ONIXS_CMEMDH_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
129 # define ONIXS_CMEMDH_STATIC_ASSERT_MSG(X, MSG) enum { ONIXS_CMEMDH_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
130 
131 
132 # if defined ONIXS_CMEMDH_COMPILER_IS_GNU_or_Clang
133 # define ONIXS_CMEMDH_ALIGNAS(X) __attribute__ ((__aligned__(X)))
134 # elif defined ONIXS_CMEMDH_COMPILER_IS_MSVC
135 # define ONIXS_CMEMDH_ALIGNAS(X) __declspec(align(X))
136 # else
137 # define ONIXS_CMEMDH_ALIGNAS(X)
138 # endif
139 
140 #endif
141 
142 #if defined NDEBUG
143 # define ONIXS_CMEMDH_ASSERT(CHECK) static_cast<void>((CHECK))
144 #else
145 #if defined (ONIXS_CMEMDH_CXX11)
146 # define ONIXS_CMEMDH_ASSERT(CHECK) ((CHECK) ? void(0) : []() {assert(!#CHECK);}())
147 # else
148 # define ONIXS_CMEMDH_ASSERT(CHECK) (assert((CHECK)))
149 # endif
150 #endif
151 
152 #if defined (ONIXS_CMEMDH_CXX11)
153 # define ONIXS_CMEMDH_HAS_TYPE_TRAITS
154 #endif
155 
156 #define ONIXS_CMEMDH_HARDWARE_DESTRUCTIVE_INTERFACE_SIZE (64)
157 
158 #else //#if !(defined(ONIXS_DOXYGEN) && ONIXS_DOXYGEN)
159 
160 #define ONIXS_CMEMDH_EXPORTED
161 #define ONIXS_CMEMDH_NOEXCEPT noexcept
162 #define ONIXS_CMEMDH_EXPLICIT explicit
163 #define ONIXS_CMEMDH_CONST_OR_CONSTEXPR constexpr
164 #define ONIXS_CMEMDH_CONSTEXPR constexpr
165 #define ONIXS_CMEMDH_OVERRIDE override
166 #define ONIXS_CMEMDH_FINAL final
167 #define ONIXS_CMEMDH_NULLPTR nullptr
168 
169 #define ONIXS_CMEMDH_NORETURN
170 #define ONIXS_CMEMDH_NODISCARD
171 
172 #define ONIXS_CMEMDH_HOTPATH
173 #define ONIXS_CMEMDH_COLDPATH
174 #define ONIXS_CMEMDH_PURE
175 
176 #define ONIXS_CMEMDH_HAS_TYPE_TRAITS
177 
178 #define ONIXS_CMEMDH_HAS_GATEWAY_EMULATOR
179 
180 #define ONIXS_CMEMDH_CXX11
181 #define ONIXS_CMEMDH_CXX14
182 #define ONIXS_CMEMDH_CXX17
183 #define ONIXS_CMEMDH_CXX20
184 
185 
186 #define ONIXS_CMEMDH_UNUSED
187 #define ONIXS_CMEMDH_DEFAULT =default
188 
189 #endif