1 | /* |
2 | Copyright (c) 2005-2019 Intel Corporation |
3 | |
4 | Licensed under the Apache License, Version 2.0 (the "License"); |
5 | you may not use this file except in compliance with the License. |
6 | You may obtain a copy of the License at |
7 | |
8 | http://www.apache.org/licenses/LICENSE-2.0 |
9 | |
10 | Unless required by applicable law or agreed to in writing, software |
11 | distributed under the License is distributed on an "AS IS" BASIS, |
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | See the License for the specific language governing permissions and |
14 | limitations under the License. |
15 | */ |
16 | |
17 | #ifndef __TBB_harness_defs_H |
18 | #define __TBB_harness_defs_H |
19 | |
20 | #include "tbb/tbb_config.h" |
21 | #if __FreeBSD__ |
22 | #include <sys/param.h> // for __FreeBSD_version |
23 | #endif |
24 | |
25 | #if __TBB_TEST_PIC && !__PIC__ |
26 | #define __TBB_TEST_SKIP_PIC_MODE 1 |
27 | #else |
28 | #define __TBB_TEST_SKIP_PIC_MODE 0 |
29 | #endif |
30 | |
31 | // no need to test GCC builtins mode on ICC |
32 | #define __TBB_TEST_SKIP_GCC_BUILTINS_MODE ( __TBB_TEST_BUILTINS && (!__TBB_GCC_BUILTIN_ATOMICS_PRESENT || __INTEL_COMPILER) ) |
33 | |
34 | #define __TBB_TEST_SKIP_ICC_BUILTINS_MODE ( __TBB_TEST_BUILTINS && !__TBB_ICC_BUILTIN_ATOMICS_PRESENT ) |
35 | |
36 | #ifndef TBB_USE_GCC_BUILTINS |
37 | // Force TBB to use GCC intrinsics port, but not on ICC, as no need |
38 | #define TBB_USE_GCC_BUILTINS ( __TBB_TEST_BUILTINS && __TBB_GCC_BUILTIN_ATOMICS_PRESENT && !__INTEL_COMPILER ) |
39 | #endif |
40 | |
41 | #ifndef TBB_USE_ICC_BUILTINS |
42 | // Force TBB to use ICC c++11 style intrinsics port |
43 | #define TBB_USE_ICC_BUILTINS ( __TBB_TEST_BUILTINS && __TBB_ICC_BUILTIN_ATOMICS_PRESENT ) |
44 | #endif |
45 | |
46 | #if (_WIN32 && !__TBB_WIN8UI_SUPPORT) || (__linux__ && !__ANDROID__ && !__bg__) || __FreeBSD_version >= 701000 |
47 | #define __TBB_TEST_SKIP_AFFINITY 0 |
48 | #else |
49 | #define __TBB_TEST_SKIP_AFFINITY 1 |
50 | #endif |
51 | |
52 | #if __INTEL_COMPILER |
53 | #define __TBB_CPP11_REFERENCE_WRAPPER_PRESENT ( __INTEL_CXX11_MODE__ && __INTEL_COMPILER >= 1200 && \ |
54 | ( _MSC_VER >= 1600 || __TBB_GLIBCXX_VERSION >= 40400 || ( _LIBCPP_VERSION && __cplusplus >= 201103L ) ) ) |
55 | #define __TBB_RANGE_BASED_FOR_PRESENT ( __INTEL_CXX11_MODE__ && __INTEL_COMPILER >= 1300 ) |
56 | #define __TBB_SCOPED_ENUM_PRESENT ( __INTEL_CXX11_MODE__ && __INTEL_COMPILER > 1100 ) |
57 | #elif __clang__ |
58 | #define __TBB_CPP11_REFERENCE_WRAPPER_PRESENT ( __cplusplus >= 201103L && (__TBB_GLIBCXX_VERSION >= 40400 || _LIBCPP_VERSION) ) |
59 | #define __TBB_RANGE_BASED_FOR_PRESENT ( __has_feature(__cxx_range_for) ) |
60 | #define __TBB_SCOPED_ENUM_PRESENT ( __has_feature(cxx_strong_enums) ) |
61 | #elif __GNUC__ |
62 | #define __TBB_CPP11_REFERENCE_WRAPPER_PRESENT ( __GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40400 ) |
63 | #define __TBB_RANGE_BASED_FOR_PRESENT ( __GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40500 ) |
64 | #define __TBB_SCOPED_ENUM_PRESENT ( __GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40400 ) |
65 | #define __TBB_GCC_WARNING_IGNORED_ATTRIBUTES_PRESENT (__TBB_GCC_VERSION >= 60100) |
66 | #elif _MSC_VER |
67 | #define __TBB_CPP11_REFERENCE_WRAPPER_PRESENT ( _MSC_VER >= 1600 ) |
68 | #define __TBB_RANGE_BASED_FOR_PRESENT ( _MSC_VER >= 1700 ) |
69 | #define __TBB_SCOPED_ENUM_PRESENT ( _MSC_VER >= 1700 ) |
70 | #endif |
71 | |
72 | #define __TBB_CPP14_GENERIC_LAMBDAS_PRESENT (__cpp_generic_lambdas >= 201304 ) |
73 | |
74 | #define __TBB_TEST_SKIP_LAMBDA (__TBB_ICC_13_0_CPP11_STDLIB_SUPPORT_BROKEN || !__TBB_CPP11_LAMBDAS_PRESENT) |
75 | |
76 | #if __GNUC__ && __ANDROID__ |
77 | // On Android* OS, GCC does not support _thread keyword |
78 | #define __TBB_THREAD_LOCAL_VARIABLES_PRESENT 0 |
79 | #else |
80 | #define __TBB_THREAD_LOCAL_VARIABLES_PRESENT 1 |
81 | #endif |
82 | |
83 | // ICC has a bug in assumptions of the modifications made via atomic pointer |
84 | #define __TBB_ICC_BUILTIN_ATOMICS_POINTER_ALIASING_BROKEN (TBB_USE_ICC_BUILTINS && __INTEL_COMPILER < 1400 && __INTEL_COMPILER > 1200) |
85 | |
86 | // clang on Android/IA-32 fails on exception thrown from static move constructor |
87 | #define __TBB_CPP11_EXCEPTION_IN_STATIC_TEST_BROKEN (__ANDROID__ && __SIZEOF_POINTER__==4 && __clang__) |
88 | |
89 | // MSVC 2013 is unable to properly resolve call to overloaded operator= with std::initializer_list argument for std::pair list elements |
90 | // clang on Android/IA-32 fails on "std::vector<std::pair<int,int>> vd{{1,1},{1,1},{1,1}};" line in release mode |
91 | #define __TBB_CPP11_INIT_LIST_TEST_BROKEN (_MSC_VER <= 1800 && _MSC_VER && !__INTEL_COMPILER) || (__ANDROID__ && __TBB_x86_32 && __clang__) |
92 | // MSVC 2013 is unable to manage lifetime of temporary objects passed to a std::initializer_list constructor properly |
93 | #define __TBB_CPP11_INIT_LIST_TEMP_OBJS_LIFETIME_BROKEN (_MSC_FULL_VER < 180030501 && _MSC_VER && !__INTEL_COMPILER) |
94 | |
95 | // Implementation of C++11 std::placeholders in libstdc++ coming with GCC prior to 4.5 reveals bug in Intel(R) C++ Compiler 13 causing "multiple definition" link errors. |
96 | #define __TBB_CPP11_STD_PLACEHOLDERS_LINKAGE_BROKEN ((__INTEL_COMPILER == 1300 || __INTEL_COMPILER == 1310) && __GXX_EXPERIMENTAL_CXX0X__ && __GLIBCXX__ && __TBB_GLIBCXX_VERSION < 40500) |
97 | |
98 | // Intel C++ Compiler has an issue when a scoped enum with a specified underlying type has negative values. |
99 | #define __TBB_ICC_SCOPED_ENUM_WITH_UNDERLYING_TYPE_NEGATIVE_VALUE_BROKEN ( _MSC_VER && !__TBB_DEBUG && __INTEL_COMPILER && __INTEL_COMPILER <= 1500 ) |
100 | // Intel C++ Compiler has an issue with __atomic_load_explicit from a scoped enum with a specified underlying type. |
101 | #define __TBB_ICC_SCOPED_ENUM_WITH_UNDERLYING_TYPE_ATOMIC_LOAD_BROKEN ( TBB_USE_ICC_BUILTINS && !__TBB_DEBUG && __INTEL_COMPILER && __INTEL_COMPILER <= 1500 ) |
102 | |
103 | // Unable to use constexpr member functions to initialize compile time constants |
104 | #define __TBB_CONSTEXPR_MEMBER_FUNCTION_BROKEN (__INTEL_COMPILER == 1500) |
105 | // Some versions of MSVC do not do compile-time initialization of static variables with constexpr constructors in debug mode |
106 | #define __TBB_STATIC_CONSTEXPR_INIT_BROKEN (_MSC_VER >= 1900 && _MSC_VER <= 1914 && !__INTEL_COMPILER && _DEBUG) |
107 | |
108 | #if __GNUC__ && __ANDROID__ |
109 | #define __TBB_EXCEPTION_TYPE_INFO_BROKEN ( __TBB_GCC_VERSION < 40600 ) |
110 | #elif _MSC_VER |
111 | #define __TBB_EXCEPTION_TYPE_INFO_BROKEN ( _MSC_VER < 1400 ) |
112 | #else |
113 | #define __TBB_EXCEPTION_TYPE_INFO_BROKEN 0 |
114 | #endif |
115 | |
116 | // a function ptr cannot be converted to const T& template argument without explicit cast |
117 | #define __TBB_FUNC_PTR_AS_TEMPL_PARAM_BROKEN ( ((__linux__ || __APPLE__) && __INTEL_COMPILER && __INTEL_COMPILER < 1100) || __SUNPRO_CC ) |
118 | |
119 | #define __TBB_UNQUALIFIED_CALL_OF_DTOR_BROKEN (__GNUC__==3 && __GNUC_MINOR__<=3) |
120 | |
121 | #define __TBB_CAS_8_CODEGEN_BROKEN (__TBB_x86_32 && __PIC__ && __TBB_GCC_VERSION == 40102 && !__INTEL_COMPILER) |
122 | |
123 | #define __TBB_THROW_FROM_DTOR_BROKEN (__clang__ && __apple_build_version__ && __apple_build_version__ < 5000279) |
124 | |
125 | // std::uncaught_exception is broken on some version of stdlibc++ (it returns true with no active exception) |
126 | #define __TBB_STD_UNCAUGHT_EXCEPTION_BROKEN (__TBB_GLIBCXX_VERSION == 40407) |
127 | |
128 | #if __TBB_LIBSTDCPP_EXCEPTION_HEADERS_BROKEN |
129 | #define _EXCEPTION_PTR_H /* prevents exception_ptr.h inclusion */ |
130 | #define _GLIBCXX_NESTED_EXCEPTION_H /* prevents nested_exception.h inclusion */ |
131 | #endif |
132 | |
133 | // TODO: Investigate the cases that require this macro. |
134 | #define __TBB_COMPLICATED_ADL_BROKEN ( __GNUC__ && __TBB_GCC_VERSION < 40400 ) |
135 | |
136 | // Intel C++ Compiler fails to compile the comparison of tuples in some cases |
137 | #if __INTEL_COMPILER && __INTEL_COMPILER < 1700 |
138 | #define __TBB_TUPLE_COMPARISON_COMPILATION_BROKEN (__TBB_GLIBCXX_VERSION >= 40800 || __MIC__) |
139 | #endif |
140 | |
141 | // Intel C++ Compiler fails to compile std::reference in some cases |
142 | #if __INTEL_COMPILER && __INTEL_COMPILER < 1600 || __INTEL_COMPILER == 1600 && __INTEL_COMPILER_UPDATE <= 1 |
143 | #define __TBB_REFERENCE_WRAPPER_COMPILATION_BROKEN (__TBB_GLIBCXX_VERSION >= 40800 && __TBB_GLIBCXX_VERSION <= 50101 || __MIC__) |
144 | #endif |
145 | |
146 | // Intel C++ Compiler fails to generate non-throwing move members for a class inherited from template |
147 | #define __TBB_NOTHROW_MOVE_MEMBERS_IMPLICIT_GENERATION_BROKEN \ |
148 | (__INTEL_COMPILER>=1600 && __INTEL_COMPILER<=1900 || __INTEL_COMPILER==1500 && __INTEL_COMPILER_UPDATE>3) |
149 | |
150 | // std::is_copy_constructible<T>::value returns 'true' for non copyable type when MSVC compiler is used. |
151 | #define __TBB_IS_COPY_CONSTRUCTIBLE_BROKEN ( _MSC_VER && (_MSC_VER <= 1700 || _MSC_VER <= 1800 && !__INTEL_COMPILER) ) |
152 | |
153 | // GCC 4.7 and 4.8 might fail to take an address of overloaded template function (bug 57043) |
154 | #if __GNUC__ && !__INTEL_COMPILER && !__clang__ |
155 | #define __TBB_GCC_OVERLOADED_TEMPLATE_FUNCTION_ADDRESS_BROKEN \ |
156 | (__TBB_GCC_VERSION>=40700 && __TBB_GCC_VERSION<40704 || __TBB_GCC_VERSION>=40800 && __TBB_GCC_VERSION<40803 ) |
157 | #endif |
158 | |
159 | // Swapping of scoped_allocator_adaptors is broken on GCC 4.9 and lower and on Android for Windows |
160 | // Allocator propagation into std::pair is broken for Apple clang, lower then 9.0 |
161 | // Compilation of <scoped_allocator> header is broken for Visual Studio 2017 with ICC 17.8 |
162 | #define __TBB_SCOPED_ALLOCATOR_BROKEN (__TBB_GCC_VERSION <= 50100 || (__APPLE__ && __TBB_CLANG_VERSION < 90000) || \ |
163 | (__FreeBSD__ && __TBB_CLANG_VERSION <= 60000) || \ |
164 | (__ANDROID__ && (_WIN32 || _WIN64)) || \ |
165 | (_MSC_VER && _MSC_VER == 1912 && __INTEL_COMPILER == 1700)) |
166 | |
167 | |
168 | |
169 | // The tuple-based tests with more inputs take a long time to compile. If changes |
170 | // are made to the tuple implementation or any switch that controls it, or if testing |
171 | // with a new platform implementation of std::tuple, the test should be compiled with |
172 | // MAX_TUPLE_TEST_SIZE >= 10 (or the largest number of elements supported) to ensure |
173 | // all tuple sizes are tested. Expect a very long compile time. |
174 | #ifndef MAX_TUPLE_TEST_SIZE |
175 | #if TBB_USE_DEBUG |
176 | #define MAX_TUPLE_TEST_SIZE 3 |
177 | #else |
178 | #define MAX_TUPLE_TEST_SIZE 5 |
179 | #endif |
180 | #else |
181 | #if _MSC_VER |
182 | // test sizes <= 8 don't get "decorated name length exceeded" errors. (disable : 4503) |
183 | #if MAX_TUPLE_TEST_SIZE > 8 |
184 | #undef MAX_TUPLE_TEST_SIZE |
185 | #define MAX_TUPLE_TEST_SIZE 8 |
186 | #endif |
187 | #endif |
188 | #if MAX_TUPLE_TEST_SIZE > __TBB_VARIADIC_MAX |
189 | #undef MAX_TUPLE_TEST_SIZE |
190 | #define MAX_TUPLE_TEST_SIZE __TBB_VARIADIC_MAX |
191 | #endif |
192 | #endif |
193 | |
194 | #if __TBB_CPF_BUILD |
195 | #ifndef TBB_PREVIEW_FLOW_GRAPH_FEATURES |
196 | #define TBB_PREVIEW_FLOW_GRAPH_FEATURES 1 |
197 | #endif |
198 | #ifndef TBB_PREVIEW_FLOW_GRAPH_TRACE |
199 | #define TBB_PREVIEW_FLOW_GRAPH_TRACE 1 |
200 | #endif |
201 | #ifndef TBB_PREVIEW_ALGORITHM_TRACE |
202 | #define TBB_PREVIEW_ALGORITHM_TRACE 1 |
203 | #endif |
204 | #ifndef TBB_DEPRECATED_LIMITER_NODE_CONSTRUCTOR |
205 | #define TBB_DEPRECATED_LIMITER_NODE_CONSTRUCTOR 1 |
206 | #endif |
207 | #endif |
208 | |
209 | namespace Harness { |
210 | //! Utility template function to prevent "unused" warnings by various compilers. |
211 | template<typename T> void suppress_unused_warning( const T& ) {} |
212 | |
213 | //TODO: unify with one in tbb::internal |
214 | //! Utility helper structure to ease overload resolution |
215 | template<int > struct int_to_type {}; |
216 | } |
217 | |
218 | const unsigned MByte = 1024*1024; |
219 | |
220 | #endif /* __TBB_harness_defs_H */ |
221 | |