OnixS C++ FIX Engine
4.14.0
Users' manual and 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_FIXENGINE_DOXYGEN) && ONIXS_FIXENGINE_DOXYGEN)
23
24
#include <OnixS/FIXEngine/CompilerDetection.h>
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 ONIXS_CURRENT_CXX_STD < 201103L
33
# error C++11 or later is required to use the OnixS SDK
34
#endif
35
36
#if defined(ONIXS_FIXENGINE_CXX14) && ONIXS_CURRENT_CXX_STD < 201402L
37
# error C++14 was targeted during the OnixS SDK compilation but is not detected now
38
#endif
39
40
#if defined(ONIXS_FIXENGINE_CXX17) && ONIXS_CURRENT_CXX_STD < 201703L
41
# error C++17 was targeted during the OnixS SDK compilation but is not detected now
42
#endif
43
44
#if defined(ONIXS_FIXENGINE_CXX20) && !(ONIXS_CURRENT_CXX_STD > 201703L)
45
# error C++20 was targeted during the OnixS SDK compilation but is not detected now
46
#endif
47
48
#undef ONIXS_CURRENT_CXX_STD
49
50
#if !defined ONIXS_FIXENGINE_COMPILER_IS_GNU
51
# if defined(__has_cpp_attribute)
52
# if __has_cpp_attribute(likely)
53
# define ONIXS_FIXENGINE_LIKELY_ATTR [[likely]]
54
# define ONIXS_FIXENGINE_LIKELY(cond) ((cond)) [[likely]]
55
# endif
56
# if __has_cpp_attribute(unlikely)
57
# define ONIXS_FIXENGINE_UNLIKELY_ATTR [[unlikely]]
58
# define ONIXS_FIXENGINE_UNLIKELY(cond) ((cond)) [[unlikely]]
59
# endif
60
# if __has_cpp_attribute(nodiscard)
61
# define ONIXS_FIXENGINE_NODISCARD [[nodiscard]]
62
# endif
63
# endif
64
#endif
65
66
#if defined(ONIXS_FIXENGINE_COMPILER_IS_GNU) || defined(ONIXS_FIXENGINE_COMPILER_IS_Clang)
67
68
# if !defined ONIXS_FIXENGINE_LIKELY
69
# define ONIXS_FIXENGINE_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
70
# endif
71
72
# if !defined ONIXS_FIXENGINE_LIKELY_ATTR
73
# define ONIXS_FIXENGINE_LIKELY_ATTR
74
# endif
75
76
# if !defined ONIXS_FIXENGINE_UNLIKELY
77
# define ONIXS_FIXENGINE_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
78
# endif
79
80
# if !defined ONIXS_FIXENGINE_UNLIKELY_ATTR
81
# define ONIXS_FIXENGINE_UNLIKELY_ATTR
82
# endif
83
84
# if !defined ONIXS_FIXENGINE_NODISCARD
85
# define ONIXS_FIXENGINE_NODISCARD __attribute__((warn_unused_result))
86
# endif
87
88
# define ONIXS_FIXENGINE_UNUSED __attribute__((__unused__))
89
# define ONIXS_FIXENGINE_MAY_ALIAS __attribute__((__may_alias__))
90
# define ONIXS_FIXENGINE_HOTPATH __attribute__((hot))
91
# define ONIXS_FIXENGINE_COLDPATH __attribute__((noinline,cold))
92
# define ONIXS_FIXENGINE_PURE __attribute__((pure))
93
94
#elif defined(ONIXS_FIXENGINE_COMPILER_IS_MSVC)
95
96
# if !defined ONIXS_FIXENGINE_LIKELY
97
# define ONIXS_FIXENGINE_LIKELY(cond) ((cond))
98
# endif
99
100
# if !defined ONIXS_FIXENGINE_LIKELY_ATTR
101
# define ONIXS_FIXENGINE_LIKELY_ATTR
102
# endif
103
104
# if !defined ONIXS_FIXENGINE_UNLIKELY
105
# define ONIXS_FIXENGINE_UNLIKELY(cond) ((cond))
106
# endif
107
108
# if !defined ONIXS_FIXENGINE_UNLIKELY_ATTR
109
# define ONIXS_FIXENGINE_UNLIKELY_ATTR
110
# endif
111
112
# if !defined ONIXS_FIXENGINE_NODISCARD
113
# define ONIXS_FIXENGINE_NODISCARD _Check_return_
114
# endif
115
116
# define ONIXS_FIXENGINE_PURE
117
# define ONIXS_FIXENGINE_UNUSED
118
# define ONIXS_FIXENGINE_MAY_ALIAS
119
# define ONIXS_FIXENGINE_HOTPATH
120
# define ONIXS_FIXENGINE_COLDPATH __declspec(noinline)
121
122
#else
123
# error Unsupported compiler
124
#endif
125
126
#define ONIXS_FIXENGINE_HARDWARE_DESTRUCTIVE_INTERFACE_SIZE (64)
127
128
#else
// ONIXS_FIXENGINE_DOXYGEN
129
130
#define ONIXS_FIXENGINE_EXPORTED
131
#define ONIXS_FIXENGINE_NODISCARD
132
133
#define ONIXS_FIXENGINE_HOTPATH
134
#define ONIXS_FIXENGINE_COLDPATH
135
#define ONIXS_FIXENGINE_PURE
136
137
#define ONIXS_FIXENGINE_CXX11
138
#define ONIXS_FIXENGINE_CXX14
139
#define ONIXS_FIXENGINE_CXX17
140
#define ONIXS_FIXENGINE_CXX20
141
142
#define ONIXS_FIXENGINE_UNUSED
143
#endif
OnixS
FIXEngine
Compiler.h
Technical Support:
support@onixs.biz
Copyright © 2026 OnixS. All Rights Reserved.