From fdcde242070bc186cca36dd1f2047d5c071d0a6f Mon Sep 17 00:00:00 2001 From: oltolm Date: Sat, 2 Dec 2023 23:02:48 +0100 Subject: [PATCH] fix compiler warnings --- core/cfg/option.cpp | 20 ++++++++++---------- core/hw/arm7/arm7.cpp | 7 +++++++ core/hw/modem/modem.cpp | 2 +- core/rend/dx11/dx11context.cpp | 2 +- core/rend/dx9/d3d_overlay.cpp | 8 ++++---- core/rend/vulkan/drawer.cpp | 2 +- core/rend/vulkan/vmallocator.h | 7 +++++++ core/windows/winmain.cpp | 9 +++++++++ 8 files changed, 40 insertions(+), 17 deletions(-) diff --git a/core/cfg/option.cpp b/core/cfg/option.cpp index eb06c2509..103b6dd92 100644 --- a/core/cfg/option.cpp +++ b/core/cfg/option.cpp @@ -179,19 +179,19 @@ std::array, 4> MapleMainDevices { Option("device3", MDT_None, "input"), Option("device4", MDT_None, "input"), }; -std::array, 2>, 4> MapleExpansionDevices { - Option("device1.1", MDT_SegaVMU, "input"), - Option("device1.2", MDT_SegaVMU, "input"), +std::array, 2>, 4> MapleExpansionDevices {{ + {{Option("device1.1", MDT_SegaVMU, "input"), + Option("device1.2", MDT_SegaVMU, "input")}}, - Option("device2.1", MDT_None, "input"), - Option("device2.2", MDT_None, "input"), + {{Option("device2.1", MDT_None, "input"), + Option("device2.2", MDT_None, "input")}}, - Option("device3.1", MDT_None, "input"), - Option("device3.2", MDT_None, "input"), + {{Option("device3.1", MDT_None, "input"), + Option("device3.2", MDT_None, "input")}}, - Option("device4.1", MDT_None, "input"), - Option("device4.2", MDT_None, "input"), -}; + {{Option("device4.1", MDT_None, "input"), + Option("device4.2", MDT_None, "input")}}, +}}; Option PerGameVmu("PerGameVmu", false, "config"); #ifdef _WIN32 Option UseRawInput("RawInput", false, "input"); diff --git a/core/hw/arm7/arm7.cpp b/core/hw/arm7/arm7.cpp index 7571036b0..3848d2a0f 100644 --- a/core/hw/arm7/arm7.cpp +++ b/core/hw/arm7/arm7.cpp @@ -368,7 +368,14 @@ void DYNACALL interpret(u32 opcode) u32 clockTicks = 0; #define NO_OPCODE_READ +#ifndef _MSC_VER +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif #include "arm-new.h" +#ifndef _MSC_VER +#pragma GCC diagnostic pop +#endif #undef NO_OPCODE_READ reg[CYCL_CNT].I -= clockTicks; diff --git a/core/hw/modem/modem.cpp b/core/hw/modem/modem.cpp index f3d6e904d..39384ed20 100644 --- a/core/hw/modem/modem.cpp +++ b/core/hw/modem/modem.cpp @@ -276,7 +276,7 @@ static int modem_sched_func(int tag, int cycles, int jitter, void *arg) if (!mem_dumped) { mem_dumped = true; - for (int i = 0 ; i < sizeof(modem_regs); i++) + for (size_t i = 0 ; i < sizeof(modem_regs); i++) LOG("modem_regs %02x == %02x", i, modem_regs.ptr[i]); } #endif diff --git a/core/rend/dx11/dx11context.cpp b/core/rend/dx11/dx11context.cpp index 808efac00..dcdf39d1c 100644 --- a/core/rend/dx11/dx11context.cpp +++ b/core/rend/dx11/dx11context.cpp @@ -348,7 +348,7 @@ void DX11Context::handleDeviceLost() } else { - Renderer* rend_norend(); + Renderer* rend_norend(void); renderer = rend_norend(); renderer->Init(); } diff --git a/core/rend/dx9/d3d_overlay.cpp b/core/rend/dx9/d3d_overlay.cpp index 4dc527b7a..e9d03117c 100644 --- a/core/rend/dx9/d3d_overlay.cpp +++ b/core/rend/dx9/d3d_overlay.cpp @@ -25,10 +25,10 @@ void D3DOverlay::drawQuad(const RECT& rect, D3DCOLOR color) { device->SetTextureStageState(0, D3DTSS_CONSTANT, color); Vertex quad[] { - { (float)(rect.left), (float)(rect.top), 0.5f, 0.f, 0.f }, - { (float)(rect.left), (float)(rect.bottom), 0.5f, 0.f, 1.f }, - { (float)(rect.right), (float)(rect.top), 0.5f, 1.f, 0.f }, - { (float)(rect.right), (float)(rect.bottom), 0.5f, 1.f, 1.f } + { {(float)(rect.left), (float)(rect.top), 0.5f}, {0.f, 0.f} }, + { {(float)(rect.left), (float)(rect.bottom), 0.5f}, {0.f, 1.f} }, + { {(float)(rect.right), (float)(rect.top), 0.5f}, {1.f, 0.f} }, + { {(float)(rect.right), (float)(rect.bottom), 0.5f}, {1.f, 1.f} } }; device->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, quad, sizeof(Vertex)); } diff --git a/core/rend/vulkan/drawer.cpp b/core/rend/vulkan/drawer.cpp index abfb99338..24181ec75 100644 --- a/core/rend/vulkan/drawer.cpp +++ b/core/rend/vulkan/drawer.cpp @@ -80,7 +80,7 @@ void BaseDrawer::SetBaseScissor(const vk::Extent2D& viewport) } else { - baseScissor = { 0, 0, (u32)viewport.width, (u32)viewport.height }; + baseScissor = vk::Rect2D{ {0, 0}, {(u32)viewport.width, (u32)viewport.height} }; } } diff --git a/core/rend/vulkan/vmallocator.h b/core/rend/vulkan/vmallocator.h index f94de21e1..0675e8db2 100644 --- a/core/rend/vulkan/vmallocator.h +++ b/core/rend/vulkan/vmallocator.h @@ -21,7 +21,14 @@ #pragma once #include #include "vulkan.h" +#ifndef _MSC_VER +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif #include "vk_mem_alloc.h" +#ifndef _MSC_VER +#pragma GCC diagnostic pop +#endif #if !defined(PRIu64) && defined(_WIN32) #define PRIu64 "I64u" diff --git a/core/windows/winmain.cpp b/core/windows/winmain.cpp index 2ab7a1118..3e9805e44 100644 --- a/core/windows/winmain.cpp +++ b/core/windows/winmain.cpp @@ -453,8 +453,17 @@ void os_SetThreadName(const char *name) } #ifdef VIDEO_ROUTING +#ifndef _MSC_VER +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunknown-pragmas" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif #include "SpoutSender.h" #include "SpoutDX.h" +#ifndef _MSC_VER +#pragma GCC diagnostic pop +#endif static SpoutSender* spoutSender; static spoutDX* spoutDXSender;