OnixS C++ CME MDP Premium Market Data Handler 5.9.0
API Documentation
Loading...
Searching...
No Matches
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
61#define ONIXS_CMEMDH_CONCATENATE_IMPL(X,Y) X##Y
62#define ONIXS_CMEMDH_CONCATENATE(X,Y) ONIXS_CMEMDH_CONCATENATE_IMPL(X,Y)
63
64#if defined(ONIXS_CMEMDH_COMPILER_IS_Clang)
65#define ONIXS_CMEMDH_PADDING(size) __attribute__((__unused__)) char ONIXS_CMEMDH_CONCATENATE(padding, __LINE__)[size]
66#else
67#define ONIXS_CMEMDH_PADDING(size) char ONIXS_CMEMDH_CONCATENATE(padding, __LINE__)[size]
68#endif
69
70
71# if defined(ONIXS_CMEMDH_COMPILER_IS_GNU_or_Clang)
72
73# define ONIXS_CMEMDH_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
74# define ONIXS_CMEMDH_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
75# define ONIXS_CMEMDH_UNUSED __attribute__((__unused__))
76# define ONIXS_CMEMDH_MAY_ALIAS __attribute__((__may_alias__))
77# define ONIXS_CMEMDH_HOTPATH __attribute__((hot))
78# define ONIXS_CMEMDH_COLDPATH __attribute__((noinline,cold))
79# define ONIXS_CMEMDH_NORETURN __attribute__ ((__noreturn__))
80# define ONIXS_CMEMDH_NODISCARD __attribute__((warn_unused_result))
81# define ONIXS_CMEMDH_PURE
82
83#elif defined(ONIXS_CMEMDH_COMPILER_IS_MSVC)
84
85# define ONIXS_CMEMDH_LIKELY(cond) ((cond))
86# define ONIXS_CMEMDH_UNLIKELY(cond) ((cond))
87# define ONIXS_CMEMDH_PURE
88# define ONIXS_CMEMDH_UNUSED
89# define ONIXS_CMEMDH_MAY_ALIAS
90# define ONIXS_CMEMDH_HOTPATH
91# define ONIXS_CMEMDH_COLDPATH
92# define ONIXS_CMEMDH_NORETURN __declspec(noreturn)
93# define ONIXS_CMEMDH_NODISCARD _Check_return_
94
95#else
96# error Unsupported compiler
97#endif
98
99#if defined(ONIXS_CMEMDH_CXX11)
100
101# define ONIXS_CMEMDH_NOEXCEPT noexcept
102# define ONIXS_CMEMDH_CHECK_NOTHROW(equation) ONIXS_CMEMDH_STATIC_ASSERT(noexcept((equation)))
103# define ONIXS_CMEMDH_EXPLICIT explicit
104# define ONIXS_CMEMDH_CONST_OR_CONSTEXPR constexpr
105# define ONIXS_CMEMDH_FINAL final
106# define ONIXS_CMEMDH_OVERRIDE override
107# define ONIXS_CMEMDH_CONSTEXPR constexpr
108# define ONIXS_CMEMDH_NULLPTR nullptr
109# define ONIXS_CMEMDH_DELETED_FUNCTION = delete
110# define ONIXS_CMEMDH_STATIC_ASSERT(X) static_assert(X, #X)
111# define ONIXS_CMEMDH_STATIC_ASSERT_MSG(X, MSG) static_assert(X, MSG)
112# define ONIXS_CMEMDH_ALIGNAS(X) alignas(X)
113# define ONIXS_CMEMDH_DEFAULT =default
114
115#else
116
117# define ONIXS_CMEMDH_NOEXCEPT throw()
118# define ONIXS_CMEMDH_CHECK_NOTHROW(equation) ONIXS_CMEMDH_STATIC_ASSERT((true))
119# define ONIXS_CMEMDH_EXPLICIT
120# define ONIXS_CMEMDH_CONST_OR_CONSTEXPR const
121# define ONIXS_CMEMDH_FINAL
122# define ONIXS_CMEMDH_OVERRIDE
123# define ONIXS_CMEMDH_CONSTEXPR
124# define ONIXS_CMEMDH_DELETED_FUNCTION
125# define ONIXS_CMEMDH_DEFAULT {}
126
127
128# if defined ONIXS_CMEMDH_COMPILER_IS_GNU_or_Clang
129# define ONIXS_CMEMDH_NULLPTR __null
130# else
131# define ONIXS_CMEMDH_NULLPTR 0
132# endif
133
134
135# define ONIXS_CMEMDH_STATIC_ASSERT_JOIN(X, Y) ONIXS_CMEMDH_STATIC_ASSERT_JOIN_IMPL(X, Y)
136# define ONIXS_CMEMDH_STATIC_ASSERT_JOIN_IMPL(X, Y) X##Y
137template<bool> struct ONIXS_ILINK3StaticAssert;
138template<> struct ONIXS_ILINK3StaticAssert<true>{};
139# define ONIXS_CMEMDH_STATIC_ASSERT(X) enum { ONIXS_CMEMDH_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
140# define ONIXS_CMEMDH_STATIC_ASSERT_MSG(X, MSG) enum { ONIXS_CMEMDH_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
141
142
143# if defined ONIXS_CMEMDH_COMPILER_IS_GNU_or_Clang
144# define ONIXS_CMEMDH_ALIGNAS(X) __attribute__ ((__aligned__(X)))
145# elif defined ONIXS_CMEMDH_COMPILER_IS_MSVC
146# define ONIXS_CMEMDH_ALIGNAS(X) __declspec(align(X))
147# else
148# define ONIXS_CMEMDH_ALIGNAS(X)
149# endif
150
151#endif
152
153#if defined NDEBUG
154# define ONIXS_CMEMDH_ASSERT(CHECK) static_cast<void>((CHECK))
155#else
156#if defined (ONIXS_CMEMDH_CXX11)
157# define ONIXS_CMEMDH_ASSERT(CHECK) ((CHECK) ? void(0) : []() {assert(!#CHECK);}())
158# else
159# define ONIXS_CMEMDH_ASSERT(CHECK) (assert((CHECK)))
160# endif
161#endif
162
163#if defined (ONIXS_CMEMDH_CXX11)
164# define ONIXS_CMEMDH_HAS_TYPE_TRAITS
165#endif
166
167#define ONIXS_CMEMDH_HARDWARE_DESTRUCTIVE_INTERFACE_SIZE (64)
168
169#else //#if !(defined(ONIXS_DOXYGEN) && ONIXS_DOXYGEN)
170
171#define ONIXS_CMEMDH_EXPORTED
172#define ONIXS_CMEMDH_NOEXCEPT noexcept
173#define ONIXS_CMEMDH_EXPLICIT explicit
174#define ONIXS_CMEMDH_CONST_OR_CONSTEXPR constexpr
175#define ONIXS_CMEMDH_CONSTEXPR constexpr
176#define ONIXS_CMEMDH_OVERRIDE override
177#define ONIXS_CMEMDH_FINAL final
178#define ONIXS_CMEMDH_NULLPTR nullptr
179
180#define ONIXS_CMEMDH_NORETURN
181#define ONIXS_CMEMDH_NODISCARD
182
183#define ONIXS_CMEMDH_HOTPATH
184#define ONIXS_CMEMDH_COLDPATH
185#define ONIXS_CMEMDH_PURE
186
187#define ONIXS_CMEMDH_HAS_TYPE_TRAITS
188
189#define ONIXS_CMEMDH_HAS_GATEWAY_EMULATOR
190
191#define ONIXS_CMEMDH_CXX11
192#define ONIXS_CMEMDH_CXX14
193#define ONIXS_CMEMDH_CXX17
194#define ONIXS_CMEMDH_CXX20
195
196
197#define ONIXS_CMEMDH_UNUSED
198#define ONIXS_CMEMDH_DEFAULT =default
199
200#endif