tbb_stddef.h Source File

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# tbb_stddef.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_stddef_H
    00022 #define __TBB_tbb_stddef_H
    00023
    00024 // Marketing-driven product version
    00025 #define TBB_VERSION_MAJOR 4
    00026 #define TBB_VERSION_MINOR 1
    00027
    00028 // Engineering-focused interface version
    00029 #define TBB_INTERFACE_VERSION 6101
    00030 #define TBB_INTERFACE_VERSION_MAJOR TBB_INTERFACE_VERSION/1000
    00031
    00032 // The oldest major interface version still supported
    00033 // To be used in SONAME, manifests, etc.
    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 // We do not need defines below for resource processing on windows
    00040 #if !defined RC_INVOKED
    00041
    00042 // Define groups for Doxygen documentation
    00052 // Simple text that is displayed on the main page of Doxygen documentation.
    00094 // Define preprocessor symbols used to determine architecture
    00095 #if _WIN32||_WIN64
    00096 #   if defined(_M_X64)||defined(__x86_64__)  // the latter for MinGW support
    00097 #       define __TBB_x86_64 1
    00098 #   elif defined(_M_IA64)
    00099 #       define __TBB_ipf 1
    00100 #   elif defined(_M_IX86)||defined(__i386__) // the latter for MinGW support
    00101 #       define __TBB_x86_32 1
    00102 #   endif
    00103 #else /* Assume generic Unix */
    00104 #   if !__linux__ && !__APPLE__
    00105 #       define __TBB_generic_os 1
    00106 #   endif
    00107 #   if __x86_64__
    00108 #       define __TBB_x86_64 1
    00109 #   elif __ia64__
    00110 #       define __TBB_ipf 1
    00111 #   elif __i386__||__i386  // __i386 is for Sun OS
    00112 #       define __TBB_x86_32 1
    00113 #   else
    00114 #       define __TBB_generic_arch 1
    00115 #   endif
    00116 #endif
    00117
    00118 // tbb_config.h should be included the first since it contains macro definitions used in other headers
    00119 #include "tbb_config.h"
    00120
    00121 #if _MSC_VER >=1400
    00122     #define __TBB_EXPORTED_FUNC   __cdecl
    00123     #define __TBB_EXPORTED_METHOD __thiscall
    00124 #else
    00125     #define __TBB_EXPORTED_FUNC
    00126     #define __TBB_EXPORTED_METHOD
    00127 #endif
    00128
    00129 #if __INTEL_COMPILER || _MSC_VER
    00130 #define __TBB_NOINLINE(decl) __declspec(noinline) decl
    00131 #elif __GNUC__
    00132 #define __TBB_NOINLINE(decl) decl __attribute__ ((noinline))
    00133 #else
    00134 #define __TBB_NOINLINE(decl) decl
    00135 #endif
    00136
    00137 #include <cstddef>      /* Need size_t and ptrdiff_t */
    00138
    00139 #if _MSC_VER
    00140     #define __TBB_tbb_windef_H
    00141     #include "internal/_tbb_windef.h"
    00142     #undef __TBB_tbb_windef_H
    00143 #endif
    00144 #if !defined(_MSC_VER) || _MSC_VER>=1600
    00145     #include <stdint.h>
    00146 #endif
    00147
    00149 typedef void(*assertion_handler_type)( const char* filename, int line, const char* expression, const char * comment );
    00150
    00151 #if TBB_USE_ASSERT
    00152
    00153      #define __TBB_ASSERT_NS(predicate,message,ns) ((predicate)?((void)0) : ns::assertion_failure(__FILE__,__LINE__,#predicate,message))
    00155
    00158 #if __TBBMALLOC_BUILD
    00159 namespace rml { namespace internal {
    00160     #define __TBB_ASSERT(predicate,message) __TBB_ASSERT_NS(predicate,message,rml::internal)
    00161 #else
    00162 namespace tbb {
    00163     #define __TBB_ASSERT(predicate,message) __TBB_ASSERT_NS(predicate,message,tbb)
    00164 #endif
    00165
    00166     #define __TBB_ASSERT_EX __TBB_ASSERT
    00167
    00169     assertion_handler_type __TBB_EXPORTED_FUNC set_assertion_handler( assertion_handler_type new_handler );
    00170
    00172
    00175     void __TBB_EXPORTED_FUNC assertion_failure( const char* filename, int line, const char* expression, const char* comment );
    00176
    00177 #if __TBBMALLOC_BUILD
    00178 }}  // namespace rml::internal
    00179 #else
    00180 } // namespace tbb
    00181 #endif
    00182 #else /* !TBB_USE_ASSERT */
    00183
    00185     #define __TBB_ASSERT(predicate,comment) ((void)0)
    00187     #define __TBB_ASSERT_EX(predicate,comment) ((void)(1 && (predicate)))
    00188
    00189 #endif /* !TBB_USE_ASSERT */
    00190
    00192 namespace tbb {
    00193
    00194 #if _MSC_VER && _MSC_VER<1600
    00195     namespace internal {
    00196         typedef __int8 int8_t;
    00197         typedef __int16 int16_t;
    00198         typedef __int32 int32_t;
    00199         typedef __int64 int64_t;
    00200         typedef unsigned __int8 uint8_t;
    00201         typedef unsigned __int16 uint16_t;
    00202         typedef unsigned __int32 uint32_t;
    00203         typedef unsigned __int64 uint64_t;
    00204     } // namespace internal
    00205 #else /* Posix */
    00206     namespace internal {
    00207         using ::int8_t;
    00208         using ::int16_t;
    00209         using ::int32_t;
    00210         using ::int64_t;
    00211         using ::uint8_t;
    00212         using ::uint16_t;
    00213         using ::uint32_t;
    00214         using ::uint64_t;
    00215     } // namespace internal
    00216 #endif /* Posix */
    00217
    00218     using std::size_t;
    00219     using std::ptrdiff_t;
    00220
    00222
    00226 extern "C" int __TBB_EXPORTED_FUNC TBB_runtime_interface_version();
    00227
    00229
    00233 class split {
    00234 };
    00235
    00240 namespace internal {
    00241
    00243
    00246 const size_t NFS_MaxLineSize = 128;
    00247
    00267 #define __TBB_atomic // intentionally empty, see above
    00268
    00269 template<class T, int S>
    00270 struct padded_base : T {
    00271     char pad[NFS_MaxLineSize - sizeof(T) % NFS_MaxLineSize];
    00272 };
    00273 template<class T> struct padded_base<T, 0> : T {};
    00274
    00276 template<class T>
    00277 struct padded : padded_base<T, sizeof(T)> {};
    00278
    00280
    00282 #define __TBB_offsetof(class_name, member_name) \
    00283     ((ptrdiff_t)&(reinterpret_cast<class_name*>(0x1000)->member_name) - 0x1000)
    00284
    00286 #define __TBB_get_object_ref(class_name, member_name, member_addr) \
    00287     (*reinterpret_cast<class_name*>((char*)member_addr - __TBB_offsetof(class_name, member_name)))
    00288
    00290 void __TBB_EXPORTED_FUNC handle_perror( int error_code, const char* aux_info );
    00291
    00292 #if TBB_USE_EXCEPTIONS
    00293     #define __TBB_TRY try
    00294     #define __TBB_CATCH(e) catch(e)
    00295     #define __TBB_THROW(e) throw e
    00296     #define __TBB_RETHROW() throw
    00297 #else /* !TBB_USE_EXCEPTIONS */
    00298     inline bool __TBB_false() { return false; }
    00299     #define __TBB_TRY
    00300     #define __TBB_CATCH(e) if ( tbb::internal::__TBB_false() )
    00301     #define __TBB_THROW(e) ((void)0)
    00302     #define __TBB_RETHROW() ((void)0)
    00303 #endif /* !TBB_USE_EXCEPTIONS */
    00304
    00306 void __TBB_EXPORTED_FUNC runtime_warning( const char* format, ... );
    00307
    00308 #if TBB_USE_ASSERT
    00309 static void* const poisoned_ptr = reinterpret_cast<void*>(-1);
    00310
    00312 template<typename T>
    00313 inline void poison_pointer( T*& p ) { p = reinterpret_cast<T*>(poisoned_ptr); }
    00314
    00316 template<typename T>
    00317 inline bool is_poisoned( T* p ) { return p == reinterpret_cast<T*>(poisoned_ptr); }
    00318 #else
    00319 template<typename T>
    00320 inline void poison_pointer( T* ) {/*do nothing*/}
    00321 #endif /* !TBB_USE_ASSERT */
    00322
    00324
    00326 template<typename T, typename U>
    00327 inline T punned_cast( U* ptr ) {
    00328     uintptr_t x = reinterpret_cast<uintptr_t>(ptr);
    00329     return reinterpret_cast<T>(x);
    00330 }
    00331
    00333 class no_assign {
    00334     // Deny assignment
    00335     void operator=( const no_assign& );
    00336 public:
    00337 #if __GNUC__
    00339     no_assign() {}
    00340 #endif /* __GNUC__ */
    00341 };
    00342
    00344 class no_copy: no_assign {
    00346     no_copy( const no_copy& );
    00347 public:
    00349     no_copy() {}
    00350 };
    00351
    00353 template<typename T>
    00354 struct allocator_type {
    00355     typedef T value_type;
    00356 };
    00357
    00358 #if _MSC_VER
    00360 template<typename T>
    00361 struct allocator_type<const T> {
    00362     typedef T value_type;
    00363 };
    00364 #endif
    00365
    00367 inline size_t size_t_select( unsigned u, unsigned long long ull ) {
    00368     /* Explicit cast of the arguments to size_t is done to avoid compiler warnings
    00369        (e.g. by Clang and MSVC) about possible truncation. The value of the right size,
    00370        which is selected by ?:, is anyway not truncated or promoted.
    00371        MSVC still warns if this trick is applied directly to constants, hence this function. */
    00372     return (sizeof(size_t)==sizeof(u)) ? size_t(u) : size_t(ull);
    00373 }
    00374
    00375 // Struct to be used as a version tag for inline functions.
    00378 struct version_tag_v3 {};
    00379
    00380 typedef version_tag_v3 version_tag;
    00381
    00382 } // internal
    00384
    00385 } // tbb
    00386
    00387 #endif /* RC_INVOKED */
    00388 #endif /* __TBB_tbb_stddef_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.