00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef __TBB_tbb_stddef_H
00030 #define __TBB_tbb_stddef_H
00031
00032
00033 #define TBB_VERSION_MAJOR 4
00034 #define TBB_VERSION_MINOR 1
00035
00036
00037 #define TBB_INTERFACE_VERSION 6102
00038 #define TBB_INTERFACE_VERSION_MAJOR TBB_INTERFACE_VERSION/1000
00039
00040
00041
00042 #define TBB_COMPATIBLE_INTERFACE_VERSION 2
00043
00044 #define __TBB_STRING_AUX(x) #x
00045 #define __TBB_STRING(x) __TBB_STRING_AUX(x)
00046
00047
00048 #if !defined RC_INVOKED
00049
00050
00060
00102
00103 #include "tbb_config.h"
00104
00105 #if _MSC_VER >=1400
00106 #define __TBB_EXPORTED_FUNC __cdecl
00107 #define __TBB_EXPORTED_METHOD __thiscall
00108 #else
00109 #define __TBB_EXPORTED_FUNC
00110 #define __TBB_EXPORTED_METHOD
00111 #endif
00112
00113 #if __INTEL_COMPILER || _MSC_VER
00114 #define __TBB_NOINLINE(decl) __declspec(noinline) decl
00115 #elif __GNUC__
00116 #define __TBB_NOINLINE(decl) decl __attribute__ ((noinline))
00117 #else
00118 #define __TBB_NOINLINE(decl) decl
00119 #endif
00120
00121 #include <cstddef>
00122
00123 #if _MSC_VER
00124 #define __TBB_tbb_windef_H
00125 #include "internal/_tbb_windef.h"
00126 #undef __TBB_tbb_windef_H
00127 #endif
00128 #if !defined(_MSC_VER) || _MSC_VER>=1600
00129 #include <stdint.h>
00130 #endif
00131
00133 typedef void(*assertion_handler_type)( const char* filename, int line, const char* expression, const char * comment );
00134
00135 #if TBB_USE_ASSERT
00136
00137 #define __TBB_ASSERT_NS(predicate,message,ns) ((predicate)?((void)0) : ns::assertion_failure(__FILE__,__LINE__,#predicate,message))
00139
00142 #if __TBBMALLOC_BUILD
00143 namespace rml { namespace internal {
00144 #define __TBB_ASSERT(predicate,message) __TBB_ASSERT_NS(predicate,message,rml::internal)
00145 #else
00146 namespace tbb {
00147 #define __TBB_ASSERT(predicate,message) __TBB_ASSERT_NS(predicate,message,tbb)
00148 #endif
00149
00150 #define __TBB_ASSERT_EX __TBB_ASSERT
00151
00153 assertion_handler_type __TBB_EXPORTED_FUNC set_assertion_handler( assertion_handler_type new_handler );
00154
00156
00159 void __TBB_EXPORTED_FUNC assertion_failure( const char* filename, int line, const char* expression, const char* comment );
00160
00161 #if __TBBMALLOC_BUILD
00162 }}
00163 #else
00164 }
00165 #endif
00166 #else
00167
00169 #define __TBB_ASSERT(predicate,comment) ((void)0)
00171 #define __TBB_ASSERT_EX(predicate,comment) ((void)(1 && (predicate)))
00172
00173 #endif
00174
00176 namespace tbb {
00177
00178 #if _MSC_VER && _MSC_VER<1600
00179 namespace internal {
00180 typedef __int8 int8_t;
00181 typedef __int16 int16_t;
00182 typedef __int32 int32_t;
00183 typedef __int64 int64_t;
00184 typedef unsigned __int8 uint8_t;
00185 typedef unsigned __int16 uint16_t;
00186 typedef unsigned __int32 uint32_t;
00187 typedef unsigned __int64 uint64_t;
00188 }
00189 #else
00190 namespace internal {
00191 using ::int8_t;
00192 using ::int16_t;
00193 using ::int32_t;
00194 using ::int64_t;
00195 using ::uint8_t;
00196 using ::uint16_t;
00197 using ::uint32_t;
00198 using ::uint64_t;
00199 }
00200 #endif
00201
00202 using std::size_t;
00203 using std::ptrdiff_t;
00204
00206
00210 extern "C" int __TBB_EXPORTED_FUNC TBB_runtime_interface_version();
00211
00213
00217 class split {
00218 };
00219
00224 namespace internal {
00225
00227
00230 const size_t NFS_MaxLineSize = 128;
00231
00251 #define __TBB_atomic // intentionally empty, see above
00252
00253 template<class T, int S>
00254 struct padded_base : T {
00255 char pad[NFS_MaxLineSize - sizeof(T) % NFS_MaxLineSize];
00256 };
00257 template<class T> struct padded_base<T, 0> : T {};
00258
00260 template<class T>
00261 struct padded : padded_base<T, sizeof(T)> {};
00262
00264
00266 #define __TBB_offsetof(class_name, member_name) \
00267 ((ptrdiff_t)&(reinterpret_cast<class_name*>(0x1000)->member_name) - 0x1000)
00268
00270 #define __TBB_get_object_ref(class_name, member_name, member_addr) \
00271 (*reinterpret_cast<class_name*>((char*)member_addr - __TBB_offsetof(class_name, member_name)))
00272
00274 void __TBB_EXPORTED_FUNC handle_perror( int error_code, const char* aux_info );
00275
00276 #if TBB_USE_EXCEPTIONS
00277 #define __TBB_TRY try
00278 #define __TBB_CATCH(e) catch(e)
00279 #define __TBB_THROW(e) throw e
00280 #define __TBB_RETHROW() throw
00281 #else
00282 inline bool __TBB_false() { return false; }
00283 #define __TBB_TRY
00284 #define __TBB_CATCH(e) if ( tbb::internal::__TBB_false() )
00285 #define __TBB_THROW(e) ((void)0)
00286 #define __TBB_RETHROW() ((void)0)
00287 #endif
00288
00290 void __TBB_EXPORTED_FUNC runtime_warning( const char* format, ... );
00291
00292 #if TBB_USE_ASSERT
00293 static void* const poisoned_ptr = reinterpret_cast<void*>(-1);
00294
00296 template<typename T>
00297 inline void poison_pointer( T*& p ) { p = reinterpret_cast<T*>(poisoned_ptr); }
00298
00300 template<typename T>
00301 inline bool is_poisoned( T* p ) { return p == reinterpret_cast<T*>(poisoned_ptr); }
00302 #else
00303 template<typename T>
00304 inline void poison_pointer( T* ) {}
00305 #endif
00306
00308
00310 template<typename T, typename U>
00311 inline T punned_cast( U* ptr ) {
00312 uintptr_t x = reinterpret_cast<uintptr_t>(ptr);
00313 return reinterpret_cast<T>(x);
00314 }
00315
00317 class no_assign {
00318
00319 void operator=( const no_assign& );
00320 public:
00321 #if __GNUC__
00323 no_assign() {}
00324 #endif
00325 };
00326
00328 class no_copy: no_assign {
00330 no_copy( const no_copy& );
00331 public:
00333 no_copy() {}
00334 };
00335
00337 template<typename T>
00338 struct allocator_type {
00339 typedef T value_type;
00340 };
00341
00342 #if _MSC_VER
00344 template<typename T>
00345 struct allocator_type<const T> {
00346 typedef T value_type;
00347 };
00348 #endif
00349
00351 inline size_t size_t_select( unsigned u, unsigned long long ull ) {
00352
00353
00354
00355
00356 return (sizeof(size_t)==sizeof(u)) ? size_t(u) : size_t(ull);
00357 }
00358
00359 template<typename T>
00360 static inline bool is_aligned(T* pointer, uintptr_t alignment) {
00361 return 0==((uintptr_t)pointer & (alignment-1));
00362 }
00363
00364
00367 struct version_tag_v3 {};
00368
00369 typedef version_tag_v3 version_tag;
00370
00371 }
00373
00374 }
00375
00376 namespace tbb { namespace internal {
00377 template <bool condition>
00378 struct STATIC_ASSERTION_FAILED;
00379
00380 template <>
00381 struct STATIC_ASSERTION_FAILED<false> { enum {value=1};};
00382
00383 template<>
00384 struct STATIC_ASSERTION_FAILED<true>;
00385 }}
00386
00387 #if __TBB_STATIC_ASSERT_PRESENT
00388 #define __TBB_STATIC_ASSERT(condition,msg) static_assert(condition,msg)
00389 #else
00390
00391 #define __TBB_STATIC_ASSERT_IMPL1(condition,msg,line) \
00392 enum {static_assert_on_line_##line = tbb::internal::STATIC_ASSERTION_FAILED<!(condition)>::value}
00393
00394 #define __TBB_STATIC_ASSERT_IMPL(condition,msg,line) __TBB_STATIC_ASSERT_IMPL1(condition,msg,line)
00396 #define __TBB_STATIC_ASSERT(condition,msg) __TBB_STATIC_ASSERT_IMPL(condition,msg,__LINE__)
00397 #endif
00398
00399 #endif
00400 #endif