OnixS C++ Euronext Optiq MDG Handler 1.5.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#include <sstream>
23
24#if defined (_MSC_VER)
25# define ONIXS_EURONEXT_OPTIQMDG_COMPILER_INFO ("MSVS")
26#elif __GNUC__
27inline
28std::string compilerInfo()
29{
30 std::stringstream ss;
31 ss << "gcc " << __VERSION__ << ", std=" << __cplusplus;
32 return ss.str();
33}
34# define ONIXS_EURONEXT_OPTIQMDG_COMPILER_INFO (compilerInfo())
35#else
36# define ONIXS_EURONEXT_OPTIQMDG_COMPILER_INFO ("Unknown")
37#endif
38
39#if !(defined(ONIXS_EURONEXT_OPTIQMDG_DOXYGEN) && ONIXS_EURONEXT_OPTIQMDG_DOXYGEN)
40
41#include <OnixS/Euronext/MarketData/OptiqMdg/CompilerDetection.h>
42
43
44#if defined(_MSC_VER) && defined(_MSVC_LANG)
45# define ONIXS_EURONEXT_OPTIQMDG_CURRENT_CXX_STD _MSVC_LANG
46#else
47# define ONIXS_EURONEXT_OPTIQMDG_CURRENT_CXX_STD __cplusplus
48#endif
49
50# if defined(ONIXS_EURONEXT_OPTIQMDG_CXX11)
51# if (ONIXS_EURONEXT_OPTIQMDG_CURRENT_CXX_STD < 201103L)
52# error C++11 was targeted during the OnixS SDK compilation but is not detected now
53# endif
54# endif
55
56# if defined(ONIXS_EURONEXT_OPTIQMDG_CXX14)
57# if (ONIXS_EURONEXT_OPTIQMDG_CURRENT_CXX_STD < 201402L)
58# error C++14 was targeted during the OnixS SDK compilation but is not detected now
59# endif
60# endif
61
62# if defined(ONIXS_EURONEXT_OPTIQMDG_CXX17)
63# if (ONIXS_EURONEXT_OPTIQMDG_CURRENT_CXX_STD < 201703L)
64# error C++17 was targeted during the OnixS SDK compilation but is not detected now
65# endif
66# endif
67
68# if defined(ONIXS_EURONEXT_OPTIQMDG_CXX20)
69# if !(ONIXS_EURONEXT_OPTIQMDG_CURRENT_CXX_STD > 201703L)
70# error C++20 was targeted during the OnixS SDK compilation but is not detected now
71# endif
72# endif
73
74# if defined(ONIXS_EURONEXT_OPTIQMDG_COMPILER_IS_GNU) | defined(ONIXS_EURONEXT_OPTIQMDG_COMPILER_IS_Clang)
75# define ONIXS_EURONEXT_OPTIQMDG_COMPILER_IS_GNU_or_Clang
76# endif
77
78# if defined(ONIXS_EURONEXT_OPTIQMDG_COMPILER_IS_GNU_or_Clang)
79
80# define ONIXS_EURONEXT_OPTIQMDG_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
81# define ONIXS_EURONEXT_OPTIQMDG_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
82# define ONIXS_EURONEXT_OPTIQMDG_UNUSED __attribute__((__unused__))
83# define ONIXS_EURONEXT_OPTIQMDG_HOTPATH __attribute__((hot))
84# define ONIXS_EURONEXT_OPTIQMDG_COLDPATH __attribute__((noinline,cold))
85# define ONIXS_EURONEXT_OPTIQMDG_NORETURN __attribute__ ((__noreturn__))
86# define ONIXS_EURONEXT_OPTIQMDG_NODISCARD __attribute__((warn_unused_result))
87# define ONIXS_EURONEXT_OPTIQMDG_PURE
88
89#elif defined(ONIXS_EURONEXT_OPTIQMDG_COMPILER_IS_MSVC)
90
91# define ONIXS_EURONEXT_OPTIQMDG_LIKELY(cond) ((cond))
92# define ONIXS_EURONEXT_OPTIQMDG_UNLIKELY(cond) ((cond))
93# define ONIXS_EURONEXT_OPTIQMDG_PURE
94# define ONIXS_EURONEXT_OPTIQMDG_UNUSED
95# define ONIXS_EURONEXT_OPTIQMDG_HOTPATH
96# define ONIXS_EURONEXT_OPTIQMDG_COLDPATH
97# define ONIXS_EURONEXT_OPTIQMDG_NORETURN __declspec(noreturn)
98# define ONIXS_EURONEXT_OPTIQMDG_NODISCARD _Check_return_
99
100#else
101# error Unsupported compiler
102#endif
103
104# define ONIXS_EURONEXT_OPTIQMDG_CHECK_NOTHROW(equation) ONIXS_EURONEXT_OPTIQMDG_STATIC_ASSERT(noexcept((equation)))
105# define ONIXS_EURONEXT_OPTIQMDG_STATIC_ASSERT(X) static_assert(X, #X)
106# define ONIXS_EURONEXT_OPTIQMDG_STATIC_ASSERT_MSG(X, MSG) static_assert(X, MSG)
107
108#if defined NDEBUG
109# define ONIXS_EURONEXT_OPTIQMDG_ASSERT(CHECK) static_cast<void>((CHECK))
110#else
111# define ONIXS_EURONEXT_OPTIQMDG_ASSERT(CHECK) ((CHECK) ? void(0) : []() {assert(!#CHECK);}())
112#endif
113
114#else //#if !(defined(ONIXS_DOXYGEN) && ONIXS_DOXYGEN)
115
116#define ONIXS_EURONEXT_OPTIQMDG_EXPORTED
117
118#define ONIXS_EURONEXT_OPTIQMDG_NORETURN
119#define ONIXS_EURONEXT_OPTIQMDG_NODISCARD
120
121#define ONIXS_EURONEXT_OPTIQMDG_HOTPATH
122#define ONIXS_EURONEXT_OPTIQMDG_COLDPATH
123#define ONIXS_EURONEXT_OPTIQMDG_PURE
124
125#define ONIXS_EURONEXT_OPTIQMDG_CXX11
126#define ONIXS_EURONEXT_OPTIQMDG_CXX14
127#define ONIXS_EURONEXT_OPTIQMDG_CXX17
128#define ONIXS_EURONEXT_OPTIQMDG_CXX20
129
130#define ONIXS_EURONEXT_OPTIQMDG_UNUSED
131
132#endif