OnixS C++ CME iLink 3 Binary Order Entry Handler  1.18.11
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_ILINK3_DOXYGEN) && ONIXS_ILINK3_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_ILINK3_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 # define ONIXS_TERMINATE_COMPILATION
36 # endif
37 # endif
38 
39 # if defined(ONIXS_ILINK3_CXX14)
40 # if (ONIXS_CURRENT_CXX_STD < 201402L)
41 # error C++14 was targeted during the OnixS SDK compilation but is not detected now
42 # define ONIXS_TERMINATE_COMPILATION
43 # endif
44 # endif
45 
46 # if defined(ONIXS_ILINK3_CXX17)
47 # if (ONIXS_CURRENT_CXX_STD < 201703L)
48 # error C++17 was targeted during the OnixS SDK compilation but is not detected now
49 # define ONIXS_TERMINATE_COMPILATION
50 # endif
51 # endif
52 
53 # if defined(ONIXS_ILINK3_CXX20)
54 # if !(ONIXS_CURRENT_CXX_STD > 201703L)
55 # error C++20 was targeted during the OnixS SDK compilation but is not detected now
56 # define ONIXS_TERMINATE_COMPILATION
57 # endif
58 # endif
59 
60 # if defined(ONIXS_TERMINATE_COMPILATION)
61 # include <termnate_compilation>
62 #endif
63 
64 # if defined(ONIXS_ILINK3_COMPILER_IS_GNU) | defined(ONIXS_ILINK3_COMPILER_IS_Clang)
65 # define ONIXS_ILINK3_COMPILER_IS_GNU_or_Clang
66 # endif
67 
68 # if defined(ONIXS_ILINK3_COMPILER_IS_GNU_or_Clang)
69 
70 # define ONIXS_ILINK3_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
71 # define ONIXS_ILINK3_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
72 # define ONIXS_ILINK3_UNUSED __attribute__((__unused__))
73 # define ONIXS_ILINK3_MAY_ALIAS __attribute__((__may_alias__))
74 # define ONIXS_ILINK3_HOTPATH __attribute__((hot))
75 # define ONIXS_ILINK3_COLDPATH __attribute__((noinline,cold))
76 # define ONIXS_ILINK3_NORETURN __attribute__ ((__noreturn__))
77 # define ONIXS_ILINK3_NODISCARD __attribute__((warn_unused_result))
78 # define ONIXS_ILINK3_PURE
79 # define ONIXS_ILINK3_NONULL __attribute__((nonnull))
80 
81 #elif defined(ONIXS_ILINK3_COMPILER_IS_MSVC)
82 
83 # define ONIXS_ILINK3_LIKELY(cond) ((cond))
84 # define ONIXS_ILINK3_UNLIKELY(cond) ((cond))
85 # define ONIXS_ILINK3_PURE
86 # define ONIXS_ILINK3_UNUSED
87 # define ONIXS_ILINK3_MAY_ALIAS
88 # define ONIXS_ILINK3_HOTPATH
89 # define ONIXS_ILINK3_COLDPATH
90 # define ONIXS_ILINK3_NORETURN __declspec(noreturn)
91 # define ONIXS_ILINK3_NODISCARD _Check_return_
92 # define ONIXS_ILINK3_NONULL
93 #else
94 # error Unsupported compiler
95 #endif
96 
97 # if defined(ONIXS_ILINK3_COMPILER_IS_GNU) & !defined(ONIXS_ILINK3_CXX11)
98 # define ONIXS_ILINK3_GCC44_SPURIOUS_WARNING_TURNAROUND ONIXS_ILINK3_MAY_ALIAS
99 # else
100 # define ONIXS_ILINK3_GCC44_SPURIOUS_WARNING_TURNAROUND
101 # endif
102 
103 
104 #if defined(ONIXS_ILINK3_CXX11)
105 
106 # define ONIXS_ILINK3_NOTHROW noexcept
107 # define ONIXS_ILINK3_CHECK_NOTHROW(equation) ONIXS_ILINK3_STATIC_ASSERT(noexcept((equation)))
108 # define ONIXS_ILINK3_EXPLICIT explicit
109 # define ONIXS_ILINK3_CONST_OR_CONSTEXPR constexpr
110 # define ONIXS_ILINK3_FINAL final
111 # define ONIXS_ILINK3_OVERRIDE override
112 # define ONIXS_ILINK3_CONSTEXPR constexpr
113 # define ONIXS_ILINK3_NULLPTR nullptr
114 # define ONIXS_ILINK3_DELETED_FUNCTION = delete
115 # define ONIXS_ILINK3_STATIC_ASSERT(X) static_assert(X, #X)
116 # define ONIXS_ILINK3_STATIC_ASSERT_MSG(X, MSG) static_assert(X, MSG)
117 # define ONIXS_ILINK3_ALIGNAS(X) alignas(X)
118 # define ONIXS_ILINK3_DEFAULT =default
119 
120 #else
121 
122 # define ONIXS_ILINK3_NOTHROW throw()
123 # define ONIXS_ILINK3_CHECK_NOTHROW(equation) ONIXS_ILINK3_STATIC_ASSERT((true))
124 # define ONIXS_ILINK3_EXPLICIT
125 # define ONIXS_ILINK3_CONST_OR_CONSTEXPR const
126 # define ONIXS_ILINK3_FINAL
127 # define ONIXS_ILINK3_OVERRIDE
128 # define ONIXS_ILINK3_CONSTEXPR
129 # define ONIXS_ILINK3_DELETED_FUNCTION
130 # define ONIXS_ILINK3_DEFAULT {}
131 
132 
133 # if defined ONIXS_ILINK3_COMPILER_IS_GNU_or_Clang
134 # define ONIXS_ILINK3_NULLPTR __null
135 # else
136 # define ONIXS_ILINK3_NULLPTR 0
137 # endif
138 
139 
140 # define ONIXS_ILINK3_STATIC_ASSERT_JOIN(X, Y) ONIXS_ILINK3_STATIC_ASSERT_JOIN_IMPL(X, Y)
141 # define ONIXS_ILINK3_STATIC_ASSERT_JOIN_IMPL(X, Y) X##Y
142 template<bool> struct ONIXS_ILINK3StaticAssert;
143 template<> struct ONIXS_ILINK3StaticAssert<true>{};
144 # define ONIXS_ILINK3_STATIC_ASSERT(X) enum { ONIXS_ILINK3_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
145 # define ONIXS_ILINK3_STATIC_ASSERT_MSG(X, MSG) enum { ONIXS_ILINK3_STATIC_ASSERT_JOIN(ONIXS_ILINK3StaticAssertEnum, __LINE__) = sizeof(ONIXS_ILINK3StaticAssert<X>) }
146 
147 
148 # if defined ONIXS_ILINK3_COMPILER_IS_GNU_or_Clang
149 # define ONIXS_ILINK3_ALIGNAS(X) __attribute__ ((__aligned__(X)))
150 # elif defined ONIXS_ILINK3_COMPILER_IS_MSVC
151 # define ONIXS_ILINK3_ALIGNAS(X) __declspec(align(X))
152 # else
153 # define ONIXS_ILINK3_ALIGNAS(X)
154 # endif
155 
156 #endif
157 
158 #if defined NDEBUG
159 # define ONIXS_ILINK3_ASSERT(CHECK) static_cast<void>((CHECK))
160 #else
161 #if defined (ONIXS_ILINK3_CXX11)
162 # define ONIXS_ILINK3_ASSERT(CHECK) ((CHECK) ? void(0) : []() {assert(!#CHECK);}())
163 # else
164 # define ONIXS_ILINK3_ASSERT(CHECK) (assert((CHECK)))
165 # endif
166 #endif
167 
168 #if defined (ONIXS_ILINK3_CXX11)
169 # define ONIXS_ILINK3_HAS_TYPE_TRAITS
170 #endif
171 
172 #define ONIXS_ILINK3_HARDWARE_DESTRUCTIVE_INTERFACE_SIZE (64)
173 
174 #else //#if !(defined(ONIXS_DOXYGEN) && ONIXS_DOXYGEN)
175 
176 #define ONIXS_ILINK3_EXPORTED
177 #define ONIXS_ILINK3_NOTHROW noexcept
178 #define ONIXS_ILINK3_EXPLICIT explicit
179 #define ONIXS_ILINK3_CONST_OR_CONSTEXPR constexpr
180 #define ONIXS_ILINK3_CONSTEXPR constexpr
181 #define ONIXS_ILINK3_OVERRIDE override
182 #define ONIXS_ILINK3_FINAL final
183 #define ONIXS_ILINK3_NULLPTR nullptr
184 
185 #define ONIXS_ILINK3_NORETURN
186 #define ONIXS_ILINK3_NODISCARD
187 
188 #define ONIXS_ILINK3_HOTPATH
189 #define ONIXS_ILINK3_COLDPATH
190 #define ONIXS_ILINK3_PURE
191 
192 #define ONIXS_ILINK3_HAS_TYPE_TRAITS
193 
194 #define ONIXS_ILINK3_HAS_GATEWAY_EMULATOR
195 
196 #define ONIXS_ILINK3_CXX11
197 #define ONIXS_ILINK3_CXX14
198 #define ONIXS_ILINK3_CXX17
199 #define ONIXS_ILINK3_CXX20
200 
201 
202 #define ONIXS_ILINK3_UNUSED
203 #define ONIXS_ILINK3_DEFAULT =default
204 
205 #define ONIXS_ILINK3_GCC44_SPURIOUS_WARNING_TURNAROUND
206 
207 #endif