OnixS C++ B3 BOE Binary Order Entry  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_B3_BOE_DOXYGEN) && ONIXS_B3_BOE_DOXYGEN)
23 
25 
26 #if defined(ONIXS_B3_BOE_COMPILER_IS_Clang)
27 #define ONIXS_B3_BOE_PADDING(size) __attribute__((__unused__)) char padding[size]
28 #else
29 #define ONIXS_B3_BOE_PADDING(size) char padding[size]
30 #endif
31 
32 #if defined(_MSC_VER) && defined(_MSVC_LANG)
33 # define ONIXS_CURRENT_CXX_STD _MSVC_LANG
34 #else
35 # define ONIXS_CURRENT_CXX_STD __cplusplus
36 #endif
37 
38 # if defined(ONIXS_B3_BOE_CXX11)
39 # if (ONIXS_CURRENT_CXX_STD < 201103L)
40 # error C++11 was targeted during the OnixS SDK compilation but is not detected now
41 # define ONIXS_TERMINATE_COMPILATION
42 # endif
43 # endif
44 
45 # if defined(ONIXS_B3_BOE_CXX14)
46 # if (ONIXS_CURRENT_CXX_STD < 201402L)
47 # error C++14 was targeted during the OnixS SDK compilation but is not detected now
48 # define ONIXS_TERMINATE_COMPILATION
49 # endif
50 # endif
51 
52 # if defined(ONIXS_B3_BOE_CXX17)
53 # if (ONIXS_CURRENT_CXX_STD < 201703L)
54 # error C++17 was targeted during the OnixS SDK compilation but is not detected now
55 # define ONIXS_TERMINATE_COMPILATION
56 # endif
57 # endif
58 
59 # if defined(ONIXS_B3_BOE_CXX20)
60 # if !(ONIXS_CURRENT_CXX_STD > 201703L)
61 # error C++20 was targeted during the OnixS SDK compilation but is not detected now
62 # define ONIXS_TERMINATE_COMPILATION
63 # endif
64 # endif
65 
66 # if defined(ONIXS_TERMINATE_COMPILATION)
67 # include <termnate_compilation>
68 #endif
69 
70 # if defined(ONIXS_B3_BOE_COMPILER_IS_GNU) | defined(ONIXS_B3_BOE_COMPILER_IS_Clang)
71 # define ONIXS_B3_BOE_COMPILER_IS_GNU_or_Clang
72 # endif
73 
74 # if defined(ONIXS_B3_BOE_COMPILER_IS_GNU_or_Clang)
75 
76 # define ONIXS_B3_BOE_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
77 # define ONIXS_B3_BOE_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
78 # define ONIXS_B3_BOE_UNUSED __attribute__((__unused__))
79 # define ONIXS_B3_BOE_MAY_ALIAS __attribute__((__may_alias__))
80 # define ONIXS_B3_BOE_HOTPATH __attribute__((hot))
81 # define ONIXS_B3_BOE_COLDPATH __attribute__((noinline,cold))
82 # define ONIXS_B3_BOE_NORETURN __attribute__ ((__noreturn__))
83 # define ONIXS_B3_BOE_NODISCARD __attribute__((warn_unused_result))
84 # define ONIXS_B3_BOE_PURE
85 
86 #elif defined(ONIXS_B3_BOE_COMPILER_IS_MSVC)
87 
88 # define ONIXS_B3_BOE_LIKELY(cond) ((cond))
89 # define ONIXS_B3_BOE_UNLIKELY(cond) ((cond))
90 # define ONIXS_B3_BOE_PURE
91 # define ONIXS_B3_BOE_UNUSED
92 # define ONIXS_B3_BOE_MAY_ALIAS
93 # define ONIXS_B3_BOE_HOTPATH
94 # define ONIXS_B3_BOE_COLDPATH
95 # define ONIXS_B3_BOE_NORETURN __declspec(noreturn)
96 # define ONIXS_B3_BOE_NODISCARD _Check_return_
97 
98 #else
99 # error Unsupported compiler
100 #endif
101 
102 # if defined(ONIXS_B3_BOE_COMPILER_IS_GNU) & !defined(ONIXS_B3_BOE_CXX11)
103 # define ONIXS_B3_BOE_GCC44_SPURIOUS_WARNING_TURNAROUND ONIXS_B3_BOE_MAY_ALIAS
104 # else
105 # define ONIXS_B3_BOE_GCC44_SPURIOUS_WARNING_TURNAROUND
106 # endif
107 
108 
109 #if defined(ONIXS_B3_BOE_CXX11)
110 
111 # define ONIXS_B3_BOE_NOTHROW noexcept
112 # define ONIXS_B3_BOE_CHECK_NOTHROW(equation) ONIXS_B3_BOE_STATIC_ASSERT(noexcept((equation)))
113 # define ONIXS_B3_BOE_EXPLICIT explicit
114 # define ONIXS_B3_BOE_CONST_OR_CONSTEXPR constexpr
115 # define ONIXS_B3_BOE_FINAL final
116 # define ONIXS_B3_BOE_OVERRIDE override
117 # define ONIXS_B3_BOE_CONSTEXPR constexpr
118 # define ONIXS_B3_BOE_NULLPTR nullptr
119 # define ONIXS_B3_BOE_DELETED_FUNCTION = delete
120 # define ONIXS_B3_BOE_STATIC_ASSERT(X) static_assert(X, #X)
121 # define ONIXS_B3_BOE_STATIC_ASSERT_MSG(X, MSG) static_assert(X, MSG)
122 # define ONIXS_B3_BOE_ALIGNAS(X) alignas(X)
123 # define ONIXS_B3_BOE_DEFAULT =default
124 
125 #else
126 
127 # define ONIXS_B3_BOE_NOTHROW throw()
128 # define ONIXS_B3_BOE_CHECK_NOTHROW(equation) ONIXS_B3_BOE_STATIC_ASSERT((true))
129 # define ONIXS_B3_BOE_EXPLICIT
130 # define ONIXS_B3_BOE_CONST_OR_CONSTEXPR const
131 # define ONIXS_B3_BOE_FINAL
132 # define ONIXS_B3_BOE_OVERRIDE
133 # define ONIXS_B3_BOE_CONSTEXPR
134 # define ONIXS_B3_BOE_DELETED_FUNCTION
135 # define ONIXS_B3_BOE_DEFAULT {}
136 
137 
138 # if defined ONIXS_B3_BOE_COMPILER_IS_GNU_or_Clang
139 # define ONIXS_B3_BOE_NULLPTR __null
140 # else
141 # define ONIXS_B3_BOE_NULLPTR 0
142 # endif
143 
144 
145 # define ONIXS_B3_BOE_STATIC_ASSERT_JOIN(X, Y) ONIXS_B3_BOE_STATIC_ASSERT_JOIN_IMPL(X, Y)
146 # define ONIXS_B3_BOE_STATIC_ASSERT_JOIN_IMPL(X, Y) X##Y
147 template<bool> struct ONIXS_B3_BOEStaticAssert;
148 template<> struct ONIXS_B3_BOEStaticAssert<true>{};
149 # define ONIXS_B3_BOE_STATIC_ASSERT(X) enum { ONIXS_B3_BOE_STATIC_ASSERT_JOIN(ONIXS_B3_BOEStaticAssertEnum, __LINE__) = sizeof(ONIXS_B3_BOEStaticAssert<X>) }
150 # define ONIXS_B3_BOE_STATIC_ASSERT_MSG(X, MSG) enum { ONIXS_B3_BOE_STATIC_ASSERT_JOIN(ONIXS_B3_BOEStaticAssertEnum, __LINE__) = sizeof(ONIXS_B3_BOEStaticAssert<X>) }
151 
152 
153 # if defined ONIXS_B3_BOE_COMPILER_IS_GNU_or_Clang
154 # define ONIXS_B3_BOE_ALIGNAS(X) __attribute__ ((__aligned__(X)))
155 # elif defined ONIXS_B3_BOE_COMPILER_IS_MSVC
156 # define ONIXS_B3_BOE_ALIGNAS(X) __declspec(align(X))
157 # else
158 # define ONIXS_B3_BOE_ALIGNAS(X)
159 # endif
160 
161 #endif
162 
163 #if defined NDEBUG
164 # define ONIXS_B3_BOE_ASSERT(CHECK) static_cast<void>((CHECK))
165 #else
166 #if defined (ONIXS_B3_BOE_CXX11)
167 # define ONIXS_B3_BOE_ASSERT(CHECK) ((CHECK) ? void(0) : []() {assert(!#CHECK);}())
168 # else
169 # define ONIXS_B3_BOE_ASSERT(CHECK) (assert((CHECK)))
170 # endif
171 #endif
172 
173 #if defined (ONIXS_B3_BOE_CXX11)
174 # define ONIXS_B3_BOE_HAS_TYPE_TRAITS
175 #endif
176 
177 #define ONIXS_B3_BOE_HARDWARE_DESTRUCTIVE_INTERFACE_SIZE (64)
178 
179 #else //#if !(defined(ONIXS_DOXYGEN) && ONIXS_DOXYGEN)
180 
181 #define ONIXS_B3_BOE_EXPORTED
182 #define ONIXS_B3_BOE_NOTHROW noexcept
183 #define ONIXS_B3_BOE_EXPLICIT explicit
184 #define ONIXS_B3_BOE_CONST_OR_CONSTEXPR constexpr
185 #define ONIXS_B3_BOE_CONSTEXPR constexpr
186 #define ONIXS_B3_BOE_OVERRIDE override
187 #define ONIXS_B3_BOE_FINAL final
188 #define ONIXS_B3_BOE_NULLPTR nullptr
189 
190 #define ONIXS_B3_BOE_NORETURN
191 #define ONIXS_B3_BOE_NODISCARD
192 
193 #define ONIXS_B3_BOE_HOTPATH
194 #define ONIXS_B3_BOE_COLDPATH
195 #define ONIXS_B3_BOE_PURE
196 
197 #define ONIXS_B3_BOE_HAS_TYPE_TRAITS
198 
199 #define ONIXS_B3_BOE_HAS_GATEWAY_EMULATOR
200 
201 #define ONIXS_B3_BOE_CXX11
202 #define ONIXS_B3_BOE_CXX14
203 #define ONIXS_B3_BOE_CXX17
204 #define ONIXS_B3_BOE_CXX20
205 
206 
207 #define ONIXS_B3_BOE_UNUSED
208 #define ONIXS_B3_BOE_DEFAULT =default
209 
210 #define ONIXS_B3_BOE_GCC44_SPURIOUS_WARNING_TURNAROUND
211 
212 #endif