OnixS C++ CME iLink 3 Binary Order Entry Handler 1.19.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_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) || (ONIXS_CURRENT_CXX_STD < 201103L)
33# error At least C++11 is reqired to build this project
34# define ONIXS_TERMINATE_COMPILATION
35#endif
36
37# if defined(ONIXS_ILINK3_CXX14)
38# if (ONIXS_CURRENT_CXX_STD < 201402L)
39# error C++14 was targeted during the OnixS SDK compilation but is not detected now
40# define ONIXS_TERMINATE_COMPILATION
41# endif
42# endif
43
44# if defined(ONIXS_ILINK3_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# define ONIXS_TERMINATE_COMPILATION
48# endif
49# endif
50
51# if defined(ONIXS_ILINK3_CXX20)
52# if !(ONIXS_CURRENT_CXX_STD > 201703L)
53# error C++20 was targeted during the OnixS SDK compilation but is not detected now
54# define ONIXS_TERMINATE_COMPILATION
55# endif
56# endif
57
58# if defined(ONIXS_TERMINATE_COMPILATION)
59# include <terminate_compilation>
60#endif
61
62#if defined(__has_cpp_attribute)
63# define ONIXS_ILINK3_HAS_CPP_ATTRIBUTE(attr) __has_cpp_attribute(attr)
64#else
65# define ONIXS_ILINK3_HAS_CPP_ATTRIBUTE(attr) (0)
66#endif
67
68#if ((ONIXS_CURRENT_CXX_STD >= 201703L) && (!defined(ONIXS_ILINK3_CXX17)))
69# define _ONIXS_ILINK3_DTS_BUILD 1
70#else
71# define _ONIXS_ILINK3_DTS_BUILD 0
72#endif
73
74#if defined(ONIXS_ILINK3_COMPILER_IS_GNU)
75# if (__GNUC__ >= 9) && !_ONIXS_ILINK3_DTS_BUILD
76# define ONIXS_ILINK3_LIKELY(cond) (__builtin_expect_with_probability((static_cast<bool>((cond))), true, 0.99999f))
77# define ONIXS_ILINK3_UNLIKELY(cond) (__builtin_expect_with_probability((static_cast<bool>((cond))), false, 0.99999f))
78# else
79# define ONIXS_ILINK3_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
80# define ONIXS_ILINK3_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
81# endif
82#endif
83
84#undef _ONIXS_ILINK3_DTS_BUILD
85
86#if defined(ONIXS_ILINK3_COMPILER_IS_Clang)
87# define ONIXS_ILINK3_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
88# define ONIXS_ILINK3_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
89#endif
90
91#if !defined(ONIXS_ILINK3_LIKELY)
92# if ONIXS_ILINK3_HAS_CPP_ATTRIBUTE(likely)
93# define ONIXS_ILINK3_LIKELY(cond) ((cond)) [[likely]]
94#else
95# define ONIXS_ILINK3_LIKELY(cond) ((cond))
96# endif
97#endif
98
99#if !defined(ONIXS_ILINK3_UNLIKELY)
100# if ONIXS_ILINK3_HAS_CPP_ATTRIBUTE(unlikely)
101# define ONIXS_ILINK3_UNLIKELY(cond) ((cond)) [[unlikely]]
102#else
103# define ONIXS_ILINK3_UNLIKELY(cond) ((cond))
104#endif
105#endif
106
107
108# if defined(ONIXS_ILINK3_COMPILER_IS_GNU) | defined(ONIXS_ILINK3_COMPILER_IS_Clang)
109# define ONIXS_ILINK3_COMPILER_IS_GNU_or_Clang
110# endif
111
112# if defined(ONIXS_ILINK3_COMPILER_IS_GNU_or_Clang)
113# define ONIXS_ILINK3_UNUSED __attribute__((__unused__))
114# define ONIXS_ILINK3_MAY_ALIAS __attribute__((__may_alias__))
115# define ONIXS_ILINK3_HOTPATH __attribute__((hot))
116# define ONIXS_ILINK3_COLDPATH __attribute__((noinline,cold))
117# define ONIXS_ILINK3_NORETURN __attribute__ ((__noreturn__))
118# define ONIXS_ILINK3_NODISCARD __attribute__((warn_unused_result))
119# define ONIXS_ILINK3_PURE
120# define ONIXS_ILINK3_NONULL __attribute__((nonnull))
121
122#elif defined(ONIXS_ILINK3_COMPILER_IS_MSVC)
123# define ONIXS_ILINK3_PURE
124# define ONIXS_ILINK3_UNUSED
125# define ONIXS_ILINK3_MAY_ALIAS
126# define ONIXS_ILINK3_HOTPATH
127# define ONIXS_ILINK3_COLDPATH
128# define ONIXS_ILINK3_NORETURN __declspec(noreturn)
129# define ONIXS_ILINK3_NODISCARD _Check_return_
130# define ONIXS_ILINK3_NONULL
131#else
132# error Unsupported compiler
133#endif
134
135# define ONIXS_ILINK3_CHECK_NOTHROW(equation) static_assert(noexcept((equation)), "must be noexcept")
136
137#if defined NDEBUG
138# define ONIXS_ILINK3_ASSERT(CHECK) static_cast<void>((CHECK))
139#else
140# define ONIXS_ILINK3_ASSERT(CHECK) ((CHECK) ? void(0) : []() {assert(!#CHECK);}())
141#endif
142
143#else //#if !(defined(ONIXS_DOXYGEN) && ONIXS_DOXYGEN)
144
145#define ONIXS_ILINK3_EXPORTED
146#define ONIXS_ILINK3_NORETURN
147#define ONIXS_ILINK3_NODISCARD
148#define ONIXS_ILINK3_HOTPATH
149#define ONIXS_ILINK3_COLDPATH
150#define ONIXS_ILINK3_PURE
151#define ONIXS_ILINK3_CXX11
152#define ONIXS_ILINK3_CXX14
153#define ONIXS_ILINK3_CXX17
154#define ONIXS_ILINK3_CXX20
155#define ONIXS_ILINK3_UNUSED
156#define ONIXS_ILINK3_CHECK_NOTHROW(equation)
157#define ONIXS_ILINK3_LIKELY(cond) ((cond))
158#define ONIXS_ILINK3_UNLIKELY(cond) ((cond))
159
160#endif
161
162#define ONIXS_ILINK3_HARDWARE_DESTRUCTIVE_INTERFACE_SIZE (64)