Skip to content

Commit

Permalink
Resolve -Wtautological-undefined-compare when building with clang
Browse files Browse the repository at this point in the history
Comparing 'this' to 'nullptr' will always evaluate to false. clang and gcc optimize away the check entirely, removing the checks silences the warnings. https://clang.llvm.org/docs/DiagnosticsReference.html#wtautological-undefined-compare
  • Loading branch information
apache-hb committed Oct 28, 2024
1 parent e00c4a7 commit 5f826f3
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/D3D12MemAlloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9312,11 +9312,6 @@ void Allocation::SetName(LPCWSTR Name)

void Allocation::ReleaseThis()
{
if (this == NULL)
{
return;
}

SAFE_RELEASE(m_Resource);

switch (m_PackedData.GetType())
Expand Down Expand Up @@ -9461,11 +9456,6 @@ void DefragmentationContext::GetStats(DEFRAGMENTATION_STATS* pStats)

void DefragmentationContext::ReleaseThis()
{
if (this == NULL)
{
return;
}

D3D12MA_DELETE(m_Pimpl->GetAllocs(), this);
}

Expand Down Expand Up @@ -9526,11 +9516,6 @@ HRESULT Pool::BeginDefragmentation(const DEFRAGMENTATION_DESC* pDesc, Defragment

void Pool::ReleaseThis()
{
if (this == NULL)
{
return;
}

D3D12MA_DELETE(m_Pimpl->GetAllocator()->GetAllocs(), this);
}

Expand Down

0 comments on commit 5f826f3

Please sign in to comment.