D3D12MemoryAllocator: fix the build with llvm-mingw 18.1.8 WoA

C:/qt/qtbase/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.cpp:144:32: error: unknown warning group '-Wnonnull-compare', ignored [-Werror,-Wunknown-warning-option]
  144 | #pragma GCC diagnostic ignored "-Wnonnull-compare"
      |                                ^
C:/qt/qtbase/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.cpp:9902:9: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to false [-Werror,-Wtautological-undefined-compare]
 9902 |     if (this == NULL)
      |         ^~~~    ~~~~
C:/qt/qtbase/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.cpp:10053:9: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to false [-Werror,-Wtautological-undefined-compare]
 10053 |     if (this == NULL)
       |         ^~~~    ~~~~
C:/qt/qtbase/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.cpp:10118:9: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to false [-Werror,-Wtautological-undefined-compare]
 10118 |     if (this == NULL)
       |         ^~~~    ~~~~
4 errors generated.

This amends 84fb0de413ec574aab778d863c56e0d9a7f7ef6e .

See also
* https://clang.llvm.org/docs/DiagnosticsReference.html
* https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

Pick-to: 6.8
Change-Id: I2c8d27ade8a123bc4ff2fa5082e161c042335c6c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
(cherry picked from commit 34be5083bddffc38b3034ac8a04b5b6b698d5e4e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Liang Qi 2025-03-25 15:27:05 +01:00 committed by Qt Cherry-pick Bot
parent 9b67f62950
commit cd26d3470a
2 changed files with 27 additions and 11 deletions

View File

@ -141,9 +141,17 @@ especially to test compatibility with D3D12_RESOURCE_HEAP_TIER_1 on modern GPUs.
#pragma GCC diagnostic ignored "-Wswitch"
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#if defined(__clang__)
#pragma GCC diagnostic ignored "-Wtautological-undefined-compare"
#endif
#if defined(__GNUC__) && !defined(_M_ARM64)
#pragma GCC diagnostic ignored "-Wnonnull-compare"
#endif
namespace D3D12MA
{
static constexpr UINT HEAP_TYPE_COUNT = 4;

View File

@ -1,19 +1,19 @@
From d83bc556c26b13e1a243c71628f75ef624de05bf Mon Sep 17 00:00:00 2001
From 57f112e8a8b826a761bb3af272cd33a76ee3c861 Mon Sep 17 00:00:00 2001
From: Laszlo Agocs <laszlo.agocs@qt.io>
Date: Sat, 21 Jan 2023 20:07:00 +0100
Subject: [PATCH] Eliminate warnings in D3D12MA
Change-Id: If703c50cc1239248b94967edb4047868aaf07f1a
---
.../D3D12MemoryAllocator/D3D12MemAlloc.cpp | 23 ++++++++++++++++++-
.../D3D12MemoryAllocator/D3D12MemAlloc.h | 6 ++---
2 files changed, 25 insertions(+), 4 deletions(-)
.../D3D12MemoryAllocator/D3D12MemAlloc.cpp | 31 ++++++++++++++++++-
.../D3D12MemoryAllocator/D3D12MemAlloc.h | 6 ++--
2 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.cpp b/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.cpp
index fe1856927f..f041ec13d8 100644
index 8e2488091a4..42b0ed9a39a 100644
--- a/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.cpp
+++ b/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.cpp
@@ -132,6 +132,18 @@ especially to test compatibility with D3D12_RESOURCE_HEAP_TIER_1 on modern GPUs.
@@ -132,6 +132,26 @@ especially to test compatibility with D3D12_RESOURCE_HEAP_TIER_1 on modern GPUs.
#define D3D12MA_CREATE_NOT_ZEROED_AVAILABLE 1
#endif
@ -26,13 +26,21 @@ index fe1856927f..f041ec13d8 100644
+#pragma GCC diagnostic ignored "-Wswitch"
+#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
+#pragma GCC diagnostic ignored "-Wunused-function"
+#endif
+
+#if defined(__clang__)
+#pragma GCC diagnostic ignored "-Wtautological-undefined-compare"
+#endif
+
+#if defined(__GNUC__) && !defined(_M_ARM64)
+#pragma GCC diagnostic ignored "-Wnonnull-compare"
+#endif
+
+
namespace D3D12MA
{
static constexpr UINT HEAP_TYPE_COUNT = 4;
@@ -7581,12 +7593,14 @@ void AllocatorPimpl::BuildStatsString(WCHAR** ppStatsString, BOOL detailedMap)
@@ -7584,12 +7604,14 @@ void AllocatorPimpl::BuildStatsString(WCHAR** ppStatsString, BOOL detailedMap)
json.WriteString(L"HEAP_FLAG_ALLOW_DISPLAY");
if (flags & D3D12_HEAP_FLAG_SHARED_CROSS_ADAPTER)
json.WriteString(L"HEAP_FLAG_CROSS_ADAPTER");
@ -47,7 +55,7 @@ index fe1856927f..f041ec13d8 100644
#ifdef __ID3D12Device8_INTERFACE_DEFINED__
if (flags & D3D12_HEAP_FLAG_CREATE_NOT_RESIDENT)
json.WriteString(L"HEAP_FLAG_CREATE_NOT_RESIDENT");
@@ -7607,9 +7621,12 @@ void AllocatorPimpl::BuildStatsString(WCHAR** ppStatsString, BOOL detailedMap)
@@ -7610,9 +7632,12 @@ void AllocatorPimpl::BuildStatsString(WCHAR** ppStatsString, BOOL detailedMap)
| D3D12_HEAP_FLAG_SHARED_CROSS_ADAPTER
| D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES
| D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES
@ -61,7 +69,7 @@ index fe1856927f..f041ec13d8 100644
#ifdef __ID3D12Device8_INTERFACE_DEFINED__
flags &= ~(D3D12_HEAP_FLAG_CREATE_NOT_RESIDENT
| D3D12_HEAP_FLAG_CREATE_NOT_ZEROED);
@@ -10539,3 +10556,7 @@ VirtualBlock::~VirtualBlock()
@@ -10542,3 +10567,7 @@ VirtualBlock::~VirtualBlock()
#endif // _D3D12MA_VIRTUAL_BLOCK_FUNCTIONS
#endif // _D3D12MA_PUBLIC_INTERFACE
} // namespace D3D12MA
@ -70,7 +78,7 @@ index fe1856927f..f041ec13d8 100644
+#pragma GCC diagnostic pop
+#endif
diff --git a/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.h b/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.h
index 4ab7be318e..d80dcb1e89 100644
index 4ab7be318e6..d80dcb1e892 100644
--- a/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.h
+++ b/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.h
@@ -151,9 +151,9 @@ class D3D12MA_API IUnknownImpl : public IUnknown
@ -87,5 +95,5 @@ index 4ab7be318e..d80dcb1e89 100644
virtual void ReleaseThis() { delete this; }
private:
--
2.33.0.windows.2
2.48.1