OnixS C++ ICE Binary Order Entry Handler
1.0.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_ICEBOE_DOXYGEN) && ONIXS_ICEBOE_DOXYGEN)
23
24
#include <
OnixS/ICE/BOE/CompilerDetection.h
>
25
#include <
OnixS/ICE/BOE/Export.h
>
26
27
#if defined(_MSC_VER) && defined(_MSVC_LANG)
28
# define ONIXS_CURRENT_CXX_STD _MSVC_LANG
29
#else
30
# define ONIXS_CURRENT_CXX_STD __cplusplus
31
#endif
32
33
#if !defined(ONIXS_ICEBOE_CXX11)
34
# error at least C++11 is required
35
# define ONIXS_ICEBOE_TERMINATE_COMPILATION
36
# endif
37
38
# if defined(ONIXS_ICEBOE_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_ICEBOE_TERMINATE_COMPILATION
42
# endif
43
# endif
44
45
# if defined(ONIXS_ICEBOE_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_ICEBOE_TERMINATE_COMPILATION
49
# endif
50
# endif
51
52
# if defined(ONIXS_ICEBOE_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_ICEBOE_TERMINATE_COMPILATION
56
# endif
57
# endif
58
59
# if defined(ONIXS_ICEBOE_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_ICEBOE_TERMINATE_COMPILATION
63
# endif
64
# endif
65
66
# if defined(ONIXS_ICEBOE_TERMINATE_COMPILATION)
67
# include <terminate_compilation>
68
#endif
69
70
#define ONIXS_ICEBOE_TO_STR(entity) #entity
71
#define ONIXS_ICEBOE_CONCATENATE_IMPL(X,Y) X##Y
72
#define ONIXS_ICEBOE_CONCATENATE(X,Y) ONIXS_ICEBOE_CONCATENATE_IMPL(X,Y)
73
#define ONIXS_ICEBOE_MAKE_UNIQUE_NAME(name) ONIXS_ICEBOE_CONCATENATE(___, ONIXS_ICEBOE_CONCATENATE(name, __LINE__))
74
75
# if defined(ONIXS_ICEBOE_COMPILER_IS_GNU) | defined(ONIXS_ICEBOE_COMPILER_IS_Clang)
76
# define ONIXS_ICEBOE_COMPILER_IS_GNU_or_Clang
77
# endif
78
79
80
# if defined(ONIXS_ICEBOE_COMPILER_IS_GNU_or_Clang)
81
82
#if ((ONIXS_CURRENT_CXX_STD >= 201703L) && (!defined(ONIXS_ICEBOE_CXX17)))
83
# define _ONIXS_ICEBOE_DTS_BUILD 1
84
#else
85
# define _ONIXS_ICEBOE_DTS_BUILD 0
86
#endif
87
88
#if defined(ONIXS_ICEBOE_COMPILER_IS_GNU)
89
# if (__GNUC__ >= 9) && !_ONIXS_ICEBOE_DTS_BUILD
90
# define ONIXS_ICEBOE_LIKELY(cond) (__builtin_expect_with_probability((static_cast<bool>((cond))), true, 0.99999f))
91
# define ONIXS_ICEBOE_UNLIKELY(cond) (__builtin_expect_with_probability((static_cast<bool>((cond))), false, 0.99999f))
92
# else
93
# define ONIXS_ICEBOE_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
94
# define ONIXS_ICEBOE_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
95
# endif
96
#endif
97
98
#undef _ONIXS_ICEBOE_DTS_BUILD
99
100
#if defined(ONIXS_ICEBOE_COMPILER_IS_Clang)
101
# define ONIXS_ICEBOE_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
102
# define ONIXS_ICEBOE_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
103
#endif
104
105
# define ONIXS_ICEBOE_UNUSED __attribute__((__unused__))
106
# define ONIXS_ICEBOE_HOTPATH __attribute__((hot))
107
# define ONIXS_ICEBOE_COLDPATH __attribute__((noinline,cold))
108
# define ONIXS_ICEBOE_NODISCARD __attribute__((warn_unused_result))
109
# define ONIXS_ICEBOE_PURE
110
# define ONIXS_ICEBOE_NONULL __attribute__((nonnull))
111
# define ONIXS_ICEBOE_FORCEINLINE inline __attribute__ ((__always_inline__))
112
# define ONIXS_ICEBOE_PRAGMA(x) _Pragma(#x)
113
114
// https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html
115
#if defined(__cpp_noexcept_function_type) && __cpp_noexcept_function_type >= 201510L
116
# define ONIXS_ICEBOE_CXX17_NOEXCEPT 1
117
#else
118
# define ONIXS_ICEBOE_CXX17_NOEXCEPT 0
119
#endif
120
121
122
123
#elif defined(ONIXS_ICEBOE_COMPILER_IS_MSVC)
124
125
# define ONIXS_ICEBOE_LIKELY(cond) ((cond))
126
# define ONIXS_ICEBOE_UNLIKELY(cond) ((cond))
127
# define ONIXS_ICEBOE_PURE
128
# define ONIXS_ICEBOE_UNUSED
129
# define ONIXS_ICEBOE_HOTPATH
130
# define ONIXS_ICEBOE_COLDPATH
131
# define ONIXS_ICEBOE_NODISCARD _Check_return_
132
# define ONIXS_ICEBOE_NONULL
133
# define ONIXS_ICEBOE_FORCEINLINE inline
134
# define ONIXS_ICEBOE_PRAGMA(x) __pragma(x)
135
136
#else
137
# error Unsupported compiler
138
#endif
139
140
#define ONIXS_ICEBOE_STATIC_ASSERT(...) static_assert(__VA_ARGS__, "")
141
#define ONIXS_ICEBOE_CHECK_NOTHROW(equation) ONIXS_ICEBOE_STATIC_ASSERT(noexcept((equation)))
142
143
144
#if defined NDEBUG
145
# define ONIXS_ICEBOE_ASSERT(CHECK) void(0)
146
#else
147
# define ONIXS_ICEBOE_ASSERT(CHECK) ((CHECK) ? void(0) : []() {assert(!#CHECK);}())
148
#endif
149
150
#define ONIXS_ICEBOE_HARDWARE_DESTRUCTIVE_INTERFACE_SIZE (64)
151
152
#else
//#if !(defined(ONIXS_DOXYGEN) && ONIXS_DOXYGEN)
153
#define ONIXS_ICEBOE_EXPORTED
154
#define ONIXS_ICEBOE_NODISCARD
155
#define ONIXS_ICEBOE_HOTPATH
156
#define ONIXS_ICEBOE_COLDPATH
157
#define ONIXS_ICEBOE_PURE
158
#define ONIXS_ICEBOE_CXX11
159
#define ONIXS_ICEBOE_CXX14
160
#define ONIXS_ICEBOE_CXX17
161
#define ONIXS_ICEBOE_CXX20
162
#define ONIXS_ICEBOE_UNUSED
163
#define ONIXS_ICEBOE_CXX17_NOEXCEPT 0
164
#define ONIXS_ICEBOE_PRAGMA(x)
165
#endif
166
167
#define ONIXS_ICEBOE_DATA_PACKING_BEGIN(alignment) ONIXS_ICEBOE_PRAGMA(pack(push, alignment))
168
#define ONIXS_ICEBOE_DATA_PACKING_END ONIXS_ICEBOE_PRAGMA(pack(pop))
CompilerDetection.h
Export.h
OnixS
ICE
BOE
Compiler.h
Technical Support:
support@onixs.biz
Copyright © 2025 OnixS. All Rights Reserved.