Merge pull request #9567 from Dentomologist/fix_various_warnings

Fix various build warnings
This commit is contained in:
Léo Lam 2021-03-16 09:33:01 +01:00 committed by GitHub
commit 3b0b221fcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 23 additions and 30 deletions

View File

@ -26,9 +26,6 @@ namespace Arm64Gen
{ {
namespace namespace
{ {
const int kWRegSizeInBits = 32;
const int kXRegSizeInBits = 64;
uint64_t LargestPowerOf2Divisor(uint64_t value) uint64_t LargestPowerOf2Divisor(uint64_t value)
{ {
return value & -(int64_t)value; return value & -(int64_t)value;
@ -89,6 +86,8 @@ std::optional<std::tuple<u32, u32, u32>> IsImmLogical(u64 value, u32 width)
value = ~value; value = ~value;
} }
constexpr int kWRegSizeInBits = 32;
if (width == kWRegSizeInBits) if (width == kWRegSizeInBits)
{ {
// To handle 32-bit logical immediates, the very easiest thing is to repeat // To handle 32-bit logical immediates, the very easiest thing is to repeat

View File

@ -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 // 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. // to a file we need to prepare a 0x10 byte output buffer as response.
struct Request struct
{ {
u32 command; u32 command;
u32 type; u32 type;

View File

@ -725,11 +725,11 @@ void WiimoteDevice::SendConfigurationRequest(u16 cid, u16 mtu, u16 flush_time_ou
SendCommandToACL(L2CAP_CONFIG_REQ, L2CAP_CONFIG_REQ, offset, buffer); SendCommandToACL(L2CAP_CONFIG_REQ, L2CAP_CONFIG_REQ, offset, buffer);
} }
constexpr u8 SDP_UINT8 = 0x08; [[maybe_unused]] constexpr u8 SDP_UINT8 = 0x08;
constexpr u8 SDP_UINT16 = 0x09; [[maybe_unused]] constexpr u8 SDP_UINT16 = 0x09;
constexpr u8 SDP_UINT32 = 0x0A; constexpr u8 SDP_UINT32 = 0x0A;
constexpr u8 SDP_SEQ8 = 0x35; 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, void WiimoteDevice::SDPSendServiceSearchResponse(u16 cid, u16 transaction_id,
u8* service_search_pattern, u8* service_search_pattern,

View File

@ -186,8 +186,8 @@ void PCAPSSLCaptureLogger::LogIPv4(LogType log_type, const u8* data, u16 length,
} }
std::vector<u8> packet; std::vector<u8> packet;
auto insert = [&](const auto* data, std::size_t size) { auto insert = [&](const auto* new_data, std::size_t size) {
const u8* begin = reinterpret_cast<const u8*>(data); const u8* begin = reinterpret_cast<const u8*>(new_data);
packet.insert(packet.end(), begin, begin + size); packet.insert(packet.end(), begin, begin + size);
}; };

View File

@ -6,15 +6,10 @@
#include <QWidget> #include <QWidget>
class QFormLayout;
class GraphicsWidget : public QWidget class GraphicsWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
protected: protected:
virtual void LoadSettings() = 0; virtual void LoadSettings() = 0;
virtual void SaveSettings() = 0; virtual void SaveSettings() = 0;
private:
QFormLayout* m_main_layout;
}; };

View File

@ -15,9 +15,9 @@ private:
class Button : public Input class Button : public Input
{ {
public: 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) {} Button(int pad_id, ButtonManager::ButtonType index) : m_pad_id(pad_id), m_index(index) {}
ControlState GetState() const; ControlState GetState() const override;
private: private:
const int m_pad_id; const int m_pad_id;
@ -26,13 +26,13 @@ private:
class Axis : public Input class Axis : public Input
{ {
public: public:
std::string GetName() const; std::string GetName() const override;
bool IsDetectable() const override { return false; } bool IsDetectable() const override { return false; }
Axis(int pad_id, ButtonManager::ButtonType index, float neg = 1.0f) Axis(int pad_id, ButtonManager::ButtonType index, float neg = 1.0f)
: m_pad_id(pad_id), m_index(index), m_neg(neg) : m_pad_id(pad_id), m_index(index), m_neg(neg)
{ {
} }
ControlState GetState() const; ControlState GetState() const override;
private: private:
const int m_pad_id; const int m_pad_id;
@ -56,8 +56,8 @@ private:
public: public:
Touchscreen(int pad_id, bool accelerometer_enabled, bool gyroscope_enabled); Touchscreen(int pad_id, bool accelerometer_enabled, bool gyroscope_enabled);
~Touchscreen() {} ~Touchscreen() {}
std::string GetName() const; std::string GetName() const override;
std::string GetSource() const; std::string GetSource() const override;
private: private:
const int m_pad_id; const int m_pad_id;

View File

@ -365,7 +365,7 @@ static void StopHotplugThread()
// Write something to efd so that select() stops blocking. // Write something to efd so that select() stops blocking.
const uint64_t value = 1; const uint64_t value = 1;
static_cast<void>(write(s_wakeup_eventfd, &value, sizeof(uint64_t))); static_cast<void>(!write(s_wakeup_eventfd, &value, sizeof(uint64_t)));
s_hotplug_thread.join(); s_hotplug_thread.join();
close(s_wakeup_eventfd); close(s_wakeup_eventfd);
@ -525,7 +525,7 @@ bool evdevDevice::AddNode(std::string devnode, int fd, libevdev* dev)
ie.code = FF_AUTOCENTER; ie.code = FF_AUTOCENTER;
ie.value = 0; ie.value = 0;
static_cast<void>(write(fd, &ie, sizeof(ie))); static_cast<void>(!write(fd, &ie, sizeof(ie)));
} }
// Constant FF effect // Constant FF effect
@ -725,7 +725,7 @@ void evdevDevice::Effect::UpdateEffect()
play.code = m_effect.id; play.code = m_effect.id;
play.value = 1; play.value = 1;
static_cast<void>(write(m_fd, &play, sizeof(play))); static_cast<void>(!write(m_fd, &play, sizeof(play)));
} }
else else
{ {

View File

@ -186,9 +186,9 @@ bool InputConfig::ControllersNeedToBeCreated() const
return m_controllers.empty(); return m_controllers.empty();
} }
std::size_t InputConfig::GetControllerCount() const int InputConfig::GetControllerCount() const
{ {
return m_controllers.size(); return static_cast<int>(m_controllers.size());
} }
void InputConfig::RegisterHotplugCallback() void InputConfig::RegisterHotplugCallback()

View File

@ -41,7 +41,7 @@ public:
std::string GetGUIName() const { return m_gui_name; } std::string GetGUIName() const { return m_gui_name; }
std::string GetProfileName() const { return m_profile_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. // These should be used after creating all controllers and before clearing them, respectively.
void RegisterHotplugCallback(); void RegisterHotplugCallback();

View File

@ -67,7 +67,7 @@ public:
void Reset() override { m_mat = Common::Matrix44::Identity(); } 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: private:
Common::Matrix44 m_mat = Common::Matrix44::Identity(); Common::Matrix44 m_mat = Common::Matrix44::Identity();
@ -119,7 +119,7 @@ public:
m_rotate_quat = Common::Quaternion::Identity(); m_rotate_quat = Common::Quaternion::Identity();
} }
void DoState(PointerWrap& p) void DoState(PointerWrap& p) override
{ {
p.Do(m_rotation); p.Do(m_rotation);
p.Do(m_rotate_quat); p.Do(m_rotate_quat);
@ -170,7 +170,7 @@ public:
m_distance = 0; m_distance = 0;
} }
void DoState(PointerWrap& p) void DoState(PointerWrap& p) override
{ {
p.Do(m_rotation); p.Do(m_rotation);
p.Do(m_rotate_quat); p.Do(m_rotate_quat);

View File

@ -79,7 +79,6 @@ private:
float m_fov_step_size = 0.025f; float m_fov_step_size = 0.025f;
float m_speed = 1.0f; float m_speed = 1.0f;
bool m_enabled = true;
}; };
extern FreeLookCamera g_freelook_camera; extern FreeLookCamera g_freelook_camera;