Skip to content

Commit f5ab924

Browse files
committed
avoid memset warnings
1 parent 10a06c6 commit f5ab924

33 files changed

+72
-50
lines changed

src/tbb/include/tbb/internal/_concurrent_unordered_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ class concurrent_unordered_base : public Traits
13251325
// Initialize the hash and keep the first bucket open
13261326
void internal_init() {
13271327
// Initialize the array of segment pointers
1328-
memset(my_buckets, 0, sizeof(my_buckets));
1328+
memset(static_cast<void*>(my_buckets), 0, sizeof(my_buckets));
13291329

13301330
// Initialize bucket 0
13311331
raw_iterator dummy_node = my_solist.raw_begin();

src/tbb/python/rml/ipc_server.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -822,19 +822,19 @@ ipc_server::ipc_server(tbb_client& client) :
822822

823823
my_asleep_list_root = NULL;
824824
my_thread_array = tbb::cache_aligned_allocator<padded_ipc_worker>().allocate( my_n_thread );
825-
memset( my_thread_array, 0, sizeof(padded_ipc_worker)*my_n_thread );
825+
memset( static_cast<void*>(my_thread_array), 0, sizeof(padded_ipc_worker)*my_n_thread );
826826
for( size_t i=0; i<my_n_thread; ++i ) {
827827
ipc_worker* t = new( &my_thread_array[i] ) padded_ipc_worker( *this, client, i );
828828
t->my_next = my_asleep_list_root;
829829
my_asleep_list_root = t;
830830
}
831831

832832
my_waker = tbb::cache_aligned_allocator<ipc_waker>().allocate(1);
833-
memset( my_waker, 0, sizeof(ipc_waker) );
833+
memset( static_cast<void*>(my_waker), 0, sizeof(ipc_waker) );
834834
new( my_waker ) ipc_waker( *this, client, my_n_thread );
835835

836836
my_stopper = tbb::cache_aligned_allocator<ipc_stopper>().allocate(1);
837-
memset( my_stopper, 0, sizeof(ipc_stopper) );
837+
memset( static_cast<void*>(my_stopper), 0, sizeof(ipc_stopper) );
838838
new( my_stopper ) ipc_stopper( *this, client, my_n_thread + 1 );
839839

840840
char* active_sem_name = get_active_sem_name();
@@ -1083,7 +1083,7 @@ void rml_atfork_child() {
10831083
if( my_global_server!=NULL && my_global_client!=NULL ) {
10841084
ipc_server* server = static_cast<ipc_server*>( my_global_server );
10851085
server->~ipc_server();
1086-
memset( server, 0, sizeof(ipc_server) );
1086+
memset( static_cast<void*>(server), 0, sizeof(ipc_server) );
10871087
new( server ) ipc_server( *my_global_client );
10881088
pthread_atfork( NULL, NULL, rml_atfork_child );
10891089
atexit( rml_atexit );

src/tbb/src/old/test_concurrent_queue_v2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ struct Body: NoAssign {
7979
void operator()( long thread_id ) const {
8080
long pop_kind[3] = {0,0,0};
8181
int serial[MAXTHREAD+1];
82-
memset( serial, 0, nthread*sizeof(unsigned) );
82+
memset( static_cast<void*>(serial), 0, nthread*sizeof(unsigned) );
8383
ASSERT( thread_id<nthread, NULL );
8484

8585
long sum = 0;

src/tbb/src/old/test_concurrent_vector_v2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ void TestConcurrentGrowBy( int nthread ) {
409409
// Verify that v is a permutation of 0..m
410410
int inversions = 0;
411411
bool* found = new bool[m];
412-
memset( found, 0, m );
412+
memset( static_cast<void*>(found), 0, m );
413413
for( int i=0; i<m; ++i ) {
414414
int index = v[i].bar();
415415
ASSERT( !found[index], NULL );

src/tbb/src/perf/statistics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class StatisticsCollector
170170

171171
//! using: Func(const char *fmt, ...) { vargf2buff(buff, 128, fmt);...
172172
#define vargf2buff(name, size, fmt) \
173-
char name[size]; memset(name, 0, size); \
173+
char name[size]; memset(static_cast<void*>(name), 0, size); \
174174
va_list args; va_start(args, fmt); \
175175
vsnprintf(name, size-1, fmt, args); \
176176
va_end(args);

src/tbb/src/tbb/arena.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ arena& arena::allocate_arena( market& m, unsigned num_slots, unsigned num_reserv
242242
size_t n = allocation_size(num_arena_slots(num_slots));
243243
unsigned char* storage = (unsigned char*)NFS_Allocate( 1, n, NULL );
244244
// Zero all slots to indicate that they are empty
245-
memset( storage, 0, n );
245+
memset( static_cast<void*>(storage), 0, n );
246246
return *new( storage + num_arena_slots(num_slots) * sizeof(mail_outbox) ) arena(m, num_slots, num_reserved_slots);
247247
}
248248

@@ -293,7 +293,7 @@ void arena::free_arena () {
293293
__TBB_ASSERT( my_pool_state == SNAPSHOT_EMPTY || !my_max_num_workers, NULL );
294294
this->~arena();
295295
#if TBB_USE_ASSERT > 1
296-
memset( storage, 0, allocation_size(my_num_slots) );
296+
memset( static_cast<void*>(storage), 0, allocation_size(my_num_slots) );
297297
#endif /* TBB_USE_ASSERT */
298298
NFS_Free( storage );
299299
}

src/tbb/src/tbb/custom_scheduler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class custom_scheduler: private generic_scheduler {
118118
public:
119119
static generic_scheduler* allocate_scheduler( market& m ) {
120120
void* p = NFS_Allocate(1, sizeof(scheduler_type), NULL);
121-
std::memset(p, 0, sizeof(scheduler_type));
121+
std::memset(static_cast<void*>(p), 0, sizeof(scheduler_type));
122122
scheduler_type* s = new( p ) scheduler_type( m );
123123
s->assert_task_pool_valid();
124124
ITT_SYNC_CREATE(s, SyncType_Scheduler, SyncObj_TaskPoolSpinning);

src/tbb/src/tbb/market.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ market& market::global_market ( bool is_public, unsigned workers_requested, size
148148
#endif /* __TBB_TASK_GROUP_CONTEXT */
149149
__TBB_InitOnce::add_ref();
150150
void* storage = NFS_Allocate(1, size, NULL);
151-
memset( storage, 0, size );
151+
memset( static_cast<void*>(storage), 0, size );
152152
// Initialize and publish global market
153153
m = new (storage) market( workers_soft_limit, workers_hard_limit, stack_size );
154154
if( is_public )

src/tbb/src/tbb/task.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ void affinity_partitioner_base_v3::resize( unsigned factor ) {
166166
}
167167
if( new_size ) {
168168
my_array = static_cast<affinity_id*>(NFS_Allocate(new_size,sizeof(affinity_id), NULL ));
169-
memset( my_array, 0, sizeof(affinity_id)*new_size );
169+
memset( static_cast<void*>(my_array), 0, sizeof(affinity_id)*new_size );
170170
my_size = new_size;
171171
}
172172
}

src/tbb/src/tbb/tbb_assert_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ namespace tbb {
8484
//! Report a runtime warning.
8585
void __TBB_EXPORTED_FUNC runtime_warning( const char* format, ... )
8686
{
87-
char str[1024]; memset(str, 0, 1024);
87+
char str[1024]; memset(static_cast<void*>(str), 0, 1024);
8888
va_list args; va_start(args, format);
8989
vsnprintf( str, 1024-1, format, args);
9090
va_end(args);

0 commit comments

Comments
 (0)