Silence memcpy/memset warnings.

This commit is contained in:
Bartosz Taudul 2020-08-15 02:14:29 +02:00
parent 5243bfe5a0
commit be0e3b9cc4
2 changed files with 14 additions and 14 deletions

View File

@ -31,14 +31,14 @@ public:
tracy_force_inline Vector()
{
memset( this, 0, sizeof( Vector<T> ) );
memset( (char*)this, 0, sizeof( Vector<T> ) );
}
Vector( const Vector& ) = delete;
tracy_force_inline Vector( Vector&& src ) noexcept
{
memcpy( this, &src, sizeof( Vector<T> ) );
memset( &src, 0, sizeof( Vector<T> ) );
memcpy( (char*)this, &src, sizeof( Vector<T> ) );
memset( (char*)&src, 0, sizeof( Vector<T> ) );
}
tracy_force_inline Vector( const T& value )
@ -68,17 +68,17 @@ public:
memUsage -= Capacity() * sizeof( T );
free( m_ptr );
}
memcpy( this, &src, sizeof( Vector<T> ) );
memset( &src, 0, sizeof( Vector<T> ) );
memcpy( (char*)this, &src, sizeof( Vector<T> ) );
memset( (char*)&src, 0, sizeof( Vector<T> ) );
return *this;
}
tracy_force_inline void swap( Vector& other )
{
uint8_t tmp[sizeof( Vector<T> )];
memcpy( tmp, &other, sizeof( Vector<T> ) );
memcpy( &other, this, sizeof( Vector<T> ) );
memcpy( this, tmp, sizeof( Vector<T> ) );
memcpy( (char*)tmp, &other, sizeof( Vector<T> ) );
memcpy( (char*)&other, this, sizeof( Vector<T> ) );
memcpy( (char*)this, tmp, sizeof( Vector<T> ) );
}
tracy_force_inline bool empty() const { return m_size == 0; }
@ -310,7 +310,7 @@ private:
{
if( std::is_trivially_copyable<T>() )
{
memcpy( ptr, m_ptr, m_size * sizeof( T ) );
memcpy( (char*)ptr, m_ptr, m_size * sizeof( T ) );
}
else
{

View File

@ -257,7 +257,7 @@ Worker::Worker( const char* addr, int port )
m_data.callstackPayload.push_back( nullptr );
m_data.zoneExtra.push_back( ZoneExtra {} );
memset( m_gpuCtxMap, 0, sizeof( m_gpuCtxMap ) );
memset( (char*)m_gpuCtxMap, 0, sizeof( m_gpuCtxMap ) );
#ifndef TRACY_NO_STATISTICS
m_data.sourceLocationZonesReady = true;
@ -833,7 +833,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
s_loadProgress.subProgress.store( 0, std::memory_order_relaxed );
f.Read( sz );
m_data.zoneChildren.reserve_exact( sz, m_slab );
memset( m_data.zoneChildren.data(), 0, sizeof( Vector<short_ptr<ZoneEvent>> ) * sz );
memset( (char*)m_data.zoneChildren.data(), 0, sizeof( Vector<short_ptr<ZoneEvent>> ) * sz );
int32_t childIdx = 0;
f.Read( sz );
m_data.threads.reserve_exact( sz, m_slab );
@ -917,7 +917,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
s_loadProgress.subProgress.store( 0, std::memory_order_relaxed );
f.Read( sz );
m_data.gpuChildren.reserve_exact( sz, m_slab );
memset( m_data.gpuChildren.data(), 0, sizeof( Vector<short_ptr<GpuEvent>> ) * sz );
memset( (char*)m_data.gpuChildren.data(), 0, sizeof( Vector<short_ptr<GpuEvent>> ) * sz );
childIdx = 0;
f.Read( sz );
m_data.gpuData.reserve_exact( sz, m_slab );
@ -4940,7 +4940,7 @@ void Worker::ProcessGpuNewContext( const QueueGpuNewContext& ev )
const auto cpuTime = TscTime( ev.cpuTime - m_data.baseTime );
auto gpu = m_slab.AllocInit<GpuCtxData>();
memset( gpu->query, 0, sizeof( gpu->query ) );
memset( (char*)gpu->query, 0, sizeof( gpu->query ) );
gpu->timeDiff = cpuTime - gpuTime;
gpu->thread = ev.thread;
gpu->period = ev.period;
@ -7050,7 +7050,7 @@ ZoneExtra& Worker::AllocZoneExtra( ZoneEvent& ev )
assert( ev.extra == 0 );
ev.extra = uint32_t( m_data.zoneExtra.size() );
auto& extra = m_data.zoneExtra.push_next();
memset( &extra, 0, sizeof( extra ) );
memset( (char*)&extra, 0, sizeof( extra ) );
return extra;
}