From 9d4337b7ebffefb61f240a21304139151b787226 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sun, 15 Nov 2020 04:37:58 -0800 Subject: [PATCH] [USB+] Clean up Warnings (#3930) * Suppress hardening warning spam for the moment. Get rid of a multi-line comment warning. * Resolve a bunch of warnings about unused variables, unused labels, and sign mismatches. * Deal with various possibly unused variables. * Rearrange member variables to match initialization order. * Move [[maybe_unused]] to a separate line in one spot to make it easier to read. --- cmake/BuildParameters.cmake | 6 ++++-- pcsx2/DEV9/flash.cpp | 8 +++----- pcsx2/DebugTools/DisassemblyManager.h | 2 +- pcsx2/SPU2/spu2replay.cpp | 4 ++-- pcsx2/SPU2/wx/wxConfig.h | 1 - pcsx2/USB/USB.cpp | 2 +- pcsx2/USB/configuration.cpp | 2 +- pcsx2/USB/linux/config-gtk.cpp | 5 ++--- pcsx2/USB/qemu-usb/USBinternal.h | 2 +- pcsx2/USB/qemu-usb/usb-ohci.cpp | 17 +++++++---------- pcsx2/USB/shared/inifile_usb.cpp | 4 ++-- pcsx2/USB/shared/ringbuffer.h | 4 ++-- pcsx2/USB/usb-eyetoy/cam-linux.cpp | 4 ++-- pcsx2/USB/usb-hid/evdev/evdev-gtk.cpp | 2 +- pcsx2/USB/usb-hid/evdev/evdev.cpp | 4 ++-- pcsx2/USB/usb-hid/usb-hid.cpp | 2 +- pcsx2/USB/usb-mic/audiodev-pulse.cpp | 6 +++--- pcsx2/USB/usb-mic/audiodev-pulse.h | 14 +++++++------- pcsx2/USB/usb-mic/usb-headset.cpp | 6 +++--- pcsx2/USB/usb-msd/usb-msd.cpp | 4 ++-- pcsx2/USB/usb-pad/evdev/evdev-ff.cpp | 2 +- pcsx2/USB/usb-pad/evdev/evdev-gtk.cpp | 2 +- pcsx2/USB/usb-pad/evdev/evdev.cpp | 8 ++++---- pcsx2/USB/usb-pad/evdev/shared-gtk.cpp | 12 ++++++------ pcsx2/USB/usb-pad/joydev/joydev.cpp | 2 +- pcsx2/USB/usb-pad/usb-seamic.cpp | 2 +- pcsx2/gui/AppAccelerators.h | 2 +- .../onepad/wx_dialog/JoystickConfiguration.h | 1 - 28 files changed, 62 insertions(+), 68 deletions(-) diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index b1b1447623..747a8e4412 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -286,8 +286,9 @@ endif() # -Wno-unused-value: lots of warning for this kind of statements "0 && ...". There are used to disable some parts of code in release/dev build. # -Wno-overloaded-virtual: Gives a fair number of warnings under clang over in the wxwidget gui section of the code. # -Wno-deprecated-declarations: The USB plugins dialogs are written in straight gtk 2, which gives a million deprecated warnings. Suppress them until we can deal with them. +# -Wno-format: Yeah, these need to be taken care of, but... -set(DEFAULT_WARNINGS "-Wall -Wextra -Wno-attributes -Wno-unused-function -Wno-unused-parameter -Wno-missing-field-initializers -Wno-overloaded-virtual -Wno-deprecated-declarations") +set(DEFAULT_WARNINGS "-Wall -Wextra -Wno-attributes -Wno-unused-function -Wno-unused-parameter -Wno-missing-field-initializers -Wno-overloaded-virtual -Wno-deprecated-declarations -Wno-format") if (NOT USE_ICC) set(DEFAULT_WARNINGS "${DEFAULT_WARNINGS} -Wno-unused-value ") endif() @@ -376,7 +377,8 @@ if(USE_CLANG) endif() # Note: -DGTK_DISABLE_DEPRECATED can be used to test a build without gtk deprecated feature. It could be useful to port to a newer API -set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${AGGRESSIVE_WARNING} ${HARDENING_FLAG} ${DEBUG_FLAG} ${ASAN_FLAG} ${OPTIMIZATION_FLAG} ${LTO_FLAGS} ${PGO_FLAGS} ${PLUGIN_SUPPORT}") +# Disabling the hardening flags for the moment, as they spam quite a bit. ${HARDENING_FLAG} +set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${AGGRESSIVE_WARNING} ${DEBUG_FLAG} ${ASAN_FLAG} ${OPTIMIZATION_FLAG} ${LTO_FLAGS} ${PGO_FLAGS} ${PLUGIN_SUPPORT}") # c++ only flags set(DEFAULT_CPP_FLAG "${DEFAULT_GCC_FLAG} -Wno-invalid-offsetof") diff --git a/pcsx2/DEV9/flash.cpp b/pcsx2/DEV9/flash.cpp index af1c08f390..1d80de3e66 100644 --- a/pcsx2/DEV9/flash.cpp +++ b/pcsx2/DEV9/flash.cpp @@ -283,11 +283,9 @@ void FLASHwrite32(u32 addr, u32 value, int size) } addrbyte = 0; // address reset { - u32 bytes, pages, blocks; - - blocks = address / BLOCK_SIZE; - pages = address - (blocks * BLOCK_SIZE); - bytes = pages % PAGE_SIZE; + const u32 blocks = address / BLOCK_SIZE; + u32 pages = address - (blocks * BLOCK_SIZE); + [[maybe_unused]]const u32 bytes = pages % PAGE_SIZE; pages = pages / PAGE_SIZE; DEV9_LOG("*FLASH ADDR = 0x%08lX (%d:%d:%d) (addrbyte=%d) FINAL\n", address, blocks, pages, bytes, addrbyte); } diff --git a/pcsx2/DebugTools/DisassemblyManager.h b/pcsx2/DebugTools/DisassemblyManager.h index c4d5cf24e9..bd5165c5ce 100644 --- a/pcsx2/DebugTools/DisassemblyManager.h +++ b/pcsx2/DebugTools/DisassemblyManager.h @@ -181,7 +181,7 @@ public: virtual u32 getTotalSize() { return size; }; virtual bool disassemble(u32 address, DisassemblyLineInfo& dest, bool insertSymbols); private: - DebugInterface* cpu; + [[maybe_unused]]DebugInterface* cpu; u32 address; u32 size; std::string name; diff --git a/pcsx2/SPU2/spu2replay.cpp b/pcsx2/SPU2/spu2replay.cpp index de384f964f..74a13f8903 100644 --- a/pcsx2/SPU2/spu2replay.cpp +++ b/pcsx2/SPU2/spu2replay.cpp @@ -101,8 +101,8 @@ bool replay_mode = false; u16 dmabuffer[0xFFFFF]; -const u32 IOP_CLK = 768 * 48000; -const u32 IOPCiclesPerMS = 768 * 48; +[[maybe_unused]]const u32 IOP_CLK = 768 * 48000; +[[maybe_unused]]const u32 IOPCiclesPerMS = 768 * 48; u32 CurrentIOPCycle = 0; u64 HighResFreq; diff --git a/pcsx2/SPU2/wx/wxConfig.h b/pcsx2/SPU2/wx/wxConfig.h index 70fe586532..e281fc18f3 100644 --- a/pcsx2/SPU2/wx/wxConfig.h +++ b/pcsx2/SPU2/wx/wxConfig.h @@ -80,7 +80,6 @@ public: class Dialog : public wxDialog { wxBoxSizer *m_top_box, *m_portaudio_box, *m_sdl_box; - wxStaticBoxSizer* m_output_box; wxChoice *m_module_select, *m_portaudio_select, *m_sdl_select; wxStaticText *m_portaudio_text, *m_sdl_text; diff --git a/pcsx2/USB/USB.cpp b/pcsx2/USB/USB.cpp index 0d371b9f37..9aba3b8f39 100644 --- a/pcsx2/USB/USB.cpp +++ b/pcsx2/USB/USB.cpp @@ -361,7 +361,7 @@ s32 USBfreeze(int mode, freezeData* data) s8* ptr = data->data + sizeof(USBfreezeData); // Load the state of the attached devices - if (data->size != sizeof(USBfreezeData) + usbd.device[0].size + usbd.device[1].size + 8192) + if ((long unsigned int)data->size != sizeof(USBfreezeData) + usbd.device[0].size + usbd.device[1].size + 8192) return -1; //TODO Subsequent save state loadings make USB "stall" for n seconds since previous load diff --git a/pcsx2/USB/configuration.cpp b/pcsx2/USB/configuration.cpp index 598b9b98a9..22816832cf 100644 --- a/pcsx2/USB/configuration.cpp +++ b/pcsx2/USB/configuration.cpp @@ -168,7 +168,7 @@ void SaveConfig() #ifdef _WIN32 bool ret = ciniFile.Save(IniPath); #else - bool ret = ciniFile.Save(str_to_wstr(IniPath)); + [[maybe_unused]]bool ret = ciniFile.Save(str_to_wstr(IniPath)); #endif } diff --git a/pcsx2/USB/linux/config-gtk.cpp b/pcsx2/USB/linux/config-gtk.cpp index 9a71d938f7..d684f4724d 100644 --- a/pcsx2/USB/linux/config-gtk.cpp +++ b/pcsx2/USB/linux/config-gtk.cpp @@ -160,7 +160,7 @@ static void configureApi(GtkWidget* widget, gpointer data) if (dev) { GtkWidget* dlg = GTK_WIDGET(g_object_get_data(G_OBJECT(widget), "dlg")); - int res = dev->Configure(port, api, dlg); + [[maybe_unused]]int res = dev->Configure(port, api, dlg); } } @@ -203,7 +203,6 @@ void USBconfigure() USBsetSettingsDir(); RegisterDevice::Register(); LoadConfig(); - void* that = NULL; SettingsCB settingsCB[2]; settingsCB[0].player = 0; settingsCB[1].player = 1; @@ -289,7 +288,7 @@ void USBconfigure() sel_idx = 0; - for (int i = 0; i < countof(wt); i++) + for (int i = 0; i < (int)countof(wt); i++) { gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(rs_cb), wt[i]); if (conf.WheelType[port] == i) diff --git a/pcsx2/USB/qemu-usb/USBinternal.h b/pcsx2/USB/qemu-usb/USBinternal.h index a3410e24d6..2a8650c5c0 100644 --- a/pcsx2/USB/qemu-usb/USBinternal.h +++ b/pcsx2/USB/qemu-usb/USBinternal.h @@ -25,7 +25,7 @@ /* Number of Downstream Ports on the root hub. */ -#define OHCI_MAX_PORTS 15 // status regs from 0x0c54 but usb snooping \ +#define OHCI_MAX_PORTS 15 // status regs from 0x0c54 but usb snooping // reg is at 0x0c80, so only 11 ports? extern int64_t usb_frame_time; diff --git a/pcsx2/USB/qemu-usb/usb-ohci.cpp b/pcsx2/USB/qemu-usb/usb-ohci.cpp index fbb675a037..c837027e84 100644 --- a/pcsx2/USB/qemu-usb/usb-ohci.cpp +++ b/pcsx2/USB/qemu-usb/usb-ohci.cpp @@ -275,14 +275,13 @@ static void ohci_stop_endpoints(OHCIState* ohci) static void ohci_roothub_reset(OHCIState* ohci) { OHCIPort* port; - int i; ohci_bus_stop(ohci); ohci->rhdesc_a = OHCI_RHA_NPS | ohci->num_ports; ohci->rhdesc_b = 0x0; /* Impl. specific */ ohci->rhstatus = 0; - for (i = 0; i < ohci->num_ports; i++) + for (uint32_t i = 0; i < ohci->num_ports; i++) { port = &ohci->rhport[i]; port->ctrl = 0; @@ -503,7 +502,7 @@ static int ohci_service_iso_td(OHCIState* ohci, struct ohci_ed* ed, { int dir; uint32_t len = 0; - const char* str = NULL; + [[maybe_unused]] const char* str = NULL; int pid; int ret; int i; @@ -729,7 +728,7 @@ static int ohci_service_iso_td(OHCIState* ohci, struct ohci_ed* ed, OHCI_CC_NOERROR); OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_SIZE, ret); } - else if (dir == OHCI_TD_DIR_OUT && ret == len) + else if (dir == OHCI_TD_DIR_OUT && (ret == (int)len)) { /* OUT transfer succeeded */ OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_CC, @@ -806,7 +805,7 @@ static int ohci_service_td(OHCIState* ohci, struct ohci_ed* ed) { int dir; uint32_t len = 0, pktlen = 0; - const char* str = NULL; + [[maybe_unused]]const char* str = NULL; int pid; int ret; int i; @@ -972,10 +971,10 @@ static int ohci_service_td(OHCIState* ohci, struct ohci_ed* ed) } /* Writeback */ - if (ret == pktlen || (dir == OHCI_TD_DIR_IN && ret >= 0 && flag_r)) + if (ret == (int)pktlen || (dir == OHCI_TD_DIR_IN && ret >= 0 && flag_r)) { /* Transmission succeeded. */ - if (ret == len) + if (ret == (int)len) { td.cbp = 0; } @@ -995,7 +994,7 @@ static int ohci_service_td(OHCIState* ohci, struct ohci_ed* ed) OHCI_SET_BM(td.flags, TD_CC, OHCI_CC_NOERROR); OHCI_SET_BM(td.flags, TD_EC, 0); - if ((dir != OHCI_TD_DIR_IN) && (ret != len)) + if ((dir != OHCI_TD_DIR_IN) && (ret != (int)len)) { /* Partial packet transfer: TD not ready to retire yet */ goto exit_no_retire; @@ -1717,8 +1716,6 @@ static USBPortOps ohci_port_ops = { /*.complete =*/ohci_async_complete_packet, }; -static USBBusOps ohci_bus_ops = {}; - OHCIState* ohci_create(uint32_t base, int ports) { OHCIState* ohci = (OHCIState*)malloc(sizeof(OHCIState)); diff --git a/pcsx2/USB/shared/inifile_usb.cpp b/pcsx2/USB/shared/inifile_usb.cpp index 7fb54311f5..7d2690763d 100644 --- a/pcsx2/USB/shared/inifile_usb.cpp +++ b/pcsx2/USB/shared/inifile_usb.cpp @@ -177,7 +177,7 @@ void CIniFileA::Load(std::istream& input, bool bMerge) if (!sRead.empty()) { - unsigned int nType = (sRead.find_first_of("[") == 0 && (sRead[sRead.find_last_not_of(" \t\r\n")] == ']')) ? SECTION : OTHER; + auto nType = (sRead.find_first_of("[") == 0 && (sRead[sRead.find_last_not_of(" \t\r\n")] == ']')) ? SECTION : OTHER; nType = ((nType == OTHER) && (sRead.find_first_of("=") != std::string::npos && sRead.find_first_of("=") > 0)) ? KEY : nType; nType = ((nType == OTHER) && (sRead.find_first_of("#") == 0)) ? COMMENT : nType; @@ -674,7 +674,7 @@ void CIniFileW::Load(std::wistream& input, bool bMerge) if (!sRead.empty()) { - unsigned int nType = (sRead.find_first_of(L"[") == 0 && (sRead[sRead.find_last_not_of(L" \t\r\n")] == L']')) ? SECTION : OTHER; + auto nType = (sRead.find_first_of(L"[") == 0 && (sRead[sRead.find_last_not_of(L" \t\r\n")] == L']')) ? SECTION : OTHER; nType = ((nType == OTHER) && (sRead.find_first_of(L"=") != std::wstring::npos && sRead.find_first_of(L"=") > 0)) ? KEY : nType; nType = ((nType == OTHER) && (sRead.find_first_of(L"#") == 0)) ? COMMENT : nType; diff --git a/pcsx2/USB/shared/ringbuffer.h b/pcsx2/USB/shared/ringbuffer.h index a9425b5a0c..0ccb6666da 100644 --- a/pcsx2/USB/shared/ringbuffer.h +++ b/pcsx2/USB/shared/ringbuffer.h @@ -104,11 +104,11 @@ public: } private: + size_t m_begin; + size_t m_end; size_t m_capacity; char* m_data; - size_t m_begin; bool m_overrun; - size_t m_end; hrc::time_point mLastWrite = hrc::time_point(ns(0)); }; diff --git a/pcsx2/USB/usb-eyetoy/cam-linux.cpp b/pcsx2/USB/usb-eyetoy/cam-linux.cpp index 00914621c9..3a39ae3d30 100644 --- a/pcsx2/USB/usb-eyetoy/cam-linux.cpp +++ b/pcsx2/USB/usb-eyetoy/cam-linux.cpp @@ -477,7 +477,7 @@ namespace usb_eyetoy { mpeg_mutex.lock(); int len2 = mpeg_buffer.length; - if (len < mpeg_buffer.length) + if (len < (int)mpeg_buffer.length) len2 = len; memcpy(buf, mpeg_buffer.start, len2); mpeg_mutex.unlock(); @@ -513,7 +513,7 @@ namespace usb_eyetoy std::vector devList = getDevList(); int sel_idx = 0; - for (auto idx = 0; idx < devList.size(); idx++) + for (uint32_t idx = 0; idx < (uint32_t)devList.size(); idx++) { gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(rs_cb), devList.at(idx).c_str()); if (!selectedDevice.empty() && selectedDevice == devList.at(idx)) diff --git a/pcsx2/USB/usb-hid/evdev/evdev-gtk.cpp b/pcsx2/USB/usb-hid/evdev/evdev-gtk.cpp index db59b85e4e..3d3968d2b5 100644 --- a/pcsx2/USB/usb-hid/evdev/evdev-gtk.cpp +++ b/pcsx2/USB/usb-hid/evdev/evdev-gtk.cpp @@ -94,7 +94,7 @@ namespace usb_hid if (!cfg) return; - std::string& name = (cfg->devs.begin() + idx)->first; + //std::string& name = (cfg->devs.begin() + idx)->first; cfg->iter = (cfg->devs.begin() + idx); if (idx > 0) diff --git a/pcsx2/USB/usb-hid/evdev/evdev.cpp b/pcsx2/USB/usb-hid/evdev/evdev.cpp index ff0315007e..9cca71e0f4 100644 --- a/pcsx2/USB/usb-hid/evdev/evdev.cpp +++ b/pcsx2/USB/usb-hid/evdev/evdev.cpp @@ -83,7 +83,7 @@ namespace usb_hid } } } - quit: + //quit: closedir(dirp); return false; } @@ -292,7 +292,7 @@ namespace usb_hid } } - if (len < sizeof(input_event) && errno != EAGAIN) + if (len < (ssize_t)sizeof(input_event) && errno != EAGAIN) { break; } diff --git a/pcsx2/USB/usb-hid/usb-hid.cpp b/pcsx2/USB/usb-hid/usb-hid.cpp index 9269fe641a..c6198f3eec 100644 --- a/pcsx2/USB/usb-hid/usb-hid.cpp +++ b/pcsx2/USB/usb-hid/usb-hid.cpp @@ -276,7 +276,7 @@ namespace usb_hid 0x0a, /* u8 ep_bInterval; (255ms -- usb 2.0 spec) */ }; - static const uint8_t qemu_tablet_config_descriptor[] = { + [[maybe_unused]]static const uint8_t qemu_tablet_config_descriptor[] = { /* one configuration */ 0x09, /* u8 bLength; */ 0x02, /* u8 bDescriptorType; Configuration */ diff --git a/pcsx2/USB/usb-mic/audiodev-pulse.cpp b/pcsx2/USB/usb-mic/audiodev-pulse.cpp index 1885b896bb..fc624a569f 100644 --- a/pcsx2/USB/usb-mic/audiodev-pulse.cpp +++ b/pcsx2/USB/usb-mic/audiodev-pulse.cpp @@ -334,6 +334,7 @@ namespace usb_mic if (mPAready == 3 && dur >= 1000) { mLastGetBuffer = now; + [[maybe_unused]] int ret = pa_context_connect(mPContext, mServer, PA_CONTEXT_NOFLAGS, @@ -460,11 +461,10 @@ namespace usb_mic void PulseAudioDevice::Uninit() { - int ret; if (mStream) { pa_threaded_mainloop_lock(mPMainLoop); - ret = pa_stream_disconnect(mStream); + [[maybe_unused]]int ret = pa_stream_disconnect(mStream); pa_stream_unref(mStream); mStream = nullptr; pa_threaded_mainloop_unlock(mPMainLoop); @@ -875,7 +875,7 @@ namespace usb_mic padev->mOutBuffer.read(read); } - if (pa_bytes > final_bytes) + if ((ssize_t)pa_bytes > final_bytes) memset((uint8_t*)pa_buffer + final_bytes, 0, pa_bytes - final_bytes); ret = pa_stream_write(padev->mStream, pa_buffer, pa_bytes, NULL, 0LL, PA_SEEK_RELATIVE); diff --git a/pcsx2/USB/usb-mic/audiodev-pulse.h b/pcsx2/USB/usb-mic/audiodev-pulse.h index 58ddf7058a..c01fbefacc 100644 --- a/pcsx2/USB/usb-mic/audiodev-pulse.h +++ b/pcsx2/USB/usb-mic/audiodev-pulse.h @@ -138,27 +138,27 @@ namespace usb_mic int mChannels; int mBuffering; std::string mDeviceName; - int mSamplesPerSec; pa_sample_spec mSSpec; - SRC_STATE* mResampler; - double mResampleRatio; - // Speed up or slow down audio - double mTimeAdjust; RingBuffer mOutBuffer; RingBuffer mInBuffer; //std::thread mThread; //std::condition_variable mEvent; std::mutex mMutex; - bool mQuit; bool mPaused; + bool mQuit; hrc::time_point mLastGetBuffer; - int mPAready; pa_threaded_mainloop* mPMainLoop; pa_context* mPContext; pa_stream* mStream; char* mServer; //TODO add server selector? + int mPAready; + double mResampleRatio; + // Speed up or slow down audio + double mTimeAdjust; + int mSamplesPerSec; + SRC_STATE* mResampler; int mOutSamples; hrc::time_point mLastOut; diff --git a/pcsx2/USB/usb-mic/usb-headset.cpp b/pcsx2/USB/usb-mic/usb-headset.cpp index 503953e2dd..b663189078 100644 --- a/pcsx2/USB/usb-mic/usb-headset.cpp +++ b/pcsx2/USB/usb-mic/usb-headset.cpp @@ -472,7 +472,7 @@ namespace usb_mic int length, uint8_t* data) { uint8_t cs = cscn >> 8; - uint8_t cn = cscn - 1; /* -1 for the non-present master control */ + const uint8_t cn = cscn - 1; /* -1 for the non-present master control */ uint32_t aid = ATTRIB_ID(cs, attrib, idif); int ret = USB_RET_STALL; @@ -586,7 +586,7 @@ namespace usb_mic int length, uint8_t* data) { uint8_t cs = cscn >> 8; - uint8_t cn = cscn - 1; /* -1 for the non-present master control */ + const uint8_t cn = cscn - 1; /* -1 for the non-present master control */ uint32_t aid = ATTRIB_ID(cs, attrib, idif); uint16_t vol; int ret = USB_RET_STALL; @@ -660,7 +660,7 @@ namespace usb_mic int length, uint8_t* data) { uint8_t cs = cscn >> 8; - uint8_t cn = cscn - 1; /* -1 for the non-present master control */ + [[maybe_unused]] const uint8_t cn = cscn - 1; /* -1 for the non-present master control */ uint32_t aid = ATTRIB_ID(cs, attrib, ep); int ret = USB_RET_STALL; diff --git a/pcsx2/USB/usb-msd/usb-msd.cpp b/pcsx2/USB/usb-msd/usb-msd.cpp index dea64e86e5..07f99db4d0 100644 --- a/pcsx2/USB/usb-msd/usb-msd.cpp +++ b/pcsx2/USB/usb-msd/usb-msd.cpp @@ -381,11 +381,11 @@ namespace usb_msd NO_SENSE, 0x00, 0x00}; /* LUN not ready, Manual intervention required */ - const struct SCSISense sense_code_LUN_NOT_READY = { + [[maybe_unused]]const struct SCSISense sense_code_LUN_NOT_READY = { NOT_READY, 0x04, 0x03}; /* LUN not ready, Medium not present */ - const struct SCSISense sense_code_NO_MEDIUM = { + [[maybe_unused]]const struct SCSISense sense_code_NO_MEDIUM = { NOT_READY, 0x3a, 0x00}; const struct SCSISense sense_code_UNKNOWN_ERROR = { diff --git a/pcsx2/USB/usb-pad/evdev/evdev-ff.cpp b/pcsx2/USB/usb-pad/evdev/evdev-ff.cpp index aaeb84bad5..06186a8b03 100644 --- a/pcsx2/USB/usb-pad/evdev/evdev-ff.cpp +++ b/pcsx2/USB/usb-pad/evdev/evdev-ff.cpp @@ -97,7 +97,7 @@ namespace usb_pad EvdevFF::~EvdevFF() { - for (int i = 0; i < countof(mEffIds); i++) + for (int i = 0; i < (int)countof(mEffIds); i++) { if (mEffIds[i] != -1 && ioctl(mHandle, EVIOCRMFF, mEffIds[i]) == -1) { diff --git a/pcsx2/USB/usb-pad/evdev/evdev-gtk.cpp b/pcsx2/USB/usb-pad/evdev/evdev-gtk.cpp index 73e297627e..548f4aaae1 100644 --- a/pcsx2/USB/usb-pad/evdev/evdev-gtk.cpp +++ b/pcsx2/USB/usb-pad/evdev/evdev-gtk.cpp @@ -566,7 +566,7 @@ namespace usb_pad if (map < JOY_STEERING || !strcmp(dev_type, BuzzDevice::TypeName())) { - if (event < key_to_str.size()) + if (event < (int)key_to_str.size()) { *name = key_to_str[event]; return true; diff --git a/pcsx2/USB/usb-pad/evdev/evdev.cpp b/pcsx2/USB/usb-pad/evdev/evdev.cpp index 3cd10e9363..ebeb9b44bc 100644 --- a/pcsx2/USB/usb-pad/evdev/evdev.cpp +++ b/pcsx2/USB/usb-pad/evdev/evdev.cpp @@ -108,7 +108,7 @@ namespace usb_pad } } } - quit: + //quit: closedir(dirp); return false; } @@ -134,7 +134,7 @@ namespace usb_pad } // get rid of unplugged devices - for (int i = 0; i < list_cache.size();) + for (int i = 0; i < (int)list_cache.size();) { if (!file_exists(list_cache[i].path)) list_cache.erase(list_cache.begin() + i); @@ -183,7 +183,7 @@ namespace usb_pad } list.assign(list_cache.begin(), list_cache.end()); - quit: + //quit: closedir(dirp); } @@ -220,7 +220,7 @@ namespace usb_pad //case ABS_Y: mWheelData.clutch = NORM(value, 0xFF); break; //no wheel on PS2 has one, afaik //case ABS_RX: mWheelData.axis_rx = NORM(event.value, 0xFF); break; case ABS_RY: - treat_me_like_ABS_RY: + //treat_me_like_ABS_RY: mWheelData.throttle = 0xFF; mWheelData.brake = 0xFF; if (value < 0) diff --git a/pcsx2/USB/usb-pad/evdev/shared-gtk.cpp b/pcsx2/USB/usb-pad/evdev/shared-gtk.cpp index e35047739e..45c22349a2 100644 --- a/pcsx2/USB/usb-pad/evdev/shared-gtk.cpp +++ b/pcsx2/USB/usb-pad/evdev/shared-gtk.cpp @@ -173,7 +173,7 @@ namespace usb_pad gtk_list_store_clear(cfg->store); for (auto& it : cfg->jsconf) { - for (int i = 0; /*i < JOY_MAPS_COUNT && */ i < it.second.controls.size(); i++) + for (int i = 0; /*i < JOY_MAPS_COUNT && */ i < (int)it.second.controls.size(); i++) { if (it.second.controls[i] < 0) continue; @@ -218,7 +218,7 @@ namespace usb_pad static void joystick_changed(GtkComboBox* widget, gpointer data) { gint idx = gtk_combo_box_get_active(GTK_COMBO_BOX(widget)); - int port = reinterpret_cast(data); + //int port = reinterpret_cast(data); ConfigData* cfg = (ConfigData*)g_object_get_data(G_OBJECT(widget), CFG); if (!cfg) @@ -256,7 +256,7 @@ namespace usb_pad return i.first == dev_name; }); - if (it != cfg->jsconf.end() && type < it->second.controls.size()) + if (it != cfg->jsconf.end() && type < (int)it->second.controls.size()) { it->second.controls[type] = value; if (is_axis) @@ -295,7 +295,7 @@ namespace usb_pad return i.first == dev_name; }); - if (it != cfg->jsconf.end() && type < it->second.controls.size()) + if (it != cfg->jsconf.end() && type < (int)it->second.controls.size()) { it->second.controls[type] = value; refresh_store(cfg); @@ -546,7 +546,7 @@ namespace usb_pad {3, 2, JOY_START}, }; - for (int i = 0; i < countof(button_labels); i++) + for (int i = 0; i < (int)countof(button_labels); i++) { GtkWidget* button = gtk_button_new_with_label(button_labels[i]); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(button_clicked), reinterpret_cast(port)); @@ -860,7 +860,7 @@ namespace usb_pad for (int j = 0; j < 4; j++) { - for (int i = 0; i < countof(button_labels); i++) + for (int i = 0; i < (int)countof(button_labels); i++) { GtkWidget* button = gtk_button_new_with_label(button_labels[i]); diff --git a/pcsx2/USB/usb-pad/joydev/joydev.cpp b/pcsx2/USB/usb-pad/joydev/joydev.cpp index e2e8996f54..787edab514 100644 --- a/pcsx2/USB/usb-pad/joydev/joydev.cpp +++ b/pcsx2/USB/usb-pad/joydev/joydev.cpp @@ -72,7 +72,7 @@ namespace usb_pad close(fd); } } - quit: + //quit: closedir(dirp); } diff --git a/pcsx2/USB/usb-pad/usb-seamic.cpp b/pcsx2/USB/usb-pad/usb-seamic.cpp index bfd13c89dc..10ad96bab3 100644 --- a/pcsx2/USB/usb-pad/usb-seamic.cpp +++ b/pcsx2/USB/usb-pad/usb-seamic.cpp @@ -280,7 +280,7 @@ namespace usb_pad { ret = s->pad->TokenIn(data, p->iov.size); if (ret > 0) - usb_packet_copy(p, data, MIN(ret, sizeof(data))); + usb_packet_copy(p, data, MIN((unsigned long)ret, sizeof(data))); else p->status = ret; } diff --git a/pcsx2/gui/AppAccelerators.h b/pcsx2/gui/AppAccelerators.h index ac3adc9340..a472593033 100644 --- a/pcsx2/gui/AppAccelerators.h +++ b/pcsx2/gui/AppAccelerators.h @@ -111,7 +111,7 @@ struct KeyAcceleratorCode wxString modifiedKeyCode; for (int i = 0; i < (int)tokens.size(); i++) { - if (i == tokens.size() - 1) + if (i == (int)(tokens.size() - 1)) modifiedKeyCode.append(tokens.at(i)); else modifiedKeyCode.append(wxString::Format("%s+", tokens.at(i))); diff --git a/plugins/onepad/wx_dialog/JoystickConfiguration.h b/plugins/onepad/wx_dialog/JoystickConfiguration.h index d4ea94ad89..ba8dc0f9b8 100644 --- a/plugins/onepad/wx_dialog/JoystickConfiguration.h +++ b/plugins/onepad/wx_dialog/JoystickConfiguration.h @@ -41,7 +41,6 @@ class JoystickConfiguration : public wxDialog wxCheckBox *m_cb_reverse_Lx, *m_cb_reverse_Ly, *m_cb_reverse_Rx, *m_cb_reverse_Ry, *m_cb_mouse_Ljoy, // Use mouse for left joystick *m_cb_mouse_Rjoy; // Use mouse for right joystick - wxButton *m_bt_ok, *m_bt_cancel; u32 m_pad_id; // isForLeftJoystick -> true is for Left Joystick, false is for Right Joystick