OnixS C++ FMX UST BIMP Market Data Handler  1.2.0
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_FMXUST_BIMP_DOXYGEN) && ONIXS_FMXUST_BIMP_DOXYGEN)
23 
24 #include <OnixS/FmxUST/MarketData/Bimp/CompilerDetection.h>
25 
26 #if defined(_MSC_VER) && defined(_MSVC_LANG)
27 # define NIXS_FMXUST_BIMP_CURRENT_CXX_STD _MSVC_LANG
28 #else
29 # define NIXS_FMXUST_BIMP_CURRENT_CXX_STD __cplusplus
30 #endif
31 
32 # if defined(ONIXS_FMXUST_BIMP_CXX11)
33 # if (NIXS_FMXUST_BIMP_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_FMXUST_BIMP_CXX14)
39 # if (NIXS_FMXUST_BIMP_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_FMXUST_BIMP_CXX17)
45 # if (NIXS_FMXUST_BIMP_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_FMXUST_BIMP_CXX20)
51 # if !(NIXS_FMXUST_BIMP_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_FMXUST_BIMP_COMPILER_IS_GNU) | defined(ONIXS_FMXUST_BIMP_COMPILER_IS_Clang)
57 # define ONIXS_FMXUST_BIMP_COMPILER_IS_GNU_or_Clang
58 # endif
59 
60 # if defined(ONIXS_FMXUST_BIMP_COMPILER_IS_GNU_or_Clang)
61 
62 # define ONIXS_FMXUST_BIMP_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
63 # define ONIXS_FMXUST_BIMP_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
64 # define ONIXS_FMXUST_BIMP_CHECK_EXPECT(exp, c) (__builtin_expect(static_cast<bool>((exp)), (c)))
65 # define ONIXS_FMXUST_BIMP_UNUSED __attribute__((__unused__))
66 # define ONIXS_FMXUST_BIMP_MAY_ALIAS __attribute__((__may_alias__))
67 # define ONIXS_FMXUST_BIMP_HOTPATH __attribute__((hot))
68 # define ONIXS_FMXUST_BIMP_COLDPATH __attribute__((noinline,cold))
69 # define ONIXS_FMXUST_BIMP_NORETURN __attribute__ ((__noreturn__))
70 # define ONIXS_FMXUST_BIMP_NODISCARD __attribute__((warn_unused_result))
71 # define ONIXS_FMXUST_BIMP_PURE
72 
73 #elif defined(ONIXS_FMXUST_BIMP_COMPILER_IS_MSVC)
74 
75 # define ONIXS_FMXUST_BIMP_LIKELY(cond) ((cond))
76 # define ONIXS_FMXUST_BIMP_UNLIKELY(cond) ((cond))
77 # define ONIXS_FMXUST_BIMP_CHECK_EXPECT(exp,c) ((exp))
78 # define ONIXS_FMXUST_BIMP_PURE
79 # define ONIXS_FMXUST_BIMP_UNUSED
80 # define ONIXS_FMXUST_BIMP_MAY_ALIAS
81 # define ONIXS_FMXUST_BIMP_HOTPATH
82 # define ONIXS_FMXUST_BIMP_COLDPATH
83 # define ONIXS_FMXUST_BIMP_NORETURN __declspec(noreturn)
84 # define ONIXS_FMXUST_BIMP_NODISCARD _Check_return_
85 
86 #else
87 # error Unsupported compiler
88 #endif
89 
90 #if defined(ONIXS_FMXUST_BIMP_CXX11)
91 
92 # define ONIXS_FMXUST_BIMP_NOTHROW noexcept
93 # define ONIXS_FMXUST_BIMP_CHECK_NOTHROW(equation) ONIXS_FMXUST_BIMP_STATIC_ASSERT(noexcept((equation)))
94 # define ONIXS_FMXUST_BIMP_EXPLICIT explicit
95 # define ONIXS_FMXUST_BIMP_CONST_OR_CONSTEXPR constexpr
96 # define ONIXS_FMXUST_BIMP_FINAL final
97 # define ONIXS_FMXUST_BIMP_OVERRIDE override
98 # define ONIXS_FMXUST_BIMP_CONSTEXPR constexpr
99 # define ONIXS_FMXUST_BIMP_NULLPTR nullptr
100 # define ONIXS_FMXUST_BIMP_DELETED_FUNCTION = delete
101 # define ONIXS_FMXUST_BIMP_STATIC_ASSERT(X) static_assert(X, #X)
102 # define ONIXS_FMXUST_BIMP_STATIC_ASSERT_MSG(X, MSG) static_assert(X, MSG)
103 # define ONIXS_FMXUST_BIMP_ALIGNAS(X) alignas(X)
104 # define ONIXS_FMXUST_BIMP_DEFAULT =default
105 
106 #else
107 
108 # define ONIXS_FMXUST_BIMP_NOTHROW throw()
109 # define ONIXS_FMXUST_BIMP_CHECK_NOTHROW(equation) ONIXS_FMXUST_BIMP_STATIC_ASSERT((true))
110 # define ONIXS_FMXUST_BIMP_EXPLICIT
111 # define ONIXS_FMXUST_BIMP_CONST_OR_CONSTEXPR const
112 # define ONIXS_FMXUST_BIMP_FINAL
113 # define ONIXS_FMXUST_BIMP_OVERRIDE
114 # define ONIXS_FMXUST_BIMP_CONSTEXPR
115 # define ONIXS_FMXUST_BIMP_DELETED_FUNCTION
116 # define ONIXS_FMXUST_BIMP_DEFAULT {}
117 
118 
119 # if defined ONIXS_FMXUST_BIMP_COMPILER_IS_GNU_or_Clang
120 # define ONIXS_FMXUST_BIMP_NULLPTR __null
121 # else
122 # define ONIXS_FMXUST_BIMP_NULLPTR 0
123 # endif
124 
125 
126 # define ONIXS_FMXUST_BIMP_STATIC_ASSERT_JOIN(X, Y) ONIXS_FMXUST_BIMP_STATIC_ASSERT_JOIN_IMPL(X, Y)
127 # define ONIXS_FMXUST_BIMP_STATIC_ASSERT_JOIN_IMPL(X, Y) X##Y
128 template<bool> struct ONIXS_ILINK3StaticAssert;
129 template<> struct ONIXS_ILINK3StaticAssert<true>{};
130 # define ONIXS_FMXUST_BIMP_STATIC_ASSERT(X) enum { ONIXS_FMXUST_BIMP_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
131 # define ONIXS_FMXUST_BIMP_STATIC_ASSERT_MSG(X, MSG) enum { ONIXS_FMXUST_BIMP_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
132 
133 
134 # if defined ONIXS_FMXUST_BIMP_COMPILER_IS_GNU_or_Clang
135 # define ONIXS_FMXUST_BIMP_ALIGNAS(X) __attribute__ ((__aligned__(X)))
136 # elif defined ONIXS_FMXUST_BIMP_COMPILER_IS_MSVC
137 # define ONIXS_FMXUST_BIMP_ALIGNAS(X) __declspec(align(X))
138 # else
139 # define ONIXS_FMXUST_BIMP_ALIGNAS(X)
140 # endif
141 
142 #endif
143 
144 #if defined NDEBUG
145 # define ONIXS_FMXUST_BIMP_ASSERT(CHECK) static_cast<void>((CHECK))
146 #else
147 #if defined (ONIXS_FMXUST_BIMP_CXX11)
148 # define ONIXS_FMXUST_BIMP_ASSERT(CHECK) ((CHECK) ? void(0) : []() {assert(!#CHECK);}())
149 # else
150 # define ONIXS_FMXUST_BIMP_ASSERT(CHECK) (assert((CHECK)))
151 # endif
152 #endif
153 
154 #if defined (ONIXS_FMXUST_BIMP_CXX11)
155 # define ONIXS_FMXUST_BIMP_HAS_TYPE_TRAITS
156 #endif
157 
158 #define ONIXS_FMXUST_BIMP_HARDWARE_DESTRUCTIVE_INTERFACE_SIZE (64)
159 
160 #else //#if !(defined(ONIXS_DOXYGEN) && ONIXS_DOXYGEN)
161 
162 #define ONIXS_FMXUST_BIMP_EXPORTED
163 #define ONIXS_FMXUST_BIMP_NOTHROW noexcept
164 #define ONIXS_FMXUST_BIMP_EXPLICIT explicit
165 #define ONIXS_FMXUST_BIMP_CONST_OR_CONSTEXPR constexpr
166 #define ONIXS_FMXUST_BIMP_CONSTEXPR constexpr
167 #define ONIXS_FMXUST_BIMP_OVERRIDE override
168 #define ONIXS_FMXUST_BIMP_FINAL final
169 #define ONIXS_FMXUST_BIMP_NULLPTR nullptr
170 
171 #define ONIXS_FMXUST_BIMP_NORETURN
172 #define ONIXS_FMXUST_BIMP_NODISCARD
173 
174 #define ONIXS_FMXUST_BIMP_HOTPATH
175 #define ONIXS_FMXUST_BIMP_COLDPATH
176 #define ONIXS_FMXUST_BIMP_PURE
177 
178 #define ONIXS_FMXUST_BIMP_HAS_TYPE_TRAITS
179 
180 #define ONIXS_FMXUST_BIMP_HAS_GATEWAY_EMULATOR
181 
182 #define ONIXS_FMXUST_BIMP_CXX11
183 #define ONIXS_FMXUST_BIMP_CXX14
184 #define ONIXS_FMXUST_BIMP_CXX17
185 #define ONIXS_FMXUST_BIMP_CXX20
186 
187 
188 #define ONIXS_FMXUST_BIMP_UNUSED
189 #define ONIXS_FMXUST_BIMP_DEFAULT =default
190 
191 #endif