mirror of https://github.com/PCSX2/pcsx2.git
Common: Warning fixes for clang-cl
This commit is contained in:
parent
5c95a6f4fa
commit
ca92d4ea3d
|
@ -91,6 +91,7 @@ target_sources(common PRIVATE
|
||||||
PrecompiledHeader.h
|
PrecompiledHeader.h
|
||||||
ProgressCallback.h
|
ProgressCallback.h
|
||||||
ReadbackSpinManager.h
|
ReadbackSpinManager.h
|
||||||
|
RedtapeWilCom.h
|
||||||
RedtapeWindows.h
|
RedtapeWindows.h
|
||||||
SafeArray.h
|
SafeArray.h
|
||||||
ScopedGuard.h
|
ScopedGuard.h
|
||||||
|
|
|
@ -114,7 +114,7 @@ static void WriteMinidumpAndCallstack(PEXCEPTION_POINTERS exi)
|
||||||
{
|
{
|
||||||
char line[1024];
|
char line[1024];
|
||||||
DWORD written;
|
DWORD written;
|
||||||
std::snprintf(line, std::size(line), "Exception 0x%08X at 0x%p\n", exi->ExceptionRecord->ExceptionCode,
|
std::snprintf(line, std::size(line), "Exception 0x%08X at 0x%p\n", static_cast<unsigned>(exi->ExceptionRecord->ExceptionCode),
|
||||||
exi->ExceptionRecord->ExceptionAddress);
|
exi->ExceptionRecord->ExceptionAddress);
|
||||||
WriteFile(hFile, line, static_cast<DWORD>(std::strlen(line)), &written, nullptr);
|
WriteFile(hFile, line, static_cast<DWORD>(std::strlen(line)), &written, nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,13 +17,14 @@
|
||||||
#include "common/Pcsx2Defs.h"
|
#include "common/Pcsx2Defs.h"
|
||||||
#include "common/HashCombine.h"
|
#include "common/HashCombine.h"
|
||||||
#include "common/RedtapeWindows.h"
|
#include "common/RedtapeWindows.h"
|
||||||
|
#include "common/RedtapeWilCom.h"
|
||||||
#include "common/D3D11/ShaderCompiler.h"
|
#include "common/D3D11/ShaderCompiler.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <d3d11.h>
|
#include <d3d11.h>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <wil/com.h>
|
|
||||||
|
|
||||||
namespace D3D11
|
namespace D3D11
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,11 +14,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common/RedtapeWindows.h"
|
#include "common/RedtapeWindows.h"
|
||||||
|
#include "common/RedtapeWilCom.h"
|
||||||
|
|
||||||
#include <d3d11.h>
|
#include <d3d11.h>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <wil/com.h>
|
|
||||||
|
|
||||||
namespace D3D11::ShaderCompiler
|
namespace D3D11::ShaderCompiler
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
|
|
||||||
#include "common/Pcsx2Defs.h"
|
#include "common/Pcsx2Defs.h"
|
||||||
#include "common/RedtapeWindows.h"
|
#include "common/RedtapeWindows.h"
|
||||||
|
#include "common/RedtapeWilCom.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <d3d12.h>
|
#include <d3d12.h>
|
||||||
#include <wil/com.h>
|
|
||||||
|
|
||||||
namespace D3D12
|
namespace D3D12
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
#include "common/Pcsx2Defs.h"
|
#include "common/Pcsx2Defs.h"
|
||||||
#include "common/HashCombine.h"
|
#include "common/HashCombine.h"
|
||||||
#include "common/RedtapeWindows.h"
|
#include "common/RedtapeWindows.h"
|
||||||
|
#include "common/RedtapeWilCom.h"
|
||||||
|
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <d3d12.h>
|
#include <d3d12.h>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <wil/com.h>
|
|
||||||
|
|
||||||
namespace D3D12
|
namespace D3D12
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
#include "common/Pcsx2Defs.h"
|
#include "common/Pcsx2Defs.h"
|
||||||
#include "common/HashCombine.h"
|
#include "common/HashCombine.h"
|
||||||
#include "common/RedtapeWindows.h"
|
#include "common/RedtapeWindows.h"
|
||||||
|
#include "common/RedtapeWilCom.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <d3d12.h>
|
#include <d3d12.h>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <wil/com.h>
|
|
||||||
|
|
||||||
namespace D3D12
|
namespace D3D12
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
|
|
||||||
#include "common/Pcsx2Defs.h"
|
#include "common/Pcsx2Defs.h"
|
||||||
#include "common/RedtapeWindows.h"
|
#include "common/RedtapeWindows.h"
|
||||||
|
#include "common/RedtapeWilCom.h"
|
||||||
|
|
||||||
#include <d3d12.h>
|
#include <d3d12.h>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <wil/com.h>
|
|
||||||
|
|
||||||
namespace D3D12MA
|
namespace D3D12MA
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,17 +20,17 @@
|
||||||
|
|
||||||
static void* GetProcAddressCallback(const char* name)
|
static void* GetProcAddressCallback(const char* name)
|
||||||
{
|
{
|
||||||
void* addr = wglGetProcAddress(name);
|
void* addr = reinterpret_cast<void*>(wglGetProcAddress(name));
|
||||||
if (addr)
|
if (addr)
|
||||||
return addr;
|
return addr;
|
||||||
|
|
||||||
// try opengl32.dll
|
// try opengl32.dll
|
||||||
return ::GetProcAddress(GetModuleHandleA("opengl32.dll"), name);
|
return reinterpret_cast<void*>(::GetProcAddress(GetModuleHandleA("opengl32.dll"), name));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ReloadWGL(HDC dc)
|
static bool ReloadWGL(HDC dc)
|
||||||
{
|
{
|
||||||
if (!gladLoadWGLLoader([](const char* name) -> void* { return wglGetProcAddress(name); }, dc))
|
if (!gladLoadWGLLoader([](const char* name) -> void* { return reinterpret_cast<void*>(wglGetProcAddress(name)); }, dc))
|
||||||
{
|
{
|
||||||
Console.Error("Loading GLAD WGL functions failed");
|
Console.Error("Loading GLAD WGL functions failed");
|
||||||
return false;
|
return false;
|
||||||
|
@ -208,7 +208,7 @@ namespace GL
|
||||||
if (!hDC)
|
if (!hDC)
|
||||||
{
|
{
|
||||||
Console.Error("GetDC() failed: 0x%08X", GetLastError());
|
Console.Error("GetDC() failed: 0x%08X", GetLastError());
|
||||||
return false;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_pixel_format.has_value())
|
if (!m_pixel_format.has_value())
|
||||||
|
@ -218,7 +218,7 @@ namespace GL
|
||||||
{
|
{
|
||||||
Console.Error("ChoosePixelFormat() failed: 0x%08X", GetLastError());
|
Console.Error("ChoosePixelFormat() failed: 0x%08X", GetLastError());
|
||||||
::ReleaseDC(hwnd, hDC);
|
::ReleaseDC(hwnd, hDC);
|
||||||
return false;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pixel_format = pf;
|
m_pixel_format = pf;
|
||||||
|
@ -397,7 +397,7 @@ namespace GL
|
||||||
}
|
}
|
||||||
|
|
||||||
// re-init glad-wgl
|
// re-init glad-wgl
|
||||||
if (!gladLoadWGLLoader([](const char* name) -> void* { return wglGetProcAddress(name); }, m_dc))
|
if (!gladLoadWGLLoader([](const char* name) -> void* { return reinterpret_cast<void*>(wglGetProcAddress(name)); }, m_dc))
|
||||||
{
|
{
|
||||||
Console.Error("Loading GLAD WGL functions failed");
|
Console.Error("Loading GLAD WGL functions failed");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -159,7 +159,7 @@ static constexpr size_t __pagemask = PCSX2_PAGESIZE - 1;
|
||||||
// Makes sure that if anyone includes xbyak, it doesn't do anything bad
|
// Makes sure that if anyone includes xbyak, it doesn't do anything bad
|
||||||
#define XBYAK_ENABLE_OMITTED_OPERAND
|
#define XBYAK_ENABLE_OMITTED_OPERAND
|
||||||
|
|
||||||
#ifdef __x86_64__
|
#if defined(__x86_64__) && !defined(_M_AMD64)
|
||||||
#define _M_AMD64
|
#define _M_AMD64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
/* PCSX2 - PS2 Emulator for PCs
|
||||||
|
* Copyright (C) 2002-2022 PCSX2 Dev Team
|
||||||
|
*
|
||||||
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||||
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||||
|
* ation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
#include "common/RedtapeWindows.h"
|
||||||
|
|
||||||
|
// warning : variable 's_hrErrorLast' set but not used [-Wunused-but-set-variable]
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <wil/com.h>
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -566,6 +566,8 @@ private:
|
||||||
case 8: //SymVirtual:
|
case 8: //SymVirtual:
|
||||||
szSymType = "Virtual";
|
szSymType = "Virtual";
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LPCSTR pdbName = Module.LoadedImageName;
|
LPCSTR pdbName = Module.LoadedImageName;
|
||||||
|
@ -1199,9 +1201,12 @@ void StackWalker::OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUser
|
||||||
OSVERSIONINFOEXA ver;
|
OSVERSIONINFOEXA ver;
|
||||||
ZeroMemory(&ver, sizeof(OSVERSIONINFOEXA));
|
ZeroMemory(&ver, sizeof(OSVERSIONINFOEXA));
|
||||||
ver.dwOSVersionInfoSize = sizeof(ver);
|
ver.dwOSVersionInfoSize = sizeof(ver);
|
||||||
#if _MSC_VER >= 1900
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4996)
|
#pragma warning(disable : 4996)
|
||||||
|
#elif defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
#endif
|
#endif
|
||||||
if (GetVersionExA((OSVERSIONINFOA*)&ver) != FALSE)
|
if (GetVersionExA((OSVERSIONINFOA*)&ver) != FALSE)
|
||||||
{
|
{
|
||||||
|
@ -1211,8 +1216,10 @@ void StackWalker::OnSymInit(LPCSTR szSearchPath, DWORD symOptions, LPCSTR szUser
|
||||||
buffer[STACKWALK_MAX_NAMELEN - 1] = 0;
|
buffer[STACKWALK_MAX_NAMELEN - 1] = 0;
|
||||||
OnOutput(buffer);
|
OnOutput(buffer);
|
||||||
}
|
}
|
||||||
#if _MSC_VER >= 1900
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
#elif defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ static bool VMMMarkPagesAsInUse(std::atomic<bool>* begin, std::atomic<bool>* end
|
||||||
for (auto current = begin; current < end; current++)
|
for (auto current = begin; current < end; current++)
|
||||||
{
|
{
|
||||||
bool expected = false;
|
bool expected = false;
|
||||||
if (!current->compare_exchange_strong(expected, true), std::memory_order_relaxed)
|
if (!current->compare_exchange_strong(expected, true, std::memory_order_relaxed))
|
||||||
{
|
{
|
||||||
// This was already allocated! Undo the things we've set until this point
|
// This was already allocated! Undo the things we've set until this point
|
||||||
while (--current >= begin)
|
while (--current >= begin)
|
||||||
|
|
|
@ -99,6 +99,7 @@
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wnullability-completeness"
|
#pragma clang diagnostic ignored "-Wnullability-completeness"
|
||||||
|
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VMA_STATIC_VULKAN_FUNCTIONS 1
|
#define VMA_STATIC_VULKAN_FUNCTIONS 1
|
||||||
|
|
|
@ -44,6 +44,8 @@ namespace Vulkan
|
||||||
DestroySurface();
|
DestroySurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// Unused for now, can be used for nogui
|
||||||
static VkSurfaceKHR CreateDisplaySurface(VkInstance instance, VkPhysicalDevice physical_device, WindowInfo* wi)
|
static VkSurfaceKHR CreateDisplaySurface(VkInstance instance, VkPhysicalDevice physical_device, WindowInfo* wi)
|
||||||
{
|
{
|
||||||
Console.WriteLn("Trying to create a VK_KHR_display surface of %ux%u", wi->surface_width, wi->surface_height);
|
Console.WriteLn("Trying to create a VK_KHR_display surface of %ux%u", wi->surface_width, wi->surface_height);
|
||||||
|
@ -253,6 +255,7 @@ namespace Vulkan
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
VkSurfaceKHR SwapChain::CreateVulkanSurface(VkInstance instance, VkPhysicalDevice physical_device, WindowInfo* wi)
|
VkSurfaceKHR SwapChain::CreateVulkanSurface(VkInstance instance, VkPhysicalDevice physical_device, WindowInfo* wi)
|
||||||
{
|
{
|
||||||
|
|
|
@ -286,8 +286,6 @@ bool SharedMemoryMappingArea::Unmap(void* map_base, size_t map_size)
|
||||||
pxAssert(Common::IsAlignedPow2(map_offset, __pagesize));
|
pxAssert(Common::IsAlignedPow2(map_offset, __pagesize));
|
||||||
pxAssert(Common::IsAlignedPow2(map_size, __pagesize));
|
pxAssert(Common::IsAlignedPow2(map_size, __pagesize));
|
||||||
|
|
||||||
const size_t page = map_offset / __pagesize;
|
|
||||||
|
|
||||||
// unmap the specified range
|
// unmap the specified range
|
||||||
if (!UnmapViewOfFile2(GetCurrentProcess(), map_base, MEM_PRESERVE_PLACEHOLDER))
|
if (!UnmapViewOfFile2(GetCurrentProcess(), map_base, MEM_PRESERVE_PLACEHOLDER))
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,7 +46,7 @@ using namespace x86Emitter;
|
||||||
|
|
||||||
alignas(16) x86capabilities x86caps;
|
alignas(16) x86capabilities x86caps;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER)
|
||||||
// We disable optimizations for this function, because we need x86capabilities for AVX
|
// We disable optimizations for this function, because we need x86capabilities for AVX
|
||||||
// detection, but if we keep opts on, it'll use AVX instructions for inlining memzero.
|
// detection, but if we keep opts on, it'll use AVX instructions for inlining memzero.
|
||||||
#pragma optimize("", off)
|
#pragma optimize("", off)
|
||||||
|
@ -70,7 +70,7 @@ x86capabilities::x86capabilities()
|
||||||
memzero(VendorName);
|
memzero(VendorName);
|
||||||
memzero(FamilyName);
|
memzero(FamilyName);
|
||||||
}
|
}
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER)
|
||||||
#pragma optimize("", on)
|
#pragma optimize("", on)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue