OnixS C++ Eurex T7 Market and Reference Data (EMDI, MDI, RDI, EOBI) Handlers  16.1.2
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 #pragma once
20 
21 #include <sstream>
22 
23 #if defined (_MSC_VER)
24 # define ONIXS_EUREX_EMDI_COMPILER_INFO ("MSVS")
25 #elif __GNUC__
26  inline
27  std::string compilerInfo()
28  {
29  std::stringstream ss;
30  ss << "gcc " << __VERSION__ << ", std=" << __cplusplus;
31  return ss.str();
32  }
33 # define ONIXS_EUREX_EMDI_COMPILER_INFO (compilerInfo())
34 #else
35 # define ONIXS_EUREX_EMDI_COMPILER_INFO ("Unknown")
36 #endif
37 
38 
39 #if !(defined(ONIXS_EUREX_EMDI_DOXYGEN) && ONIXS_EUREX_EMDI_DOXYGEN)
40 
41 #include <OnixS/Eurex/MarketData/CompilerDetection.h>
42 
43 #if defined(_MSC_VER) && defined(_MSVC_LANG)
44 # define ONIXS_CURRENT_CXX_STD _MSVC_LANG
45 #else
46 # define ONIXS_CURRENT_CXX_STD __cplusplus
47 #endif
48 
49 # if defined(ONIXS_EUREX_EMDI_CXX11)
50 # if (ONIXS_CURRENT_CXX_STD < 201103L)
51 # error C++11 was targeted during the OnixS SDK compilation but is not detected now
52 # define ONIXS_TERMINATE_COMPILATION
53 # endif
54 # endif
55 
56 # if defined(ONIXS_EUREX_EMDI_CXX14)
57 # if (ONIXS_CURRENT_CXX_STD < 201402L)
58 # error C++14 was targeted during the OnixS SDK compilation but is not detected now
59 # define ONIXS_TERMINATE_COMPILATION
60 # endif
61 # endif
62 
63 # if defined(ONIXS_EUREX_EMDI_CXX17)
64 # if (ONIXS_CURRENT_CXX_STD < 201703L)
65 # error C++17 was targeted during the OnixS SDK compilation but is not detected now
66 # define ONIXS_TERMINATE_COMPILATION
67 # endif
68 # endif
69 
70 # if defined(ONIXS_EUREX_EMDI_CXX20)
71 # if !(ONIXS_CURRENT_CXX_STD > 201703L)
72 # error C++20 was targeted during the OnixS SDK compilation but is not detected now
73 # define ONIXS_TERMINATE_COMPILATION
74 # endif
75 # endif
76 
77 # if defined(ONIXS_TERMINATE_COMPILATION)
78 # include <termnate_compilation>
79 #endif
80 
81 # if defined(ONIXS_EUREX_EMDI_COMPILER_IS_GNU) | defined(ONIXS_EUREX_EMDI_COMPILER_IS_Clang)
82 # define ONIXS_EUREX_EMDI_COMPILER_IS_GNU_or_Clang
83 # endif
84 
85 # if defined(ONIXS_EUREX_EMDI_COMPILER_IS_GNU_or_Clang)
86 
87 # define ONIXS_EUREX_EMDI_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
88 # define ONIXS_EUREX_EMDI_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
89 # define ONIXS_EUREX_EMDI_UNUSED __attribute__((__unused__))
90 # define ONIXS_EUREX_EMDI_MAY_ALIAS __attribute__((__may_alias__))
91 # define ONIXS_EUREX_EMDI_HOTPATH __attribute__((hot))
92 # define ONIXS_EUREX_EMDI_COLDPATH __attribute__((noinline,cold))
93 # define ONIXS_EUREX_EMDI_NORETURN __attribute__ ((__noreturn__))
94 # define ONIXS_EUREX_EMDI_NODISCARD __attribute__((warn_unused_result))
95 # define ONIXS_EUREX_EMDI_PURE
96 
97 #elif defined(ONIXS_EUREX_EMDI_COMPILER_IS_MSVC)
98 
99 # define ONIXS_EUREX_EMDI_LIKELY(cond) ((cond))
100 # define ONIXS_EUREX_EMDI_UNLIKELY(cond) ((cond))
101 # define ONIXS_EUREX_EMDI_PURE
102 # define ONIXS_EUREX_EMDI_UNUSED
103 # define ONIXS_EUREX_EMDI_MAY_ALIAS
104 # define ONIXS_EUREX_EMDI_HOTPATH
105 # define ONIXS_EUREX_EMDI_COLDPATH
106 # define ONIXS_EUREX_EMDI_NORETURN __declspec(noreturn)
107 # define ONIXS_EUREX_EMDI_NODISCARD _Check_return_
108 
109 #else
110 # error Unsupported compiler
111 #endif
112 
113 #if defined(ONIXS_EUREX_EMDI_CXX11)
114 
115 # define ONIXS_EUREX_EMDI_NOEXCEPT noexcept
116 # define ONIXS_EUREX_EMDI_EXPLICIT explicit
117 # define ONIXS_EUREX_EMDI_CONST_OR_CONSTEXPR constexpr
118 # define ONIXS_EUREX_EMDI_FINAL final
119 # define ONIXS_EUREX_EMDI_OVERRIDE override
120 # define ONIXS_EUREX_EMDI_CONSTEXPR constexpr
121 # define ONIXS_EUREX_EMDI_NULLPTR nullptr
122 # define ONIXS_EUREX_EMDI_DELETED_FUNCTION = delete
123 # define ONIXS_EUREX_EMDI_STATIC_ASSERT(X) static_assert(X, #X)
124 # define ONIXS_EUREX_EMDI_STATIC_ASSERT_MSG(X, MSG) static_assert(X, MSG)
125 # define ONIXS_EUREX_EMDI_ALIGNAS(X) alignas(X)
126 # define ONIXS_EUREX_EMDI_DEFAULT =default
127 
128 #else
129 
130 # define ONIXS_EUREX_EMDI_NOEXCEPT throw()
131 # define ONIXS_EUREX_EMDI_EXPLICIT
132 # define ONIXS_EUREX_EMDI_CONST_OR_CONSTEXPR const
133 # define ONIXS_EUREX_EMDI_FINAL
134 # define ONIXS_EUREX_EMDI_OVERRIDE
135 # define ONIXS_EUREX_EMDI_CONSTEXPR
136 # define ONIXS_EUREX_EMDI_DELETED_FUNCTION
137 # define ONIXS_EUREX_EMDI_DEFAULT {}
138 
139 
140 # if defined ONIXS_EUREX_EMDI_COMPILER_IS_GNU_or_Clang
141 # define ONIXS_EUREX_EMDI_NULLPTR __null
142 # else
143 # define ONIXS_EUREX_EMDI_NULLPTR 0
144 # endif
145 
146 
147 # define ONIXS_EUREX_EMDI_STATIC_ASSERT_JOIN(X, Y) ONIXS_EUREX_EMDI_STATIC_ASSERT_JOIN_IMPL(X, Y)
148 # define ONIXS_EUREX_EMDI_STATIC_ASSERT_JOIN_IMPL(X, Y) X##Y
149 template<bool> struct ONIXS_ILINK3StaticAssert;
150 template<> struct ONIXS_ILINK3StaticAssert<true>{};
151 # define ONIXS_EUREX_EMDI_STATIC_ASSERT(X) enum { ONIXS_EUREX_EMDI_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
152 # define ONIXS_EUREX_EMDI_STATIC_ASSERT_MSG(X, MSG) enum { ONIXS_EUREX_EMDI_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
153 
154 
155 # if defined ONIXS_EUREX_EMDI_COMPILER_IS_GNU_or_Clang
156 # define ONIXS_EUREX_EMDI_ALIGNAS(X) __attribute__ ((__aligned__(X)))
157 # elif defined ONIXS_EUREX_EMDI_COMPILER_IS_MSVC
158 # define ONIXS_EUREX_EMDI_ALIGNAS(X) __declspec(align(X))
159 # else
160 # define ONIXS_EUREX_EMDI_ALIGNAS(X)
161 # endif
162 
163 #endif
164 
165 #if defined NDEBUG
166 # define ONIXS_EUREX_EMDI_ASSERT(CHECK) static_cast<void>((CHECK))
167 #else
168 #if defined (ONIXS_EUREX_EMDI_CXX11)
169 # define ONIXS_EUREX_EMDI_ASSERT(CHECK) ((CHECK) ? void(0) : []() {assert(!#CHECK);}())
170 # else
171 # define ONIXS_EUREX_EMDI_ASSERT(CHECK) (assert((CHECK)))
172 # endif
173 #endif
174 
175 #if defined (ONIXS_EUREX_EMDI_CXX11)
176 # define ONIXS_EUREX_EMDI_HAS_TYPE_TRAITS
177 #endif
178 
179 #define ONIXS_EUREX_EMDI_HARDWARE_DESTRUCTIVE_INTERFACE_SIZE (64)
180 
181 #else //#if !(defined(ONIXS_DOXYGEN) && ONIXS_DOXYGEN)
182 
183 #define ONIXS_EUREX_EMDI_EXPORTED
184 #define ONIXS_EUREX_EMDI_NOEXCEPT noexcept
185 #define ONIXS_EUREX_EMDI_EXPLICIT explicit
186 #define ONIXS_EUREX_EMDI_CONST_OR_CONSTEXPR constexpr
187 #define ONIXS_EUREX_EMDI_CONSTEXPR constexpr
188 #define ONIXS_EUREX_EMDI_OVERRIDE override
189 #define ONIXS_EUREX_EMDI_FINAL final
190 #define ONIXS_EUREX_EMDI_NULLPTR nullptr
191 
192 #define ONIXS_EUREX_EMDI_NORETURN
193 #define ONIXS_EUREX_EMDI_NODISCARD
194 
195 #define ONIXS_EUREX_EMDI_HOTPATH
196 #define ONIXS_EUREX_EMDI_COLDPATH
197 #define ONIXS_EUREX_EMDI_PURE
198 
199 #define ONIXS_EUREX_EMDI_HAS_TYPE_TRAITS
200 
201 #define ONIXS_EUREX_EMDI_HAS_GATEWAY_EMULATOR
202 
203 #define ONIXS_EUREX_EMDI_CXX11
204 #define ONIXS_EUREX_EMDI_CXX14
205 #define ONIXS_EUREX_EMDI_CXX17
206 #define ONIXS_EUREX_EMDI_CXX20
207 
208 
209 #define ONIXS_EUREX_EMDI_UNUSED
210 #define ONIXS_EUREX_EMDI_DEFAULT =default
211 
212 #endif