BRE12
tbb_config.h
1 /*
2  Copyright 2005-2016 Intel Corporation. All Rights Reserved.
3 
4  This file is part of Threading Building Blocks. Threading Building Blocks is free software;
5  you can redistribute it and/or modify it under the terms of the GNU General Public License
6  version 2 as published by the Free Software Foundation. Threading Building Blocks is
7  distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
8  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9  See the GNU General Public License for more details. You should have received a copy of
10  the GNU General Public License along with Threading Building Blocks; if not, write to the
11  Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
12 
13  As a special exception, you may use this file as part of a free software library without
14  restriction. Specifically, if other files instantiate templates or use macros or inline
15  functions from this file, or you compile this file and link it with other files to produce
16  an executable, this file does not by itself cause the resulting executable to be covered
17  by the GNU General Public License. This exception does not however invalidate any other
18  reasons why the executable file might be covered by the GNU General Public License.
19 */
20 
21 #ifndef __TBB_tbb_config_H
22 #define __TBB_tbb_config_H
23 
32 /* This macro marks incomplete code or comments describing ideas which are considered for the future.
33  * See also for plain comment with TODO and FIXME marks for small improvement opportunities.
34  */
35 #define __TBB_TODO 0
36 
37 /*Check which standard library we use on OS X.*/
38 /*__TBB_SYMBOL is defined only while processing exported symbols list where C++ is not allowed.*/
39 #if !defined(__TBB_SYMBOL) && __APPLE__
40  #include <cstddef>
41 #endif
42 
43 // note that when ICC is in use __TBB_GCC_VERSION might not closely match GCC version on the machine
44 #define __TBB_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
45 
46 #if __clang__
47 
48  #define __TBB_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
49 #endif
50 
52 #if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
53  #define __TBB_IOS 1
54 #endif
55 
58 #if _WIN32||_WIN64
59 # if defined(_M_X64)||defined(__x86_64__) // the latter for MinGW support
60 # define __TBB_x86_64 1
61 # elif defined(_M_IA64)
62 # define __TBB_ipf 1
63 # elif defined(_M_IX86)||defined(__i386__) // the latter for MinGW support
64 # define __TBB_x86_32 1
65 # else
66 # define __TBB_generic_arch 1
67 # endif
68 #else /* Assume generic Unix */
69 # if !__linux__ && !__APPLE__
70 # define __TBB_generic_os 1
71 # endif
72 # if __TBB_IOS
73 # define __TBB_generic_arch 1
74 # elif __x86_64__
75 # define __TBB_x86_64 1
76 # elif __ia64__
77 # define __TBB_ipf 1
78 # elif __i386__||__i386 // __i386 is for Sun OS
79 # define __TBB_x86_32 1
80 # else
81 # define __TBB_generic_arch 1
82 # endif
83 #endif
84 
85 #if __MIC__ || __MIC2__
86 #define __TBB_DEFINE_MIC 1
87 #endif
88 
89 #define __TBB_TSX_AVAILABLE (__TBB_x86_32 || __TBB_x86_64) && !__TBB_DEFINE_MIC
90 
93 #if __INTEL_COMPILER == 9999 && __INTEL_COMPILER_BUILD_DATE == 20110811
94 /* Intel(R) Composer XE 2011 Update 6 incorrectly sets __INTEL_COMPILER. Fix it. */
95  #undef __INTEL_COMPILER
96  #define __INTEL_COMPILER 1210
97 #endif
98 
99 #if __TBB_GCC_VERSION >= 40400 && !defined(__INTEL_COMPILER)
100 
101  #define __TBB_GCC_WARNING_SUPPRESSION_PRESENT 1
102 #endif
103 
104 /* Select particular features of C++11 based on compiler version.
105  ICC 12.1 (Linux), GCC 4.3 and higher, clang 2.9 and higher
106  set __GXX_EXPERIMENTAL_CXX0X__ in c++11 mode.
107 
108  Compilers that mimics other compilers (ICC, clang) must be processed before
109  compilers they mimic (GCC, MSVC).
110 
111  TODO: The following conditions should be extended when new compilers/runtimes
112  support added.
113  */
114 
119 #if __INTEL_COMPILER && !__INTEL_CXX11_MODE__
120  // __INTEL_CXX11_MODE__ is not set, try to deduce it
121  #define __INTEL_CXX11_MODE__ (__GXX_EXPERIMENTAL_CXX0X__ || (_MSC_VER && __STDC_HOSTED__))
122 #endif
123 
124 #if __INTEL_COMPILER && (!_MSC_VER || __INTEL_CXX11_MODE__)
125  // On Windows, C++11 features supported by Visual Studio 2010 and higher are enabled by default,
126  // so in absense of /Qstd= use MSVC branch for __TBB_CPP11_* detection.
127  // On other platforms, no -std= means C++03.
128 
129  #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT (__INTEL_CXX11_MODE__ && __VARIADIC_TEMPLATES)
130  // Both r-value reference support in compiler and std::move/std::forward
131  // presence in C++ standard library is checked.
132  #define __TBB_CPP11_RVALUE_REF_PRESENT ((__GXX_EXPERIMENTAL_CXX0X__ && (__TBB_GCC_VERSION >= 40300 || _LIBCPP_VERSION) || _MSC_VER >= 1600) && __INTEL_COMPILER >= 1200)
133  #if _MSC_VER >= 1600
134  #define __TBB_EXCEPTION_PTR_PRESENT ( __INTEL_COMPILER > 1300 \
135  /*ICC 12.1 Upd 10 and 13 beta Upd 2 fixed exception_ptr linking issue*/ \
136  || (__INTEL_COMPILER == 1300 && __INTEL_COMPILER_BUILD_DATE >= 20120530) \
137  || (__INTEL_COMPILER == 1210 && __INTEL_COMPILER_BUILD_DATE >= 20120410) )
138 
141  #elif __TBB_GCC_VERSION >= 40404 && __TBB_GCC_VERSION < 40600
142  #define __TBB_EXCEPTION_PTR_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __INTEL_COMPILER >= 1200)
143  #elif __TBB_GCC_VERSION >= 40600
144  #define __TBB_EXCEPTION_PTR_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __INTEL_COMPILER >= 1300)
145  #elif _LIBCPP_VERSION
146  #define __TBB_EXCEPTION_PTR_PRESENT __GXX_EXPERIMENTAL_CXX0X__
147  #else
148  #define __TBB_EXCEPTION_PTR_PRESENT 0
149  #endif
150  #define __TBB_STATIC_ASSERT_PRESENT (__INTEL_CXX11_MODE__ || _MSC_VER >= 1600)
151  #define __TBB_CPP11_TUPLE_PRESENT (_MSC_VER >= 1600 || (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40300))
152  #if (__clang__ && __INTEL_COMPILER > 1400)
153  /* Older versions of Intel Compiler do not have __has_include */
154  #if (__has_feature(__cxx_generalized_initializers__) && __has_include(<initializer_list>))
155  #define __TBB_INITIALIZER_LISTS_PRESENT 1
156  #endif
157  #else
158  #define __TBB_INITIALIZER_LISTS_PRESENT __INTEL_CXX11_MODE__ && __INTEL_COMPILER >= 1400 && (_MSC_VER >= 1800 || __TBB_GCC_VERSION >= 40400 || _LIBCPP_VERSION)
159  #endif
160 
161  #define __TBB_CONSTEXPR_PRESENT __INTEL_CXX11_MODE__ && __INTEL_COMPILER >= 1400
162  #define __TBB_DEFAULTED_AND_DELETED_FUNC_PRESENT __INTEL_CXX11_MODE__ && __INTEL_COMPILER >= 1200
163 
164  #define __TBB_NOEXCEPT_PRESENT __INTEL_CXX11_MODE__ && __INTEL_COMPILER >= 1300 && (__TBB_GCC_VERSION >= 40600 || _LIBCPP_VERSION || _MSC_VER)
165  #define __TBB_CPP11_STD_BEGIN_END_PRESENT (_MSC_VER >= 1700 || __GXX_EXPERIMENTAL_CXX0X__ && __INTEL_COMPILER >= 1310 && (__TBB_GCC_VERSION >= 40600 || _LIBCPP_VERSION))
166  #define __TBB_CPP11_AUTO_PRESENT (_MSC_VER >= 1600 || __GXX_EXPERIMENTAL_CXX0X__ && __INTEL_COMPILER >= 1210)
167  #define __TBB_CPP11_DECLTYPE_PRESENT (_MSC_VER >= 1600 || __GXX_EXPERIMENTAL_CXX0X__ && __INTEL_COMPILER >= 1210)
168  #define __TBB_CPP11_LAMBDAS_PRESENT (__INTEL_CXX11_MODE__ && __INTEL_COMPILER >= 1200)
169  #define __TBB_CPP11_DEFAULT_FUNC_TEMPLATE_ARGS_PRESENT (_MSC_VER >= 1800 || __GXX_EXPERIMENTAL_CXX0X__ && __INTEL_COMPILER >= 1210)
170 #elif __clang__
171 //TODO: these options need to be rechecked
174  #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT (__has_feature(__cxx_variadic_templates__))
175  #define __TBB_CPP11_RVALUE_REF_PRESENT (__has_feature(__cxx_rvalue_references__) && (__TBB_GCC_VERSION >= 40300 || _LIBCPP_VERSION))
176 
177  #define __TBB_EXCEPTION_PTR_PRESENT (__cplusplus >= 201103L && _LIBCPP_VERSION)
178  #define __TBB_STATIC_ASSERT_PRESENT __has_feature(__cxx_static_assert__)
179 
181  #if (__GXX_EXPERIMENTAL_CXX0X__ && __has_include(<tuple>))
182  #define __TBB_CPP11_TUPLE_PRESENT 1
183  #endif
184  #if (__has_feature(__cxx_generalized_initializers__) && __has_include(<initializer_list>))
185  #define __TBB_INITIALIZER_LISTS_PRESENT 1
186  #endif
187  #define __TBB_CONSTEXPR_PRESENT __has_feature(__cxx_constexpr__)
188  #define __TBB_DEFAULTED_AND_DELETED_FUNC_PRESENT (__has_feature(__cxx_defaulted_functions__) && __has_feature(__cxx_deleted_functions__))
189 
190  #define __TBB_NOEXCEPT_PRESENT (__cplusplus >= 201103L)
191  #define __TBB_CPP11_STD_BEGIN_END_PRESENT (__has_feature(__cxx_range_for__) && _LIBCPP_VERSION)
192  #define __TBB_CPP11_AUTO_PRESENT __has_feature(__cxx_auto_type__)
193  #define __TBB_CPP11_DECLTYPE_PRESENT __has_feature(__cxx_decltype__)
194  #define __TBB_CPP11_LAMBDAS_PRESENT __has_feature(cxx_lambdas)
195  #define __TBB_CPP11_DEFAULT_FUNC_TEMPLATE_ARGS_PRESENT __has_feature(cxx_default_function_template_args)
196 #elif __GNUC__
197  #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT __GXX_EXPERIMENTAL_CXX0X__
198  #define __TBB_CPP11_RVALUE_REF_PRESENT __GXX_EXPERIMENTAL_CXX0X__
199 
202  #define __TBB_EXCEPTION_PTR_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40404 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
203  #define __TBB_STATIC_ASSERT_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40300)
204  #define __TBB_CPP11_TUPLE_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40300)
205  #define __TBB_INITIALIZER_LISTS_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40400)
206 
207  #define __TBB_CONSTEXPR_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40400)
208  #define __TBB_DEFAULTED_AND_DELETED_FUNC_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40400)
209  #define __TBB_NOEXCEPT_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40600)
210  #define __TBB_CPP11_STD_BEGIN_END_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40600)
211  #define __TBB_CPP11_AUTO_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40400)
212  #define __TBB_CPP11_DECLTYPE_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40400)
213  #define __TBB_CPP11_LAMBDAS_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40500)
214  #define __TBB_CPP11_DEFAULT_FUNC_TEMPLATE_ARGS_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40300)
215 #elif _MSC_VER
216  #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT (_MSC_VER >= 1800)
217  #define __TBB_CPP11_RVALUE_REF_PRESENT (_MSC_VER >= 1600)
218  #define __TBB_EXCEPTION_PTR_PRESENT (_MSC_VER >= 1600)
219  #define __TBB_STATIC_ASSERT_PRESENT (_MSC_VER >= 1600)
220  #define __TBB_CPP11_TUPLE_PRESENT (_MSC_VER >= 1600)
221  #define __TBB_INITIALIZER_LISTS_PRESENT (_MSC_VER >= 1800)
222  #define __TBB_CONSTEXPR_PRESENT (_MSC_VER >= 1900)
223  #define __TBB_DEFAULTED_AND_DELETED_FUNC_PRESENT (_MSC_VER >= 1800)
224  #define __TBB_NOEXCEPT_PRESENT (_MSC_VER >= 1900)
225  #define __TBB_CPP11_STD_BEGIN_END_PRESENT (_MSC_VER >= 1700)
226  #define __TBB_CPP11_AUTO_PRESENT (_MSC_VER >= 1600)
227  #define __TBB_CPP11_DECLTYPE_PRESENT (_MSC_VER >= 1600)
228  #define __TBB_CPP11_LAMBDAS_PRESENT (_MSC_VER >= 1600)
229  #define __TBB_CPP11_DEFAULT_FUNC_TEMPLATE_ARGS_PRESENT (_MSC_VER >= 1800)
230 #else
231  #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT 0
232  #define __TBB_CPP11_RVALUE_REF_PRESENT 0
233  #define __TBB_EXCEPTION_PTR_PRESENT 0
234  #define __TBB_STATIC_ASSERT_PRESENT 0
235  #define __TBB_CPP11_TUPLE_PRESENT 0
236  #define __TBB_INITIALIZER_LISTS_PRESENT 0
237  #define __TBB_CONSTEXPR_PRESENT 0
238  #define __TBB_DEFAULTED_AND_DELETED_FUNC_PRESENT 0
239  #define __TBB_NOEXCEPT_PRESENT 0
240  #define __TBB_CPP11_STD_BEGIN_END_PRESENT 0
241  #define __TBB_CPP11_AUTO_PRESENT 0
242  #define __TBB_CPP11_DECLTYPE_PRESENT 0
243  #define __TBB_CPP11_LAMBDAS_PRESENT 0
244  #define __TBB_CPP11_DEFAULT_FUNC_TEMPLATE_ARGS_PRESENT 0
245 #endif
246 
247 // C++11 standard library features
248 
249 #define __TBB_CPP11_VARIADIC_TUPLE_PRESENT (!_MSC_VER || _MSC_VER >=1800)
250 #define __TBB_CPP11_TYPE_PROPERTIES_PRESENT (_LIBCPP_VERSION || _MSC_VER >= 1700 || (__TBB_GCC_VERSION >= 50000 && __GXX_EXPERIMENTAL_CXX0X__))
251 #define __TBB_TR1_TYPE_PROPERTIES_IN_STD_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40300 || _MSC_VER >= 1600)
252 // GCC supported some of type properties since 4.7
253 #define __TBB_CPP11_IS_COPY_CONSTRUCTIBLE_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40700 || __TBB_CPP11_TYPE_PROPERTIES_PRESENT)
254 
255 // In GCC, std::move_if_noexcept appeared later than noexcept
256 #define __TBB_MOVE_IF_NOEXCEPT_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40700 || _MSC_VER >= 1900 || __clang__ && _LIBCPP_VERSION && __TBB_NOEXCEPT_PRESENT)
257 //TODO: Probably more accurate way is to analyze version of stdlibc++ via__GLIBCXX__ instead of __TBB_GCC_VERSION
258 #define __TBB_ALLOCATOR_TRAITS_PRESENT (__cplusplus >= 201103L && _LIBCPP_VERSION || _MSC_VER >= 1700 || \
259  __GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40700 && !(__TBB_GCC_VERSION == 40700 && __TBB_DEFINE_MIC) \
260  )
261 #define __TBB_MAKE_EXCEPTION_PTR_PRESENT (__TBB_EXCEPTION_PTR_PRESENT && (_MSC_VER >= 1700 || __TBB_GCC_VERSION >= 40600 || _LIBCPP_VERSION))
262 
263 //TODO: not clear how exactly this macro affects exception_ptr - investigate
264 // On linux ICC fails to find existing std::exception_ptr in libstdc++ without this define
265 #if __INTEL_COMPILER && __GNUC__ && __TBB_EXCEPTION_PTR_PRESENT && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
266  #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
267 #endif
268 
269 // Work around a bug in MinGW32
270 #if __MINGW32__ && __TBB_EXCEPTION_PTR_PRESENT && !defined(_GLIBCXX_ATOMIC_BUILTINS_4)
271  #define _GLIBCXX_ATOMIC_BUILTINS_4
272 #endif
273 
274 #if __GNUC__ || __SUNPRO_CC || __IBMCPP__
275  /* ICC defines __GNUC__ and so is covered */
276  #define __TBB_ATTRIBUTE_ALIGNED_PRESENT 1
277 #elif _MSC_VER && (_MSC_VER >= 1300 || __INTEL_COMPILER)
278  #define __TBB_DECLSPEC_ALIGN_PRESENT 1
279 #endif
280 
281 /* Actually ICC supports gcc __sync_* intrinsics starting 11.1,
282  * but 64 bit support for 32 bit target comes in later ones*/
283 /* TODO: change the version back to 4.1.2 once macro __TBB_WORD_SIZE become optional */
284 /* Assumed that all clang versions have these gcc compatible intrinsics. */
285 #if __TBB_GCC_VERSION >= 40306 || __INTEL_COMPILER >= 1200 || __clang__
286 
287  #define __TBB_GCC_BUILTIN_ATOMICS_PRESENT 1
288 #endif
289 
290 #if __INTEL_COMPILER >= 1200
291 
292  #define __TBB_ICC_BUILTIN_ATOMICS_PRESENT 1
293 #endif
294 
295 #define __TBB_TSX_INTRINSICS_PRESENT ((__RTM__ || _MSC_VER>=1700 || __INTEL_COMPILER>=1300) && !__TBB_DEFINE_MIC && !__ANDROID__)
296 
299 #ifndef TBB_USE_DEBUG
300 #ifdef _DEBUG
301 #define TBB_USE_DEBUG _DEBUG
302 #else
303 #define TBB_USE_DEBUG 0
304 #endif
305 #endif /* TBB_USE_DEBUG */
306 
307 #ifndef TBB_USE_ASSERT
308 #define TBB_USE_ASSERT TBB_USE_DEBUG
309 #endif /* TBB_USE_ASSERT */
310 
311 #ifndef TBB_USE_THREADING_TOOLS
312 #define TBB_USE_THREADING_TOOLS TBB_USE_DEBUG
313 #endif /* TBB_USE_THREADING_TOOLS */
314 
315 #ifndef TBB_USE_PERFORMANCE_WARNINGS
316 #ifdef TBB_PERFORMANCE_WARNINGS
317 #define TBB_USE_PERFORMANCE_WARNINGS TBB_PERFORMANCE_WARNINGS
318 #else
319 #define TBB_USE_PERFORMANCE_WARNINGS TBB_USE_DEBUG
320 #endif /* TBB_PEFORMANCE_WARNINGS */
321 #endif /* TBB_USE_PERFORMANCE_WARNINGS */
322 
323 #if __TBB_DEFINE_MIC || defined(_XBOX)
324  #if TBB_USE_EXCEPTIONS
325  #error The platform does not properly support exception handling. Please do not set TBB_USE_EXCEPTIONS macro or set it to 0.
326  #elif !defined(TBB_USE_EXCEPTIONS)
327  #define TBB_USE_EXCEPTIONS 0
328  #endif
329 #elif !(__EXCEPTIONS || defined(_CPPUNWIND) || __SUNPRO_CC)
330  #if TBB_USE_EXCEPTIONS
331  #error Compilation settings do not support exception handling. Please do not set TBB_USE_EXCEPTIONS macro or set it to 0.
332  #elif !defined(TBB_USE_EXCEPTIONS)
333  #define TBB_USE_EXCEPTIONS 0
334  #endif
335 #elif !defined(TBB_USE_EXCEPTIONS)
336  #define TBB_USE_EXCEPTIONS 1
337 #endif
338 
339 #if __clang__ && !__INTEL_COMPILER
340 #define __TBB_USE_OPTIONAL_RTTI __has_feature(cxx_rtti)
341 #elif defined(_CPPRTTI)
342 #define __TBB_USE_OPTIONAL_RTTI 1
343 #else
344 #define __TBB_USE_OPTIONAL_RTTI (__GXX_RTTI || __RTTI || __INTEL_RTTI__)
345 #endif
346 
347 #ifndef TBB_IMPLEMENT_CPP0X
348 
349  #if __clang__
350  /* Old versions of Intel Compiler do not have __has_include or cannot use it in #define */
351  #if (__INTEL_COMPILER && (__INTEL_COMPILER < 1500 || __INTEL_COMPILER == 1500 && __INTEL_COMPILER_UPDATE <= 1))
352  #define TBB_IMPLEMENT_CPP0X !(_LIBCPP_VERSION && (__cplusplus >= 201103L))
353  #else
354  #define TBB_IMPLEMENT_CPP0X (__cplusplus < 201103L || (!__has_include(<thread>) && !__has_include(<condition_variable>)))
355  #endif
356  #elif __GNUC__
357  #define TBB_IMPLEMENT_CPP0X (__TBB_GCC_VERSION < 40400 || !__GXX_EXPERIMENTAL_CXX0X__)
358  #elif _MSC_VER
359  #define TBB_IMPLEMENT_CPP0X (_MSC_VER < 1700)
360  #else
361  // TODO: Reconsider general approach to be more reliable, e.g. (!(__cplusplus >= 201103L && __ STDC_HOSTED__))
362  #define TBB_IMPLEMENT_CPP0X (!__STDCPP_THREADS__)
363  #endif
364 #endif /* TBB_IMPLEMENT_CPP0X */
365 
366 /* TBB_USE_CAPTURED_EXCEPTION should be explicitly set to either 0 or 1, as it is used as C++ const */
367 #ifndef TBB_USE_CAPTURED_EXCEPTION
368 
369  #if __TBB_EXCEPTION_PTR_PRESENT && !defined(__ia64__)
370  #define TBB_USE_CAPTURED_EXCEPTION 0
371  #else
372  #define TBB_USE_CAPTURED_EXCEPTION 1
373  #endif
374 #else /* defined TBB_USE_CAPTURED_EXCEPTION */
375  #if !TBB_USE_CAPTURED_EXCEPTION && !__TBB_EXCEPTION_PTR_PRESENT
376  #error Current runtime does not support std::exception_ptr. Set TBB_USE_CAPTURED_EXCEPTION and make sure that your code is ready to catch tbb::captured_exception.
377  #endif
378 #endif /* defined TBB_USE_CAPTURED_EXCEPTION */
379 
381 #if TBB_USE_GCC_BUILTINS && !__TBB_GCC_BUILTIN_ATOMICS_PRESENT
382  #error "GCC atomic built-ins are not supported."
383 #endif
384 
388 #ifndef __TBB_WEAK_SYMBOLS_PRESENT
389 #define __TBB_WEAK_SYMBOLS_PRESENT ( !_WIN32 && !__APPLE__ && !__sun && (__TBB_GCC_VERSION >= 40000 || __INTEL_COMPILER ) )
390 #endif
391 
393 #ifndef __TBB_DYNAMIC_LOAD_ENABLED
394  #define __TBB_DYNAMIC_LOAD_ENABLED 1
395 #endif
396 
400 #if (_WIN32||_WIN64) && (__TBB_SOURCE_DIRECTLY_INCLUDED || TBB_USE_PREVIEW_BINARY)
401  #define __TBB_NO_IMPLICIT_LINKAGE 1
402  #define __TBBMALLOC_NO_IMPLICIT_LINKAGE 1
403 #endif
404 
405 #ifndef __TBB_COUNT_TASK_NODES
406  #define __TBB_COUNT_TASK_NODES TBB_USE_ASSERT
407 #endif
408 
409 #ifndef __TBB_TASK_GROUP_CONTEXT
410  #define __TBB_TASK_GROUP_CONTEXT 1
411 #endif /* __TBB_TASK_GROUP_CONTEXT */
412 
413 #ifndef __TBB_SCHEDULER_OBSERVER
414  #define __TBB_SCHEDULER_OBSERVER 1
415 #endif /* __TBB_SCHEDULER_OBSERVER */
416 
417 #ifndef __TBB_FP_CONTEXT
418  #define __TBB_FP_CONTEXT __TBB_TASK_GROUP_CONTEXT
419 #endif /* __TBB_FP_CONTEXT */
420 
421 #if __TBB_FP_CONTEXT && !__TBB_TASK_GROUP_CONTEXT
422  #error __TBB_FP_CONTEXT requires __TBB_TASK_GROUP_CONTEXT to be enabled
423 #endif
424 
425 #define __TBB_RECYCLE_TO_ENQUEUE __TBB_BUILD // keep non-official
426 
427 #ifndef __TBB_ARENA_OBSERVER
428  #define __TBB_ARENA_OBSERVER ((__TBB_BUILD||TBB_PREVIEW_LOCAL_OBSERVER)&& __TBB_SCHEDULER_OBSERVER)
429 #endif /* __TBB_ARENA_OBSERVER */
430 
431 #ifndef __TBB_SLEEP_PERMISSION
432  #define __TBB_SLEEP_PERMISSION ((__TBB_CPF_BUILD||TBB_PREVIEW_LOCAL_OBSERVER)&& __TBB_SCHEDULER_OBSERVER)
433 #endif /* __TBB_SLEEP_PERMISSION */
434 
435 #if TBB_PREVIEW_FLOW_GRAPH_TRACE
436 // Users of flow-graph trace need to explicitly link against the preview library. This
437 // prevents the linker from implicitly linking an application with a preview version of
438 // TBB and unexpectedly bringing in other community preview features, which might change
439 // the behavior of the application.
440 #define __TBB_NO_IMPLICIT_LINKAGE 1
441 #endif /* TBB_PREVIEW_FLOW_GRAPH_TRACE */
442 
443 #ifndef __TBB_ITT_STRUCTURE_API
444 #define __TBB_ITT_STRUCTURE_API ( !__TBB_DEFINE_MIC && (__TBB_CPF_BUILD || TBB_PREVIEW_FLOW_GRAPH_TRACE) )
445 #endif
446 
447 #if TBB_USE_EXCEPTIONS && !__TBB_TASK_GROUP_CONTEXT
448  #error TBB_USE_EXCEPTIONS requires __TBB_TASK_GROUP_CONTEXT to be enabled
449 #endif
450 
451 #ifndef __TBB_TASK_PRIORITY
452  #define __TBB_TASK_PRIORITY (__TBB_TASK_GROUP_CONTEXT)
453 #endif /* __TBB_TASK_PRIORITY */
454 
455 #if __TBB_TASK_PRIORITY && !__TBB_TASK_GROUP_CONTEXT
456  #error __TBB_TASK_PRIORITY requires __TBB_TASK_GROUP_CONTEXT to be enabled
457 #endif
458 
459 #if TBB_PREVIEW_WAITING_FOR_WORKERS || __TBB_BUILD
460  #define __TBB_SUPPORTS_WORKERS_WAITING_IN_TERMINATE 1
461 #endif
462 
463 #ifndef __TBB_ENQUEUE_ENFORCED_CONCURRENCY
464  #define __TBB_ENQUEUE_ENFORCED_CONCURRENCY 1
465 #endif
466 
467 #if !defined(__TBB_SURVIVE_THREAD_SWITCH) && \
468  (_WIN32 || _WIN64 || __APPLE__ || (__linux__ && !__ANDROID__))
469  #define __TBB_SURVIVE_THREAD_SWITCH 1
470 #endif /* __TBB_SURVIVE_THREAD_SWITCH */
471 
472 #ifndef __TBB_DEFAULT_PARTITIONER
473 #if TBB_DEPRECATED
474 
475 #define __TBB_DEFAULT_PARTITIONER tbb::simple_partitioner
476 #else
477 
478 #define __TBB_DEFAULT_PARTITIONER tbb::auto_partitioner
479 #endif /* TBB_DEPRECATED */
480 #endif /* !defined(__TBB_DEFAULT_PARTITIONER */
481 
482 #ifndef __TBB_USE_PROPORTIONAL_SPLIT_IN_BLOCKED_RANGES
483 #define __TBB_USE_PROPORTIONAL_SPLIT_IN_BLOCKED_RANGES 1
484 #endif
485 
486 #ifndef __TBB_ENABLE_RANGE_FEEDBACK
487 #define __TBB_ENABLE_RANGE_FEEDBACK 0
488 #endif
489 
490 #ifdef _VARIADIC_MAX
491  #define __TBB_VARIADIC_MAX _VARIADIC_MAX
492 #else
493  #if _MSC_VER == 1700
494  #define __TBB_VARIADIC_MAX 5 // VS11 setting, issue resolved in VS12
495  #elif _MSC_VER == 1600
496  #define __TBB_VARIADIC_MAX 10 // VS10 setting
497  #else
498  #define __TBB_VARIADIC_MAX 15
499  #endif
500 #endif
501 
504 #if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_APP
505  #define __TBB_WIN8UI_SUPPORT 1
506 #else
507  #define __TBB_WIN8UI_SUPPORT 0
508 #endif
509 
516 #if __ANDROID__ && __TBB_GCC_VERSION <= 40403 && !__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
517 
520  #define __TBB_GCC_64BIT_ATOMIC_BUILTINS_BROKEN 1
521 #elif __TBB_x86_32 && __TBB_GCC_VERSION == 40102 && ! __GNUC_RH_RELEASE__
522 
525  #define __TBB_GCC_64BIT_ATOMIC_BUILTINS_BROKEN 1
526 #endif
527 
528 #if __GNUC__ && __TBB_x86_64 && __INTEL_COMPILER == 1200
529  #define __TBB_ICC_12_0_INL_ASM_FSTCW_BROKEN 1
530 #endif
531 
532 #if _MSC_VER && __INTEL_COMPILER && (__INTEL_COMPILER<1110 || __INTEL_COMPILER==1110 && __INTEL_COMPILER_BUILD_DATE < 20091012)
533 
536  #define __TBB_DEFAULT_DTOR_THROW_SPEC_BROKEN 1
537 #endif
538 
539 #if !__INTEL_COMPILER && (_MSC_VER && _MSC_VER < 1500 || __TBB_GCC_VERSION && __TBB_GCC_VERSION < 40102)
540 
542  #define __TBB_TEMPLATE_FRIENDS_BROKEN 1
543 #endif
544 
545 //TODO: recheck for different clang versions
546 #if __GLIBC__==2 && __GLIBC_MINOR__==3 || (__APPLE__ && ( __INTEL_COMPILER==1200 && !TBB_USE_DEBUG))
547 
549  #define __TBB_THROW_ACROSS_MODULE_BOUNDARY_BROKEN 1
550 #else
551  #define __TBB_THROW_ACROSS_MODULE_BOUNDARY_BROKEN 0
552 #endif
553 
554 #if (_WIN32||_WIN64) && __INTEL_COMPILER == 1110
555 
556  #define __TBB_ICL_11_1_CODE_GEN_BROKEN 1
557 #endif
558 
559 #if __clang__ || (__GNUC__==3 && __GNUC_MINOR__==3 && !defined(__INTEL_COMPILER))
560 
561  #define __TBB_PROTECTED_NESTED_CLASS_BROKEN 1
562 #endif
563 
564 #if __MINGW32__ && __TBB_GCC_VERSION < 40200
565 
567  #define __TBB_SSE_STACK_ALIGNMENT_BROKEN 1
568 #else
569  #define __TBB_SSE_STACK_ALIGNMENT_BROKEN 0
570 #endif
571 
572 #if __TBB_GCC_VERSION==40300 && !__INTEL_COMPILER && !__clang__
573  /* GCC of this version may rashly ignore control dependencies */
574  #define __TBB_GCC_OPTIMIZER_ORDERING_BROKEN 1
575 #endif
576 
577 #if __FreeBSD__
578 
580  #define __TBB_PRIO_INHERIT_BROKEN 1
581 
584  #define __TBB_PLACEMENT_NEW_EXCEPTION_SAFETY_BROKEN 1
585 #endif /* __FreeBSD__ */
586 
587 #if (__linux__ || __APPLE__) && __i386__ && defined(__INTEL_COMPILER)
588 
590  #define __TBB_ICC_ASM_VOLATILE_BROKEN 1
591 #endif
592 
593 #if !__INTEL_COMPILER && (_MSC_VER || __GNUC__==3 && __GNUC_MINOR__<=2)
594 
596  #define __TBB_ALIGNOF_NOT_INSTANTIATED_TYPES_BROKEN 1
597 #endif
598 
599 #if __TBB_DEFINE_MIC
600 
601  #define __TBB_MAIN_THREAD_AFFINITY_BROKEN 1
602 #endif
603 
604 #if __GXX_EXPERIMENTAL_CXX0X__ && !defined(__EXCEPTIONS) && \
605  ((!__INTEL_COMPILER && !__clang__ && (__TBB_GCC_VERSION>=40400 && __TBB_GCC_VERSION<40600)) || \
606  (__INTEL_COMPILER<=1400 && (__TBB_GCC_VERSION>=40400 && __TBB_GCC_VERSION<=40801)))
607 /* There is an issue for specific GCC toolchain when C++11 is enabled
608  and exceptions are disabled:
609  exceprion_ptr.h/nested_exception.h use throw unconditionally.
610  GCC can ignore 'throw' since 4.6; but with ICC the issue still exists.
611  */
612  #define __TBB_LIBSTDCPP_EXCEPTION_HEADERS_BROKEN 1
613 #else
614  #define __TBB_LIBSTDCPP_EXCEPTION_HEADERS_BROKEN 0
615 #endif
616 
617 #if __INTEL_COMPILER==1300 && __TBB_GCC_VERSION>=40700 && defined(__GXX_EXPERIMENTAL_CXX0X__)
618 /* Some C++11 features used inside libstdc++ are not supported by Intel compiler.
619  * Checking version of gcc instead of libstdc++ because
620  * - they are directly connected,
621  * - for now it is not possible to check version of any standard library in this file
622  */
623  #define __TBB_ICC_13_0_CPP11_STDLIB_SUPPORT_BROKEN 1
624 #else
625  #define __TBB_ICC_13_0_CPP11_STDLIB_SUPPORT_BROKEN 0
626 #endif
627 
628 #if (__GNUC__==4 && __GNUC_MINOR__==4 ) && !defined(__INTEL_COMPILER) && !defined(__clang__)
629 
630  #define __TBB_GCC_STRICT_ALIASING_BROKEN 1
631  /* topical remedy: #pragma GCC diagnostic ignored "-Wstrict-aliasing" */
632  #if !__TBB_GCC_WARNING_SUPPRESSION_PRESENT
633  #error Warning suppression is not supported, while should.
634  #endif
635 #endif
636 
637 /*In a PIC mode some versions of GCC 4.1.2 generate incorrect inlined code for 8 byte __sync_val_compare_and_swap intrinsic */
638 #if __TBB_GCC_VERSION == 40102 && __PIC__ && !defined(__INTEL_COMPILER) && !defined(__clang__)
639  #define __TBB_GCC_CAS8_BUILTIN_INLINING_BROKEN 1
640 #endif
641 
642 #if __TBB_x86_32 && ( __INTEL_COMPILER || (__GNUC__==5 && __GNUC_MINOR__==2 && __GXX_EXPERIMENTAL_CXX0X__) \
643  || (__GNUC__==3 && __GNUC_MINOR__==3) || (__MINGW32__ && __GNUC__==4 && __GNUC_MINOR__==5) || __SUNPRO_CC )
644  // Some compilers for IA-32 architecture fail to provide 8-byte alignment of objects on the stack,
645  // even if the object specifies 8-byte alignment. On such platforms, the implementation
646  // of 64 bit atomics for IA-32 architecture (e.g. atomic<long long>) use different tactics
647  // depending upon whether the object is properly aligned or not.
648  #define __TBB_FORCE_64BIT_ALIGNMENT_BROKEN 1
649 #else
650  #define __TBB_FORCE_64BIT_ALIGNMENT_BROKEN 0
651 #endif
652 
653 #if __GNUC__ && !__INTEL_COMPILER && !__clang__ && __TBB_DEFAULTED_AND_DELETED_FUNC_PRESENT && __TBB_GCC_VERSION < 40700
654  #define __TBB_ZERO_INIT_WITH_DEFAULTED_CTOR_BROKEN 1
655 #endif
656 
657 #if _MSC_VER && _MSC_VER <= 1800 && !__INTEL_COMPILER
658  // With MSVC, when an array is passed by const reference to a template function,
659  // constness from the function parameter may get propagated to the template parameter.
660  #define __TBB_CONST_REF_TO_ARRAY_TEMPLATE_PARAM_BROKEN 1
661 #endif
662 
663 // A compiler bug: a disabled copy constructor prevents use of the moving constructor
664 #define __TBB_IF_NO_COPY_CTOR_MOVE_SEMANTICS_BROKEN (_MSC_VER && (__INTEL_COMPILER >= 1300 && __INTEL_COMPILER <= 1310) && !__INTEL_CXX11_MODE__)
665 
666 #if __TBB_CPP11_RVALUE_REF_PRESENT
667 //Some compilers added implicit generation of move constructor & assignment operator in a later version
668 #if _MSC_VER
669  // Covers Intel C++ Compiler for Windows, which has compatible behavior
670  #define __TBB_CPP11_IMPLICIT_MOVE_MEMBERS_GENERATION_BROKEN (_MSC_VER <= 1800)
671 #elif __INTEL_COMPILER
672  #define __TBB_CPP11_IMPLICIT_MOVE_MEMBERS_GENERATION_BROKEN (__INTEL_COMPILER < 1400 || __INTEL_COMPILER==1600)
673 #elif __clang__
674  #define __TBB_CPP11_IMPLICIT_MOVE_MEMBERS_GENERATION_BROKEN (!__has_feature(cxx_implicit_moves))
675 #endif
676 #endif /* __TBB_CPP11_RVALUE_REF_PRESENT */
677 
678 #define __TBB_CPP11_DECLVAL_BROKEN (_MSC_VER == 1600 || (__GNUC__ && __TBB_GCC_VERSION < 40500) )
679 
680 // Intel C++ compiler has difficulties with copying std::pair with VC11 std::reference_wrapper being a const member
681 #define __TBB_COPY_FROM_NON_CONST_REF_BROKEN (_MSC_VER == 1700 && __INTEL_COMPILER && __INTEL_COMPILER < 1600)
682 //The implicit upcasting of the tuple of a reference of a derived class to a base class fails on icc 13.X
683 //if the system's gcc environment is 4.8
684 #if (__INTEL_COMPILER >=1300 && __INTEL_COMPILER <=1310) && __TBB_GCC_VERSION>=40700 && __GXX_EXPERIMENTAL_CXX0X__
685  #define __TBB_UPCAST_OF_TUPLE_OF_REF_BROKEN 1
686 #endif
687 
690 #if defined(_MSC_VER) && _MSC_VER>=1500 && !defined(__INTEL_COMPILER)
691  // A macro to suppress erroneous or benign "unreachable code" MSVC warning (4702)
692  #define __TBB_MSVC_UNREACHABLE_CODE_IGNORED 1
693 #endif
694 
695 #define __TBB_ATOMIC_CTORS (__TBB_CONSTEXPR_PRESENT && __TBB_DEFAULTED_AND_DELETED_FUNC_PRESENT && (!__TBB_ZERO_INIT_WITH_DEFAULTED_CTOR_BROKEN))
696 
697 // Many OS versions (Android 4.0.[0-3] for example) need workaround for dlopen to avoid non-recursive loader lock hang
698 // Setting the workaround for all compile targets ($APP_PLATFORM) below Android 4.4 (android-19)
699 #if __ANDROID__
700 #include <android/api-level.h>
701 #define __TBB_USE_DLOPEN_REENTRANCY_WORKAROUND (__ANDROID_API__ < 19)
702 #endif
703 
704 #define __TBB_ALLOCATOR_CONSTRUCT_VARIADIC (__TBB_CPP11_VARIADIC_TEMPLATES_PRESENT && __TBB_CPP11_RVALUE_REF_PRESENT)
705 
706 #define __TBB_VARIADIC_PARALLEL_INVOKE (TBB_PREVIEW_VARIADIC_PARALLEL_INVOKE && __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT && __TBB_CPP11_RVALUE_REF_PRESENT)
707 #define __TBB_FLOW_GRAPH_CPP11_FEATURES (__TBB_CPP11_VARIADIC_TEMPLATES_PRESENT \
708  && __TBB_CPP11_RVALUE_REF_PRESENT && __TBB_CPP11_AUTO_PRESENT) \
709  && __TBB_CPP11_VARIADIC_TUPLE_PRESENT && __TBB_CPP11_DEFAULT_FUNC_TEMPLATE_ARGS_PRESENT \
710  && !__TBB_UPCAST_OF_TUPLE_OF_REF_BROKEN
711 #define __TBB_PREVIEW_ASYNC_NODE (__TBB_FLOW_GRAPH_CPP11_FEATURES && TBB_PREVIEW_FLOW_GRAPH_NODES)
712 #define __TBB_PREVIEW_OPENCL_NODE (__TBB_FLOW_GRAPH_CPP11_FEATURES && TBB_PREVIEW_FLOW_GRAPH_NODES && !TBB_IMPLEMENT_CPP0X)
713 #define __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING (TBB_PREVIEW_FLOW_GRAPH_FEATURES || __TBB_PREVIEW_OPENCL_NODE)
714 #define __TBB_PREVIEW_ASYNC_MSG (TBB_PREVIEW_FLOW_GRAPH_FEATURES && __TBB_FLOW_GRAPH_CPP11_FEATURES)
715 #endif /* __TBB_tbb_config_H */