tbb_config.h

00001 /*
00002     Copyright 2005-2012 Intel Corporation.  All Rights Reserved.
00003 
00004     The source code contained or described herein and all documents related
00005     to the source code ("Material") are owned by Intel Corporation or its
00006     suppliers or licensors.  Title to the Material remains with Intel
00007     Corporation or its suppliers and licensors.  The Material is protected
00008     by worldwide copyright laws and treaty provisions.  No part of the
00009     Material may be used, copied, reproduced, modified, published, uploaded,
00010     posted, transmitted, distributed, or disclosed in any way without
00011     Intel's prior express written permission.
00012 
00013     No license under any patent, copyright, trade secret or other
00014     intellectual property right is granted to or conferred upon you by
00015     disclosure or delivery of the Materials, either expressly, by
00016     implication, inducement, estoppel or otherwise.  Any license under such
00017     intellectual property rights must be express and approved by Intel in
00018     writing.
00019 */
00020 
00021 #ifndef __TBB_tbb_config_H
00022 #define __TBB_tbb_config_H
00023 
00032 #define __TBB_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
00033 
00034 #if __clang__
00035     #define __TBB_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
00036 #endif
00037 
00040 #if __INTEL_COMPILER == 9999 && __INTEL_COMPILER_BUILD_DATE == 20110811
00041 /* Intel Composer XE 2011 Update 6 incorrectly sets __INTEL_COMPILER. Fix it. */
00042     #undef __INTEL_COMPILER
00043     #define __INTEL_COMPILER 1210
00044 #endif
00045 
00046 #if (__TBB_GCC_VERSION >= 40400) && !defined(__INTEL_COMPILER)
00047 
00048     #define __TBB_GCC_WARNING_SUPPRESSION_PRESENT 1
00049 #endif
00050 
00051 /* Select particular features of C++11 based on compiler version.
00052    ICC 12.1 (Linux), GCC 4.3 and higher, clang 2.9 and higher
00053    set __GXX_EXPERIMENTAL_CXX0X__ in c++11 mode.
00054 
00055    Compilers that mimics other compilers (ICC, clang) must be processed before
00056    compilers they mimic (GCC, MSVC).
00057 
00058    TODO: The following conditions should be extended when new compilers/runtimes
00059    support added.
00060  */
00061 
00062 #if __INTEL_COMPILER
00063 
00066     #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT __GXX_EXPERIMENTAL_CXX0X__ && __VARIADIC_TEMPLATES
00067     #define __TBB_CPP11_RVALUE_REF_PRESENT         (__GXX_EXPERIMENTAL_CXX0X__ || _MSC_VER >= 1600) && (__INTEL_COMPILER >= 1200)
00068     #if  _MSC_VER >= 1600
00069         #define __TBB_EXCEPTION_PTR_PRESENT        __INTEL_COMPILER > 1300                                                  \
00070                                                    /*ICC 12.1 Upd 10 and 13 beta Upd 2 fixed exception_ptr linking  issue*/ \
00071                                                    || (__INTEL_COMPILER == 1300 && __INTEL_COMPILER_BUILD_DATE >= 20120530) \
00072                                                    || (__INTEL_COMPILER == 1210 && __INTEL_COMPILER_BUILD_DATE >= 20120410)
00073 
00074     #elif (__TBB_GCC_VERSION >= 40404) && (__TBB_GCC_VERSION < 40600)
00075         #define __TBB_EXCEPTION_PTR_PRESENT        __GXX_EXPERIMENTAL_CXX0X__ && __INTEL_COMPILER >= 1200
00076     #else
00077         #define __TBB_EXCEPTION_PTR_PRESENT        0
00078     #endif
00079     #define __TBB_MAKE_EXCEPTION_PTR_PRESENT       (_MSC_VER >= 1700 || (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40600))
00080     #define __TBB_STATIC_ASSERT_PRESENT            __GXX_EXPERIMENTAL_CXX0X__ || (_MSC_VER >= 1600)
00081     #define __TBB_CPP11_TUPLE_PRESENT              (_MSC_VER >= 1600) || ((__GXX_EXPERIMENTAL_CXX0X__) && (__TBB_GCC_VERSION >= 40300))
00082 
00083     #define __TBB_INITIALIZER_LISTS_PRESENT        0
00084 #elif __clang__
00085 //TODO: these options need to be rechecked
00086     #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_CLANG_VERSION >= 20900)
00087     #define __TBB_CPP11_RVALUE_REF_PRESENT         (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_CLANG_VERSION >= 20900)
00088     #define __TBB_EXCEPTION_PTR_PRESENT            __GXX_EXPERIMENTAL_CXX0X__
00089     #define __TBB_MAKE_EXCEPTION_PTR_PRESENT       (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_CLANG_VERSION > 30100)// TODO: check version
00090     #define __TBB_STATIC_ASSERT_PRESENT            (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_CLANG_VERSION >= 20900)
00091     #define __TBB_CPP11_TUPLE_PRESENT              ((__GXX_EXPERIMENTAL_CXX0X__) && (__TBB_GCC_VERSION >= 40300))
00092     #define __TBB_INITIALIZER_LISTS_PRESENT        0
00093 #elif __GNUC__
00094     #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT __GXX_EXPERIMENTAL_CXX0X__
00095     #define __TBB_CPP11_RVALUE_REF_PRESENT         __GXX_EXPERIMENTAL_CXX0X__
00096 
00099     #define __TBB_EXCEPTION_PTR_PRESENT            (__GXX_EXPERIMENTAL_CXX0X__ && (__TBB_GCC_VERSION >= 40404) && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
00100     #define __TBB_MAKE_EXCEPTION_PTR_PRESENT       (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40600)
00101     #define __TBB_STATIC_ASSERT_PRESENT            ((__TBB_GCC_VERSION >= 40300) && (__GXX_EXPERIMENTAL_CXX0X__))
00102     #define __TBB_CPP11_TUPLE_PRESENT              ((__GXX_EXPERIMENTAL_CXX0X__) && (__TBB_GCC_VERSION >= 40300))
00103     #define __TBB_INITIALIZER_LISTS_PRESENT        ((__GXX_EXPERIMENTAL_CXX0X__) && (__TBB_GCC_VERSION >= 40400))
00104 #elif _MSC_VER
00105     #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT 0
00106     #define __TBB_CPP11_RVALUE_REF_PRESENT         0
00107     #define __TBB_EXCEPTION_PTR_PRESENT            (_MSC_VER >= 1600)
00108     #define __TBB_STATIC_ASSERT_PRESENT            (_MSC_VER >= 1600)
00109     #define __TBB_MAKE_EXCEPTION_PTR_PRESENT       (_MSC_VER >= 1700)
00110     #define __TBB_CPP11_TUPLE_PRESENT              (_MSC_VER >= 1600)
00111     #define __TBB_INITIALIZER_LISTS_PRESENT        0
00112 #else
00113     #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT 0
00114     #define __TBB_CPP11_RVALUE_REF_PRESENT         0
00115     #define __TBB_EXCEPTION_PTR_PRESENT            0
00116     #define __TBB_STATIC_ASSERT_PRESENT            0
00117     #define __TBB_MAKE_EXCEPTION_PTR_PRESENT       0
00118     #define __TBB_CPP11_TUPLE_PRESENT              0
00119     #define __TBB_INITIALIZER_LISTS_PRESENT        0
00120 #endif
00121 
00122 //TODO: not clear how exactly this macro affects exception_ptr - investigate
00123 // On linux ICC fails to find existing std::exception_ptr in libstdc++ without this define
00124 #if __INTEL_COMPILER && __GNUC__ && __TBB_EXCEPTION_PTR_PRESENT && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
00125     #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
00126 #endif
00127 
00128 // Work around a bug in MinGW32
00129 #if __MINGW32__ && __TBB_EXCEPTION_PTR_PRESENT && !defined(_GLIBCXX_ATOMIC_BUILTINS_4)
00130     #define _GLIBCXX_ATOMIC_BUILTINS_4
00131 #endif
00132 
00133 #if __GNUC__ || __SUNPRO_CC || __IBMCPP__
00134     /* ICC defines __GNUC__ and so is covered */
00135     #define __TBB_ATTRIBUTE_ALIGNED_PRESENT 1
00136 #elif _MSC_VER && (_MSC_VER >= 1300 || __INTEL_COMPILER)
00137     #define __TBB_DECLSPEC_ALIGN_PRESENT 1
00138 #endif
00139 
00140 /* Actually ICC supports gcc __sync_* intrinsics starting 11.1,
00141  * but 64 bit support for 32 bit target comes in later ones*/
00142 /* TODO: change the version back to 4.1.2 once macro __TBB_WORD_SIZE become optional */
00143 #if (__TBB_GCC_VERSION >= 40306) || (__INTEL_COMPILER >= 1200)
00144 
00145     #define __TBB_GCC_BUILTIN_ATOMICS_PRESENT 1
00146 #endif
00147 
00148 #if (__INTEL_COMPILER >= 1210)
00149 
00150     #define __TBB_ICC_BUILTIN_ATOMICS_PRESENT 1
00151 #endif
00152 
00155 #ifndef TBB_USE_DEBUG
00156 #ifdef TBB_DO_ASSERT
00157 #define TBB_USE_DEBUG TBB_DO_ASSERT
00158 #else
00159 #ifdef _DEBUG
00160 #define TBB_USE_DEBUG _DEBUG
00161 #else
00162 #define TBB_USE_DEBUG 0
00163 #endif
00164 #endif /* TBB_DO_ASSERT */
00165 #endif /* TBB_USE_DEBUG */
00166 
00167 #ifndef TBB_USE_ASSERT
00168 #ifdef TBB_DO_ASSERT
00169 #define TBB_USE_ASSERT TBB_DO_ASSERT
00170 #else 
00171 #define TBB_USE_ASSERT TBB_USE_DEBUG
00172 #endif /* TBB_DO_ASSERT */
00173 #endif /* TBB_USE_ASSERT */
00174 
00175 #ifndef TBB_USE_THREADING_TOOLS
00176 #ifdef TBB_DO_THREADING_TOOLS
00177 #define TBB_USE_THREADING_TOOLS TBB_DO_THREADING_TOOLS
00178 #else 
00179 #define TBB_USE_THREADING_TOOLS TBB_USE_DEBUG
00180 #endif /* TBB_DO_THREADING_TOOLS */
00181 #endif /* TBB_USE_THREADING_TOOLS */
00182 
00183 #ifndef TBB_USE_PERFORMANCE_WARNINGS
00184 #ifdef TBB_PERFORMANCE_WARNINGS
00185 #define TBB_USE_PERFORMANCE_WARNINGS TBB_PERFORMANCE_WARNINGS
00186 #else 
00187 #define TBB_USE_PERFORMANCE_WARNINGS TBB_USE_DEBUG
00188 #endif /* TBB_PEFORMANCE_WARNINGS */
00189 #endif /* TBB_USE_PERFORMANCE_WARNINGS */
00190 
00191 #if __MIC__ || __MIC2__
00192 #define __TBB_DEFINE_MIC 1
00193 #endif
00194 
00195 #if !defined(__EXCEPTIONS) && !defined(_CPPUNWIND) && !defined(__SUNPRO_CC) || defined(_XBOX)
00196     #if TBB_USE_EXCEPTIONS
00197         #error Compilation settings do not support exception handling. Please do not set TBB_USE_EXCEPTIONS macro or set it to 0.
00198     #elif !defined(TBB_USE_EXCEPTIONS)
00199         #define TBB_USE_EXCEPTIONS 0
00200     #endif
00201 #elif !defined(TBB_USE_EXCEPTIONS)
00202     #if __TBB_DEFINE_MIC
00203     #define TBB_USE_EXCEPTIONS 0
00204     #else
00205     #define TBB_USE_EXCEPTIONS 1
00206     #endif
00207 #elif TBB_USE_EXCEPTIONS && __TBB_DEFINE_MIC
00208     #error Please do not set TBB_USE_EXCEPTIONS macro or set it to 0.
00209 #endif
00210 
00211 #ifndef TBB_IMPLEMENT_CPP0X
00212 
00213     #if __GNUC__==4 && __GNUC_MINOR__>=4 && __GXX_EXPERIMENTAL_CXX0X__
00214         #define TBB_IMPLEMENT_CPP0X 0
00215     #else
00216         #define TBB_IMPLEMENT_CPP0X 1
00217     #endif
00218 #endif /* TBB_IMPLEMENT_CPP0X */
00219 
00220 /* TBB_USE_CAPTURED_EXCEPTION should be explicitly set to either 0 or 1, as it is used as C++ const */
00221 #ifndef TBB_USE_CAPTURED_EXCEPTION
00222 
00223     #if __TBB_EXCEPTION_PTR_PRESENT && !defined(__GNUC__)
00224         #define TBB_USE_CAPTURED_EXCEPTION 0
00225     #else
00226         #define TBB_USE_CAPTURED_EXCEPTION 1
00227     #endif
00228 #else /* defined TBB_USE_CAPTURED_EXCEPTION */
00229     #if !TBB_USE_CAPTURED_EXCEPTION && !__TBB_EXCEPTION_PTR_PRESENT
00230         #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.
00231     #endif
00232 #endif /* defined TBB_USE_CAPTURED_EXCEPTION */
00233 
00235 #if (TBB_USE_GCC_BUILTINS && !__TBB_GCC_BUILTIN_ATOMICS_PRESENT)
00236     #error "GCC atomic built-ins are not supported."
00237 #endif
00238 
00242 #define __TBB_WEAK_SYMBOLS_PRESENT !_WIN32 && !__APPLE__ && !__sun && ((__TBB_GCC_VERSION >= 40000) || defined(__INTEL_COMPILER))
00243 
00245 #ifndef __TBB_DYNAMIC_LOAD_ENABLED
00246     #define __TBB_DYNAMIC_LOAD_ENABLED 1
00247 #endif
00248 
00252 #if (_WIN32||_WIN64) && __TBB_SOURCE_DIRECTLY_INCLUDED
00253     #define __TBB_NO_IMPLICIT_LINKAGE 1
00254     #define __TBBMALLOC_NO_IMPLICIT_LINKAGE 1
00255 #endif
00256 
00257 #ifndef __TBB_COUNT_TASK_NODES
00258     #define __TBB_COUNT_TASK_NODES TBB_USE_ASSERT
00259 #endif
00260 
00261 #ifndef __TBB_TASK_GROUP_CONTEXT
00262     #define __TBB_TASK_GROUP_CONTEXT 1
00263 #endif /* __TBB_TASK_GROUP_CONTEXT */
00264 
00265 #ifndef __TBB_SCHEDULER_OBSERVER
00266     #define __TBB_SCHEDULER_OBSERVER 1
00267 #endif /* __TBB_SCHEDULER_OBSERVER */
00268 
00269 #if !defined(TBB_PREVIEW_TASK_ARENA) && __TBB_BUILD
00270     #define TBB_PREVIEW_TASK_ARENA __TBB_CPF_BUILD
00271 #endif /* TBB_PREVIEW_TASK_ARENA */
00272 #define __TBB_TASK_ARENA TBB_PREVIEW_TASK_ARENA
00273 #if TBB_PREVIEW_TASK_ARENA
00274     #define TBB_PREVIEW_LOCAL_OBSERVER 1
00275     #define __TBB_NO_IMPLICIT_LINKAGE 1
00276     #define __TBB_TASK_PRIORITY 0 // TODO: it will be removed in next versions
00277     #if !__TBB_SCHEDULER_OBSERVER
00278         #error TBB_PREVIEW_TASK_ARENA requires __TBB_SCHEDULER_OBSERVER to be enabled
00279     #endif
00280 #endif /* TBB_PREVIEW_TASK_ARENA */
00281 
00282 #if !defined(TBB_PREVIEW_LOCAL_OBSERVER) && __TBB_BUILD && __TBB_SCHEDULER_OBSERVER
00283     #define TBB_PREVIEW_LOCAL_OBSERVER 1
00284 #endif /* TBB_PREVIEW_LOCAL_OBSERVER */
00285 
00286 #if TBB_USE_EXCEPTIONS && !__TBB_TASK_GROUP_CONTEXT
00287     #error TBB_USE_EXCEPTIONS requires __TBB_TASK_GROUP_CONTEXT to be enabled
00288 #endif
00289 
00290 #ifndef __TBB_TASK_PRIORITY
00291     #define __TBB_TASK_PRIORITY __TBB_TASK_GROUP_CONTEXT
00292 #endif /* __TBB_TASK_PRIORITY */
00293 
00294 #if __TBB_TASK_PRIORITY && !__TBB_TASK_GROUP_CONTEXT
00295     #error __TBB_TASK_PRIORITY requires __TBB_TASK_GROUP_CONTEXT to be enabled
00296 #endif
00297 
00298 #if !defined(__TBB_SURVIVE_THREAD_SWITCH) && \
00299           (_WIN32 || _WIN64 || __APPLE__ || (__linux__ && !__ANDROID__))
00300     #define __TBB_SURVIVE_THREAD_SWITCH 1
00301 #endif /* __TBB_SURVIVE_THREAD_SWITCH */
00302 
00303 #ifndef __TBB_DEFAULT_PARTITIONER
00304 #if TBB_DEPRECATED
00305 
00306 #define __TBB_DEFAULT_PARTITIONER tbb::simple_partitioner
00307 #else
00308 
00309 #define __TBB_DEFAULT_PARTITIONER tbb::auto_partitioner
00310 #endif /* TBB_DEPRECATED */
00311 #endif /* !defined(__TBB_DEFAULT_PARTITIONER */
00312 
00313 #ifdef _VARIADIC_MAX
00314 #define __TBB_VARIADIC_MAX _VARIADIC_MAX
00315 #else
00316 #if _MSC_VER >= 1700
00317 #define __TBB_VARIADIC_MAX 5  /* current VS11 setting, may change. */
00318 #else
00319 #define __TBB_VARIADIC_MAX 10
00320 #endif
00321 #endif
00322 
00329 #if __ANDROID__ && __TBB_GCC_VERSION <= 40403 && !__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 
00330 
00333     #define __TBB_GCC_64BIT_ATOMIC_BUILTINS_BROKEN 1
00334 #endif
00335 
00336 #if __GNUC__ && __TBB_x86_64 && __INTEL_COMPILER == 1200
00337     #define __TBB_ICC_12_0_INL_ASM_FSTCW_BROKEN 1
00338 #endif
00339 
00340 #if _MSC_VER && __INTEL_COMPILER && (__INTEL_COMPILER<1110 || __INTEL_COMPILER==1110 && __INTEL_COMPILER_BUILD_DATE < 20091012)
00341 
00344     #define __TBB_DEFAULT_DTOR_THROW_SPEC_BROKEN 1
00345 #endif
00346 
00347 #if defined(_MSC_VER) && _MSC_VER < 1500 && !defined(__INTEL_COMPILER)
00348 
00350     #define __TBB_TEMPLATE_FRIENDS_BROKEN 1
00351 #endif
00352 
00353 #if __GLIBC__==2 && __GLIBC_MINOR__==3 || __MINGW32__ || (__APPLE__ && __INTEL_COMPILER==1200 && !TBB_USE_DEBUG)
00354 
00356     #define __TBB_THROW_ACROSS_MODULE_BOUNDARY_BROKEN 1
00357 #else
00358     #define __TBB_THROW_ACROSS_MODULE_BOUNDARY_BROKEN 0
00359 #endif
00360 
00361 #if (_WIN32||_WIN64) && __INTEL_COMPILER == 1110
00362 
00363     #define __TBB_ICL_11_1_CODE_GEN_BROKEN 1
00364 #endif
00365 
00366 #if __clang__ || (__GNUC__==3 && __GNUC_MINOR__==3 && !defined(__INTEL_COMPILER))
00367 
00368     #define __TBB_PROTECTED_NESTED_CLASS_BROKEN 1
00369 #endif
00370 
00371 #if __MINGW32__ && (__GNUC__<4 || __GNUC__==4 && __GNUC_MINOR__<2)
00372 
00374     #define __TBB_SSE_STACK_ALIGNMENT_BROKEN 1
00375 #else
00376     #define __TBB_SSE_STACK_ALIGNMENT_BROKEN 0
00377 #endif
00378 
00379 #if __GNUC__==4 && __GNUC_MINOR__==3 && __GNUC_PATCHLEVEL__==0
00380     /* GCC of this version may rashly ignore control dependencies */
00381     #define __TBB_GCC_OPTIMIZER_ORDERING_BROKEN 1
00382 #endif
00383 
00384 #if __FreeBSD__
00385 
00387     #define __TBB_PRIO_INHERIT_BROKEN 1
00388 
00391     #define __TBB_PLACEMENT_NEW_EXCEPTION_SAFETY_BROKEN 1
00392 #endif /* __FreeBSD__ */
00393 
00394 #if (__linux__ || __APPLE__) && __i386__ && defined(__INTEL_COMPILER)
00395 
00397     #define __TBB_ICC_ASM_VOLATILE_BROKEN 1
00398 #endif
00399 
00400 #if !__INTEL_COMPILER && (_MSC_VER || __GNUC__==3 && __GNUC_MINOR__<=2)
00401 
00403     #define __TBB_ALIGNOF_NOT_INSTANTIATED_TYPES_BROKEN 1
00404 #endif
00405 
00406 #if __INTEL_COMPILER
00407     #define __TBB_CPP11_STD_FORWARD_BROKEN 1
00408 #else
00409     #define __TBB_CPP11_STD_FORWARD_BROKEN 0
00410 #endif
00411 
00412 #if __TBB_DEFINE_MIC
00413 
00414     #define __TBB_MAIN_THREAD_AFFINITY_BROKEN 1
00415 #endif
00416 
00417 #if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_APP
00418 #define __TBB_WIN8UI_SUPPORT 1
00419 #else
00420 #define __TBB_WIN8UI_SUPPORT 0
00421 #endif
00422 
00423 #if !defined(__EXCEPTIONS) && __GNUC__==4 && (__GNUC_MINOR__==4 ||__GNUC_MINOR__==5 || (__INTEL_COMPILER==1300 && __TBB_GCC_VERSION>=40600 && __TBB_GCC_VERSION<=40700)) && defined(__GXX_EXPERIMENTAL_CXX0X__)
00424 /* There is an issue for specific GCC toolchain when C++11 is enabled
00425    and exceptions are disabled:
00426    exceprion_ptr.h/nested_exception.h are using throw unconditionally.
00427  */
00428     #define __TBB_LIBSTDCPP_EXCEPTION_HEADERS_BROKEN 1
00429 #else
00430     #define __TBB_LIBSTDCPP_EXCEPTION_HEADERS_BROKEN 0
00431 #endif
00432 
00433 #endif /* __TBB_tbb_config_H */

Copyright © 2005-2012 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.