]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | |
2 | // Copyright Oliver Kowalke 2014. | |
3 | // Distributed under the Boost Software License, Version 1.0. | |
4 | // (See accompanying file LICENSE_1_0.txt or copy at | |
5 | // http://www.boost.org/LICENSE_1_0.txt) | |
6 | ||
7 | #ifndef BOOST_CONTEXT_DETAIL_CONFIG_H | |
8 | #define BOOST_CONTEXT_DETAIL_CONFIG_H | |
9 | ||
10 | // required for SD-6 compile-time integer sequences | |
11 | #include <utility> | |
12 | ||
13 | #include <boost/config.hpp> | |
14 | #include <boost/detail/workaround.hpp> | |
15 | ||
16 | #ifdef BOOST_CONTEXT_DECL | |
17 | # undef BOOST_CONTEXT_DECL | |
18 | #endif | |
19 | ||
20 | #if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTEXT_DYN_LINK) ) && ! defined(BOOST_CONTEXT_STATIC_LINK) | |
21 | # if defined(BOOST_CONTEXT_SOURCE) | |
22 | # define BOOST_CONTEXT_DECL BOOST_SYMBOL_EXPORT | |
23 | # define BOOST_CONTEXT_BUILD_DLL | |
24 | # else | |
25 | # define BOOST_CONTEXT_DECL BOOST_SYMBOL_IMPORT | |
26 | # endif | |
27 | #endif | |
28 | ||
29 | #if ! defined(BOOST_CONTEXT_DECL) | |
30 | # define BOOST_CONTEXT_DECL | |
31 | #endif | |
32 | ||
1e59de90 TL |
33 | #if ! defined(BOOST_USE_UCONTEXT) && defined(__CYGWIN__) |
34 | # define BOOST_USE_UCONTEXT | |
35 | #endif | |
36 | ||
7c673cae FG |
37 | #if ! defined(BOOST_CONTEXT_SOURCE) && ! defined(BOOST_ALL_NO_LIB) && ! defined(BOOST_CONTEXT_NO_LIB) |
38 | # define BOOST_LIB_NAME boost_context | |
39 | # if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTEXT_DYN_LINK) | |
40 | # define BOOST_DYN_LINK | |
41 | # endif | |
42 | # include <boost/config/auto_link.hpp> | |
43 | #endif | |
44 | ||
45 | #undef BOOST_CONTEXT_CALLDECL | |
46 | #if (defined(i386) || defined(__i386__) || defined(__i386) \ | |
47 | || defined(__i486__) || defined(__i586__) || defined(__i686__) \ | |
48 | || defined(__X86__) || defined(_X86_) || defined(__THW_INTEL__) \ | |
49 | || defined(__I86__) || defined(__INTEL__) || defined(__IA32__) \ | |
50 | || defined(_M_IX86) || defined(_I86_)) && defined(BOOST_WINDOWS) | |
51 | # define BOOST_CONTEXT_CALLDECL __cdecl | |
52 | #else | |
53 | # define BOOST_CONTEXT_CALLDECL | |
54 | #endif | |
55 | ||
56 | #if defined(BOOST_USE_SEGMENTED_STACKS) | |
57 | # if ! ( (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) ) ) || \ | |
58 | (defined(__clang__) && (__clang_major__ > 2 || ( __clang_major__ == 2 && __clang_minor__ > 3) ) ) ) | |
59 | # error "compiler does not support segmented_stack stacks" | |
60 | # endif | |
61 | # define BOOST_CONTEXT_SEGMENTS 10 | |
62 | #endif | |
63 | ||
64 | ||
65 | #define BOOST_CONTEXT_NO_CXX14_INTEGER_SEQUENCE | |
66 | // use rd6 macros for std::integer_sequence | |
67 | #if defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304 | |
68 | # undef BOOST_CONTEXT_NO_CXX14_INTEGER_SEQUENCE | |
69 | #endif | |
70 | // workaroud: MSVC 14 does not provide macros to test for compile-time integer sequence | |
71 | #if _MSC_VER > 1800 // _MSC_VER == 1800 -> MS Visual Studio 2013 | |
72 | # undef BOOST_CONTEXT_NO_INDEX_SEQUENCE | |
73 | #endif | |
74 | // workaround: Xcode clang feature detection | |
75 | #if ! defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304 | |
76 | # if _LIBCPP_STD_VER > 11 | |
77 | # undef BOOST_CONTEXT_NO_CXX14_INTEGER_SEQUENCE | |
78 | # endif | |
79 | #endif | |
80 | ||
81 | // workaroud: MSVC 14 does support constexpr | |
82 | #if _MSC_VER > 1800 // _MSC_VER == 1800 -> MS Visual Studio 2013 | |
83 | # undef BOOST_NO_CXX11_CONSTEXPR | |
84 | #endif | |
85 | ||
86 | #undef BOOST_CONTEXT_NO_CXX11 | |
87 | #if defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) || \ | |
88 | defined(BOOST_NO_CXX11_CONSTEXPR) || \ | |
89 | defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || \ | |
90 | defined(BOOST_NO_CXX11_FINAL) || \ | |
91 | defined(BOOST_NO_CXX11_HDR_TUPLE) || \ | |
92 | defined(BOOST_NO_CXX11_NOEXCEPT) || \ | |
93 | defined(BOOST_NO_CXX11_NULLPTR) || \ | |
94 | defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \ | |
95 | defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) || \ | |
96 | defined(BOOST_NO_CXX11_UNIFIED_INITIALISATION_SYNTAX) || \ | |
97 | defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || \ | |
98 | defined(BOOST_NO_HDR_ATOMIC) || \ | |
99 | defined(BOOST_NO_HDR_TUPLE) | |
100 | # define BOOST_CONTEXT_NO_CXX11 | |
101 | #endif | |
102 | ||
103 | #if ! defined(BOOST_EXECUTION_CONTEXT) | |
104 | # if defined(BOOST_USE_SEGMENTED_STACKS) | |
105 | # define BOOST_EXECUTION_CONTEXT 1 | |
106 | # else | |
107 | # define BOOST_EXECUTION_CONTEXT 2 | |
108 | # endif | |
109 | #endif | |
110 | ||
b32b8144 FG |
111 | #if ! defined(BOOST_NO_CXX11_CONSTEXPR) |
112 | // modern architectures have cachelines with 64byte length | |
113 | // ARM Cortex-A15 32/64byte, Cortex-A9 16/32/64bytes | |
114 | // MIPS 74K: 32byte, 4KEc: 16byte | |
115 | // ist should be safe to use 64byte for all | |
116 | static constexpr std::size_t cache_alignment{ 64 }; | |
117 | static constexpr std::size_t cacheline_length{ 64 }; | |
118 | // lookahead size for prefetching | |
119 | static constexpr std::size_t prefetch_stride{ 4 * cacheline_length }; | |
120 | #endif | |
121 | ||
92f5a8d4 TL |
122 | #if defined(__GLIBCPP__) || defined(__GLIBCXX__) |
123 | // GNU libstdc++ 3 | |
124 | # define BOOST_CONTEXT_HAS_CXXABI_H | |
125 | #endif | |
126 | ||
127 | #if defined( BOOST_CONTEXT_HAS_CXXABI_H ) | |
128 | # include <cxxabi.h> | |
129 | #endif | |
130 | ||
131 | #if defined(__OpenBSD__) | |
132 | // stacks need mmap(2) with MAP_STACK | |
133 | # define BOOST_CONTEXT_USE_MAP_STACK | |
134 | #endif | |
135 | ||
7c673cae | 136 | #endif // BOOST_CONTEXT_DETAIL_CONFIG_H |