OnixS C++ B3 Binary UMDF Market Data Handler  1.4.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 
20 #pragma once
21 
22 #if !(defined(ONIXS_B3_UMDF_MD_DOXYGEN) && ONIXS_B3_UMDF_MD_DOXYGEN)
23 
24 #include <OnixS/B3/MarketData/UMDF/CompilerDetection.h>
25 
26 
27 #if defined(_MSC_VER) && defined(_MSVC_LANG)
28 # define ONIXS_B3_UMDF_MD_CURRENT_CXX_STD _MSVC_LANG
29 #else
30 # define ONIXS_B3_UMDF_MD_CURRENT_CXX_STD __cplusplus
31 #endif
32 
33 # if defined(ONIXS_B3_UMDF_MD_CXX11)
34 # if (ONIXS_B3_UMDF_MD_CURRENT_CXX_STD < 201103L)
35 # error C++11 was targeted during the OnixS SDK compilation but is not detected now
36 # endif
37 # endif
38 
39 # if defined(ONIXS_B3_UMDF_MD_CXX14)
40 # if (ONIXS_B3_UMDF_MD_CURRENT_CXX_STD < 201402L)
41 # error C++14 was targeted during the OnixS SDK compilation but is not detected now
42 # endif
43 # endif
44 
45 # if defined(ONIXS_B3_UMDF_MD_CXX17)
46 # if (ONIXS_B3_UMDF_MD_CURRENT_CXX_STD < 201703L)
47 # error C++17 was targeted during the OnixS SDK compilation but is not detected now
48 # endif
49 # endif
50 
51 # if defined(ONIXS_B3_UMDF_MD_CXX20)
52 # if !(ONIXS_B3_UMDF_MD_CURRENT_CXX_STD > 201703L)
53 # error C++20 was targeted during the OnixS SDK compilation but is not detected now
54 # endif
55 # endif
56 
57 # if defined(ONIXS_B3_UMDF_MD_COMPILER_IS_GNU) | defined(ONIXS_B3_UMDF_MD_COMPILER_IS_Clang)
58 # define ONIXS_B3_UMDF_MD_COMPILER_IS_GNU_or_Clang
59 # endif
60 
61 # if defined(ONIXS_B3_UMDF_MD_COMPILER_IS_GNU_or_Clang)
62 
63 # define ONIXS_B3_UMDF_MD_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
64 # define ONIXS_B3_UMDF_MD_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
65 # define ONIXS_B3_UMDF_MD_UNUSED __attribute__((__unused__))
66 # define ONIXS_B3_UMDF_MD_MAY_ALIAS __attribute__((__may_alias__))
67 # define ONIXS_B3_UMDF_MD_HOTPATH __attribute__((hot))
68 # define ONIXS_B3_UMDF_MD_COLDPATH __attribute__((noinline,cold))
69 # define ONIXS_B3_UMDF_MD_NORETURN __attribute__ ((__noreturn__))
70 # define ONIXS_B3_UMDF_MD_NODISCARD __attribute__((warn_unused_result))
71 # define ONIXS_B3_UMDF_MD_PURE
72 
73 #elif defined(ONIXS_B3_UMDF_MD_COMPILER_IS_MSVC)
74 
75 # define ONIXS_B3_UMDF_MD_LIKELY(cond) ((cond))
76 # define ONIXS_B3_UMDF_MD_UNLIKELY(cond) ((cond))
77 # define ONIXS_B3_UMDF_MD_PURE
78 # define ONIXS_B3_UMDF_MD_UNUSED
79 # define ONIXS_B3_UMDF_MD_MAY_ALIAS
80 # define ONIXS_B3_UMDF_MD_HOTPATH
81 # define ONIXS_B3_UMDF_MD_COLDPATH
82 # define ONIXS_B3_UMDF_MD_NORETURN __declspec(noreturn)
83 # define ONIXS_B3_UMDF_MD_NODISCARD _Check_return_
84 
85 #else
86 # error Unsupported compiler
87 #endif
88 
89 # if defined(ONIXS_B3_UMDF_MD_COMPILER_IS_GNU) & !defined(ONIXS_B3_UMDF_MD_CXX11)
90 # define ONIXS_B3_UMDF_MD_GCC44_SPURIOUS_WARNING_TURNAROUND ONIXS_B3_UMDF_MD_MAY_ALIAS
91 # else
92 # define ONIXS_B3_UMDF_MD_GCC44_SPURIOUS_WARNING_TURNAROUND
93 # endif
94 
95 
96 #if defined(ONIXS_B3_UMDF_MD_CXX11)
97 
98 # define ONIXS_B3_UMDF_MD_NOTHROW noexcept
99 # define ONIXS_B3_UMDF_MD_CHECK_NOTHROW(equation) ONIXS_B3_UMDF_MD_STATIC_ASSERT(noexcept((equation)))
100 # define ONIXS_B3_UMDF_MD_EXPLICIT explicit
101 # define ONIXS_B3_UMDF_MD_CONST_OR_CONSTEXPR constexpr
102 # define ONIXS_B3_UMDF_MD_FINAL final
103 # define ONIXS_B3_UMDF_MD_OVERRIDE override
104 # define ONIXS_B3_UMDF_MD_CONSTEXPR constexpr
105 # define ONIXS_B3_UMDF_MD_NULLPTR nullptr
106 # define ONIXS_B3_UMDF_MD_DELETED_FUNCTION = delete
107 # define ONIXS_B3_UMDF_MD_STATIC_ASSERT(X) static_assert(X, #X)
108 # define ONIXS_B3_UMDF_MD_STATIC_ASSERT_MSG(X, MSG) static_assert(X, MSG)
109 # define ONIXS_B3_UMDF_MD_ALIGNAS(X) alignas(X)
110 # define ONIXS_B3_UMDF_MD_DEFAULT =default
111 
112 #else
113 
114 # define ONIXS_B3_UMDF_MD_NOTHROW throw()
115 # define ONIXS_B3_UMDF_MD_CHECK_NOTHROW(equation) ONIXS_B3_UMDF_MD_STATIC_ASSERT((true))
116 # define ONIXS_B3_UMDF_MD_EXPLICIT
117 # define ONIXS_B3_UMDF_MD_CONST_OR_CONSTEXPR const
118 # define ONIXS_B3_UMDF_MD_FINAL
119 # define ONIXS_B3_UMDF_MD_OVERRIDE
120 # define ONIXS_B3_UMDF_MD_CONSTEXPR
121 # define ONIXS_B3_UMDF_MD_DELETED_FUNCTION
122 # define ONIXS_B3_UMDF_MD_DEFAULT {}
123 
124 
125 # if defined ONIXS_B3_UMDF_MD_COMPILER_IS_GNU_or_Clang
126 # define ONIXS_B3_UMDF_MD_NULLPTR __null
127 # else
128 # define ONIXS_B3_UMDF_MD_NULLPTR 0
129 # endif
130 
131 
132 # define ONIXS_B3_UMDF_MD_STATIC_ASSERT_JOIN(X, Y) ONIXS_B3_UMDF_MD_STATIC_ASSERT_JOIN_IMPL(X, Y)
133 # define ONIXS_B3_UMDF_MD_STATIC_ASSERT_JOIN_IMPL(X, Y) X##Y
134 template<bool> struct ONIXS_ILINK3StaticAssert;
135 template<> struct ONIXS_ILINK3StaticAssert<true>{};
136 # define ONIXS_B3_UMDF_MD_STATIC_ASSERT(X) enum { ONIXS_B3_UMDF_MD_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
137 # define ONIXS_B3_UMDF_MD_STATIC_ASSERT_MSG(X, MSG) enum { ONIXS_B3_UMDF_MD_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
138 
139 
140 # if defined ONIXS_B3_UMDF_MD_COMPILER_IS_GNU_or_Clang
141 # define ONIXS_B3_UMDF_MD_ALIGNAS(X) __attribute__ ((__aligned__(X)))
142 # elif defined ONIXS_B3_UMDF_MD_COMPILER_IS_MSVC
143 # define ONIXS_B3_UMDF_MD_ALIGNAS(X) __declspec(align(X))
144 # else
145 # define ONIXS_B3_UMDF_MD_ALIGNAS(X)
146 # endif
147 
148 #endif
149 
150 #if defined NDEBUG
151 # define ONIXS_B3_UMDF_MD_ASSERT(CHECK) static_cast<void>((CHECK))
152 #else
153 #if defined (ONIXS_B3_UMDF_MD_CXX11)
154 # define ONIXS_B3_UMDF_MD_ASSERT(CHECK) ((CHECK) ? void(0) : []() {assert(!#CHECK);}())
155 # else
156 # define ONIXS_B3_UMDF_MD_ASSERT(CHECK) (assert((CHECK)))
157 # endif
158 #endif
159 
160 #if defined (ONIXS_B3_UMDF_MD_CXX11)
161 # define ONIXS_B3_UMDF_MD_HAS_TYPE_TRAITS
162 #endif
163 
164 #define ONIXS_B3_UMDF_MD_HARDWARE_DESTRUCTIVE_INTERFACE_SIZE (64)
165 
166 #else //#if !(defined(ONIXS_DOXYGEN) && ONIXS_DOXYGEN)
167 
168 #define ONIXS_B3_UMDF_MD_EXPORTED
169 #define ONIXS_B3_UMDF_MD_NOTHROW noexcept
170 #define ONIXS_B3_UMDF_MD_EXPLICIT explicit
171 #define ONIXS_B3_UMDF_MD_CONST_OR_CONSTEXPR constexpr
172 #define ONIXS_B3_UMDF_MD_CONSTEXPR constexpr
173 #define ONIXS_B3_UMDF_MD_OVERRIDE override
174 #define ONIXS_B3_UMDF_MD_FINAL final
175 #define ONIXS_B3_UMDF_MD_NULLPTR nullptr
176 
177 #define ONIXS_B3_UMDF_MD_NORETURN
178 #define ONIXS_B3_UMDF_MD_NODISCARD
179 
180 #define ONIXS_B3_UMDF_MD_HOTPATH
181 #define ONIXS_B3_UMDF_MD_COLDPATH
182 #define ONIXS_B3_UMDF_MD_PURE
183 
184 #define ONIXS_B3_UMDF_MD_HAS_TYPE_TRAITS
185 
186 #define ONIXS_B3_UMDF_MD_HAS_GATEWAY_EMULATOR
187 
188 #define ONIXS_B3_UMDF_MD_CXX11
189 #define ONIXS_B3_UMDF_MD_CXX14
190 #define ONIXS_B3_UMDF_MD_CXX17
191 #define ONIXS_B3_UMDF_MD_CXX20
192 
193 
194 #define ONIXS_B3_UMDF_MD_UNUSED
195 #define ONIXS_B3_UMDF_MD_DEFAULT =default
196 
197 #define ONIXS_B3_UMDF_MD_GCC44_SPURIOUS_WARNING_TURNAROUND
198 
199 #endif