OnixS C++ LSE GTP Market Data Handler 1.0.6
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#pragma once
20
21#define ONIXS_LSE_GTP_CONCATENATE_IMPL(X,Y) X##Y
22#define ONIXS_LSE_GTP_CONCATENATE(X,Y) ONIXS_LSE_GTP_CONCATENATE_IMPL(X,Y)
23#define ONIXS_LSE_GTP_TO_STR(entity) #entity
24
25#if !(defined(ONIXS_LSE_GTP_DOXYGEN) && ONIXS_LSE_GTP_DOXYGEN)
26
27#include <OnixS/LSE/MarketData/GTP/CompilerDetection.h>
28
29
30#if defined(_MSC_VER) && defined(_MSVC_LANG)
31# define ONIXS_LSE_GTP_CURRENT_CXX_STD _MSVC_LANG
32#else
33# define ONIXS_LSE_GTP_CURRENT_CXX_STD __cplusplus
34#endif
35
36# if defined(ONIXS_LSE_GTP_CXX11)
37# if (ONIXS_LSE_GTP_CURRENT_CXX_STD < 201103L)
38# error C++11 was targeted during the OnixS SDK compilation but is not detected now
39# endif
40# endif
41
42# if defined(ONIXS_LSE_GTP_CXX14)
43# if (ONIXS_LSE_GTP_CURRENT_CXX_STD < 201402L)
44# error C++14 was targeted during the OnixS SDK compilation but is not detected now
45# endif
46# endif
47
48# if defined(ONIXS_LSE_GTP_CXX17)
49# if (ONIXS_LSE_GTP_CURRENT_CXX_STD < 201703L)
50# error C++17 was targeted during the OnixS SDK compilation but is not detected now
51# endif
52# endif
53
54# if defined(ONIXS_LSE_GTP_CXX20)
55# if !(ONIXS_LSE_GTP_CURRENT_CXX_STD > 201703L)
56# error C++20 was targeted during the OnixS SDK compilation but is not detected now
57# endif
58# endif
59
60# if defined(ONIXS_LSE_GTP_COMPILER_IS_GNU) | defined(ONIXS_LSE_GTP_COMPILER_IS_Clang)
61# define ONIXS_LSE_GTP_COMPILER_IS_GNU_or_Clang
62# endif
63
64#if defined(ONIXS_LSE_GTP_COMPILER_IS_Clang)
65#define ONIXS_LSE_GTP_PADDING(size) __attribute__((__unused__)) char ONIXS_LSE_GTP_CONCATENATE(padding, __LINE__)[size]
66#else
67#define ONIXS_LSE_GTP_PADDING(size) char ONIXS_LSE_GTP_CONCATENATE(padding, __LINE__)[size]
68#endif
69
70# if defined(ONIXS_LSE_GTP_COMPILER_IS_GNU_or_Clang)
71
72# define ONIXS_LSE_GTP_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
73# define ONIXS_LSE_GTP_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
74# define ONIXS_LSE_GTP_CHECK_EXPECT(exp, c) (__builtin_expect(static_cast<bool>((exp)), (c)))
75# define ONIXS_LSE_GTP_UNUSED __attribute__((__unused__))
76# define ONIXS_LSE_GTP_MAY_ALIAS __attribute__((__may_alias__))
77# define ONIXS_LSE_GTP_HOTPATH __attribute__((hot))
78# define ONIXS_LSE_GTP_COLDPATH __attribute__((noinline,cold))
79# define ONIXS_LSE_GTP_NORETURN __attribute__ ((__noreturn__))
80# define ONIXS_LSE_GTP_NODISCARD __attribute__((warn_unused_result))
81# define ONIXS_LSE_GTP_PURE
82
83#elif defined(ONIXS_LSE_GTP_COMPILER_IS_MSVC)
84
85# define ONIXS_LSE_GTP_LIKELY(cond) ((cond))
86# define ONIXS_LSE_GTP_UNLIKELY(cond) ((cond))
87# define ONIXS_LSE_GTP_CHECK_EXPECT(exp,c) ((exp))
88# define ONIXS_LSE_GTP_PURE
89# define ONIXS_LSE_GTP_UNUSED
90# define ONIXS_LSE_GTP_MAY_ALIAS
91# define ONIXS_LSE_GTP_HOTPATH
92# define ONIXS_LSE_GTP_COLDPATH
93# define ONIXS_LSE_GTP_NORETURN __declspec(noreturn)
94# define ONIXS_LSE_GTP_NODISCARD _Check_return_
95
96#else
97# error Unsupported compiler
98#endif
99
100#if defined(ONIXS_LSE_GTP_CXX11)
101
102# define ONIXS_LSE_GTP_NOTHROW noexcept
103# define ONIXS_LSE_GTP_CHECK_NOTHROW(equation) ONIXS_LSE_GTP_STATIC_ASSERT(noexcept((equation)))
104# define ONIXS_LSE_GTP_EXPLICIT explicit
105# define ONIXS_LSE_GTP_CONST_OR_CONSTEXPR constexpr
106# define ONIXS_LSE_GTP_FINAL final
107# define ONIXS_LSE_GTP_OVERRIDE override
108# define ONIXS_LSE_GTP_CONSTEXPR constexpr
109# define ONIXS_LSE_GTP_NULLPTR nullptr
110# define ONIXS_LSE_GTP_DELETED_FUNCTION = delete
111# define ONIXS_LSE_GTP_STATIC_ASSERT(X) static_assert(X, #X)
112# define ONIXS_LSE_GTP_STATIC_ASSERT_MSG(X, MSG) static_assert(X, MSG)
113# define ONIXS_LSE_GTP_ALIGNAS(X) alignas(X)
114# define ONIXS_LSE_GTP_DEFAULT =default
115
116#else
117
118# define ONIXS_LSE_GTP_NOTHROW throw()
119# define ONIXS_LSE_GTP_CHECK_NOTHROW(equation) ONIXS_LSE_GTP_STATIC_ASSERT((true))
120# define ONIXS_LSE_GTP_EXPLICIT
121# define ONIXS_LSE_GTP_CONST_OR_CONSTEXPR const
122# define ONIXS_LSE_GTP_FINAL
123# define ONIXS_LSE_GTP_OVERRIDE
124# define ONIXS_LSE_GTP_CONSTEXPR
125# define ONIXS_LSE_GTP_DELETED_FUNCTION
126# define ONIXS_LSE_GTP_DEFAULT {}
127
128
129# if defined ONIXS_LSE_GTP_COMPILER_IS_GNU_or_Clang
130# define ONIXS_LSE_GTP_NULLPTR __null
131# else
132# define ONIXS_LSE_GTP_NULLPTR 0
133# endif
134
135
136# define ONIXS_LSE_GTP_STATIC_ASSERT_JOIN(X, Y) ONIXS_LSE_GTP_STATIC_ASSERT_JOIN_IMPL(X, Y)
137# define ONIXS_LSE_GTP_STATIC_ASSERT_JOIN_IMPL(X, Y) X##Y
138template<bool> struct ONIXS_ILINK3StaticAssert;
139template<> struct ONIXS_ILINK3StaticAssert<true>{};
140# define ONIXS_LSE_GTP_STATIC_ASSERT(X) enum { ONIXS_LSE_GTP_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
141# define ONIXS_LSE_GTP_STATIC_ASSERT_MSG(X, MSG) enum { ONIXS_LSE_GTP_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
142
143
144# if defined ONIXS_LSE_GTP_COMPILER_IS_GNU_or_Clang
145# define ONIXS_LSE_GTP_ALIGNAS(X) __attribute__ ((__aligned__(X)))
146# elif defined ONIXS_LSE_GTP_COMPILER_IS_MSVC
147# define ONIXS_LSE_GTP_ALIGNAS(X) __declspec(align(X))
148# else
149# define ONIXS_LSE_GTP_ALIGNAS(X)
150# endif
151
152#endif
153
154#if defined NDEBUG
155# define ONIXS_LSE_GTP_ASSERT(CHECK) static_cast<void>((CHECK))
156#else
157#if defined (ONIXS_LSE_GTP_CXX11)
158# define ONIXS_LSE_GTP_ASSERT(CHECK) ((CHECK) ? void(0) : []() {assert(!#CHECK);}())
159# else
160# define ONIXS_LSE_GTP_ASSERT(CHECK) (assert((CHECK)))
161# endif
162#endif
163
164#if defined (ONIXS_LSE_GTP_CXX11)
165# define ONIXS_LSE_GTP_HAS_TYPE_TRAITS
166#endif
167
168#else //#if !(defined(ONIXS_DOXYGEN) && ONIXS_DOXYGEN)
169
170#define ONIXS_LSE_GTP_EXPORTED
171#define ONIXS_LSE_GTP_NOTHROW noexcept
172#define ONIXS_LSE_GTP_EXPLICIT explicit
173#define ONIXS_LSE_GTP_CONST_OR_CONSTEXPR constexpr
174#define ONIXS_LSE_GTP_CONSTEXPR constexpr
175#define ONIXS_LSE_GTP_OVERRIDE override
176#define ONIXS_LSE_GTP_FINAL final
177#define ONIXS_LSE_GTP_NULLPTR nullptr
178
179#define ONIXS_LSE_GTP_NORETURN
180#define ONIXS_LSE_GTP_NODISCARD
181
182#define ONIXS_LSE_GTP_HOTPATH
183#define ONIXS_LSE_GTP_COLDPATH
184#define ONIXS_LSE_GTP_PURE
185
186#define ONIXS_LSE_GTP_HAS_TYPE_TRAITS
187
188#define ONIXS_LSE_GTP_HAS_GATEWAY_EMULATOR
189
190#define ONIXS_LSE_GTP_CXX11
191#define ONIXS_LSE_GTP_CXX14
192#define ONIXS_LSE_GTP_CXX17
193#define ONIXS_LSE_GTP_CXX20
194
195
196#define ONIXS_LSE_GTP_UNUSED
197#define ONIXS_LSE_GTP_DEFAULT =default
198
199#define ONIXS_LSE_GTP_PADDING(size) char ONIXS_LSE_GTP_CONCATENATE(padding, __LINE__)[size]
200
201#endif