From 1312624e0510d135cbfccbd84d85a346dfc75195 Mon Sep 17 00:00:00 2001 From: Minty-Meeo <45425365+Minty-Meeo@users.noreply.github.com> Date: Thu, 23 Mar 2023 11:18:20 -0500 Subject: [PATCH 01/11] Resolve [-Wshadow] --- Source/Core/Core/FifoPlayer/FifoRecorder.cpp | 4 +--- Source/Core/VideoCommon/TextureCacheBase.cpp | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp index 15063c3f02..7cedf8299b 100644 --- a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp +++ b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp @@ -268,9 +268,7 @@ void FifoRecorder::StartRecording(s32 numFrames, CallbackFunc finishedCb) RecordInitialVideoMemory(); } - auto& system = Core::System::GetInstance(); - auto& command_processor = system.GetCommandProcessor(); - const auto& fifo = command_processor.GetFifo(); + const auto& fifo = Core::System::GetInstance().GetCommandProcessor().GetFifo(); EndFrame(fifo.CPBase.load(std::memory_order_relaxed), fifo.CPEnd.load(std::memory_order_relaxed)); }, diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 6d138d5912..fa01029ea5 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -656,8 +656,8 @@ void TextureCacheBase::DoSaveState(PointerWrap& p) } auto doList = [&p](auto list) { - u32 size = static_cast(list.size()); - p.Do(size); + u32 list_size = static_cast(list.size()); + p.Do(list_size); for (const auto& it : list) { p.Do(it.first); From 1cf30055b26fa2966c411ae9e70510daaa21174a Mon Sep 17 00:00:00 2001 From: Minty-Meeo <45425365+Minty-Meeo@users.noreply.github.com> Date: Thu, 23 Mar 2023 12:28:44 -0500 Subject: [PATCH 02/11] Resolve [-Wsign-compare] --- Source/Core/Common/FileUtil.cpp | 2 +- Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index b97185e769..a9e7c35946 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -486,7 +486,7 @@ FSTEntry ScanDirectoryTree(std::string directory, bool recursive) } else if (cur_depth < prev_depth) { - while (dir_fsts.size() - 1 != cur_depth) + while (dir_fsts.size() != static_cast(cur_depth) + 1u) { calc_dir_size(dir_fsts.top()); dir_fsts.pop(); diff --git a/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp b/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp index 4dfc0a30ee..6e5c3eac97 100644 --- a/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp +++ b/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp @@ -384,7 +384,8 @@ void CEXIETHERNET::BuiltInBBAInterface::HandleTCPFrame(const Common::TCPPacket& if (size > 0) { // only if contain data - if (static_cast(this_seq - ref->ack_num) >= 0 && data.size() >= size) + if (static_cast(this_seq - ref->ack_num) >= 0 && + data.size() >= static_cast(size)) { ref->tcp_socket.send(data.data(), size); ref->ack_num += size; From d9a49c68d98a4a45eddd69007b2e15cdea6798f5 Mon Sep 17 00:00:00 2001 From: Minty-Meeo <45425365+Minty-Meeo@users.noreply.github.com> Date: Thu, 23 Mar 2023 12:00:41 -0500 Subject: [PATCH 03/11] Resolve [-Wunused-lambda-capture] --- Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp b/Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp index 46db6477d4..eda208da00 100644 --- a/Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp @@ -885,7 +885,7 @@ void MemoryViewWidget::OnContextMenu(const QPoint& pos) auto* copy_hex = menu->addAction(tr("Copy Hex"), this, [this, addr] { OnCopyHex(addr); }); copy_hex->setEnabled(item_has_value); - auto* copy_value = menu->addAction(tr("Copy Value"), this, [this, item_selected] { + auto* copy_value = menu->addAction(tr("Copy Value"), this, [item_selected] { QApplication::clipboard()->setText(item_selected->text()); }); copy_value->setEnabled(item_has_value); From 3282082599a36d4a7597751322bcec7349c4a7d8 Mon Sep 17 00:00:00 2001 From: Minty-Meeo <45425365+Minty-Meeo@users.noreply.github.com> Date: Thu, 23 Mar 2023 11:17:49 -0500 Subject: [PATCH 04/11] Resolve [-Wwrite-strings] --- Source/Core/DolphinQt/Main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/DolphinQt/Main.cpp b/Source/Core/DolphinQt/Main.cpp index 849a5b5550..317d12fefa 100644 --- a/Source/Core/DolphinQt/Main.cpp +++ b/Source/Core/DolphinQt/Main.cpp @@ -143,7 +143,7 @@ int main(int argc, char* argv[]) // code, which makes mouse inputs work again. // For more information: https://bugs.dolphin-emu.org/issues/12913 #if (QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)) - putenv("QT_XCB_NO_XI2=1"); + setenv("QT_XCB_NO_XI2", "1", true); #endif #endif From 2bb619a508ecb3df24be709345fae7ef0dbd434d Mon Sep 17 00:00:00 2001 From: Minty-Meeo <45425365+Minty-Meeo@users.noreply.github.com> Date: Thu, 23 Mar 2023 10:42:37 -0500 Subject: [PATCH 05/11] Resolve [-Wstringop-overflow=] --- Source/Core/Common/Crypto/bn.cpp | 27 +++++++++++++++------------ Source/Core/Common/Crypto/bn.h | 14 ++++++++------ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/Source/Core/Common/Crypto/bn.cpp b/Source/Core/Common/Crypto/bn.cpp index 3dc8c75280..28bd216824 100644 --- a/Source/Core/Common/Crypto/bn.cpp +++ b/Source/Core/Common/Crypto/bn.cpp @@ -3,42 +3,45 @@ #include "Common/Crypto/bn.h" +#include #include #include #include "Common/CommonTypes.h" -static void bn_zero(u8* d, int n) +static void bn_zero(u8* d, const size_t n) { std::memset(d, 0, n); } -static void bn_copy(u8* d, const u8* a, int n) +static void bn_copy(u8* d, const u8* a, const size_t n) { std::memcpy(d, a, n); } -int bn_compare(const u8* a, const u8* b, int n) +int bn_compare(const u8* a, const u8* b, const size_t n) { return std::memcmp(a, b, n); } -void bn_sub_modulus(u8* a, const u8* N, int n) +void bn_sub_modulus(u8* a, const u8* N, const size_t n) { u8 c = 0; - for (int i = n - 1; i >= 0; --i) + for (size_t i = n; i > 0;) { + --i; u32 dig = N[i] + c; c = (a[i] < dig); a[i] -= dig; } } -void bn_add(u8* d, const u8* a, const u8* b, const u8* N, int n) +void bn_add(u8* d, const u8* a, const u8* b, const u8* N, const size_t n) { u8 c = 0; - for (int i = n - 1; i >= 0; --i) + for (size_t i = n; i > 0;) { + --i; u32 dig = a[i] + b[i] + c; c = (dig >= 0x100); d[i] = dig; @@ -51,11 +54,11 @@ void bn_add(u8* d, const u8* a, const u8* b, const u8* N, int n) bn_sub_modulus(d, N, n); } -void bn_mul(u8* d, const u8* a, const u8* b, const u8* N, int n) +void bn_mul(u8* d, const u8* a, const u8* b, const u8* N, const size_t n) { bn_zero(d, n); - for (int i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) { for (u8 mask = 0x80; mask != 0; mask >>= 1) { @@ -66,13 +69,13 @@ void bn_mul(u8* d, const u8* a, const u8* b, const u8* N, int n) } } -void bn_exp(u8* d, const u8* a, const u8* N, int n, const u8* e, int en) +void bn_exp(u8* d, const u8* a, const u8* N, const size_t n, const u8* e, const size_t en) { u8 t[512]; bn_zero(d, n); d[n - 1] = 1; - for (int i = 0; i < en; i++) + for (size_t i = 0; i < en; i++) { for (u8 mask = 0x80; mask != 0; mask >>= 1) { @@ -86,7 +89,7 @@ void bn_exp(u8* d, const u8* a, const u8* N, int n, const u8* e, int en) } // only for prime N -- stupid but lazy, see if I care -void bn_inv(u8* d, const u8* a, const u8* N, int n) +void bn_inv(u8* d, const u8* a, const u8* N, const size_t n) { u8 t[512], s[512]; diff --git a/Source/Core/Common/Crypto/bn.h b/Source/Core/Common/Crypto/bn.h index 4070fd5f00..2dcc8c864b 100644 --- a/Source/Core/Common/Crypto/bn.h +++ b/Source/Core/Common/Crypto/bn.h @@ -3,13 +3,15 @@ #pragma once +#include + #include "Common/CommonTypes.h" // bignum arithmetic -int bn_compare(const u8* a, const u8* b, int n); -void bn_sub_modulus(u8* a, const u8* N, int n); -void bn_add(u8* d, const u8* a, const u8* b, const u8* N, int n); -void bn_mul(u8* d, const u8* a, const u8* b, const u8* N, int n); -void bn_inv(u8* d, const u8* a, const u8* N, int n); // only for prime N -void bn_exp(u8* d, const u8* a, const u8* N, int n, const u8* e, int en); +int bn_compare(const u8* a, const u8* b, size_t n); +void bn_sub_modulus(u8* a, const u8* N, size_t n); +void bn_add(u8* d, const u8* a, const u8* b, const u8* N, size_t n); +void bn_mul(u8* d, const u8* a, const u8* b, const u8* N, size_t n); +void bn_inv(u8* d, const u8* a, const u8* N, size_t n); // only for prime N +void bn_exp(u8* d, const u8* a, const u8* N, size_t n, const u8* e, size_t en); From 678c93589a642a72d8f2122fca681b886e442ccd Mon Sep 17 00:00:00 2001 From: Minty-Meeo <45425365+Minty-Meeo@users.noreply.github.com> Date: Thu, 23 Mar 2023 12:49:09 -0500 Subject: [PATCH 06/11] Resolve [-Wclass-memaccess] --- Source/Core/Core/FifoPlayer/FifoPlayer.cpp | 12 ++++------ Source/Core/Core/HW/MemoryInterface.cpp | 9 +------ .../HW/WiimoteEmu/DesiredWiimoteState.cpp | 10 ++------ Source/Core/VideoCommon/CPMemory.cpp | 12 ++++------ Source/Core/VideoCommon/ShaderCache.cpp | 24 +++++++------------ .../Core/VideoCommon/VertexLoaderManager.cpp | 11 +++------ 6 files changed, 22 insertions(+), 56 deletions(-) diff --git a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp index baf7b87760..9187728c29 100644 --- a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp +++ b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "Common/Assert.h" #include "Common/CommonTypes.h" @@ -101,14 +102,9 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile* file, part_start = offset; // Copy cpmem now, because end_of_primitives isn't triggered until the first opcode after // primitive data, and the first opcode might update cpmem -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wclass-memaccess" -#endif - std::memcpy(&cpmem, &analyzer.m_cpmem, sizeof(CPState)); -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif + static_assert(std::is_trivially_copyable_v); + std::memcpy(static_cast(&cpmem), static_cast(&analyzer.m_cpmem), + sizeof(CPState)); } if (analyzer.m_end_of_primitives) { diff --git a/Source/Core/Core/HW/MemoryInterface.cpp b/Source/Core/Core/HW/MemoryInterface.cpp index 7bba5450fe..4841b083b4 100644 --- a/Source/Core/Core/HW/MemoryInterface.cpp +++ b/Source/Core/Core/HW/MemoryInterface.cpp @@ -61,14 +61,7 @@ MemoryInterfaceManager::~MemoryInterfaceManager() = default; void MemoryInterfaceManager::Init() { static_assert(std::is_trivially_copyable_v); -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wclass-memaccess" -#endif - std::memset(&m_mi_mem, 0, sizeof(MIMemStruct)); -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif + std::memset(static_cast(&m_mi_mem), 0, sizeof(MIMemStruct)); } void MemoryInterfaceManager::Shutdown() diff --git a/Source/Core/Core/HW/WiimoteEmu/DesiredWiimoteState.cpp b/Source/Core/Core/HW/WiimoteEmu/DesiredWiimoteState.cpp index 3d65694167..3157e8b9c8 100644 --- a/Source/Core/Core/HW/WiimoteEmu/DesiredWiimoteState.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/DesiredWiimoteState.cpp @@ -136,14 +136,8 @@ static bool DeserializeExtensionState(DesiredWiimoteState* state, return false; auto& e = state->extension.data.emplace(); static_assert(std::is_trivially_copyable_v); -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wclass-memaccess" -#endif - std::memcpy(&e, &serialized.data[offset], sizeof(T)); -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif + std::memcpy(static_cast(&e), static_cast(&serialized.data[offset]), + sizeof(T)); return true; } diff --git a/Source/Core/VideoCommon/CPMemory.cpp b/Source/Core/VideoCommon/CPMemory.cpp index 3d72a6f70b..a42ee8fc2e 100644 --- a/Source/Core/VideoCommon/CPMemory.cpp +++ b/Source/Core/VideoCommon/CPMemory.cpp @@ -4,6 +4,7 @@ #include "VideoCommon/CPMemory.h" #include +#include #include "Common/ChunkFile.h" #include "Common/Logging/Log.h" @@ -17,14 +18,9 @@ CPState g_preprocess_cp_state; void CopyPreprocessCPStateFromMain() { -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wclass-memaccess" -#endif - std::memcpy(&g_preprocess_cp_state, &g_main_cp_state, sizeof(CPState)); -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif + static_assert(std::is_trivially_copyable_v); + std::memcpy(static_cast(&g_preprocess_cp_state), + static_cast(&g_main_cp_state), sizeof(CPState)); } std::pair GetCPRegInfo(u8 cmd, u32 value) diff --git a/Source/Core/VideoCommon/ShaderCache.cpp b/Source/Core/VideoCommon/ShaderCache.cpp index 1c01356c99..150f38b307 100644 --- a/Source/Core/VideoCommon/ShaderCache.cpp +++ b/Source/Core/VideoCommon/ShaderCache.cpp @@ -608,14 +608,10 @@ AbstractPipelineConfig ShaderCache::GetGXPipelineConfig( static GXPipelineUid ApplyDriverBugs(const GXPipelineUid& in) { GXPipelineUid out; -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wclass-memaccess" -#endif - memcpy(&out, &in, sizeof(out)); // copy padding -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif + // TODO: static_assert(std::is_trivially_copyable_v); + // GXPipelineUid is not trivially copyable because RasterizationState and BlendingState aren't + // either, but we can pretend it is for now. This will be improved after PR #10848 is finished. + memcpy(static_cast(&out), static_cast(&in), sizeof(out)); // copy padding pixel_shader_uid_data* ps = out.ps_uid.GetUidData(); BlendingState& blend = out.blending_state; @@ -785,14 +781,10 @@ ShaderCache::GetGXPipelineConfig(const GXPipelineUid& config_in) static GXUberPipelineUid ApplyDriverBugs(const GXUberPipelineUid& in) { GXUberPipelineUid out; -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wclass-memaccess" -#endif - memcpy(&out, &in, sizeof(out)); // Copy padding -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif + // TODO: static_assert(std::is_trivially_copyable_v); + // GXUberPipelineUid is not trivially copyable because RasterizationState and BlendingState aren't + // either, but we can pretend it is for now. This will be improved after PR #10848 is finished. + memcpy(static_cast(&out), static_cast(&in), sizeof(out)); // Copy padding if (g_ActiveConfig.backend_info.bSupportsDynamicVertexLoader) out.vertex_format = nullptr; diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp index 0236201001..fb24803f1c 100644 --- a/Source/Core/VideoCommon/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -153,14 +154,8 @@ NativeVertexFormat* GetUberVertexFormat(const PortableVertexDeclaration& decl) // The padding in the structs can cause the memcmp() in the map to create duplicates. // Avoid this by initializing the padding to zero. PortableVertexDeclaration new_decl; -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wclass-memaccess" -#endif - std::memset(&new_decl, 0, sizeof(new_decl)); -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif + static_assert(std::is_trivially_copyable_v); + std::memset(static_cast(&new_decl), 0, sizeof(new_decl)); new_decl.stride = decl.stride; auto MakeDummyAttribute = [](AttributeFormat& attr, ComponentFormat type, int components, From efd06a85d2af7da5968a5daba4d601776fd32360 Mon Sep 17 00:00:00 2001 From: Minty-Meeo <45425365+Minty-Meeo@users.noreply.github.com> Date: Thu, 23 Mar 2023 12:56:57 -0500 Subject: [PATCH 07/11] Resolve [-Wunused-but-set-variable] --- Source/Core/Common/SettingsHandler.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/Core/Common/SettingsHandler.cpp b/Source/Core/Common/SettingsHandler.cpp index 109c80abb8..c36805d4ce 100644 --- a/Source/Core/Common/SettingsHandler.cpp +++ b/Source/Core/Common/SettingsHandler.cpp @@ -70,12 +70,10 @@ std::string SettingsHandler::GetValue(std::string_view key) const void SettingsHandler::Decrypt() { - const u8* str = m_buffer.data(); while (m_position < m_buffer.size()) { decoded.push_back((u8)(m_buffer[m_position] ^ m_key)); m_position++; - str++; m_key = (m_key >> 31) | (m_key << 1); } From 528f7c90e9c83b5ef1469a36a0c1035948548909 Mon Sep 17 00:00:00 2001 From: Minty-Meeo <45425365+Minty-Meeo@users.noreply.github.com> Date: Thu, 23 Mar 2023 13:26:34 -0500 Subject: [PATCH 08/11] Resolve [-Wtautological-constant-out-of-range-compare] --- Source/Core/Core/NetPlayClient.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index db5027fd08..e21dbb393e 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -254,7 +254,8 @@ bool NetPlayClient::Connect() // TODO: make this not hang ENetEvent netEvent; int net; - while ((net = enet_host_service(m_client, &netEvent, 5000)) > 0 && netEvent.type == 42) + while ((net = enet_host_service(m_client, &netEvent, 5000)) > 0 && + netEvent.type == ENetEventType(42)) // See PR #11381 and ENetUtil::InterceptCallback { // ignore packets from traversal server } From 244918acb8e0a9580f17b0c06de7583e95ea4fe6 Mon Sep 17 00:00:00 2001 From: Minty-Meeo <45425365+Minty-Meeo@users.noreply.github.com> Date: Thu, 23 Mar 2023 11:01:13 -0500 Subject: [PATCH 09/11] Resolve [-Wdeprecated-declarations] --- Source/Core/Common/HttpRequest.cpp | 13 +++++++------ Source/Core/Common/HttpRequest.h | 3 +-- Source/Core/UpdaterCommon/UpdaterCommon.cpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/Core/Common/HttpRequest.cpp b/Source/Core/Common/HttpRequest.cpp index a8ed0d26ed..b9c6756624 100644 --- a/Source/Core/Common/HttpRequest.cpp +++ b/Source/Core/Common/HttpRequest.cpp @@ -33,8 +33,8 @@ public: Response Fetch(const std::string& url, Method method, const Headers& headers, const u8* payload, size_t size, AllowedReturnCodes codes = AllowedReturnCodes::Ok_Only); - static int CurlProgressCallback(Impl* impl, double dlnow, double dltotal, double ulnow, - double ultotal); + static int CurlProgressCallback(Impl* impl, curl_off_t dltotal, curl_off_t dlnow, + curl_off_t ultotal, curl_off_t ulnow); std::string EscapeComponent(const std::string& string); private: @@ -95,11 +95,12 @@ HttpRequest::Response HttpRequest::Post(const std::string& url, const std::strin reinterpret_cast(payload.data()), payload.size(), codes); } -int HttpRequest::Impl::CurlProgressCallback(Impl* impl, double dlnow, double dltotal, double ulnow, - double ultotal) +int HttpRequest::Impl::CurlProgressCallback(Impl* impl, curl_off_t dltotal, curl_off_t dlnow, + curl_off_t ultotal, curl_off_t ulnow) { // Abort if callback isn't true - return !impl->m_callback(dlnow, dltotal, ulnow, ultotal); + return !impl->m_callback(static_cast(dltotal), static_cast(dlnow), + static_cast(ultotal), static_cast(ulnow)); } HttpRequest::Impl::Impl(std::chrono::milliseconds timeout_ms, ProgressCallback callback) @@ -116,7 +117,7 @@ HttpRequest::Impl::Impl(std::chrono::milliseconds timeout_ms, ProgressCallback c if (m_callback) { curl_easy_setopt(m_curl.get(), CURLOPT_PROGRESSDATA, this); - curl_easy_setopt(m_curl.get(), CURLOPT_PROGRESSFUNCTION, CurlProgressCallback); + curl_easy_setopt(m_curl.get(), CURLOPT_XFERINFOFUNCTION, CurlProgressCallback); } // Set up error buffer diff --git a/Source/Core/Common/HttpRequest.h b/Source/Core/Common/HttpRequest.h index 921051c9c2..17b9fd3413 100644 --- a/Source/Core/Common/HttpRequest.h +++ b/Source/Core/Common/HttpRequest.h @@ -25,8 +25,7 @@ public: }; // Return false to abort the request - using ProgressCallback = - std::function; + using ProgressCallback = std::function; explicit HttpRequest(std::chrono::milliseconds timeout_ms = std::chrono::milliseconds{3000}, ProgressCallback callback = nullptr); diff --git a/Source/Core/UpdaterCommon/UpdaterCommon.cpp b/Source/Core/UpdaterCommon/UpdaterCommon.cpp index 408c313c95..9dd40c679f 100644 --- a/Source/Core/UpdaterCommon/UpdaterCommon.cpp +++ b/Source/Core/UpdaterCommon/UpdaterCommon.cpp @@ -58,7 +58,7 @@ void LogToFile(const char* fmt, ...) va_end(args); } -bool ProgressCallback(double total, double now, double, double) +bool ProgressCallback(s64 total, s64 now, s64, s64) { UI::SetCurrentProgress(static_cast(now), static_cast(total)); return true; From 65edfb0eeda1710d11d1133501b6cd0a335869aa Mon Sep 17 00:00:00 2001 From: Minty-Meeo <45425365+Minty-Meeo@users.noreply.github.com> Date: Thu, 23 Mar 2023 13:17:29 -0500 Subject: [PATCH 10/11] Resolve [-Wunused-const-variable] --- Source/Core/Core/HW/DSPHLE/UCodes/AESnd.cpp | 16 ++++++++-------- Source/Core/Core/HW/ProcessorInterface.cpp | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.cpp index d656f81a4d..202145697e 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AESnd.cpp @@ -44,21 +44,21 @@ constexpr u32 VOICE_16_BIT_FLAG = 2; // These are used in the pre-2020 versions version constexpr u32 VOICE_PAUSE_OLD = 0x00000004; -constexpr u32 VOICE_LOOP_OLD = 0x00000008; // not used by the DSP -constexpr u32 VOICE_ONCE_OLD = 0x00000010; // not used by the DSP -constexpr u32 VOICE_STREAM_OLD = 0x00000020; // not used by the DSP +constexpr u32 VOICE_LOOP_OLD [[maybe_unused]] = 0x00000008; // not used by the DSP +constexpr u32 VOICE_ONCE_OLD [[maybe_unused]] = 0x00000010; // not used by the DSP +constexpr u32 VOICE_STREAM_OLD [[maybe_unused]] = 0x00000020; // not used by the DSP // These were changed in the 2020 version to account for the different flags constexpr u32 VOICE_PAUSE_NEW = 0x00000008; -constexpr u32 VOICE_LOOP_NEW = 0x00000010; // not used by the DSP -constexpr u32 VOICE_ONCE_NEW = 0x00000020; // not used by the DSP -constexpr u32 VOICE_STREAM_NEW = 0x00000040; // not used by the DSP +constexpr u32 VOICE_LOOP_NEW [[maybe_unused]] = 0x00000010; // not used by the DSP +constexpr u32 VOICE_ONCE_NEW [[maybe_unused]] = 0x00000020; // not used by the DSP +constexpr u32 VOICE_STREAM_NEW [[maybe_unused]] = 0x00000040; // not used by the DSP // These did not change between versions constexpr u32 VOICE_FINISHED = 0x00100000; -constexpr u32 VOICE_STOPPED = 0x00200000; // not used by the DSP +constexpr u32 VOICE_STOPPED [[maybe_unused]] = 0x00200000; // not used by the DSP constexpr u32 VOICE_RUNNING = 0x40000000; -constexpr u32 VOICE_USED = 0x80000000; // not used by the DSP +constexpr u32 VOICE_USED [[maybe_unused]] = 0x80000000; // not used by the DSP // 1<<4 = scale gain by 1/1, 2<<2 = PCM decoding from ARAM, 1<<0 = 8-bit reads constexpr u32 ACCELERATOR_FORMAT_8_BIT = 0x0019; diff --git a/Source/Core/Core/HW/ProcessorInterface.cpp b/Source/Core/Core/HW/ProcessorInterface.cpp index 70b34ccc81..cea84a4ab4 100644 --- a/Source/Core/Core/HW/ProcessorInterface.cpp +++ b/Source/Core/Core/HW/ProcessorInterface.cpp @@ -24,8 +24,8 @@ namespace ProcessorInterface { -constexpr u32 FLIPPER_REV_A = 0x046500B0; -constexpr u32 FLIPPER_REV_B = 0x146500B1; +constexpr u32 FLIPPER_REV_A [[maybe_unused]] = 0x046500B0; +constexpr u32 FLIPPER_REV_B [[maybe_unused]] = 0x146500B1; constexpr u32 FLIPPER_REV_C = 0x246500B1; ProcessorInterfaceManager::ProcessorInterfaceManager(Core::System& system) : m_system(system) From f29019180f12e8287661ebde19f0b1baed966bc9 Mon Sep 17 00:00:00 2001 From: Minty-Meeo <45425365+Minty-Meeo@users.noreply.github.com> Date: Thu, 23 Mar 2023 13:55:04 -0500 Subject: [PATCH 11/11] Pragma diagnostic ignore [-Wregister] is no longer needed --- Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp index 36371fd368..e9f8d2fff2 100644 --- a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp @@ -3,10 +3,8 @@ #include "InputCommon/ControllerInterface/Xlib/XInput2.h" -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wregister" #include -#pragma GCC diagnostic pop + #include #include #include