Skip to content

Commit 5f826f3

Browse files
committed
Resolve -Wtautological-undefined-compare when building with clang
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
1 parent e00c4a7 commit 5f826f3

1 file changed

Lines changed: 0 additions & 15 deletions

File tree

src/D3D12MemAlloc.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9312,11 +9312,6 @@ void Allocation::SetName(LPCWSTR Name)
93129312

93139313
void Allocation::ReleaseThis()
93149314
{
9315-
if (this == NULL)
9316-
{
9317-
return;
9318-
}
9319-
93209315
SAFE_RELEASE(m_Resource);
93219316

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

94629457
void DefragmentationContext::ReleaseThis()
94639458
{
9464-
if (this == NULL)
9465-
{
9466-
return;
9467-
}
9468-
94699459
D3D12MA_DELETE(m_Pimpl->GetAllocs(), this);
94709460
}
94719461

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

95279517
void Pool::ReleaseThis()
95289518
{
9529-
if (this == NULL)
9530-
{
9531-
return;
9532-
}
9533-
95349519
D3D12MA_DELETE(m_Pimpl->GetAllocator()->GetAllocs(), this);
95359520
}
95369521

0 commit comments

Comments
 (0)