From dffcbcc6c4749f5c1d5491663a0b52f860fbc5be Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Fri, 12 Feb 2021 16:56:39 -0800 Subject: [PATCH 01/10] Arm64Gen: Remove unused constant --- Source/Core/Common/Arm64Emitter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Core/Common/Arm64Emitter.cpp b/Source/Core/Common/Arm64Emitter.cpp index ae07647339..42cb60ed83 100644 --- a/Source/Core/Common/Arm64Emitter.cpp +++ b/Source/Core/Common/Arm64Emitter.cpp @@ -27,7 +27,6 @@ namespace Arm64Gen namespace { const int kWRegSizeInBits = 32; -const int kXRegSizeInBits = 64; uint64_t LargestPowerOf2Divisor(uint64_t value) { From 686314b5486653d257a782b9afe4479c27863f0c Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Fri, 12 Feb 2021 17:04:08 -0800 Subject: [PATCH 02/10] Arm64Gen: Move constant and make constexpr Namespace-scope variable was only used in one function so move it there --- Source/Core/Common/Arm64Emitter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Common/Arm64Emitter.cpp b/Source/Core/Common/Arm64Emitter.cpp index 42cb60ed83..8b39dbc7c4 100644 --- a/Source/Core/Common/Arm64Emitter.cpp +++ b/Source/Core/Common/Arm64Emitter.cpp @@ -26,8 +26,6 @@ namespace Arm64Gen { namespace { -const int kWRegSizeInBits = 32; - uint64_t LargestPowerOf2Divisor(uint64_t value) { return value & -(int64_t)value; @@ -88,6 +86,8 @@ std::optional> IsImmLogical(u64 value, u32 width) value = ~value; } + constexpr int kWRegSizeInBits = 32; + if (width == kWRegSizeInBits) { // To handle 32-bit logical immediates, the very easiest thing is to repeat From 692aaed60ce09543cc3100caf3aefdca96420f23 Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Fri, 12 Feb 2021 17:21:48 -0800 Subject: [PATCH 03/10] FreeLookController: Fix signed/unsigned warning Loop index int i was being compared against GetControllerCount() which returned a size_t. This was the only place GetControllerCount() was called from so the change of return type doesn't disturb anything else. Changing the loop index to size_t wouldn't work as well since it's passed into GetController(), which takes an int and is called from many places, so it would need a cast anyway on an already busy line. --- Source/Core/InputCommon/InputConfig.cpp | 4 ++-- Source/Core/InputCommon/InputConfig.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/InputCommon/InputConfig.cpp b/Source/Core/InputCommon/InputConfig.cpp index 72b28b6d16..07a9b62daf 100644 --- a/Source/Core/InputCommon/InputConfig.cpp +++ b/Source/Core/InputCommon/InputConfig.cpp @@ -186,9 +186,9 @@ bool InputConfig::ControllersNeedToBeCreated() const return m_controllers.empty(); } -std::size_t InputConfig::GetControllerCount() const +int InputConfig::GetControllerCount() const { - return m_controllers.size(); + return static_cast(m_controllers.size()); } void InputConfig::RegisterHotplugCallback() diff --git a/Source/Core/InputCommon/InputConfig.h b/Source/Core/InputCommon/InputConfig.h index 29ec661f67..0eeeedaed8 100644 --- a/Source/Core/InputCommon/InputConfig.h +++ b/Source/Core/InputCommon/InputConfig.h @@ -41,7 +41,7 @@ public: std::string GetGUIName() const { return m_gui_name; } std::string GetProfileName() const { return m_profile_name; } - std::size_t GetControllerCount() const; + int GetControllerCount() const; // These should be used after creating all controllers and before clearing them, respectively. void RegisterHotplugCallback(); From 1c71d33ed547797e4226d1454ba183da9cf9fa83 Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Fri, 12 Feb 2021 17:29:17 -0800 Subject: [PATCH 04/10] FreeLookCamera: Remove unused variable --- Source/Core/VideoCommon/FreeLookCamera.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Core/VideoCommon/FreeLookCamera.h b/Source/Core/VideoCommon/FreeLookCamera.h index d9c9fcbc83..f4a3242905 100644 --- a/Source/Core/VideoCommon/FreeLookCamera.h +++ b/Source/Core/VideoCommon/FreeLookCamera.h @@ -79,7 +79,6 @@ private: float m_fov_step_size = 0.025f; float m_speed = 1.0f; - bool m_enabled = true; }; extern FreeLookCamera g_freelook_camera; From 95c86ee48b6e236913304241c8ce73e998e0e54f Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Sat, 13 Feb 2021 08:42:20 -0800 Subject: [PATCH 05/10] FreeLookCamera: Add override specifiers --- Source/Core/VideoCommon/FreeLookCamera.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/VideoCommon/FreeLookCamera.cpp b/Source/Core/VideoCommon/FreeLookCamera.cpp index 9380424c04..5526ff50f0 100644 --- a/Source/Core/VideoCommon/FreeLookCamera.cpp +++ b/Source/Core/VideoCommon/FreeLookCamera.cpp @@ -67,7 +67,7 @@ public: void Reset() override { m_mat = Common::Matrix44::Identity(); } - void DoState(PointerWrap& p) { p.Do(m_mat); } + void DoState(PointerWrap& p) override { p.Do(m_mat); } private: Common::Matrix44 m_mat = Common::Matrix44::Identity(); @@ -119,7 +119,7 @@ public: m_rotate_quat = Common::Quaternion::Identity(); } - void DoState(PointerWrap& p) + void DoState(PointerWrap& p) override { p.Do(m_rotation); p.Do(m_rotate_quat); @@ -170,7 +170,7 @@ public: m_distance = 0; } - void DoState(PointerWrap& p) + void DoState(PointerWrap& p) override { p.Do(m_rotation); p.Do(m_rotate_quat); From 636bf38824820fd9e079a661bc9a33bfd6a0b5a9 Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Wed, 3 Mar 2021 14:28:06 -0800 Subject: [PATCH 06/10] IOS: Add maybe_unused attribute to variables Fixes Wunused-const-variable warning on freebsd-x64 and android --- Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.cpp b/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.cpp index 2d84ca46d7..11429042cb 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.cpp +++ b/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.cpp @@ -725,11 +725,11 @@ void WiimoteDevice::SendConfigurationRequest(u16 cid, u16 mtu, u16 flush_time_ou SendCommandToACL(L2CAP_CONFIG_REQ, L2CAP_CONFIG_REQ, offset, buffer); } -constexpr u8 SDP_UINT8 = 0x08; -constexpr u8 SDP_UINT16 = 0x09; +[[maybe_unused]] constexpr u8 SDP_UINT8 = 0x08; +[[maybe_unused]] constexpr u8 SDP_UINT16 = 0x09; constexpr u8 SDP_UINT32 = 0x0A; constexpr u8 SDP_SEQ8 = 0x35; -constexpr u8 SDP_SEQ16 = 0x36; +[[maybe_unused]] constexpr u8 SDP_SEQ16 = 0x36; void WiimoteDevice::SDPSendServiceSearchResponse(u16 cid, u16 transaction_id, u8* service_search_pattern, From fa61fc4f9cb9d9a5ea13eefc0eb7afeb26da0a9d Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Wed, 3 Mar 2021 16:31:33 -0800 Subject: [PATCH 07/10] Fix shadowing warnings Fixes type/variable shadowing warnings on debian and ubuntu --- Source/Core/Core/IOS/SDIO/SDIOSlot0.cpp | 2 +- Source/Core/Core/NetworkCaptureLogger.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/IOS/SDIO/SDIOSlot0.cpp b/Source/Core/Core/IOS/SDIO/SDIOSlot0.cpp index 122b5f6f71..32b4189321 100644 --- a/Source/Core/Core/IOS/SDIO/SDIOSlot0.cpp +++ b/Source/Core/Core/IOS/SDIO/SDIOSlot0.cpp @@ -146,7 +146,7 @@ s32 SDIOSlot0Device::ExecuteCommand(const Request& request, u32 buffer_in, u32 b { // The game will send us a SendCMD with this information. To be able to read and write // to a file we need to prepare a 0x10 byte output buffer as response. - struct Request + struct { u32 command; u32 type; diff --git a/Source/Core/Core/NetworkCaptureLogger.cpp b/Source/Core/Core/NetworkCaptureLogger.cpp index 118deb234a..22dee582fe 100644 --- a/Source/Core/Core/NetworkCaptureLogger.cpp +++ b/Source/Core/Core/NetworkCaptureLogger.cpp @@ -186,8 +186,8 @@ void PCAPSSLCaptureLogger::LogIPv4(LogType log_type, const u8* data, u16 length, } std::vector packet; - auto insert = [&](const auto* data, std::size_t size) { - const u8* begin = reinterpret_cast(data); + auto insert = [&](const auto* new_data, std::size_t size) { + const u8* begin = reinterpret_cast(new_data); packet.insert(packet.end(), begin, begin + size); }; From 7ff8e3367f6f1d09548280b282b0240d9781a37c Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Wed, 3 Mar 2021 17:00:58 -0800 Subject: [PATCH 08/10] GraphicsWidget: Remove unused field Fixes warning on freebsd-x64 --- Source/Core/DolphinQt/Config/Graphics/GraphicsWidget.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Source/Core/DolphinQt/Config/Graphics/GraphicsWidget.h b/Source/Core/DolphinQt/Config/Graphics/GraphicsWidget.h index fbe9bb8c1e..79ab293b4f 100644 --- a/Source/Core/DolphinQt/Config/Graphics/GraphicsWidget.h +++ b/Source/Core/DolphinQt/Config/Graphics/GraphicsWidget.h @@ -6,15 +6,10 @@ #include -class QFormLayout; - class GraphicsWidget : public QWidget { Q_OBJECT protected: virtual void LoadSettings() = 0; virtual void SaveSettings() = 0; - -private: - QFormLayout* m_main_layout; }; From 1fd332d3b7950a5c59cc0eb34885904a308546e2 Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Thu, 4 Mar 2021 08:09:49 -0800 Subject: [PATCH 09/10] ControllerInterface: Fix unused-result warning Add ! before unused variables to 'use' them. Ubuntu-x64 emits warnings for unused variables because gcc decides it should ignore the void cast around them. See thread for discussion: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425 --- Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp index 61b6a1e46b..214dd323ac 100644 --- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp +++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp @@ -365,7 +365,7 @@ static void StopHotplugThread() // Write something to efd so that select() stops blocking. const uint64_t value = 1; - static_cast(write(s_wakeup_eventfd, &value, sizeof(uint64_t))); + static_cast(!write(s_wakeup_eventfd, &value, sizeof(uint64_t))); s_hotplug_thread.join(); close(s_wakeup_eventfd); @@ -525,7 +525,7 @@ bool evdevDevice::AddNode(std::string devnode, int fd, libevdev* dev) ie.code = FF_AUTOCENTER; ie.value = 0; - static_cast(write(fd, &ie, sizeof(ie))); + static_cast(!write(fd, &ie, sizeof(ie))); } // Constant FF effect @@ -725,7 +725,7 @@ void evdevDevice::Effect::UpdateEffect() play.code = m_effect.id; play.value = 1; - static_cast(write(m_fd, &play, sizeof(play))); + static_cast(!write(m_fd, &play, sizeof(play))); } else { From 486a25dd2b3f3790a9dc7a4dd432ca91377b14b3 Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Fri, 5 Mar 2021 10:33:46 -0800 Subject: [PATCH 10/10] Touchscreen: Add override specifiers Fix -Winconsistent-missing-override warnings on Android --- .../ControllerInterface/Touch/Touchscreen.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Core/InputCommon/ControllerInterface/Touch/Touchscreen.h b/Source/Core/InputCommon/ControllerInterface/Touch/Touchscreen.h index ec060040d4..a47f24ec6a 100644 --- a/Source/Core/InputCommon/ControllerInterface/Touch/Touchscreen.h +++ b/Source/Core/InputCommon/ControllerInterface/Touch/Touchscreen.h @@ -15,9 +15,9 @@ private: class Button : public Input { public: - std::string GetName() const; + std::string GetName() const override; Button(int pad_id, ButtonManager::ButtonType index) : m_pad_id(pad_id), m_index(index) {} - ControlState GetState() const; + ControlState GetState() const override; private: const int m_pad_id; @@ -26,13 +26,13 @@ private: class Axis : public Input { public: - std::string GetName() const; + std::string GetName() const override; bool IsDetectable() const override { return false; } Axis(int pad_id, ButtonManager::ButtonType index, float neg = 1.0f) : m_pad_id(pad_id), m_index(index), m_neg(neg) { } - ControlState GetState() const; + ControlState GetState() const override; private: const int m_pad_id; @@ -56,8 +56,8 @@ private: public: Touchscreen(int pad_id, bool accelerometer_enabled, bool gyroscope_enabled); ~Touchscreen() {} - std::string GetName() const; - std::string GetSource() const; + std::string GetName() const override; + std::string GetSource() const override; private: const int m_pad_id;