00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __TBB_tbb_stddef_H
00022 #define __TBB_tbb_stddef_H
00023
00024
00025 #define TBB_VERSION_MAJOR 4
00026 #define TBB_VERSION_MINOR 1
00027
00028
00029 #define TBB_INTERFACE_VERSION 6102
00030 #define TBB_INTERFACE_VERSION_MAJOR TBB_INTERFACE_VERSION/1000
00031
00032
00033
00034 #define TBB_COMPATIBLE_INTERFACE_VERSION 2
00035
00036 #define __TBB_STRING_AUX(x) #x
00037 #define __TBB_STRING(x) __TBB_STRING_AUX(x)
00038
00039
00040 #if !defined RC_INVOKED
00041
00042
00052
00094
00095 #include "tbb_config.h"
00096
00097 #if _MSC_VER >=1400
00098 #define __TBB_EXPORTED_FUNC __cdecl
00099 #define __TBB_EXPORTED_METHOD __thiscall
00100 #else
00101 #define __TBB_EXPORTED_FUNC
00102 #define __TBB_EXPORTED_METHOD
00103 #endif
00104
00105 #if __INTEL_COMPILER || _MSC_VER
00106 #define __TBB_NOINLINE(decl) __declspec(noinline) decl
00107 #elif __GNUC__
00108 #define __TBB_NOINLINE(decl) decl __attribute__ ((noinline))
00109 #else
00110 #define __TBB_NOINLINE(decl) decl
00111 #endif
00112
00113 #include <cstddef>
00114
00115 #if _MSC_VER
00116 #define __TBB_tbb_windef_H
00117 #include "internal/_tbb_windef.h"
00118 #undef __TBB_tbb_windef_H
00119 #endif
00120 #if !defined(_MSC_VER) || _MSC_VER>=1600
00121 #include <stdint.h>
00122 #endif
00123
00125 typedef void(*assertion_handler_type)( const char* filename, int line, const char* expression, const char * comment );
00126
00127 #if TBB_USE_ASSERT
00128
00129 #define __TBB_ASSERT_NS(predicate,message,ns) ((predicate)?((void)0) : ns::assertion_failure(__FILE__,__LINE__,#predicate,message))
00131
00134 #if __TBBMALLOC_BUILD
00135 namespace rml { namespace internal {
00136 #define __TBB_ASSERT(predicate,message) __TBB_ASSERT_NS(predicate,message,rml::internal)
00137 #else
00138 namespace tbb {
00139 #define __TBB_ASSERT(predicate,message) __TBB_ASSERT_NS(predicate,message,tbb)
00140 #endif
00141
00142 #define __TBB_ASSERT_EX __TBB_ASSERT
00143
00145 assertion_handler_type __TBB_EXPORTED_FUNC set_assertion_handler( assertion_handler_type new_handler );
00146
00148
00151 void __TBB_EXPORTED_FUNC assertion_failure( const char* filename, int line, const char* expression, const char* comment );
00152
00153 #if __TBBMALLOC_BUILD
00154 }}
00155 #else
00156 }
00157 #endif
00158 #else
00159
00161 #define __TBB_ASSERT(predicate,comment) ((void)0)
00163 #define __TBB_ASSERT_EX(predicate,comment) ((void)(1 && (predicate)))
00164
00165 #endif
00166
00168 namespace tbb {
00169
00170 #if _MSC_VER && _MSC_VER<1600
00171 namespace internal {
00172 typedef __int8 int8_t;
00173 typedef __int16 int16_t;
00174 typedef __int32 int32_t;
00175 typedef __int64 int64_t;
00176 typedef unsigned __int8 uint8_t;
00177 typedef unsigned __int16 uint16_t;
00178 typedef unsigned __int32 uint32_t;
00179 typedef unsigned __int64 uint64_t;
00180 }
00181 #else
00182 namespace internal {
00183 using ::int8_t;
00184 using ::int16_t;
00185 using ::int32_t;
00186 using ::int64_t;
00187 using ::uint8_t;
00188 using ::uint16_t;
00189 using ::uint32_t;
00190 using ::uint64_t;
00191 }
00192 #endif
00193
00194 using std::size_t;
00195 using std::ptrdiff_t;
00196
00198
00202 extern "C" int __TBB_EXPORTED_FUNC TBB_runtime_interface_version();
00203
00205
00209 class split {
00210 };
00211
00216 namespace internal {
00217
00219
00222 const size_t NFS_MaxLineSize = 128;
00223
00243 #define __TBB_atomic // intentionally empty, see above
00244
00245 template<class T, int S>
00246 struct padded_base : T {
00247 char pad[NFS_MaxLineSize - sizeof(T) % NFS_MaxLineSize];
00248 };
00249 template<class T> struct padded_base<T, 0> : T {};
00250
00252 template<class T>
00253 struct padded : padded_base<T, sizeof(T)> {};
00254
00256
00258 #define __TBB_offsetof(class_name, member_name) \
00259 ((ptrdiff_t)&(reinterpret_cast<class_name*>(0x1000)->member_name) - 0x1000)
00260
00262 #define __TBB_get_object_ref(class_name, member_name, member_addr) \
00263 (*reinterpret_cast<class_name*>((char*)member_addr - __TBB_offsetof(class_name, member_name)))
00264
00266 void __TBB_EXPORTED_FUNC handle_perror( int error_code, const char* aux_info );
00267
00268 #if TBB_USE_EXCEPTIONS
00269 #define __TBB_TRY try
00270 #define __TBB_CATCH(e) catch(e)
00271 #define __TBB_THROW(e) throw e
00272 #define __TBB_RETHROW() throw
00273 #else
00274 inline bool __TBB_false() { return false; }
00275 #define __TBB_TRY
00276 #define __TBB_CATCH(e) if ( tbb::internal::__TBB_false() )
00277 #define __TBB_THROW(e) ((void)0)
00278 #define __TBB_RETHROW() ((void)0)
00279 #endif
00280
00282 void __TBB_EXPORTED_FUNC runtime_warning( const char* format, ... );
00283
00284 #if TBB_USE_ASSERT
00285 static void* const poisoned_ptr = reinterpret_cast<void*>(-1);
00286
00288 template<typename T>
00289 inline void poison_pointer( T*& p ) { p = reinterpret_cast<T*>(poisoned_ptr); }
00290
00292 template<typename T>
00293 inline bool is_poisoned( T* p ) { return p == reinterpret_cast<T*>(poisoned_ptr); }
00294 #else
00295 template<typename T>
00296 inline void poison_pointer( T* ) {}
00297 #endif
00298
00300
00302 template<typename T, typename U>
00303 inline T punned_cast( U* ptr ) {
00304 uintptr_t x = reinterpret_cast<uintptr_t>(ptr);
00305 return reinterpret_cast<T>(x);
00306 }
00307
00309 class no_assign {
00310
00311 void operator=( const no_assign& );
00312 public:
00313 #if __GNUC__
00315 no_assign() {}
00316 #endif
00317 };
00318
00320 class no_copy: no_assign {
00322 no_copy( const no_copy& );
00323 public:
00325 no_copy() {}
00326 };
00327
00329 template<typename T>
00330 struct allocator_type {
00331 typedef T value_type;
00332 };
00333
00334 #if _MSC_VER
00336 template<typename T>
00337 struct allocator_type<const T> {
00338 typedef T value_type;
00339 };
00340 #endif
00341
00343 inline size_t size_t_select( unsigned u, unsigned long long ull ) {
00344
00345
00346
00347
00348 return (sizeof(size_t)==sizeof(u)) ? size_t(u) : size_t(ull);
00349 }
00350
00351 template<typename T>
00352 static inline bool is_aligned(T* pointer, uintptr_t alignment) {
00353 return 0==((uintptr_t)pointer & (alignment-1));
00354 }
00355
00356
00359 struct version_tag_v3 {};
00360
00361 typedef version_tag_v3 version_tag;
00362
00363 }
00365
00366 }
00367
00368 namespace tbb { namespace internal {
00369 template <bool condition>
00370 struct STATIC_ASSERTION_FAILED;
00371
00372 template <>
00373 struct STATIC_ASSERTION_FAILED<false> { enum {value=1};};
00374
00375 template<>
00376 struct STATIC_ASSERTION_FAILED<true>;
00377 }}
00378
00379 #if __TBB_STATIC_ASSERT_PRESENT
00380 #define __TBB_STATIC_ASSERT(condition,msg) static_assert(condition,msg)
00381 #else
00382
00383 #define __TBB_STATIC_ASSERT_IMPL1(condition,msg,line) \
00384 enum {static_assert_on_line_##line = tbb::internal::STATIC_ASSERTION_FAILED<!(condition)>::value}
00385
00386 #define __TBB_STATIC_ASSERT_IMPL(condition,msg,line) __TBB_STATIC_ASSERT_IMPL1(condition,msg,line)
00388 #define __TBB_STATIC_ASSERT(condition,msg) __TBB_STATIC_ASSERT_IMPL(condition,msg,__LINE__)
00389 #endif
00390
00391 #endif
00392 #endif