]> git.sesse.net Git - casparcg/blob - tbb30_20100406oss/include/tbb/tbb_config.h
6f26e47f1cd243d29a37de88a5d7e3e8e2bad343
[casparcg] / tbb30_20100406oss / include / tbb / tbb_config.h
1 /*
2     Copyright 2005-2010 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     - compilation modes
35     - feature sets
36     - workarounds presence 
37 **/
38
39 /** Compilation modes **/
40
41 #ifndef TBB_USE_DEBUG
42 #ifdef TBB_DO_ASSERT
43 #define TBB_USE_DEBUG TBB_DO_ASSERT
44 #else
45 #define TBB_USE_DEBUG 0
46 #endif /* TBB_DO_ASSERT */
47 #else
48 #define TBB_DO_ASSERT TBB_USE_DEBUG
49 #endif /* TBB_USE_DEBUG */
50
51 #ifndef TBB_USE_ASSERT
52 #ifdef TBB_DO_ASSERT
53 #define TBB_USE_ASSERT TBB_DO_ASSERT
54 #else 
55 #define TBB_USE_ASSERT TBB_USE_DEBUG
56 #endif /* TBB_DO_ASSERT */
57 #endif /* TBB_USE_ASSERT */
58
59 #ifndef TBB_USE_THREADING_TOOLS
60 #ifdef TBB_DO_THREADING_TOOLS
61 #define TBB_USE_THREADING_TOOLS TBB_DO_THREADING_TOOLS
62 #else 
63 #define TBB_USE_THREADING_TOOLS TBB_USE_DEBUG
64 #endif /* TBB_DO_THREADING_TOOLS */
65 #endif /* TBB_USE_THREADING_TOOLS */
66
67 #ifndef TBB_USE_PERFORMANCE_WARNINGS
68 #ifdef TBB_PERFORMANCE_WARNINGS
69 #define TBB_USE_PERFORMANCE_WARNINGS TBB_PERFORMANCE_WARNINGS
70 #else 
71 #define TBB_USE_PERFORMANCE_WARNINGS TBB_USE_DEBUG
72 #endif /* TBB_PEFORMANCE_WARNINGS */
73 #endif /* TBB_USE_PERFORMANCE_WARNINGS */
74
75 #if !defined(__EXCEPTIONS) && !defined(_CPPUNWIND) && !defined(__SUNPRO_CC) || defined(_XBOX)
76     #if TBB_USE_EXCEPTIONS
77         #error Compilation settings do not support exception handling. Please do not set TBB_USE_EXCEPTIONS macro or set it to 0.
78     #elif !defined(TBB_USE_EXCEPTIONS)
79         #define TBB_USE_EXCEPTIONS 0
80     #endif
81 #elif !defined(TBB_USE_EXCEPTIONS)
82     #define TBB_USE_EXCEPTIONS 1
83 #endif
84
85 #ifndef TBB_IMPLEMENT_CPP0X
86 /** By default, use C++0x classes if available **/
87 #if __GNUC__==4 && __GNUC_MINOR__>=4 && __GXX_EXPERIMENTAL_CXX0X__
88 #define TBB_IMPLEMENT_CPP0X 0
89 #else
90 #define TBB_IMPLEMENT_CPP0X 1
91 #endif
92 #endif /* TBB_IMPLEMENT_CPP0X */
93
94 /** Feature sets **/
95
96 #ifndef __TBB_COUNT_TASK_NODES
97     #define __TBB_COUNT_TASK_NODES TBB_USE_ASSERT
98 #endif
99
100 #ifndef __TBB_TASK_GROUP_CONTEXT
101 #define __TBB_TASK_GROUP_CONTEXT 1
102 #endif /* __TBB_TASK_GROUP_CONTEXT */
103
104 #ifndef __TBB_SCHEDULER_OBSERVER
105 #define __TBB_SCHEDULER_OBSERVER 1
106 #endif /* __TBB_SCHEDULER_OBSERVER */
107
108 #ifndef __TBB_ARENA_PER_MASTER
109 #define __TBB_ARENA_PER_MASTER 1
110 #endif /* __TBB_ARENA_PER_MASTER */
111
112 /* TODO: The following condition should be extended as soon as new compilers/runtimes 
113          with std::exception_ptr support appear. */
114 #define __TBB_EXCEPTION_PTR_PRESENT  (_MSC_VER >= 1600 || __GXX_EXPERIMENTAL_CXX0X__ && (__GNUC__==4 && __GNUC_MINOR__>=4))
115
116
117 #ifndef TBB_USE_CAPTURED_EXCEPTION
118     #if __TBB_EXCEPTION_PTR_PRESENT
119         #define TBB_USE_CAPTURED_EXCEPTION 0
120     #else
121         #define TBB_USE_CAPTURED_EXCEPTION 1
122     #endif
123 #else /* defined TBB_USE_CAPTURED_EXCEPTION */
124     #if !TBB_USE_CAPTURED_EXCEPTION && !__TBB_EXCEPTION_PTR_PRESENT
125         #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.
126     #endif
127 #endif /* defined TBB_USE_CAPTURED_EXCEPTION */
128
129
130 #ifndef __TBB_DEFAULT_PARTITIONER
131 #if TBB_DEPRECATED
132 /** Default partitioner for parallel loop templates in TBB 1.0-2.1 */
133 #define __TBB_DEFAULT_PARTITIONER tbb::simple_partitioner
134 #else
135 /** Default partitioner for parallel loop templates in TBB 2.2 */
136 #define __TBB_DEFAULT_PARTITIONER tbb::auto_partitioner
137 #endif /* TBB_DEFAULT_PARTITIONER */
138 #endif /* !defined(__TBB_DEFAULT_PARTITIONER */
139
140 /** Workarounds presence **/
141
142 #if __GNUC__==4 && __GNUC_MINOR__>=4 && !defined(__INTEL_COMPILER)
143     #define __TBB_GCC_WARNING_SUPPRESSION_ENABLED 1
144 #endif
145
146 /** Macros of the form __TBB_XXX_BROKEN denote known issues that are caused by
147     the bugs in compilers, standard or OS specific libraries. They should be 
148     removed as soon as the corresponding bugs are fixed or the buggy OS/compiler
149     versions go out of the support list. 
150 **/
151
152 #if _MSC_VER && __INTEL_COMPILER && (__INTEL_COMPILER<1110 || __INTEL_COMPILER==1110 && __INTEL_COMPILER_BUILD_DATE < 20091012)
153     /** Necessary to avoid ICL error (or warning in non-strict mode): 
154         "exception specification for implicitly declared virtual destructor is 
155         incompatible with that of overridden one". **/
156     #define __TBB_DEFAULT_DTOR_THROW_SPEC_BROKEN 1
157 #endif
158
159 #if defined(_MSC_VER) && _MSC_VER < 1500 && !defined(__INTEL_COMPILER)
160     /** VS2005 and earlier do not allow declaring template class as a friend 
161         of classes defined in other namespaces. **/
162     #define __TBB_TEMPLATE_FRIENDS_BROKEN 1
163 #endif
164
165 #if __GLIBC__==2 && __GLIBC_MINOR__==3 || __MINGW32__
166     //! Macro controlling EH usages in TBB tests
167     /** Some older versions of glibc crash when exception handling happens concurrently. **/
168     #define __TBB_THROW_ACROSS_MODULE_BOUNDARY_BROKEN 1
169 #endif
170
171 #if (_WIN32||_WIN64) && __INTEL_COMPILER == 1110
172     /** 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. **/
173     #define __TBB_ICL_11_1_CODE_GEN_BROKEN 1
174 #endif
175
176 #if __GNUC__==3 && __GNUC_MINOR__==3 && !defined(__INTEL_COMPILER)
177     /** A bug in GCC 3.3 with access to nested classes declared in protected area */
178     #define __TBB_GCC_3_3_PROTECTED_BROKEN 1
179 #endif
180
181 #if __FreeBSD__
182     /** A bug in FreeBSD 8.0 results in kernel panic when there is contention 
183         on a mutex created with this attribute. **/
184     #define __TBB_PRIO_INHERIT_BROKEN 1
185
186     /** A bug in FreeBSD 8.0 results in test hanging when an exception occurs 
187         during (concurrent?) object construction by means of placement new operator. **/
188     #define __TBB_PLACEMENT_NEW_EXCEPTION_SAFETY_BROKEN 1
189 #endif /* __FreeBSD__ */
190
191 #if (__linux__ || __APPLE__) && __i386__ && defined(__INTEL_COMPILER)
192     /** The Intel compiler for IA-32 (Linux|Mac OS X) crashes or generates 
193         incorrect code when __asm__ arguments have a cast to volatile. **/
194     #define __TBB_ICC_ASM_VOLATILE_BROKEN 1
195 #endif
196
197
198 #endif /* __TBB_tbb_config_H */