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

- File List
- File Members

# tbb_stddef.h

    00001 /*
    00002     Copyright 2005-2012 Intel Corporation.  All Rights Reserved.
    00003
    00004     This file is part of Threading Building Blocks.
    00005
    00006     Threading Building Blocks is free software; you can redistribute it
    00007     and/or modify it under the terms of the GNU General Public License
    00008     version 2 as published by the Free Software Foundation.
    00009
    00010     Threading Building Blocks is distributed in the hope that it will be
    00011     useful, but WITHOUT ANY WARRANTY; without even the implied warranty
    00012     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013     GNU General Public License for more details.
    00014
    00015     You should have received a copy of the GNU General Public License
    00016     along with Threading Building Blocks; if not, write to the Free Software
    00017     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    00018
    00019     As a special exception, you may use this file as part of a free software
    00020     library without restriction.  Specifically, if other files instantiate
    00021     templates or use macros or inline functions from this file, or you compile
    00022     this file and link it with other files to produce an executable, this
    00023     file does not by itself cause the resulting executable to be covered by
    00024     the GNU General Public License.  This exception does not however
    00025     invalidate any other reasons why the executable file might be covered by
    00026     the GNU General Public License.
    00027 */
    00028
    00029 #ifndef __TBB_tbb_stddef_H
    00030 #define __TBB_tbb_stddef_H
    00031
    00032 // Marketing-driven product version
    00033 #define TBB_VERSION_MAJOR 4
    00034 #define TBB_VERSION_MINOR 1
    00035
    00036 // Engineering-focused interface version
    00037 #define TBB_INTERFACE_VERSION 6101
    00038 #define TBB_INTERFACE_VERSION_MAJOR TBB_INTERFACE_VERSION/1000
    00039
    00040 // The oldest major interface version still supported
    00041 // To be used in SONAME, manifests, etc.
    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 // We do not need defines below for resource processing on windows
    00048 #if !defined RC_INVOKED
    00049
    00050 // Define groups for Doxygen documentation
    00060 // Simple text that is displayed on the main page of Doxygen documentation.
    00102 // Define preprocessor symbols used to determine architecture
    00103 #if _WIN32||_WIN64
    00104 #   if defined(_M_X64)||defined(__x86_64__)  // the latter for MinGW support
    00105 #       define __TBB_x86_64 1
    00106 #   elif defined(_M_IA64)
    00107 #       define __TBB_ipf 1
    00108 #   elif defined(_M_IX86)||defined(__i386__) // the latter for MinGW support
    00109 #       define __TBB_x86_32 1
    00110 #   endif
    00111 #else /* Assume generic Unix */
    00112 #   if !__linux__ && !__APPLE__
    00113 #       define __TBB_generic_os 1
    00114 #   endif
    00115 #   if __x86_64__
    00116 #       define __TBB_x86_64 1
    00117 #   elif __ia64__
    00118 #       define __TBB_ipf 1
    00119 #   elif __i386__||__i386  // __i386 is for Sun OS
    00120 #       define __TBB_x86_32 1
    00121 #   else
    00122 #       define __TBB_generic_arch 1
    00123 #   endif
    00124 #endif
    00125
    00126 // tbb_config.h should be included the first since it contains macro definitions used in other headers
    00127 #include "tbb_config.h"
    00128
    00129 #if _MSC_VER >=1400
    00130     #define __TBB_EXPORTED_FUNC   __cdecl
    00131     #define __TBB_EXPORTED_METHOD __thiscall
    00132 #else
    00133     #define __TBB_EXPORTED_FUNC
    00134     #define __TBB_EXPORTED_METHOD
    00135 #endif
    00136
    00137 #if __INTEL_COMPILER || _MSC_VER
    00138 #define __TBB_NOINLINE(decl) __declspec(noinline) decl
    00139 #elif __GNUC__
    00140 #define __TBB_NOINLINE(decl) decl __attribute__ ((noinline))
    00141 #else
    00142 #define __TBB_NOINLINE(decl) decl
    00143 #endif
    00144
    00145 #include <cstddef>      /* Need size_t and ptrdiff_t */
    00146
    00147 #if _MSC_VER
    00148     #define __TBB_tbb_windef_H
    00149     #include "internal/_tbb_windef.h"
    00150     #undef __TBB_tbb_windef_H
    00151 #endif
    00152 #if !defined(_MSC_VER) || _MSC_VER>=1600
    00153     #include <stdint.h>
    00154 #endif
    00155
    00157 typedef void(*assertion_handler_type)( const char* filename, int line, const char* expression, const char * comment );
    00158
    00159 #if TBB_USE_ASSERT
    00160
    00161      #define __TBB_ASSERT_NS(predicate,message,ns) ((predicate)?((void)0) : ns::assertion_failure(__FILE__,__LINE__,#predicate,message))
    00163
    00166 #if __TBBMALLOC_BUILD
    00167 namespace rml { namespace internal {
    00168     #define __TBB_ASSERT(predicate,message) __TBB_ASSERT_NS(predicate,message,rml::internal)
    00169 #else
    00170 namespace tbb {
    00171     #define __TBB_ASSERT(predicate,message) __TBB_ASSERT_NS(predicate,message,tbb)
    00172 #endif
    00173
    00174     #define __TBB_ASSERT_EX __TBB_ASSERT
    00175
    00177     assertion_handler_type __TBB_EXPORTED_FUNC set_assertion_handler( assertion_handler_type new_handler );
    00178
    00180
    00183     void __TBB_EXPORTED_FUNC assertion_failure( const char* filename, int line, const char* expression, const char* comment );
    00184
    00185 #if __TBBMALLOC_BUILD
    00186 }}  // namespace rml::internal
    00187 #else
    00188 } // namespace tbb
    00189 #endif
    00190 #else /* !TBB_USE_ASSERT */
    00191
    00193     #define __TBB_ASSERT(predicate,comment) ((void)0)
    00195     #define __TBB_ASSERT_EX(predicate,comment) ((void)(1 && (predicate)))
    00196
    00197 #endif /* !TBB_USE_ASSERT */
    00198
    00200 namespace tbb {
    00201
    00202 #if _MSC_VER && _MSC_VER<1600
    00203     namespace internal {
    00204         typedef __int8 int8_t;
    00205         typedef __int16 int16_t;
    00206         typedef __int32 int32_t;
    00207         typedef __int64 int64_t;
    00208         typedef unsigned __int8 uint8_t;
    00209         typedef unsigned __int16 uint16_t;
    00210         typedef unsigned __int32 uint32_t;
    00211         typedef unsigned __int64 uint64_t;
    00212     } // namespace internal
    00213 #else /* Posix */
    00214     namespace internal {
    00215         using ::int8_t;
    00216         using ::int16_t;
    00217         using ::int32_t;
    00218         using ::int64_t;
    00219         using ::uint8_t;
    00220         using ::uint16_t;
    00221         using ::uint32_t;
    00222         using ::uint64_t;
    00223     } // namespace internal
    00224 #endif /* Posix */
    00225
    00226     using std::size_t;
    00227     using std::ptrdiff_t;
    00228
    00230
    00234 extern "C" int __TBB_EXPORTED_FUNC TBB_runtime_interface_version();
    00235
    00237
    00241 class split {
    00242 };
    00243
    00248 namespace internal {
    00249
    00251
    00254 const size_t NFS_MaxLineSize = 128;
    00255
    00275 #define __TBB_atomic // intentionally empty, see above
    00276
    00277 template<class T, int S>
    00278 struct padded_base : T {
    00279     char pad[NFS_MaxLineSize - sizeof(T) % NFS_MaxLineSize];
    00280 };
    00281 template<class T> struct padded_base<T, 0> : T {};
    00282
    00284 template<class T>
    00285 struct padded : padded_base<T, sizeof(T)> {};
    00286
    00288
    00290 #define __TBB_offsetof(class_name, member_name) \
    00291     ((ptrdiff_t)&(reinterpret_cast<class_name*>(0x1000)->member_name) - 0x1000)
    00292
    00294 #define __TBB_get_object_ref(class_name, member_name, member_addr) \
    00295     (*reinterpret_cast<class_name*>((char*)member_addr - __TBB_offsetof(class_name, member_name)))
    00296
    00298 void __TBB_EXPORTED_FUNC handle_perror( int error_code, const char* aux_info );
    00299
    00300 #if TBB_USE_EXCEPTIONS
    00301     #define __TBB_TRY try
    00302     #define __TBB_CATCH(e) catch(e)
    00303     #define __TBB_THROW(e) throw e
    00304     #define __TBB_RETHROW() throw
    00305 #else /* !TBB_USE_EXCEPTIONS */
    00306     inline bool __TBB_false() { return false; }
    00307     #define __TBB_TRY
    00308     #define __TBB_CATCH(e) if ( tbb::internal::__TBB_false() )
    00309     #define __TBB_THROW(e) ((void)0)
    00310     #define __TBB_RETHROW() ((void)0)
    00311 #endif /* !TBB_USE_EXCEPTIONS */
    00312
    00314 void __TBB_EXPORTED_FUNC runtime_warning( const char* format, ... );
    00315
    00316 #if TBB_USE_ASSERT
    00317 static void* const poisoned_ptr = reinterpret_cast<void*>(-1);
    00318
    00320 template<typename T>
    00321 inline void poison_pointer( T*& p ) { p = reinterpret_cast<T*>(poisoned_ptr); }
    00322
    00324 template<typename T>
    00325 inline bool is_poisoned( T* p ) { return p == reinterpret_cast<T*>(poisoned_ptr); }
    00326 #else
    00327 template<typename T>
    00328 inline void poison_pointer( T* ) {/*do nothing*/}
    00329 #endif /* !TBB_USE_ASSERT */
    00330
    00332
    00334 template<typename T, typename U>
    00335 inline T punned_cast( U* ptr ) {
    00336     uintptr_t x = reinterpret_cast<uintptr_t>(ptr);
    00337     return reinterpret_cast<T>(x);
    00338 }
    00339
    00341 class no_assign {
    00342     // Deny assignment
    00343     void operator=( const no_assign& );
    00344 public:
    00345 #if __GNUC__
    00347     no_assign() {}
    00348 #endif /* __GNUC__ */
    00349 };
    00350
    00352 class no_copy: no_assign {
    00354     no_copy( const no_copy& );
    00355 public:
    00357     no_copy() {}
    00358 };
    00359
    00361 template<typename T>
    00362 struct allocator_type {
    00363     typedef T value_type;
    00364 };
    00365
    00366 #if _MSC_VER
    00368 template<typename T>
    00369 struct allocator_type<const T> {
    00370     typedef T value_type;
    00371 };
    00372 #endif
    00373
    00375 inline size_t size_t_select( unsigned u, unsigned long long ull ) {
    00376     /* Explicit cast of the arguments to size_t is done to avoid compiler warnings
    00377        (e.g. by Clang and MSVC) about possible truncation. The value of the right size,
    00378        which is selected by ?:, is anyway not truncated or promoted.
    00379        MSVC still warns if this trick is applied directly to constants, hence this function. */
    00380     return (sizeof(size_t)==sizeof(u)) ? size_t(u) : size_t(ull);
    00381 }
    00382
    00383 // Struct to be used as a version tag for inline functions.
    00386 struct version_tag_v3 {};
    00387
    00388 typedef version_tag_v3 version_tag;
    00389
    00390 } // internal
    00392
    00393 } // tbb
    00394
    00395 #endif /* RC_INVOKED */
    00396 #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.