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 #if __clang__
00034     #define __TBB_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
00035 #endif
00036 
00039 #if __INTEL_COMPILER == 9999 && __INTEL_COMPILER_BUILD_DATE == 20110811
00040 /* Intel Composer XE 2011 Update 6 incorrectly sets __INTEL_COMPILER. Fix it. */
00041     #undef __INTEL_COMPILER
00042     #define __INTEL_COMPILER 1210
00043 #endif
00044 
00045 #if (__TBB_GCC_VERSION >= 40400) && !defined(__INTEL_COMPILER)
00046 
00047     #define __TBB_GCC_WARNING_SUPPRESSION_PRESENT 1
00048 #endif
00049 
00050 /* Select particular features of C++11 based on compiler version.
00051    ICC 12.1 (Linux), GCC 4.3 and higher, clang 2.9 and higher
00052    set __GXX_EXPERIMENTAL_CXX0X__ in c++11 mode.
00053 
00054    Compilers that mimics other compilers (ICC, clang) must be processed before
00055    compilers they mimic (GCC, MSVC).
00056 
00057    TODO: The following conditions should be extended when new compilers/runtimes
00058    support added.
00059  */
00060 
00061 #if __INTEL_COMPILER
00062 
00065     #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT __GXX_EXPERIMENTAL_CXX0X__ && __VARIADIC_TEMPLATES
00066     #define __TBB_CPP11_RVALUE_REF_PRESENT         (__GXX_EXPERIMENTAL_CXX0X__ || _MSC_VER >= 1600) && (__INTEL_COMPILER >= 1200)
00067     #if  _MSC_VER >= 1600
00068         #define __TBB_EXCEPTION_PTR_PRESENT        __INTEL_COMPILER > 1300                                                  \
00069                                                    /*ICC 12.1 Upd 10 and 13 beta Upd 2 fixed exception_ptr linking  issue*/ \
00070                                                    || (__INTEL_COMPILER == 1300 && __INTEL_COMPILER_BUILD_DATE >= 20120530) \
00071                                                    || (__INTEL_COMPILER == 1210 && __INTEL_COMPILER_BUILD_DATE >= 20120410)
00072 
00073     #elif (__TBB_GCC_VERSION >= 40404) && (__TBB_GCC_VERSION < 40600)
00074         #define __TBB_EXCEPTION_PTR_PRESENT        __GXX_EXPERIMENTAL_CXX0X__ && __INTEL_COMPILER >= 1200
00075     #else
00076         #define __TBB_EXCEPTION_PTR_PRESENT        0
00077     #endif
00078     #define __TBB_MAKE_EXCEPTION_PTR_PRESENT       (_MSC_VER >= 1700 || (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40600))
00079     #define __TBB_CPP11_TUPLE_PRESENT              (_MSC_VER >= 1600) || ((__GXX_EXPERIMENTAL_CXX0X__) && (__TBB_GCC_VERSION >= 40300))
00080 #elif __clang__
00081 //TODO: these options need to be rechecked
00082     #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_CLANG_VERSION >= 20900)
00083     #define __TBB_CPP11_RVALUE_REF_PRESENT         (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_CLANG_VERSION >= 20900)
00084     #define __TBB_EXCEPTION_PTR_PRESENT            __GXX_EXPERIMENTAL_CXX0X__
00085     #define __TBB_MAKE_EXCEPTION_PTR_PRESENT       (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_CLANG_VERSION > 30100)// TODO: check version
00086     #define __TBB_CPP11_TUPLE_PRESENT              ((__GXX_EXPERIMENTAL_CXX0X__) && (__TBB_GCC_VERSION >= 40300))
00087 #elif __GNUC__
00088     #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT __GXX_EXPERIMENTAL_CXX0X__
00089     #define __TBB_CPP11_RVALUE_REF_PRESENT         __GXX_EXPERIMENTAL_CXX0X__
00090 
00093     #define __TBB_EXCEPTION_PTR_PRESENT            (__GXX_EXPERIMENTAL_CXX0X__ && (__TBB_GCC_VERSION >= 40404) && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
00094     #define __TBB_MAKE_EXCEPTION_PTR_PRESENT       (__GXX_EXPERIMENTAL_CXX0X__ && __TBB_GCC_VERSION >= 40600)
00095     #define __TBB_CPP11_TUPLE_PRESENT              ((__GXX_EXPERIMENTAL_CXX0X__) && (__TBB_GCC_VERSION >= 40300))
00096 #elif _MSC_VER
00097     #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT 0
00098     #define __TBB_CPP11_RVALUE_REF_PRESENT         0
00099     #define __TBB_EXCEPTION_PTR_PRESENT            (_MSC_VER >= 1600)
00100     #define __TBB_MAKE_EXCEPTION_PTR_PRESENT       (_MSC_VER >= 1700)
00101     #define __TBB_CPP11_TUPLE_PRESENT              (_MSC_VER >= 1600)
00102 #else
00103     #define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT 0
00104     #define __TBB_CPP11_RVALUE_REF_PRESENT         0
00105     #define __TBB_EXCEPTION_PTR_PRESENT            0
00106     #define __TBB_MAKE_EXCEPTION_PTR_PRESENT       0    
00107     #define __TBB_CPP11_TUPLE_PRESENT              0
00108 #endif
00109 
00110 //TODO: not clear how exactly this macro affects exception_ptr - investigate
00111 // On linux ICC fails to find existing std::exception_ptr in libstdc++ without this define
00112 #if __INTEL_COMPILER && __GNUC__ && __TBB_EXCEPTION_PTR_PRESENT && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
00113     #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
00114 #endif
00115 
00116 // Work around a bug in MinGW32
00117 #if __MINGW32__ && __TBB_EXCEPTION_PTR_PRESENT && !defined(_GLIBCXX_ATOMIC_BUILTINS_4)
00118     #define _GLIBCXX_ATOMIC_BUILTINS_4
00119 #endif
00120 
00121 #if __GNUC__ || __SUNPRO_CC || __IBMCPP__
00122     /* ICC defines __GNUC__ and so is covered */
00123     #define __TBB_ATTRIBUTE_ALIGNED_PRESENT 1
00124 #elif _MSC_VER && (_MSC_VER >= 1300 || __INTEL_COMPILER)
00125     #define __TBB_DECLSPEC_ALIGN_PRESENT 1
00126 #endif
00127 
00128 /* TODO: change the version back to 4.1.2 once macro __TBB_WORD_SIZE become optional */
00129 #if (__TBB_GCC_VERSION >= 40306) && !defined(__INTEL_COMPILER)
00130 
00131     #define __TBB_GCC_BUILTIN_ATOMICS_PRESENT 1
00132 #endif
00133 
00136 #ifndef TBB_USE_DEBUG
00137 #ifdef TBB_DO_ASSERT
00138 #define TBB_USE_DEBUG TBB_DO_ASSERT
00139 #else
00140 #ifdef _DEBUG
00141 #define TBB_USE_DEBUG _DEBUG
00142 #else
00143 #define TBB_USE_DEBUG 0
00144 #endif
00145 #endif /* TBB_DO_ASSERT */
00146 #endif /* TBB_USE_DEBUG */
00147 
00148 #ifndef TBB_USE_ASSERT
00149 #ifdef TBB_DO_ASSERT
00150 #define TBB_USE_ASSERT TBB_DO_ASSERT
00151 #else 
00152 #define TBB_USE_ASSERT TBB_USE_DEBUG
00153 #endif /* TBB_DO_ASSERT */
00154 #endif /* TBB_USE_ASSERT */
00155 
00156 #ifndef TBB_USE_THREADING_TOOLS
00157 #ifdef TBB_DO_THREADING_TOOLS
00158 #define TBB_USE_THREADING_TOOLS TBB_DO_THREADING_TOOLS
00159 #else 
00160 #define TBB_USE_THREADING_TOOLS TBB_USE_DEBUG
00161 #endif /* TBB_DO_THREADING_TOOLS */
00162 #endif /* TBB_USE_THREADING_TOOLS */
00163 
00164 #ifndef TBB_USE_PERFORMANCE_WARNINGS
00165 #ifdef TBB_PERFORMANCE_WARNINGS
00166 #define TBB_USE_PERFORMANCE_WARNINGS TBB_PERFORMANCE_WARNINGS
00167 #else 
00168 #define TBB_USE_PERFORMANCE_WARNINGS TBB_USE_DEBUG
00169 #endif /* TBB_PEFORMANCE_WARNINGS */
00170 #endif /* TBB_USE_PERFORMANCE_WARNINGS */
00171 
00172 #if __MIC__ || __MIC2__
00173 #define __TBB_DEFINE_MIC 1
00174 #endif
00175 
00176 #if !defined(__EXCEPTIONS) && !defined(_CPPUNWIND) && !defined(__SUNPRO_CC) || defined(_XBOX)
00177     #if TBB_USE_EXCEPTIONS
00178         #error Compilation settings do not support exception handling. Please do not set TBB_USE_EXCEPTIONS macro or set it to 0.
00179     #elif !defined(TBB_USE_EXCEPTIONS)
00180         #define TBB_USE_EXCEPTIONS 0
00181     #endif
00182 #elif !defined(TBB_USE_EXCEPTIONS)
00183     #if __TBB_DEFINE_MIC
00184     #define TBB_USE_EXCEPTIONS 0
00185     #else
00186     #define TBB_USE_EXCEPTIONS 1
00187     #endif
00188 #elif TBB_USE_EXCEPTIONS && __TBB_DEFINE_MIC
00189     #error Please do not set TBB_USE_EXCEPTIONS macro or set it to 0.
00190 #endif
00191 
00192 #ifndef TBB_IMPLEMENT_CPP0X
00193 
00194     #if __GNUC__==4 && __GNUC_MINOR__>=4 && __GXX_EXPERIMENTAL_CXX0X__
00195         #define TBB_IMPLEMENT_CPP0X 0
00196     #else
00197         #define TBB_IMPLEMENT_CPP0X 1
00198     #endif
00199 #endif /* TBB_IMPLEMENT_CPP0X */
00200 
00201 /* TBB_USE_CAPTURED_EXCEPTION should be explicitly set to either 0 or 1, as it is used as C++ const */
00202 #ifndef TBB_USE_CAPTURED_EXCEPTION
00203 
00204     #if __TBB_EXCEPTION_PTR_PRESENT && !defined(__GNUC__)
00205         #define TBB_USE_CAPTURED_EXCEPTION 0
00206     #else
00207         #define TBB_USE_CAPTURED_EXCEPTION 1
00208     #endif
00209 #else /* defined TBB_USE_CAPTURED_EXCEPTION */
00210     #if !TBB_USE_CAPTURED_EXCEPTION && !__TBB_EXCEPTION_PTR_PRESENT
00211         #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.
00212     #endif
00213 #endif /* defined TBB_USE_CAPTURED_EXCEPTION */
00214 
00216 #if (TBB_USE_GCC_BUILTINS && !__TBB_GCC_BUILTIN_ATOMICS_PRESENT)
00217     #error "GCC atomic built-ins are not supported."
00218 #endif
00219 
00227 #ifndef __TBB_DYNAMIC_LOAD_ENABLED
00228     #define __TBB_DYNAMIC_LOAD_ENABLED 1
00229 #elif !(_WIN32||_WIN64) && !__TBB_DYNAMIC_LOAD_ENABLED
00230     #define __TBB_WEAK_SYMBOLS 1
00231 #endif
00232 
00233 #if (_WIN32||_WIN64) && __TBB_SOURCE_DIRECTLY_INCLUDED
00234     #define __TBB_NO_IMPLICIT_LINKAGE 1
00235     #define __TBBMALLOC_NO_IMPLICIT_LINKAGE 1
00236 #endif
00237 
00238 #ifndef __TBB_COUNT_TASK_NODES
00239     #define __TBB_COUNT_TASK_NODES TBB_USE_ASSERT
00240 #endif
00241 
00242 #ifndef __TBB_TASK_GROUP_CONTEXT
00243     #define __TBB_TASK_GROUP_CONTEXT 1
00244 #endif /* __TBB_TASK_GROUP_CONTEXT */
00245 
00246 #ifndef __TBB_SCHEDULER_OBSERVER
00247     #define __TBB_SCHEDULER_OBSERVER 1
00248 #endif /* __TBB_SCHEDULER_OBSERVER */
00249 
00250 #if !defined(TBB_PREVIEW_TASK_ARENA) && __TBB_BUILD
00251     #define TBB_PREVIEW_TASK_ARENA __TBB_CPF_BUILD
00252 #endif /* TBB_PREVIEW_TASK_ARENA */
00253 #define __TBB_TASK_ARENA TBB_PREVIEW_TASK_ARENA
00254 #if TBB_PREVIEW_TASK_ARENA
00255     #define TBB_PREVIEW_LOCAL_OBSERVER 1
00256     #define __TBB_NO_IMPLICIT_LINKAGE 1
00257     #define __TBB_TASK_PRIORITY 0 // TODO: it will be removed in next versions
00258     #if !__TBB_SCHEDULER_OBSERVER
00259         #error TBB_PREVIEW_TASK_ARENA requires __TBB_SCHEDULER_OBSERVER to be enabled
00260     #endif
00261 #endif /* TBB_PREVIEW_TASK_ARENA */
00262 
00263 #if !defined(TBB_PREVIEW_LOCAL_OBSERVER) && __TBB_BUILD && __TBB_SCHEDULER_OBSERVER
00264     #define TBB_PREVIEW_LOCAL_OBSERVER 1
00265 #endif /* TBB_PREVIEW_LOCAL_OBSERVER */
00266 
00267 #if TBB_USE_EXCEPTIONS && !__TBB_TASK_GROUP_CONTEXT
00268     #error TBB_USE_EXCEPTIONS requires __TBB_TASK_GROUP_CONTEXT to be enabled
00269 #endif
00270 
00271 #ifndef __TBB_TASK_PRIORITY
00272     #define __TBB_TASK_PRIORITY __TBB_TASK_GROUP_CONTEXT
00273 #endif /* __TBB_TASK_PRIORITY */
00274 
00275 #if __TBB_TASK_PRIORITY && !__TBB_TASK_GROUP_CONTEXT
00276     #error __TBB_TASK_PRIORITY requires __TBB_TASK_GROUP_CONTEXT to be enabled
00277 #endif
00278 
00279 #if !defined(__TBB_SURVIVE_THREAD_SWITCH) && \
00280           (_WIN32 || _WIN64 || __APPLE__ || __linux__)
00281     #define __TBB_SURVIVE_THREAD_SWITCH 1
00282 #endif /* __TBB_SURVIVE_THREAD_SWITCH */
00283 
00284 #ifndef __TBB_DEFAULT_PARTITIONER
00285 #if TBB_DEPRECATED
00286 
00287 #define __TBB_DEFAULT_PARTITIONER tbb::simple_partitioner
00288 #else
00289 
00290 #define __TBB_DEFAULT_PARTITIONER tbb::auto_partitioner
00291 #endif /* TBB_DEPRECATED */
00292 #endif /* !defined(__TBB_DEFAULT_PARTITIONER */
00293 
00294 #ifdef _VARIADIC_MAX
00295 #define __TBB_VARIADIC_MAX _VARIADIC_MAX
00296 #else
00297 #if _MSC_VER >= 1700
00298 #define __TBB_VARIADIC_MAX 5  /* current VS11 setting, may change. */
00299 #else
00300 #define __TBB_VARIADIC_MAX 10
00301 #endif
00302 #endif
00303 
00310 #if __GNUC__ && __TBB_x86_64 && __INTEL_COMPILER == 1200
00311     #define __TBB_ICC_12_0_INL_ASM_FSTCW_BROKEN 1
00312 #endif
00313 
00314 #if _MSC_VER && __INTEL_COMPILER && (__INTEL_COMPILER<1110 || __INTEL_COMPILER==1110 && __INTEL_COMPILER_BUILD_DATE < 20091012)
00315 
00318     #define __TBB_DEFAULT_DTOR_THROW_SPEC_BROKEN 1
00319 #endif
00320 
00321 #if defined(_MSC_VER) && _MSC_VER < 1500 && !defined(__INTEL_COMPILER)
00322 
00324     #define __TBB_TEMPLATE_FRIENDS_BROKEN 1
00325 #endif
00326 
00327 #if __GLIBC__==2 && __GLIBC_MINOR__==3 || __MINGW32__ || (__APPLE__ && __INTEL_COMPILER==1200 && !TBB_USE_DEBUG)
00328 
00330     #define __TBB_THROW_ACROSS_MODULE_BOUNDARY_BROKEN 1
00331 #else
00332     #define __TBB_THROW_ACROSS_MODULE_BOUNDARY_BROKEN 0
00333 #endif
00334 
00335 #if (_WIN32||_WIN64) && __INTEL_COMPILER == 1110
00336 
00337     #define __TBB_ICL_11_1_CODE_GEN_BROKEN 1
00338 #endif
00339 
00340 #if __clang__ || (__GNUC__==3 && __GNUC_MINOR__==3 && !defined(__INTEL_COMPILER))
00341 
00342     #define __TBB_PROTECTED_NESTED_CLASS_BROKEN 1
00343 #endif
00344 
00345 #if __MINGW32__ && (__GNUC__<4 || __GNUC__==4 && __GNUC_MINOR__<2)
00346 
00348     #define __TBB_SSE_STACK_ALIGNMENT_BROKEN 1
00349 #else
00350     #define __TBB_SSE_STACK_ALIGNMENT_BROKEN 0
00351 #endif
00352 
00353 #if __GNUC__==4 && __GNUC_MINOR__==3 && __GNUC_PATCHLEVEL__==0
00354     /* GCC of this version may rashly ignore control dependencies */
00355     #define __TBB_GCC_OPTIMIZER_ORDERING_BROKEN 1
00356 #endif
00357 
00358 #if __FreeBSD__
00359 
00361     #define __TBB_PRIO_INHERIT_BROKEN 1
00362 
00365     #define __TBB_PLACEMENT_NEW_EXCEPTION_SAFETY_BROKEN 1
00366 #endif /* __FreeBSD__ */
00367 
00368 #if (__linux__ || __APPLE__) && __i386__ && defined(__INTEL_COMPILER)
00369 
00371     #define __TBB_ICC_ASM_VOLATILE_BROKEN 1
00372 #endif
00373 
00374 #if !__INTEL_COMPILER && (_MSC_VER || __GNUC__==3 && __GNUC_MINOR__<=2)
00375 
00377     #define __TBB_ALIGNOF_NOT_INSTANTIATED_TYPES_BROKEN 1
00378 #endif
00379 
00380 #if __INTEL_COMPILER
00381     #define __TBB_CPP11_STD_FORWARD_BROKEN 1
00382 #else
00383     #define __TBB_CPP11_STD_FORWARD_BROKEN 0
00384 #endif
00385 
00386 #if __TBB_DEFINE_MIC
00387 
00388     #define __TBB_MAIN_THREAD_AFFINITY_BROKEN 1
00389 #endif
00390 
00391 #if !defined(__EXCEPTIONS) && __GNUC__==4 && (__GNUC_MINOR__==4 ||__GNUC_MINOR__==5) && defined(__GXX_EXPERIMENTAL_CXX0X__)
00392 /* There is an issue for specific GCC toolchain when C++11 is enabled
00393    and exceptions are disabled:
00394    exceprion_ptr.h/nested_exception.h are using throw unconditionally.
00395  */
00396     #define __TBB_LIBSTDCPP_EXCEPTION_HEADERS_BROKEN 1
00397 #else
00398     #define __TBB_LIBSTDCPP_EXCEPTION_HEADERS_BROKEN 0
00399 #endif
00400 
00401 #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.