OnixS C++ Cboe CFE Multicast PITCH Market Data Handler  1.12.1
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 #if !(defined(ONIXS_BATS_PITCH_DOXYGEN) && ONIXS_BATS_PITCH_DOXYGEN)
22 
23 #include <OnixS/CboeCFE/MarketData/Pitch/CompilerDetection.h>
24 
25 #if defined(_MSC_VER) && defined(_MSVC_LANG)
26 # define ONIXS_BATS_PITCH_CURRENT_CXX_STD _MSVC_LANG
27 #else
28 # define ONIXS_BATS_PITCH_CURRENT_CXX_STD __cplusplus
29 #endif
30 
31 # if defined(ONIXS_BATS_PITCH_CXX11)
32 # if (ONIXS_BATS_PITCH_CURRENT_CXX_STD < 201103L)
33 # error C++11 was targeted during the OnixS SDK compilation but is not detected now
34 # endif
35 # endif
36 
37 # if defined(ONIXS_BATS_PITCH_CXX14)
38 # if (ONIXS_BATS_PITCH_CURRENT_CXX_STD < 201402L)
39 # error C++14 was targeted during the OnixS SDK compilation but is not detected now
40 # endif
41 # endif
42 
43 # if defined(ONIXS_BATS_PITCH_CXX17)
44 # if (ONIXS_BATS_PITCH_CURRENT_CXX_STD < 201703L)
45 # error C++17 was targeted during the OnixS SDK compilation but is not detected now
46 # endif
47 # endif
48 
49 # if defined(ONIXS_BATS_PITCH_CXX20)
50 # if !(ONIXS_BATS_PITCH_CURRENT_CXX_STD > 201703L)
51 # error C++20 was targeted during the OnixS SDK compilation but is not detected now
52 # endif
53 # endif
54 
55 # if defined(ONIXS_BATS_PITCH_COMPILER_IS_GNU) | defined(ONIXS_BATS_PITCH_COMPILER_IS_Clang)
56 # define ONIXS_BATS_PITCH_COMPILER_IS_GNU_or_Clang
57 # endif
58 
59 # if defined(ONIXS_BATS_PITCH_COMPILER_IS_GNU_or_Clang)
60 
61 # define ONIXS_BATS_PITCH_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
62 # define ONIXS_BATS_PITCH_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
63 # define ONIXS_BATS_PITCH_CHECK_EXPECT(exp, c) (__builtin_expect(static_cast<bool>((exp)), (c)))
64 # define ONIXS_BATS_PITCH_UNUSED __attribute__((__unused__))
65 # define ONIXS_BATS_PITCH_MAY_ALIAS __attribute__((__may_alias__))
66 # define ONIXS_BATS_PITCH_HOTPATH __attribute__((hot))
67 # define ONIXS_BATS_PITCH_COLDPATH __attribute__((noinline,cold))
68 # define ONIXS_BATS_PITCH_NORETURN __attribute__ ((__noreturn__))
69 # define ONIXS_BATS_PITCH_NODISCARD __attribute__((warn_unused_result))
70 # define ONIXS_BATS_PITCH_PURE
71 
72 #elif defined(ONIXS_BATS_PITCH_COMPILER_IS_MSVC)
73 
74 # define ONIXS_BATS_PITCH_LIKELY(cond) ((cond))
75 # define ONIXS_BATS_PITCH_UNLIKELY(cond) ((cond))
76 # define ONIXS_BATS_PITCH_CHECK_EXPECT(exp,c) ((exp))
77 # define ONIXS_BATS_PITCH_PURE
78 # define ONIXS_BATS_PITCH_UNUSED
79 # define ONIXS_BATS_PITCH_MAY_ALIAS
80 # define ONIXS_BATS_PITCH_HOTPATH
81 # define ONIXS_BATS_PITCH_COLDPATH
82 # define ONIXS_BATS_PITCH_NORETURN __declspec(noreturn)
83 # define ONIXS_BATS_PITCH_NODISCARD _Check_return_
84 
85 #else
86 # error Unsupported compiler
87 #endif
88 
89 #if defined(ONIXS_BATS_PITCH_CXX11)
90 
91 # define ONIXS_BATS_PITCH_NOTHROW noexcept
92 # define ONIXS_BATS_PITCH_CHECK_NOTHROW(equation) ONIXS_BATS_PITCH_STATIC_ASSERT(noexcept((equation)))
93 # define ONIXS_BATS_PITCH_EXPLICIT explicit
94 # define ONIXS_BATS_PITCH_CONST_OR_CONSTEXPR constexpr
95 # define ONIXS_BATS_PITCH_FINAL final
96 # define ONIXS_BATS_PITCH_OVERRIDE override
97 # define ONIXS_BATS_PITCH_CONSTEXPR constexpr
98 # define ONIXS_BATS_PITCH_NULLPTR nullptr
99 # define ONIXS_BATS_PITCH_DELETED_FUNCTION = delete
100 # define ONIXS_BATS_PITCH_STATIC_ASSERT(X) static_assert(X, #X)
101 # define ONIXS_BATS_PITCH_STATIC_ASSERT_MSG(X, MSG) static_assert(X, MSG)
102 # define ONIXS_BATS_PITCH_ALIGNAS(X) alignas(X)
103 # define ONIXS_BATS_PITCH_DEFAULT =default
104 
105 #else
106 
107 # define ONIXS_BATS_PITCH_NOTHROW throw()
108 # define ONIXS_BATS_PITCH_CHECK_NOTHROW(equation) ONIXS_BATS_PITCH_STATIC_ASSERT((true))
109 # define ONIXS_BATS_PITCH_EXPLICIT
110 # define ONIXS_BATS_PITCH_CONST_OR_CONSTEXPR const
111 # define ONIXS_BATS_PITCH_FINAL
112 # define ONIXS_BATS_PITCH_OVERRIDE
113 # define ONIXS_BATS_PITCH_CONSTEXPR
114 # define ONIXS_BATS_PITCH_DELETED_FUNCTION
115 # define ONIXS_BATS_PITCH_DEFAULT {}
116 
117 
118 # if defined ONIXS_BATS_PITCH_COMPILER_IS_GNU_or_Clang
119 # define ONIXS_BATS_PITCH_NULLPTR __null
120 # else
121 # define ONIXS_BATS_PITCH_NULLPTR 0
122 # endif
123 
124 
125 # define ONIXS_BATS_PITCH_STATIC_ASSERT_JOIN(X, Y) ONIXS_BATS_PITCH_STATIC_ASSERT_JOIN_IMPL(X, Y)
126 # define ONIXS_BATS_PITCH_STATIC_ASSERT_JOIN_IMPL(X, Y) X##Y
127 template<bool> struct ONIXS_ILINK3StaticAssert;
128 template<> struct ONIXS_ILINK3StaticAssert<true>{};
129 # define ONIXS_BATS_PITCH_STATIC_ASSERT(X) enum { ONIXS_BATS_PITCH_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
130 # define ONIXS_BATS_PITCH_STATIC_ASSERT_MSG(X, MSG) enum { ONIXS_BATS_PITCH_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
131 
132 
133 # if defined ONIXS_BATS_PITCH_COMPILER_IS_GNU_or_Clang
134 # define ONIXS_BATS_PITCH_ALIGNAS(X) __attribute__ ((__aligned__(X)))
135 # elif defined ONIXS_BATS_PITCH_COMPILER_IS_MSVC
136 # define ONIXS_BATS_PITCH_ALIGNAS(X) __declspec(align(X))
137 # else
138 # define ONIXS_BATS_PITCH_ALIGNAS(X)
139 # endif
140 
141 #endif
142 
143 #if defined NDEBUG
144 # define ONIXS_BATS_PITCH_ASSERT(CHECK) static_cast<void>((CHECK))
145 #else
146 #if defined (ONIXS_BATS_PITCH_CXX11)
147 # define ONIXS_BATS_PITCH_ASSERT(CHECK) ((CHECK) ? void(0) : []() {assert(!#CHECK);}())
148 # else
149 # define ONIXS_BATS_PITCH_ASSERT(CHECK) (assert((CHECK)))
150 # endif
151 #endif
152 
153 #if defined (ONIXS_BATS_PITCH_CXX11)
154 # define ONIXS_BATS_PITCH_HAS_TYPE_TRAITS
155 #endif
156 
157 #else //#if !(defined(ONIXS_DOXYGEN) && ONIXS_DOXYGEN)
158 
159 #define ONIXS_BATS_PITCH_EXPORTED
160 #define ONIXS_BATS_PITCH_NOTHROW noexcept
161 #define ONIXS_BATS_PITCH_EXPLICIT explicit
162 #define ONIXS_BATS_PITCH_CONST_OR_CONSTEXPR constexpr
163 #define ONIXS_BATS_PITCH_CONSTEXPR constexpr
164 #define ONIXS_BATS_PITCH_OVERRIDE override
165 #define ONIXS_BATS_PITCH_FINAL final
166 #define ONIXS_BATS_PITCH_NULLPTR nullptr
167 
168 #define ONIXS_BATS_PITCH_NORETURN
169 #define ONIXS_BATS_PITCH_NODISCARD
170 
171 #define ONIXS_BATS_PITCH_HOTPATH
172 #define ONIXS_BATS_PITCH_COLDPATH
173 #define ONIXS_BATS_PITCH_PURE
174 
175 #define ONIXS_BATS_PITCH_HAS_TYPE_TRAITS
176 
177 #define ONIXS_BATS_PITCH_HAS_GATEWAY_EMULATOR
178 
179 #define ONIXS_BATS_PITCH_CXX11
180 #define ONIXS_BATS_PITCH_CXX14
181 #define ONIXS_BATS_PITCH_CXX17
182 #define ONIXS_BATS_PITCH_CXX20
183 
184 
185 #define ONIXS_BATS_PITCH_UNUSED
186 #define ONIXS_BATS_PITCH_DEFAULT =default
187 
188 #endif