]> git.sesse.net Git - casparcg/blob - dependencies64/tbb/include/tbb/tbb_config.h
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
[casparcg] / dependencies64 / tbb / include / tbb / tbb_config.h
1 /*
2     Copyright 2005-2011 Intel Corporation.  All Rights Reserved.
3
4     This file is part of Threading Building Blocks.
5
6     Threading Building Blocks is free software; you can redistribute it
7     and/or modify it under the terms of the GNU General Public License
8     version 2 as published by the Free Software Foundation.
9
10     Threading Building Blocks is distributed in the hope that it will be
11     useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with Threading Building Blocks; if not, write to the Free Software
17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
19     As a special exception, you may use this file as part of a free software
20     library without restriction.  Specifically, if other files instantiate
21     templates or use macros or inline functions from this file, or you compile
22     this file and link it with other files to produce an executable, this
23     file does not by itself cause the resulting executable to be covered by
24     the GNU General Public License.  This exception does not however
25     invalidate any other reasons why the executable file might be covered by
26     the GNU General Public License.
27 */
28
29 #ifndef __TBB_tbb_config_H
30 #define __TBB_tbb_config_H
31
32 /** This header is supposed to contain macro definitions and C style comments only.
33     The macros defined here are intended to control such aspects of TBB build as 
34     - presence of compiler features
35     - compilation modes
36     - feature sets
37     - known compiler/platform issues
38 **/
39
40 #define __TBB_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
41
42 /** Presence of compiler features **/
43
44 #if (__TBB_GCC_VERSION >= 40400) && !defined(__INTEL_COMPILER)
45     /** warning suppression pragmas available in GCC since 4.4 **/
46     #define __TBB_GCC_WARNING_SUPPRESSION_PRESENT 1
47 #endif
48
49 /* TODO: The following condition should be extended when new compilers/runtimes 
50          with std::exception_ptr support appear. */
51 #define __TBB_EXCEPTION_PTR_PRESENT  ((_MSC_VER >= 1600 || (__GXX_EXPERIMENTAL_CXX0X__ && __GNUC__==4 && __GNUC_MINOR__>=4)) && !__INTEL_COMPILER)
52
53 #if __GNUC__ || __SUNPRO_CC || __IBMCPP__
54     /* ICC defines __GNUC__ and so is covered */
55     #define __TBB_ATTRIBUTE_ALIGNED_PRESENT 1
56 #elif _MSC_VER && (_MSC_VER >= 1300 || __INTEL_COMPILER)
57     #define __TBB_DECLSPEC_ALIGN_PRESENT 1
58 #endif
59
60 #if (__TBB_GCC_VERSION >= 40102) && !defined(__INTEL_COMPILER)
61     /** built-in atomics available in GCC since 4.1.2 **/
62     #define __TBB_GCC_BUILTIN_ATOMICS_PRESENT 1
63 #endif
64
65 /** User controlled TBB features & modes **/
66
67 #ifndef TBB_USE_DEBUG
68 #ifdef TBB_DO_ASSERT
69 #define TBB_USE_DEBUG TBB_DO_ASSERT
70 #else
71 #ifdef _DEBUG
72 #define TBB_USE_DEBUG _DEBUG
73 #else
74 #define TBB_USE_DEBUG 0
75 #endif
76 #endif /* TBB_DO_ASSERT */
77 #endif /* TBB_USE_DEBUG */
78
79 #ifndef TBB_USE_ASSERT
80 #ifdef TBB_DO_ASSERT
81 #define TBB_USE_ASSERT TBB_DO_ASSERT
82 #else 
83 #define TBB_USE_ASSERT TBB_USE_DEBUG
84 #endif /* TBB_DO_ASSERT */
85 #endif /* TBB_USE_ASSERT */
86
87 #ifndef TBB_USE_THREADING_TOOLS
88 #ifdef TBB_DO_THREADING_TOOLS
89 #define TBB_USE_THREADING_TOOLS TBB_DO_THREADING_TOOLS
90 #else 
91 #define TBB_USE_THREADING_TOOLS TBB_USE_DEBUG
92 #endif /* TBB_DO_THREADING_TOOLS */
93 #endif /* TBB_USE_THREADING_TOOLS */
94
95 #ifndef TBB_USE_PERFORMANCE_WARNINGS
96 #ifdef TBB_PERFORMANCE_WARNINGS
97 #define TBB_USE_PERFORMANCE_WARNINGS TBB_PERFORMANCE_WARNINGS
98 #else 
99 #define TBB_USE_PERFORMANCE_WARNINGS TBB_USE_DEBUG
100 #endif /* TBB_PEFORMANCE_WARNINGS */
101 #endif /* TBB_USE_PERFORMANCE_WARNINGS */
102
103
104 #if !defined(__EXCEPTIONS) && !defined(_CPPUNWIND) && !defined(__SUNPRO_CC) || defined(_XBOX)
105     #if TBB_USE_EXCEPTIONS
106         #error Compilation settings do not support exception handling. Please do not set TBB_USE_EXCEPTIONS macro or set it to 0.
107     #elif !defined(TBB_USE_EXCEPTIONS)
108         #define TBB_USE_EXCEPTIONS 0
109     #endif
110 #elif !defined(TBB_USE_EXCEPTIONS)
111     #define TBB_USE_EXCEPTIONS 1
112 #endif
113
114 #ifndef TBB_IMPLEMENT_CPP0X
115     /** By default, use C++0x classes if available **/
116     #if __GNUC__==4 && __GNUC_MINOR__>=4 && __GXX_EXPERIMENTAL_CXX0X__
117         #define TBB_IMPLEMENT_CPP0X 0
118     #else
119         #define TBB_IMPLEMENT_CPP0X 1
120     #endif
121 #endif /* TBB_IMPLEMENT_CPP0X */
122
123 #ifndef TBB_USE_CAPTURED_EXCEPTION
124     #if __TBB_EXCEPTION_PTR_PRESENT
125         #define TBB_USE_CAPTURED_EXCEPTION 0
126     #else
127         #define TBB_USE_CAPTURED_EXCEPTION 1
128     #endif
129 #else /* defined TBB_USE_CAPTURED_EXCEPTION */
130     #if !TBB_USE_CAPTURED_EXCEPTION && !__TBB_EXCEPTION_PTR_PRESENT
131         #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.
132     #endif
133 #endif /* defined TBB_USE_CAPTURED_EXCEPTION */
134
135 /** Check whether the request to use GCC atomics can be satisfied **/
136 #if (TBB_USE_GCC_BUILTINS && !__TBB_GCC_BUILTIN_ATOMICS_PRESENT)
137     #error "GCC atomic built-ins are not supported."
138 #endif
139
140 /** Internal TBB features & modes **/
141
142 #ifndef __TBB_DYNAMIC_LOAD_ENABLED
143     #define __TBB_DYNAMIC_LOAD_ENABLED !__TBB_TASK_CPP_DIRECTLY_INCLUDED
144 #elif !__TBB_DYNAMIC_LOAD_ENABLED
145     #if _WIN32||_WIN64
146         #define __TBB_NO_IMPLICIT_LINKAGE 1
147         #define __TBBMALLOC_NO_IMPLICIT_LINKAGE 1
148     #else
149         #define __TBB_WEAK_SYMBOLS 1
150     #endif
151 #endif
152
153 #ifndef __TBB_COUNT_TASK_NODES
154     #define __TBB_COUNT_TASK_NODES TBB_USE_ASSERT
155 #endif
156
157 #ifndef __TBB_TASK_GROUP_CONTEXT
158     #define __TBB_TASK_GROUP_CONTEXT 1
159 #endif /* __TBB_TASK_GROUP_CONTEXT */
160
161 #if TBB_USE_EXCEPTIONS && !__TBB_TASK_GROUP_CONTEXT
162     #error TBB_USE_EXCEPTIONS requires __TBB_TASK_GROUP_CONTEXT to be enabled
163 #endif
164
165 #ifndef __TBB_SCHEDULER_OBSERVER
166     #define __TBB_SCHEDULER_OBSERVER 1
167 #endif /* __TBB_SCHEDULER_OBSERVER */
168
169 #ifndef __TBB_TASK_PRIORITY
170     #define __TBB_TASK_PRIORITY __TBB_TASK_GROUP_CONTEXT
171 #endif /* __TBB_TASK_PRIORITY */
172
173 #if __TBB_TASK_PRIORITY && !__TBB_TASK_GROUP_CONTEXT
174     #error __TBB_TASK_PRIORITY requires __TBB_TASK_GROUP_CONTEXT to be enabled
175 #endif
176
177 #if !defined(__TBB_SURVIVE_THREAD_SWITCH) && (_WIN32 || _WIN64 || __linux__)
178     #define __TBB_SURVIVE_THREAD_SWITCH 1
179 #endif /* __TBB_SURVIVE_THREAD_SWITCH */
180
181 #ifndef __TBB_DEFAULT_PARTITIONER
182 #if TBB_DEPRECATED
183 /** Default partitioner for parallel loop templates in TBB 1.0-2.1 */
184 #define __TBB_DEFAULT_PARTITIONER tbb::simple_partitioner
185 #else
186 /** Default partitioner for parallel loop templates since TBB 2.2 */
187 #define __TBB_DEFAULT_PARTITIONER tbb::auto_partitioner
188 #endif /* TBB_DEPRECATED */
189 #endif /* !defined(__TBB_DEFAULT_PARTITIONER */
190
191 /** Macros of the form __TBB_XXX_BROKEN denote known issues that are caused by
192     the bugs in compilers, standard or OS specific libraries. They should be 
193     removed as soon as the corresponding bugs are fixed or the buggy OS/compiler
194     versions go out of the support list. 
195 **/
196
197 #if __GNUC__ && __TBB_x86_64 && __INTEL_COMPILER == 1200
198     #define __TBB_ICC_12_0_INL_ASM_FSTCW_BROKEN 1
199 #endif
200
201 #if _MSC_VER && __INTEL_COMPILER && (__INTEL_COMPILER<1110 || __INTEL_COMPILER==1110 && __INTEL_COMPILER_BUILD_DATE < 20091012)
202     /** Necessary to avoid ICL error (or warning in non-strict mode): 
203         "exception specification for implicitly declared virtual destructor is 
204         incompatible with that of overridden one". **/
205     #define __TBB_DEFAULT_DTOR_THROW_SPEC_BROKEN 1
206 #endif
207
208 #if defined(_MSC_VER) && _MSC_VER < 1500 && !defined(__INTEL_COMPILER)
209     /** VS2005 and earlier do not allow declaring template class as a friend 
210         of classes defined in other namespaces. **/
211     #define __TBB_TEMPLATE_FRIENDS_BROKEN 1
212 #endif
213
214 #if __GLIBC__==2 && __GLIBC_MINOR__==3 || __MINGW32__ || (__APPLE__ && __INTEL_COMPILER==1200 && !TBB_USE_DEBUG)
215     //! Macro controlling EH usages in TBB tests
216     /** Some older versions of glibc crash when exception handling happens concurrently. **/
217     #define __TBB_THROW_ACROSS_MODULE_BOUNDARY_BROKEN 1
218 #endif
219
220 #if (_WIN32||_WIN64) && __INTEL_COMPILER == 1110
221     /** That's a bug in Intel compiler 11.1.044/IA-32/Windows, that leads to a worker thread crash on the thread's startup. **/
222     #define __TBB_ICL_11_1_CODE_GEN_BROKEN 1
223 #endif
224
225 #if __GNUC__==3 && __GNUC_MINOR__==3 && !defined(__INTEL_COMPILER)
226     /** A bug in GCC 3.3 with access to nested classes declared in protected area */
227     #define __TBB_GCC_3_3_PROTECTED_BROKEN 1
228 #endif
229
230 #if __MINGW32__ && (__GNUC__<4 || __GNUC__==4 && __GNUC_MINOR__<2)
231     /** MinGW has a bug with stack alignment for routines invoked from MS RTLs.
232         Since GCC 4.2, the bug can be worked around via a special attribute. **/
233     #define __TBB_SSE_STACK_ALIGNMENT_BROKEN 1
234 #endif
235
236 #if __GNUC__==4 && __GNUC_MINOR__==3 && __GNUC_PATCHLEVEL__==0
237     // GCC of this version may rashly ignore control dependencies
238     #define __TBB_GCC_OPTIMIZER_ORDERING_BROKEN 1
239 #endif
240
241 #if __FreeBSD__
242     /** A bug in FreeBSD 8.0 results in kernel panic when there is contention 
243         on a mutex created with this attribute. **/
244     #define __TBB_PRIO_INHERIT_BROKEN 1
245
246     /** A bug in FreeBSD 8.0 results in test hanging when an exception occurs 
247         during (concurrent?) object construction by means of placement new operator. **/
248     #define __TBB_PLACEMENT_NEW_EXCEPTION_SAFETY_BROKEN 1
249 #endif /* __FreeBSD__ */
250
251 #if (__linux__ || __APPLE__) && __i386__ && defined(__INTEL_COMPILER)
252     /** The Intel compiler for IA-32 (Linux|Mac OS X) crashes or generates 
253         incorrect code when __asm__ arguments have a cast to volatile. **/
254     #define __TBB_ICC_ASM_VOLATILE_BROKEN 1
255 #endif
256
257 #if !__INTEL_COMPILER && (_MSC_VER || __GNUC__==3 && __GNUC_MINOR__<=2)
258     /** Bug in GCC 3.2 and MSVC compilers that sometimes return 0 for __alignof(T) 
259         when T has not yet been instantiated. **/
260     #define __TBB_ALIGNOF_NOT_INSTANTIATED_TYPES_BROKEN 1
261 #endif
262
263 #endif /* __TBB_tbb_config_H */