Files
2024-09-23 12:00:04 -04:00

217 lines
6.6 KiB
C++

/*
* Copyright Onix Solutions Limited [OnixS]. All rights reserved.
*
* This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
* and international copyright treaties.
*
* Access to and use of the software is governed by the terms of the applicable ONIXS Software
* Services Agreement (the Agreement) and Customer end user license agreements granting
* a non-assignable, non-transferable and non-exclusive license to use the software
* for it's own data processing purposes under the terms defined in the Agreement.
*
* Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
* of this source code or associated reference material to any other location for further reproduction
* or redistribution, and any amendments to this copyright notice, are expressly prohibited.
*
* Any reproduction or redistribution for sale or hiring of the Software not in accordance with
* the terms of the Agreement is a violation of copyright law.
*/
#pragma once
#if !(defined(ONIXS_FIXENGINE_DOXYGEN) && ONIXS_FIXENGINE_DOXYGEN)
#include <OnixS/FIXEngine/CompilerDetection.h>
#if defined(__GNUC__)
#define ONIXS_FIXENGINE_MAY_ALIAS __attribute__((__may_alias__))
#else
#define ONIXS_FIXENGINE_MAY_ALIAS
#endif
// https://bugzilla.redhat.com/show_bug.cgi?id=702984
#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
#define ONIXS_FIXENGINE_GCC44_SPURIOUS_WARNING_TURNAROUND ONIXS_FIXENGINE_MAY_ALIAS
#else
#define ONIXS_FIXENGINE_GCC44_SPURIOUS_WARNING_TURNAROUND
#endif
# if defined(ONIXS_FIXENGINE_COMPILER_CXX_NOEXCEPT) && ONIXS_FIXENGINE_COMPILER_CXX_NOEXCEPT
# define ONIXS_FIXENGINE_NOTHROW noexcept
# else
# define ONIXS_FIXENGINE_NOTHROW throw()
# endif
# if defined(ONIXS_FIXENGINE_COMPILER_CXX_EXPLICIT_CONVERSIONS) && ONIXS_FIXENGINE_COMPILER_CXX_EXPLICIT_CONVERSIONS
# define ONIXS_FIXENGINE_EXPLICIT explicit
#else
# define ONIXS_FIXENGINE_EXPLICIT
#endif
#if (__cplusplus >= 201103L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || (defined(__GXX_EXPERIMENTAL_CXX0X__) && (__GXX_EXPERIMENTAL_CXX0X__))
# define ONIXS_FIXENGINE_CXX11
#endif
#if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
# define ONIXS_FIXENGINE_CXX17
#endif
# if defined(ONIXS_FIXENGINE_COMPILER_CXX_CONSTEXPR) && ONIXS_FIXENGINE_COMPILER_CXX_CONSTEXPR
# define ONIXS_FIXENGINE_CONST_OR_CONSTEXPR constexpr
#else
# define ONIXS_FIXENGINE_CONST_OR_CONSTEXPR const
#endif
#if defined(__GNUC__)
# define ONIXS_FIXENGINE_CHECK_EXPECT(exp,c) (__builtin_expect((exp), (c)))
#else
# define ONIXS_FIXENGINE_CHECK_EXPECT(exp,c) ((exp))
#endif
#if !defined(ONIXS_FIXENGINE_NORETURN)
# if defined(_MSC_VER)
# define ONIXS_FIXENGINE_NORETURN __declspec(noreturn)
# elif defined(__GNUC__)
# define ONIXS_FIXENGINE_NORETURN __attribute__ ((__noreturn__))
# elif defined(__has_cpp_attribute)
# if __has_cpp_attribute(noreturn)
# define ONIXS_FIXENGINE_NORETURN [[noreturn]]
# endif
# endif
#endif
#if !defined(ONIXS_FIXENGINE_NORETURN)
# define ONIXS_FIXENGINE_NORETURN
#endif
#if !defined(ONIXS_FIXENGINE_NODISCARD)
# if defined(_MSC_VER)
# define ONIXS_FIXENGINE_NODISCARD _Check_return_
# elif defined(__GNUC__)
# define ONIXS_FIXENGINE_NODISCARD __attribute__((warn_unused_result))
# elif defined(__has_cpp_attribute)
# if __has_cpp_attribute(nodiscard)
# define ONIXS_FIXENGINE_NODISCARD [[nodiscard]]
# endif
# endif
#endif
#if defined(__has_cpp_attribute)
# if __has_cpp_attribute(unlikely)
# define ONIXS_FIXENGINE_UNLIKELY_ATTR [[unlikely]]
# endif
#endif
#if !defined(ONIXS_FIXENGINE_UNLIKELY_ATTR)
# define ONIXS_FIXENGINE_UNLIKELY_ATTR
#endif
#if defined(__has_cpp_attribute)
# if __has_cpp_attribute(likely)
# define ONIXS_FIXENGINE_LIKELY_ATTR [[likely]]
# endif
#endif
#if !defined(ONIXS_FIXENGINE_LIKELY_ATTR)
# define ONIXS_FIXENGINE_LIKELY_ATTR
#endif
#if !defined(ONIXS_FIXENGINE_NODISCARD)
# define ONIXS_FIXENGINE_NODISCARD
#endif
#if defined(__GNUC__)
# define ONIXS_FIXENGINE_UNUSED __attribute__((__unused__))
#else
# define ONIXS_FIXENGINE_UNUSED
#endif
#if defined(__GNUC__)
# define ONIXS_FIXENGINE_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
# define ONIXS_FIXENGINE_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
#else
# if defined(__has_cpp_attribute)
# if __has_cpp_attribute(unlikely)
# define ONIXS_FIXENGINE_UNLIKELY(cond) ((cond)) [[unlikely]]
# define ONIXS_FIXENGINE_LIKELY(cond) ((cond)) [[likely]]
# endif
# endif
#endif
#if !defined(ONIXS_FIXENGINE_LIKELY)
# define ONIXS_FIXENGINE_LIKELY(cond) ((cond))
#endif
#if !defined(ONIXS_FIXENGINE_UNLIKELY)
# define ONIXS_FIXENGINE_UNLIKELY(cond) ((cond))
#endif
#if defined(__GNUC__)
#define ONIXS_FIXENGINE_HOTPATH __attribute__((hot))
#define ONIXS_FIXENGINE_COLDPATH __attribute__((noinline,cold))
#define ONIXS_FIXENGINE_PURE __attribute__((pure))
#else
#if defined(_MSC_VER)
#define ONIXS_FIXENGINE_COLDPATH __declspec(noinline)
#else
#define ONIXS_FIXENGINE_COLDPATH
#endif
#define ONIXS_FIXENGINE_HOTPATH
#define ONIXS_FIXENGINE_PURE
#endif
#if defined (ONIXS_FIXENGINE_CXX11)
# define ONIXS_FIXENGINE_HAS_TYPE_TRAITS
#endif
#if defined(ONIXS_FIXENGINE_CXX17)
# define ONIXS_FIXENGINE_HAS_STRING_VIEW
#endif
#if defined(ONIXS_FIXENGINE_COMPILER_CXX_DEFAULTED_FUNCTIONS) && ONIXS_FIXENGINE_COMPILER_CXX_DEFAULTED_FUNCTIONS
# define ONIXS_FIXENGINE_DEFAULT = default;
#else
# define ONIXS_FIXENGINE_DEFAULT {}
#endif
#if defined NDEBUG
# define ONIXS_FIXENGINE_ASSERT(CHECK) void(0)
#else
# if !defined(ONIXS_FIXENGINE_CXX11)
# define ONIXS_FIXENGINE_ASSERT(CHECK) (assert((CHECK)))
# else
# define ONIXS_FIXENGINE_ASSERT(CHECK) \
(ONIXS_FIXENGINE_LIKELY(CHECK) ? void(0) : []() {assert(!#CHECK);}())
# endif
#endif
#define ONIXS_FIXENGINE_HARDWARE_DESTRUCTIVE_INTERFACE_SIZE (64)
#else //#if !(defined(ONIXS_DOXYGEN) && ONIXS_DOXYGEN)
#define ONIXS_FIXENGINE_CXX11
#define ONIXS_FIXENGINE_UNUSED
#define ONIXS_FIXENGINE_EXPORTED
#define ONIXS_FIXENGINE_GCC44_SPURIOUS_WARNING_TURNAROUND
#define ONIXS_FIXENGINE_NOTHROW noexcept
#define ONIXS_FIXENGINE_EXPLICIT explicit
#define ONIXS_FIXENGINE_CONST_OR_CONSTEXPR constexpr
#define ONIXS_FIXENGINE_CONSTEXPR constexpr
#define ONIXS_FIXENGINE_OVERRIDE override
#define ONIXS_FIXENGINE_FINAL final
#define ONIXS_FIXENGINE_COMPILER_CXX_NULLPTR nullptr
#define ONIXS_FIXENGINE_NORETURN
#define ONIXS_FIXENGINE_NODISCARD
#define ONIXS_FIXENGINE_HOTPATH
#define ONIXS_FIXENGINE_COLDPATH
#define ONIXS_FIXENGINE_PURE
#define ONIXS_FIXENGINE_HAS_TYPE_TRAITS
#define ONIXS_FIXENGINE_HAS_STRING_VIEW
#endif