diff -urp tbb20_20070927oss_src/src/test/harness_memory.h tbb20_20070927oss_src.pm3/src/test/harness_memory.h --- tbb20_20070927oss_src/src/test/harness_memory.h 2007-09-28 22:13:25.000000000 +0200 +++ tbb20_20070927oss_src.pm3/src/test/harness_memory.h 2007-12-19 20:00:49.000000000 +0100 @@ -59,7 +59,7 @@ static size_t GetMemoryUsage() { size_t pagesize = getpagesize(); ASSERT( statsfile, NULL ); long total_mem; - fscanf(statsfile,"%lu",&total_mem); + ASSERT( fscanf(statsfile,"%lu",&total_mem) == 1, NULL ); fclose(statsfile); return total_mem*pagesize; #elif __APPLE__ diff -urp tbb20_20070927oss_src.orig/src/test/test_concurrent_hash_map.cpp tbb20_20070927oss_src/src/test/test_concurrent_hash_map.cpp --- tbb20_20070927oss_src.orig/src/test/test_concurrent_hash_map.cpp 2008-01-31 16:03:16.000000000 +0100 +++ tbb20_20070927oss_src/src/test/test_concurrent_hash_map.cpp 2008-01-31 16:04:29.000000000 +0100 @@ -177,7 +177,7 @@ public: }; template -void DoConcurrentOperations( MyTable& table, int n, char* what, int nthread ) { +void DoConcurrentOperations( MyTable& table, int n, char const* what, int nthread ) { if( Verbose ) printf("testing %s with %d threads\n",what,nthread); tbb::tick_count t0 = tbb::tick_count::now(); diff -urp tbb20_20070927oss_src/include/tbb/concurrent_hash_map.h tbb20_20070927oss_src.ORIG/include/tbb/concurrent_hash_map.h --- tbb20_20070927oss_src.orig/include/tbb/concurrent_hash_map.h 2008-02-08 17:17:13.000000000 +0100 +++ tbb20_20070927oss_src/include/tbb/concurrent_hash_map.h 2008-02-08 19:04:49.000000000 +0100 @@ -584,7 +584,7 @@ bool concurrent_hash_map= sizeof(Bin) * numBlockBins, ASSERT_TEXT ); tls = (Bin*) bootStrapMalloc(tlsSize); /* the block contains zeroes after bootStrapMalloc, so bins are initialized */ #ifdef MALLOC_DEBUG - for (i = 0; i < numBlockBinLimit; i++) { + for (int i = 0; i < numBlockBinLimit; i++) { MALLOC_ASSERT( tls[i].activeBlk == 0, ASSERT_TEXT ); MALLOC_ASSERT( tls[i].mailbox == 0, ASSERT_TEXT ); } diff -urp tbb20_20070927oss_src.orig/src/tbb/concurrent_vector.cpp tbb20_20070927oss_src/src/tbb/concurrent_vector.cpp --- tbb20_20070927oss_src.orig/src/tbb/concurrent_vector.cpp 2008-01-31 14:07:33.000000000 +0100 +++ tbb20_20070927oss_src/src/tbb/concurrent_vector.cpp 2008-01-31 14:21:46.000000000 +0100 @@ -31,6 +31,7 @@ #include #include "itt_notify.h" #include "tbb/task.h" +#include namespace tbb { diff -urp tbb20_20070927oss_src.orig/include/tbb/concurrent_vector.h tbb20_20070927oss_src/include/tbb/concurrent_vector.h --- tbb20_20070927oss_src.orig/include/tbb/concurrent_vector.h 2008-01-31 15:39:02.000000000 +0100 +++ tbb20_20070927oss_src/include/tbb/concurrent_vector.h 2008-01-31 15:48:04.000000000 +0100 @@ -280,7 +280,7 @@ public: // workaround for MSVC size_t k = ++my_index; if( my_item ) { // Following test uses 2's-complement wizardry - if( (k& k-2)==0 ) { + if( (k& (k-2))==0 ) { // k is a power of two that is at least k-2 my_item= NULL; } else { @@ -296,7 +296,7 @@ public: // workaround for MSVC size_t k = my_index--; if( my_item ) { // Following test uses 2's-complement wizardry - if( (k& k-2)==0 ) { + if( (k& (k-2))==0 ) { // k is a power of two that is at least k-2 my_item= NULL; } else { diff -urp tbb20_20070927oss_src.orig/src/tbbmalloc/Statistics.h tbb20_20070927oss_src/src/tbbmalloc/Statistics.h --- tbb20_20070927oss_src.orig/src/tbbmalloc/Statistics.h 2008-01-31 14:07:33.000000000 +0100 +++ tbb20_20070927oss_src/src/tbbmalloc/Statistics.h 2008-01-31 14:16:12.000000000 +0100 @@ -66,7 +66,7 @@ static inline int STAT_increment(int thr return ++(statistic[thread][bin].counter[ctr]); } #else -#define STAT_increment(a,b,c) ((int)0) +#define STAT_increment(a,b,c) ((void)0) #endif static inline void STAT_print(int thread) diff -urp tbb20_20070927oss_src.orig/src/tbb/task.cpp tbb20_20070927oss_src/src/tbb/task.cpp --- tbb20_20070927oss_src.orig/src/tbb/task.cpp 2008-01-31 15:22:32.000000000 +0100 +++ tbb20_20070927oss_src/src/tbb/task.cpp 2008-01-31 15:28:11.000000000 +0100 @@ -393,7 +393,7 @@ static inline bool IsGenuineIntel() { bool result = true; #if defined(__TBB_cpuid) char info[16]; - char *genuine_string = "GenuntelineI"; + static char const genuine_string[] = "GenuntelineI"; __TBB_x86_cpuid( reinterpret_cast(info), 0 ); // The multibyte chars below spell "GenuineIntel". //if( info[1]=='uneG' && info[3]=='Ieni' && info[2]=='letn' ) { diff -urp tbb20_20070927oss_src.orig/src/tbb/pipeline.cpp tbb20_20070927oss_src/src/tbb/pipeline.cpp --- tbb20_20070927oss_src.orig/src/tbb/pipeline.cpp 2008-01-31 15:08:02.000000000 +0100 +++ tbb20_20070927oss_src/src/tbb/pipeline.cpp 2008-01-31 15:14:19.000000000 +0100 @@ -62,6 +62,10 @@ class ordered_buffer { //! Initial size for "array" /** Must be a power of 2 */ static const size_type initial_buffer_size = 4; + + static inline size_type getindex(size_type token, size_type size) { + return token & (size - 1); + } public: //! Construct empty buffer. ordered_buffer() : array(NULL), array_size(0), low_token(0) { @@ -92,7 +96,7 @@ public: if( token-low_token>=array_size ) grow( token-low_token+1 ); ITT_NOTIFY( sync_releasing, this ); - array[token&array_size-1] = &putter; + array[getindex(token, array_size)] = &putter; } } return result; @@ -106,7 +110,7 @@ public: spin_mutex::scoped_lock lock( array_mutex ); if( token==low_token ) { // Wake the next task - task*& item = array[++low_token & array_size-1]; + task*& item = array[getindex(++low_token, array_size)]; ITT_NOTIFY( sync_acquired, this ); wakee = item; item = NULL; @@ -129,7 +133,7 @@ void ordered_buffer::grow( size_type min new_array[i] = NULL; long t=low_token; for( size_type i=0; i(operator new( n )); @@ -181,7 +185,7 @@ bool micro_queue::pop( void* dst, ticket SpinwaitWhileEq( tail_counter, k ); page& p = *head_page; __TBB_ASSERT( &p, NULL ); - size_t index = (k/concurrent_queue_rep::n_queue & base.items_per_page-1); + size_t index = concurrent_queue_rep::getindex(k, base); bool success = false; { pop_finalizer finalizer( *this, k+concurrent_queue_rep::n_queue, index==base.items_per_page-1 ? &p : NULL ); @@ -319,7 +323,7 @@ public: else { concurrent_queue_base::page* p = array[concurrent_queue_rep::index(k)]; __TBB_ASSERT(p,NULL); - size_t i = k/concurrent_queue_rep::n_queue & my_queue.items_per_page-1; + size_t i = concurrent_queue_rep::getindex(k, my_queue); return static_cast(static_cast(p+1)) + my_queue.item_size*i; } } @@ -351,7 +355,7 @@ void concurrent_queue_iterator_base::adv size_t k = my_rep->head_counter; const concurrent_queue_base& queue = my_rep->my_queue; __TBB_ASSERT( my_item==my_rep->choose(k), NULL ); - size_t i = k/concurrent_queue_rep::n_queue & queue.items_per_page-1; + size_t i = concurrent_queue_rep::getindex(k, queue); if( i==queue.items_per_page-1 ) { concurrent_queue_base::page*& root = my_rep->array[concurrent_queue_rep::index(k)]; root = root->next; diff -urp tbb20_20070927oss_src.orig/include/tbb/concurrent_hash_map.h tbb20_20070927oss_src/include/tbb/concurrent_hash_map.h --- tbb20_20070927oss_src.orig/include/tbb/concurrent_hash_map.h 2008-01-31 16:03:16.000000000 +0100 +++ tbb20_20070927oss_src/include/tbb/concurrent_hash_map.h 2008-01-31 16:10:02.000000000 +0100 @@ -328,7 +328,7 @@ private: }; segment& get_segment( hashcode_t hashcode ) { - return my_segment[hashcode&n_segment-1]; + return my_segment[hashcode&(n_segment-1)]; } HashCompare my_hash_compare; diff -urp tbb20_20070927oss_src.orig/include/tbb/parallel_scan.h tbb20_20070927oss_src/include/tbb/parallel_scan.h --- tbb20_20070927oss_src.orig/include/tbb/parallel_scan.h 2008-01-31 16:19:28.000000000 +0100 +++ tbb20_20070927oss_src/include/tbb/parallel_scan.h 2008-01-31 16:30:17.000000000 +0100 @@ -232,7 +232,7 @@ namespace internal { is_final = false; } task* next_task = NULL; - if( is_right_child && !treat_as_stolen || partitioner.should_execute_range(range, *this) ) { + if( (is_right_child && !treat_as_stolen) || partitioner.should_execute_range(range, *this) ) { if( is_final ) (body->body)( range, final_scan_tag() ); else if( sum ) diff -urp tbb20_20070927oss_src/src/tbb/cache_aligned_allocator.cpp tbb20_20070927oss_src.pm/src/tbb/cache_aligned_allocator.cpp --- tbb20_20070927oss_src/src/tbb/cache_aligned_allocator.cpp 2007-09-28 22:13:24.000000000 +0200 +++ tbb20_20070927oss_src.pm/src/tbb/cache_aligned_allocator.cpp 2008-02-08 12:51:36.000000000 +0100 @@ -129,7 +129,7 @@ void* NFS_Allocate( size_t n, size_t ele using namespace internal; size_t m = NFS_LineSize; __TBB_ASSERT( m<=NFS_MaxLineSize, "illegal value for NFS_LineSize" ); - __TBB_ASSERT( (m & m-1)==0, "must be power of two" ); + __TBB_ASSERT( (m & (m-1))==0, "must be power of two" ); size_t bytes = n*element_size; unsigned char* base; if( bytes=BigSize?malloc(m+bytes):(*MallocHandler)(m+bytes))) ) {