Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:45:36

0001 
0002 //          Copyright Oliver Kowalke 2014.
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //    (See accompanying file LICENSE_1_0.txt or copy at
0005 //          http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 #ifndef BOOST_CONTEXT_DETAIL_CONFIG_H
0008 #define BOOST_CONTEXT_DETAIL_CONFIG_H
0009 
0010 // required for SD-6 compile-time integer sequences
0011 #include <utility>
0012 
0013 #include <boost/config.hpp>
0014 #include <boost/detail/workaround.hpp>
0015 
0016 #ifdef BOOST_CONTEXT_DECL
0017 # undef BOOST_CONTEXT_DECL
0018 #endif
0019 
0020 #if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTEXT_DYN_LINK) ) && ! defined(BOOST_CONTEXT_STATIC_LINK)
0021 # if defined(BOOST_CONTEXT_SOURCE)
0022 #  define BOOST_CONTEXT_DECL BOOST_SYMBOL_EXPORT
0023 #  define BOOST_CONTEXT_BUILD_DLL
0024 # else
0025 #  define BOOST_CONTEXT_DECL BOOST_SYMBOL_IMPORT
0026 # endif
0027 #endif
0028 
0029 #if ! defined(BOOST_CONTEXT_DECL)
0030 # define BOOST_CONTEXT_DECL
0031 #endif
0032 
0033 #if ! defined(BOOST_USE_UCONTEXT) && defined(__CYGWIN__)
0034 # define BOOST_USE_UCONTEXT
0035 #endif
0036 
0037 #if ! defined(BOOST_CONTEXT_SOURCE) && ! defined(BOOST_ALL_NO_LIB) && ! defined(BOOST_CONTEXT_NO_LIB)
0038 # define BOOST_LIB_NAME boost_context
0039 # if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTEXT_DYN_LINK)
0040 #  define BOOST_DYN_LINK
0041 # endif
0042 # include <boost/config/auto_link.hpp>
0043 #endif
0044 
0045 #undef BOOST_CONTEXT_CALLDECL
0046 #if (defined(i386) || defined(__i386__) || defined(__i386) \
0047      || defined(__i486__) || defined(__i586__) || defined(__i686__) \
0048      || defined(__X86__) || defined(_X86_) || defined(__THW_INTEL__) \
0049      || defined(__I86__) || defined(__INTEL__) || defined(__IA32__) \
0050      || defined(_M_IX86) || defined(_I86_)) && defined(BOOST_WINDOWS)
0051 # define BOOST_CONTEXT_CALLDECL __cdecl
0052 #else
0053 # define BOOST_CONTEXT_CALLDECL
0054 #endif
0055 
0056 #if defined(BOOST_USE_SEGMENTED_STACKS)
0057 # if ! ( (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) ) ) || \
0058          (defined(__clang__) && (__clang_major__ > 2 || ( __clang_major__ == 2 && __clang_minor__ > 3) ) ) )
0059 #  error "compiler does not support segmented_stack stacks"
0060 # endif
0061 # define BOOST_CONTEXT_SEGMENTS 10
0062 #endif
0063 
0064 
0065 #define BOOST_CONTEXT_NO_CXX14_INTEGER_SEQUENCE
0066 // use rd6 macros for std::integer_sequence
0067 #if defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304
0068 # undef BOOST_CONTEXT_NO_CXX14_INTEGER_SEQUENCE
0069 #endif
0070 // workaroud: MSVC 14 does not provide macros to test for compile-time integer sequence
0071 #if _MSC_VER > 1800 // _MSC_VER == 1800 -> MS Visual Studio 2013
0072 # undef BOOST_CONTEXT_NO_INDEX_SEQUENCE
0073 #endif
0074 // workaround: Xcode clang feature detection
0075 #if ! defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304
0076 # if _LIBCPP_STD_VER > 11
0077 #  undef BOOST_CONTEXT_NO_CXX14_INTEGER_SEQUENCE
0078 # endif
0079 #endif
0080 
0081 // workaroud: MSVC 14 does support constexpr
0082 #if _MSC_VER > 1800 // _MSC_VER == 1800 -> MS Visual Studio 2013
0083 # undef BOOST_NO_CXX11_CONSTEXPR
0084 #endif
0085 
0086 #undef BOOST_CONTEXT_NO_CXX11
0087 #if defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) || \
0088     defined(BOOST_NO_CXX11_CONSTEXPR) || \
0089     defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || \
0090     defined(BOOST_NO_CXX11_FINAL) || \
0091     defined(BOOST_NO_CXX11_HDR_TUPLE) || \
0092     defined(BOOST_NO_CXX11_NOEXCEPT) || \
0093     defined(BOOST_NO_CXX11_NULLPTR) || \
0094     defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
0095     defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) || \
0096     defined(BOOST_NO_CXX11_UNIFIED_INITIALISATION_SYNTAX) || \
0097     defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || \
0098     defined(BOOST_NO_HDR_ATOMIC) || \
0099     defined(BOOST_NO_HDR_TUPLE)
0100 # define BOOST_CONTEXT_NO_CXX11
0101 #endif
0102 
0103 #if ! defined(BOOST_EXECUTION_CONTEXT)
0104 # if defined(BOOST_USE_SEGMENTED_STACKS)
0105 #  define BOOST_EXECUTION_CONTEXT 1
0106 # else
0107 #  define BOOST_EXECUTION_CONTEXT 2
0108 # endif
0109 #endif
0110 
0111 #if ! defined(BOOST_NO_CXX11_CONSTEXPR)
0112 // modern architectures have cachelines with 64byte length
0113 // ARM Cortex-A15 32/64byte, Cortex-A9 16/32/64bytes
0114 // MIPS 74K: 32byte, 4KEc: 16byte
0115 // ist should be safe to use 64byte for all
0116 static constexpr std::size_t cache_alignment{ 64 };
0117 static constexpr std::size_t cacheline_length{ 64 };
0118 // lookahead size for prefetching
0119 static constexpr std::size_t prefetch_stride{ 4 * cacheline_length };
0120 #endif
0121 
0122 #if defined(__GLIBCPP__) || defined(__GLIBCXX__)
0123 // GNU libstdc++ 3
0124 #  define BOOST_CONTEXT_HAS_CXXABI_H
0125 #endif
0126 
0127 #if defined( BOOST_CONTEXT_HAS_CXXABI_H )
0128 # include <cxxabi.h>
0129 #endif
0130 
0131 #if defined(__OpenBSD__)
0132 // stacks need mmap(2) with MAP_STACK
0133 # define BOOST_CONTEXT_USE_MAP_STACK
0134 #endif
0135 
0136 #endif // BOOST_CONTEXT_DETAIL_CONFIG_H