OnixS C++ CME MDP Premium Market Data Handler  5.8.3
API Documentation
Compiler.h
Go to the documentation of this file.
1 // clang-format off
2 // Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3 //
4 // This software owned by Onix Solutions Limited [OnixS] and is
5 // protected by copyright law and international copyright treaties.
6 //
7 // Access to and use of the software is governed by the terms of the applicable
8 // OnixS Software Services Agreement (the Agreement) and Customer end user license
9 // agreements granting a non-assignable, non-transferable and non-exclusive license
10 // to use the software for it's own data processing purposes under the terms defined
11 // in the Agreement.
12 //
13 // Except as otherwise granted within the terms of the Agreement, copying or
14 // reproduction of any part of this source code or associated reference material
15 // to any other location for further reproduction or redistribution, and any
16 // amendments to this copyright notice, are expressly prohibited.
17 //
18 // Any reproduction or redistribution for sale or hiring of the Software not in
19 // accordance with the terms of the Agreement is a violation of copyright law.
20 //
21 
22 #pragma once
23 
24 #if !(defined(ONIXS_CMEMDH_DOXYGEN) && ONIXS_CMEMDH_DOXYGEN)
25 
27 
28 # if defined(ONIXS_CMEMDH_COMPILER_CXX_NOEXCEPT) && ONIXS_CMEMDH_COMPILER_CXX_NOEXCEPT
29 # define ONIXS_CMEMDH_NOTHROW noexcept
30 # else
31 # define ONIXS_CMEMDH_NOTHROW throw()
32 # endif
33 
34 # if defined(ONIXS_CMEMDH_COMPILER_CXX_NOEXCEPT) && ONIXS_CMEMDH_COMPILER_CXX_NOEXCEPT
35 # define ONIXS_CMEMDH_CHECK_NOTHROW(equation) ONIXS_CMEMDH_STATIC_ASSERT(noexcept((equation)))
36 # else
37 # define ONIXS_CMEMDH_CHECK_NOTHROW(equation) ONIXS_CMEMDH_STATIC_ASSERT((true))
38 # endif
39 
40 # if defined(ONIXS_CMEMDH_COMPILER_CXX_EXPLICIT_CONVERSIONS) && ONIXS_CMEMDH_COMPILER_CXX_EXPLICIT_CONVERSIONS
41 # define ONIXS_CMEMDH_EXPLICIT explicit
42 #else
43 # define ONIXS_CMEMDH_EXPLICIT
44 #endif
45 
46 #if (__cplusplus >= 201103L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)
47 # define ONIXS_CMEMDH_CXX11
48 #endif
49 
50 #if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
51 # define ONIXS_CMEMDH_CXX17
52 #endif
53 
54 # if defined(ONIXS_CMEMDH_COMPILER_CXX_CONSTEXPR) && ONIXS_CMEMDH_COMPILER_CXX_CONSTEXPR
55 # define ONIXS_CMEMDH_CONST_OR_CONSTEXPR constexpr
56 #else
57 # define ONIXS_CMEMDH_CONST_OR_CONSTEXPR const
58 #endif
59 
60 #if defined(__GNUC__)
61 # define ONIXS_CMEMDH_CHECK_EXPECT(exp,c) (__builtin_expect((exp), (c)))
62 #else
63 # define ONIXS_CMEMDH_CHECK_EXPECT(exp,c) ((exp))
64 #endif
65 
66 #if !defined(ONIXS_CMEMDH_NORETURN)
67 # if defined(_MSC_VER)
68 # define ONIXS_CMEMDH_NORETURN __declspec(noreturn)
69 # elif defined(__GNUC__)
70 # define ONIXS_CMEMDH_NORETURN __attribute__ ((__noreturn__))
71 # elif defined(__has_cpp_attribute)
72 # if __has_cpp_attribute(noreturn)
73 # define ONIXS_CMEMDH_NORETURN [[noreturn]]
74 # endif
75 # endif
76 #endif
77 
78 #if !defined(ONIXS_CMEMDH_NORETURN)
79 # define ONIXS_CMEMDH_NORETURN
80 #endif
81 
82 #if !defined(ONIXS_CMEMDH_NODISCARD)
83 # if defined(_MSC_VER)
84 # define ONIXS_CMEMDH_NODISCARD _Check_return_
85 # elif defined(__GNUC__)
86 # define ONIXS_CMEMDH_NODISCARD __attribute__((warn_unused_result))
87 # elif defined(__has_cpp_attribute)
88 # if __has_cpp_attribute(nodiscard)
89 # define ONIXS_CMEMDH_NODISCARD [[nodiscard]]
90 # endif
91 # endif
92 #endif
93 
94 #if !defined(ONIXS_CMEMDH_NODISCARD)
95 # define ONIXS_CMEMDH_NODISCARD
96 #endif
97 
98 #if defined(__GNUC__)
99 # define ONIXS_CMEMDH_UNUSED __attribute__((__unused__))
100 #else
101 # define ONIXS_CMEMDH_UNUSED
102 #endif
103 
104 #if defined(__GNUC__)
105 # define ONIXS_CMEMDH_HOTPATH __attribute__((hot))
106 # define ONIXS_CMEMDH_COLDPATH __attribute__((cold, noinline))
107 #else
108 # define ONIXS_CMEMDH_COLDPATH
109 # define ONIXS_CMEMDH_HOTPATH
110 #endif
111 
112 
113 #if defined(__GNUC__)
114 # define ONIXS_CMEMDH_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
115 # define ONIXS_CMEMDH_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
116 #else
117 # if defined(__has_cpp_attribute)
118 # if __has_cpp_attribute(unlikely)
119 # define ONIXS_CMEMDH_UNLIKELY(cond) ((cond)) [[unlikely]]
120 # define ONIXS_CMEMDH_LIKELY(cond) ((cond)) [[likely]]
121 # endif
122 # endif
123 #endif
124 
125 #if !defined(ONIXS_CMEMDH_LIKELY)
126 # define ONIXS_CMEMDH_LIKELY(cond) ((cond))
127 #endif
128 
129 #if !defined(ONIXS_CMEMDH_UNLIKELY)
130 # define ONIXS_CMEMDH_UNLIKELY(cond) ((cond))
131 #endif
132 
133 #else
134 
135 #define ONIXS_CMEMDH_EXPORTED
136 #define ONIXS_CMEMDH_LTWT_EXPORTED
137 #define ONIXS_CMEMDH_LTWT
138 
139 #define ONIXS_CMEMDH_NOTHROW noexcept
140 #define ONIXS_CMEMDH_EXPLICIT explicit
141 #define ONIXS_CMEMDH_CONST_OR_CONSTEXPR constexpr
142 #define ONIXS_CMEMDH_CONSTEXPR constexpr
143 #define ONIXS_CMEMDH_OVERRIDE override
144 #define ONIXS_CMEMDH_FINAL final
145 #define ONIXS_CMEMDH_NULLPTR nullptr
146 
147 #endif